/* The stage: the grid under load. Scroll is the clock. */
.stage { position: relative; height: 640vh; }
.stage-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; color: #fff; }
.grid-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y;
  /* the network dims behind the copy so the words stay readable */
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 14%, #000 40%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 14%, #000 40%);
}
.stage-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 34, 115, 0.9) 0%, rgba(10, 34, 115, 0.7) 30%, rgba(10, 34, 115, 0) 58%),
    linear-gradient(0deg, rgba(10, 34, 115, 0.94) 0%, rgba(10, 34, 115, 0) 30%),
    radial-gradient(110% 80% at 100% 0%, rgba(255, 70, 40, calc(var(--heat, 0) * 0.3)) 0%, transparent 62%);
}
.noscript { position: absolute; z-index: 3; left: 16px; right: 16px; top: 70px; max-width: 62ch; margin: 0; color: #fff; font-size: 16px; line-height: 1.5; }
.stage-ui {
  position: absolute; inset: 0; pointer-events: none; padding: 18px clamp(16px, 3vw, 40px) 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); grid-template-rows: auto minmax(0, 1fr) auto; column-gap: clamp(20px, 4vw, 60px); row-gap: 12px;
}
/* only the controls take the pointer; everything else leaves the lines clickable */
.stage-top, .rail, .stage-right { pointer-events: none; }
.stage-top > *, .rail > *, .stage-right > *, .fine { pointer-events: auto; }
.stage-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stage-top .mark { font: 700 18px/1 var(--f-display); letter-spacing: 0.14em; text-transform: uppercase; }
.stage-top .chip { font: 500 12.5px/1.3 var(--f-text); border: 1px solid rgba(255, 255, 255, 0.5); padding: 5px 10px; display: inline-flex; align-items: center; gap: 8px; }
.stage-top .chip svg { width: 15px; height: 15px; flex: none; }
.chip-short { display: none; }
.skipdown { margin-left: auto; color: #fff; font: 600 13px/1 var(--f-text); text-decoration: underline; text-underline-offset: 4px; padding: 6px 10px; background: rgba(10, 34, 115, 0.8); text-shadow: 0 0 6px rgba(10, 34, 115, 0.9); }
.skipdown:hover { color: var(--heat-amber); }

.beats { position: relative; pointer-events: none; align-self: stretch; min-height: 320px; max-width: 660px; }
.beat { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-46%); opacity: 0; visibility: hidden; transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), visibility 0s linear 0.5s; }
.beat.on { opacity: 1; visibility: visible; transform: translateY(-50%); transition-delay: 0s; }
.beat .h1, .beat .beat-h { margin: 0; font: 700 clamp(52px, 8.6vw, 96px)/0.9 var(--f-display); text-transform: uppercase; letter-spacing: 0.005em; text-wrap: balance; text-shadow: 0 0 22px rgba(10, 34, 115, 0.9); }
.beat .beat-h { font-size: clamp(40px, 6.2vw, 76px); }
.beat .h1 em { font-style: normal; color: var(--heat-amber); }
.beat-d { margin: 18px 0 0; max-width: 50ch; font: 400 clamp(16.5px, 1.5vw, 19.5px)/1.5 var(--f-text); color: rgba(255, 255, 255, 0.96); text-wrap: pretty; text-shadow: 0 0 14px rgba(10, 34, 115, 0.95), 0 0 4px rgba(10, 34, 115, 0.8); }
.beat .cite { background: transparent; color: rgba(255, 255, 255, 0.9); border-color: rgba(255, 255, 255, 0.45); margin-left: 4px; text-shadow: none; }
.when-done { display: none; }
.stage.done .when-open { display: none; }
.stage.done .when-done { display: inline; }
.hint { margin: 22px 0 0; font: 600 14px/1.4 var(--f-text); color: var(--heat-amber); display: inline-flex; align-items: center; gap: 10px; text-shadow: 0 0 12px rgba(10, 34, 115, 0.95); }
.hint a { color: #fff; pointer-events: auto; }
.hint::before { content: ""; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); animation: nudge 1.6s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(-3px) rotate(45deg); } 50% { transform: translateY(3px) rotate(45deg); } }
.stage.go .beat.on > * { animation: lift 0.8s var(--ease) both; }
.stage.go .beat.on > *:nth-child(2) { animation-delay: 0.08s; }
.stage.go .beat.on > *:nth-child(3) { animation-delay: 0.16s; }

