@font-face { font-family: Michroma; src: url(fonts/michroma-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(fonts/b612-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(fonts/b612-mono-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* Layout: one screen. Name upper left, gearbox fills the rest behind it, riveted machine plate along the bottom. */
:root {
  --enamel: #9db3a5;
  --enamel-lit: #b4c7ba;
  --enamel-deep: #83998c;
  --ink: #14231d;
  --plate: #e3e8e2;
  --brass: #d9a441;
  --blue: #2b3f94; /* layout fluid */
  --display: Michroma, "Eurostile Extended", "Arial Black", sans-serif;
  --data: "B612 Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 3vw, 44px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  font: 400 14px/1.5 var(--data);
  background: var(--enamel);
  overflow-x: hidden;
}
#scene, #leaders, #balloons { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#scene { opacity: 0; transition: opacity .5s; }
.ready #scene { opacity: 1; }
#leaders line { stroke: var(--ink); stroke-width: 1.25; }
#leaders circle { fill: var(--ink); }
.balloon {
  position: absolute; top: 0; left: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%;
  background: var(--plate); font-weight: 700; font-size: 14px; will-change: transform;
}

.page {
  position: relative; background: radial-gradient(ellipse 75% 80% at 66% 40%, var(--enamel-lit), var(--enamel) 55%, var(--enamel-deep)); min-height: 100vh; min-height: 100svh;
  display: grid; grid-template: auto minmax(var(--room, 0px), 1fr) auto / minmax(0, 1fr); gap: 16px;
  padding: max(var(--gutter), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(var(--gutter), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.intro { grid-area: 1 / 1; justify-self: start; position: relative; z-index: 1; }
.stage { grid-area: 1 / 1 / 3 / 2; position: relative; cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.holding .stage { cursor: grabbing; }

h1 { margin: 0; font: 400 clamp(34px, min(6.3vw, 11.5vh), 112px)/1.06 var(--display); letter-spacing: -.015em; text-transform: uppercase; -webkit-text-stroke: .018em currentColor; }
h1 span { display: block; width: max-content; animation: scribe 1.1s cubic-bezier(.7, 0, .2, 1) backwards .1s; }
h1 span + span { animation-delay: .35s; }
.role { margin: .9em 0 0; font-weight: 700; font-size: clamp(15px, 1.35vw, 20px); }
.message { margin: .35em 0 0; max-width: 34ch; font-size: clamp(14px, 1.1vw, 16px); }
.role, .message { animation: settle .7s ease-out backwards .9s; }
.plate { animation: settle .8s cubic-bezier(.2, .8, .2, 1) backwards .5s; }
@keyframes scribe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes settle { from { opacity: 0; transform: translateY(14px); } }

/* Machine plate */
.plate {
  grid-area: 3 / 1; position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: stretch;
  background: var(--plate); border-radius: 5px; padding: 16px 30px;
  box-shadow: inset 0 0 0 1px #fff9, 0 1px 0 #14231d66, 0 8px 22px -8px #14231d80;
}
.plate > * + section, .plate > dl, .plate > .control { padding-left: 24px; }
.plate > dl, .plate > .control { border-left: 1.5px solid var(--ink); margin-left: 24px; }
.rivet { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #8f9a94 55%, #4c5852); box-shadow: 0 1px 1px #14231d88; }
.rivet:nth-of-type(1) { top: 9px; left: 9px; }
.rivet:nth-of-type(2) { top: 9px; right: 9px; }
.rivet:nth-of-type(3) { bottom: 9px; left: 9px; }
.rivet:nth-of-type(4) { bottom: 9px; right: 9px; }

.parts { align-self: center; padding: 0 !important; }
.parts ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 12px 14px; }
.parts li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.parts b { grid-row: 1 / 3; width: 30px; height: 30px; display: grid; place-items: center; border: 1.5px solid; border-radius: 50%; font-size: 13px; transition: background .2s, color .2s; }
.parts li:hover b { background: var(--ink); color: var(--plate); }
.will { font: 400 14px/1.3 var(--display); }
.part { font-size: 12px; line-height: 1.35; white-space: nowrap; }

.gauge { margin: 0; align-self: center; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.gauge div { display: grid; grid-template-columns: 5.5ch 1fr; }
.gauge dt { font-size: 12px; line-height: 21px; }
.gauge dd { margin: 0; font-weight: 700; white-space: nowrap; min-width: 9ch; text-align: right; }
.gauge output { display: inline-block; min-width: 4ch; text-align: right; }

.control { display: grid; align-content: center; gap: 2px; }
#hold {
  display: flex; align-items: center; gap: 14px; padding: 4px 6px 4px 0; border: 0; background: none; color: inherit;
  font: 400 15px/1.2 var(--display); text-align: left; cursor: pointer; border-radius: 8px;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#hold:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.cap {
  flex: none; width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #4a5fc0, var(--blue) 60%, #1c2a6b);
  border: 5px solid var(--brass); box-shadow: 0 4px 0 #7d5d1f, 0 7px 9px #14231d66; transition: transform .1s, box-shadow .1s;
}
.holding .cap { transform: translateY(4px); box-shadow: 0 0 0 #7d5d1f, 0 1px 3px #14231d88; }
.label { padding-bottom: 20px; }
#state { margin: -30px 0 10px 64px; pointer-events: none; font-size: 12px; min-width: 17ch; }
html:not(.ready) .needs-js { display: none; }

@media (max-width: 1280px) {
  .plate { grid-template-columns: minmax(0, 1fr) auto; row-gap: 14px; }
  .parts { grid-column: 1 / -1; }
  .plate > dl { border-left: 0; margin-left: 0; padding-left: 0; }
  .plate > .control { justify-self: end; border-left: 0; }
  .gauge { grid-template-columns: repeat(3, auto); justify-content: start; gap: 28px; }
  .gauge div { display: block; }
  .gauge dt { line-height: 1.3; }
  .gauge dd { min-width: 0; text-align: left; }
  .gauge output { text-align: left; min-width: 0; }
}
@media (max-width: 640px) {
  .page { gap: 10px; }
  h1 { font-size: min(12.4vw, 9vh); }
  .role { margin-top: .5em; }
  .page { --room: 200px; }
  .plate { padding: 18px 20px; }
  .parts ol { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .parts b { width: 26px; height: 26px; }
  .will { font-size: 12px; }
  .part { font-size: 11px; }
  .plate > .control { border-left: 0; margin-left: 0; padding-left: 0; }
  .plate { grid-template-columns: minmax(0, 1fr); }
  .plate > .control { justify-self: stretch; order: 2; }
  .plate > dl { order: 3; }
  .gauge { justify-content: space-between; border-top: 1.5px solid var(--ink); padding-top: 10px; }
  .gauge dd { font-size: 13px; }
}
/* Short screens: let the page scroll instead of squeezing the gearbox away. */
@media (max-height: 560px) { .stage { min-height: 240px; } #scene, #leaders, #balloons { position: absolute; } }

@media (prefers-reduced-motion: reduce) {
  h1 span, .role, .message, .plate { animation: none; }
  .cap, #scene { transition: none; }
}
@media (max-width: 359px) { .part { white-space: normal; } .parts li { column-gap: 8px; } .plate { padding-inline: 16px; } }