.stage-right { align-self: center; display: grid; gap: 14px; }
.stage-right .due { padding: 14px 16px 16px; color: var(--ink); box-shadow: 0 18px 40px -16px rgba(4, 14, 66, 0.7); }
.stage-right .due a { color: var(--blue); }
.stage-right .due-label { text-transform: none; letter-spacing: 0; font: 600 14px/1.3 var(--f-text); }
.stage-right .due-fig { font-size: clamp(60px, 6.4vw, 86px); }
.stage-right .due-unit { font-size: 17px; }
.due-range { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.due-range a { color: var(--blue); }
.how { margin-left: 4px; font: 600 12px/1 var(--f-text); text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.due-range b { color: var(--ink); font-weight: 700; }
.due-short { margin: 6px 0 0; font: 600 12px/1.3 var(--f-text); color: var(--ink-2); }
.due-label b { font-weight: 700; font-variant-numeric: tabular-nums; }
.stage-right .due-fig { align-items: baseline; }
.stage-right .due-fig .odo { line-height: 0.95; }
.due-built { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; color: var(--ink-2); }
.due-built b { font: 700 24px/1 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-right .due-you { display: none; }
.stage-right .rosette { width: 300px; height: 300px; right: -80px; top: -80px; }

.rail { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 28px; align-items: end; }
.rail-clock { min-width: 0; }
.readout { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px 30px; padding: 8px 12px 7px; background: rgba(10, 34, 115, 0.8); border-radius: 2px; }
.hud-n b { display: block; font: 700 34px/0.95 var(--f-display); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; text-shadow: 0 0 16px rgba(10, 34, 115, 0.9); }
.hud-n small { display: block; margin-top: 3px; font: 500 11.5px/1.25 var(--f-text); letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.9); max-width: 24ch; }
.hud-n.hot b { color: #fff; color: color-mix(in srgb, var(--heat-hot) calc(var(--heat, 0) * 100%), #fff); }
.hud-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 4px auto; padding: 0; list-style: none; font-size: 12px; color: rgba(255, 255, 255, 0.92); align-self: flex-end; }
.hud-key li { display: inline-flex; align-items: center; gap: 7px; }
.hud-key i { width: 24px; height: 7px; border-radius: 3px; display: inline-block; }
.hud-key .k1 { background: #aac4ff; }
.hud-key .k2 { background: var(--heat-amber); }
.hud-key .k3 { background: repeating-linear-gradient(90deg, var(--heat-hot) 0 7px, #fff1d6 7px 10px); }
.rail-clock input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; cursor: ew-resize; --p: 0%; }
.rail-clock input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.6) var(--p)); }
.rail-clock input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.6); }
.rail-clock input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: #fff; }
.rail-clock input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--heat-amber); border: 4px solid #fff; box-shadow: 0 4px 12px rgba(4, 14, 66, 0.55); }
.rail-clock input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--heat-amber); border: 4px solid #fff; box-shadow: 0 4px 12px rgba(4, 14, 66, 0.55); }
.rail-clock input[type=range]:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
.rail-ticks { display: flex; justify-content: space-between; margin-top: 2px; font: 500 12px/1 var(--f-mono); color: rgba(255, 255, 255, 0.9); }
.rail-cred { display: inline-grid; grid-template-columns: auto auto; justify-content: start; }
.cred-lab { grid-column: 1 / -1; margin-bottom: 4px; font: 600 11.5px/1.2 var(--f-text); letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.92); text-shadow: 0 0 8px rgba(10, 34, 115, 0.9); }
.seg { font: 600 13px/1 var(--f-text); color: #fff; background: transparent; border: 1.5px solid rgba(255, 255, 255, 0.7); padding: 12px 14px; min-height: 44px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg:first-of-type { border-radius: 2px 0 0 2px; border-right-width: 0.75px; }
.seg:last-child { border-radius: 0 2px 2px 0; border-left-width: 0.75px; }
.seg:hover { background: rgba(255, 255, 255, 0.16); }
.seg[aria-pressed="true"] { background: #fff; color: var(--cobalt-deep); }
.seg:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rail-build { display: flex; align-items: center; gap: 10px; }
.built { display: block; text-align: right; margin-right: 6px; }
.built b { display: block; font: 700 34px/0.95 var(--f-display); font-variant-numeric: tabular-nums; text-shadow: 0 0 16px rgba(10, 34, 115, 0.9); }
.built small { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.9); }
.built b.bump { animation: bump 0.5s var(--ease); }
@keyframes bump { 0% { transform: scale(1); color: #fff; } 35% { transform: scale(1.28); color: var(--heat-amber); } 100% { transform: scale(1); color: #fff; } }
.built b { transform-origin: 100% 60%; }
.stage .btn { min-height: 44px; padding: 12px 14px; }
.btn.dark { background: #fff; color: var(--cobalt-deep); border-color: #fff; }
.btn.dark:hover { background: var(--heat-amber); border-color: var(--heat-amber); color: var(--ink); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.stage .btn:focus-visible { outline: 3px solid #fff; }
.stage :focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.stage .due :focus-visible { outline-color: var(--blue); }
.hint a:focus-visible, .skipdown:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.fine { grid-column: 1 / -1; margin: 0; max-width: 100ch; font: 400 11.5px/1.45 var(--f-text); color: rgba(255, 255, 255, 0.86); }
.fine summary { cursor: pointer; font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 7px; min-height: 28px; }
.fine summary::-webkit-details-marker { display: none; }
.fine summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s var(--ease); }
.fine[open] summary::before { transform: rotate(45deg); }
.fine { position: relative; }
.fine p { margin: 4px 0 0; }
.fine[open] p { position: absolute; left: 0; bottom: calc(100% + 6px); width: min(76ch, 100%); margin: 0; padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #fff; background: rgba(10, 34, 115, 0.97); border: 1px solid rgba(255, 255, 255, 0.45); z-index: 6; }

@supports (animation-timeline: view()) {
  @keyframes rise { from { transform: translateY(90px); } to { transform: none; } }
  .sheet { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
}

@media (max-width: 880px) {
  .grid-canvas {
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 22%, #000 40%);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 22%, #000 40%);
  }
  .stage-scrim {
    background:
      linear-gradient(180deg, rgba(10, 34, 115, 0.88) 0%, rgba(10, 34, 115, 0.62) 26%, rgba(10, 34, 115, 0) 46%),
      linear-gradient(0deg, rgba(10, 34, 115, 0.82) 0%, rgba(10, 34, 115, 0.3) 24%, rgba(10, 34, 115, 0) 40%),
      radial-gradient(110% 60% at 100% 0%, rgba(255, 70, 40, calc(var(--heat, 0) * 0.3)) 0%, transparent 62%);
  }
  .stage { height: 600vh; }
  .stage-ui { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto; padding-top: 12px; row-gap: 8px; }
  .stage-top { gap: 6px 12px; }
  .stage-top .chip { flex-basis: 100%; font-size: 11px; padding: 3px 8px; }
  .chip-long { display: none; }
  .chip-short { display: inline; }
  .stage-top .skipdown { display: none; }
  .beats { min-height: 150px; }
  .beat .h1, .beat .beat-h { font-size: clamp(34px, 10.5vw, 52px); }
  .beat .beat-h { font-size: clamp(32px, 9.5vw, 44px); }
  .beat-d { font-size: 14.5px; margin-top: 10px; }
  .hint { margin-top: 10px; font-size: 13px; }
  .stage-right { align-self: end; gap: 8px; }
  .stage-right .rosette, .due-built, .rng-more { display: none; }
  .due-short { grid-column: 1 / -1; font-size: 11px; margin: 4px 0 0; }
  .stage-right .due { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 8px 12px 9px; }
  .stage-right .due-fig { grid-row: 1 / span 2; font-size: 46px; }
  .stage-right .due-label { grid-column: 2; font-size: 12px; line-height: 1.25; margin: 0; }
  .stage-right .due-unit { grid-column: 2; font-size: 12px; }
  .due-range { grid-column: 1 / -1; font-size: 11px; margin-top: 4px; }
  .rail { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .rail > * { min-width: 0; }
  .readout { gap: 2px 16px; flex-wrap: wrap; }
  .readout .hud-n:nth-child(4) { display: none; }          /* the customers share stays in the tooltip and the desktop view */
  .hud-n b { font-size: 26px; }
  .hud-n small { font-size: 10px; max-width: 22ch; }
  .hud-key { margin-left: 0; flex: 1 1 100%; width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 2px 14px; font-size: 10.5px; }
  .hud-key i { width: 18px; height: 6px; }
  .rail-clock input[type=range] { height: 32px; }
  .dock .btn { min-height: 40px; }
  .stage .btn, .seg { min-height: 40px; padding: 9px 11px; }
  .rail-cred, .rail-build { justify-content: space-between; }
  .built b { font-size: 26px; }
  .fine { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .beat, .stage.go .beat.on > *, .hint::before, .built b.bump { animation: none !important; transition: none !important; }
  .seg, .fine summary::before, .btn { transition: none !important; }
  .sheet { animation: none !important; }
}

@media (min-width: 881px) and (max-height: 640px) { .due-built, .rng-more { display: none; } }

/* short phones: keep the headline, the live figure and the controls; drop the lowest-priority lines */
@media (max-width: 880px) and (max-height: 780px) {
  .hint { display: none; }
  .beat-d { font-size: 13.5px; margin-top: 8px; }
  .stage-right .due-fig { font-size: 40px; }
}
@media (max-width: 880px) and (max-height: 700px) {
  .beat .cite { display: none; }
  .hud-n b { font-size: 24px; }
}

/* phones: tighter stack so the description is never covered by the plate */
@media (max-width: 880px) {
  .stage-ui { padding-bottom: 8px; row-gap: 6px; }
  .beat-d { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .readout { padding: 6px 10px 5px; gap: 0 14px; }
  .hud-key { margin-top: 2px; }
  .built small { max-width: 14ch; margin-left: auto; }
}
@media (max-width: 880px) and (max-height: 660px) {
  .hud-key { display: none; }
  .beats { min-height: 120px; }
  .beat .h1, .beat .beat-h { font-size: clamp(30px, 9.5vw, 44px); }
}

@media (max-width: 880px) { .rail-cred { justify-content: start; } .rail-cred .seg:last-child { border-left-width: 1.5px; margin-left: -1px; } }

/* phones: give the network a real window. Beat copy up top, a slim plate, translucent readout, tighter controls */
@media (max-width: 880px) {
  .readout { background: rgba(10, 34, 115, 0.55); }
  .stage-right .due { padding: 6px 10px 7px; }
  .stage-right .due-fig { font-size: 38px; }
  .stage-right .due-label { font-size: 11.5px; }
  .due-short, .due-range { font-size: 10.5px; margin-top: 2px; }
  .cred-lab { margin-bottom: 2px; font-size: 11px; }
  .stage .btn, .seg { min-height: 40px; padding: 8px 10px; }
  .stage-ui { row-gap: 4px; }
  .stage.done .beat-d, .beat[data-beat="4"] .beat-d { -webkit-line-clamp: unset; display: block; font-size: 14px; }
  .beat[data-beat="3"] .beat-d { font-size: 14px; }
}

/* mid widths: the state takes the top of the stage and the copy sits under it, so neither hides the other */
@media (min-width: 881px) and (max-width: 1199px) {
  .beats { align-self: end; min-height: 260px; }
  .beat { top: auto; bottom: 0; transform: translateY(10px); }
  .beat.on { transform: none; }
  .grid-canvas { -webkit-mask-image: none; mask-image: none; }
  .stage-scrim {
    background:
      linear-gradient(0deg, rgba(10, 34, 115, 0.9) 0%, rgba(10, 34, 115, 0.72) 34%, rgba(10, 34, 115, 0) 56%),
      radial-gradient(110% 80% at 100% 0%, rgba(255, 70, 40, calc(var(--heat, 0) * 0.3)) 0%, transparent 62%);
  }
}

.fine-x { display: block; margin-top: 12px; padding: 9px 16px; min-height: 40px; font: 600 13px/1 var(--f-text); color: var(--cobalt-deep); background: #fff; border: 1.5px solid #fff; border-radius: 2px; cursor: pointer; }
.fine-x:hover { background: var(--heat-amber); border-color: var(--heat-amber); color: var(--ink); }
