/* ============================================================
   Effective Data.ai — The Desk

   A working desk. Panels sit on a near-black violet surface with
   title bars, keys and status marks; a tape runs under the
   masthead; figures are monospaced because they are measurements.
   In this world a still screen means the system is down, so
   something is always moving — but nothing that moves is a claim.

   PALETTE LAW: --live is reserved for exactly one meaning, a value
   that has just changed. Nothing else on this page may use it.
   STATE LAW: every state carries a drawn mark as well as a colour,
   so the page survives being read in greyscale.
   ============================================================ */

:root {
    --desk:          #12071a;   /* the surface everything rests on */
    --panel:         #1b0a27;   /* panel fill */
    --panel-2:       #250d35;   /* interiors and recesses */
    --chrome:        #3c1053;   /* title bars */

    --paper:         #f5f1f6;
    --ink:           #1b0a27;
    --ink-soft:      #5c2b7a;

    --text:          #f2ecf6;   /* 17.0:1 on desk */
    --text-soft:     #c9a8d6;   /*  9.4:1 on desk */
    --text-muted:    #9d86ad;   /*  6.0:1 on desk */
    --edge:          #ad5389;   /*  4.1:1 — chrome, rules, large type */
    --edge-bright:   #e0a6c8;   /*  9.8:1 — accent that carries words */
    --live:          #ff5cb0;   /*  6.9:1 — RESERVED: a value that just changed */
    --caution:       #ffc46b;   /* 12.0:1 on panel — sample and caution marks */

    --rule:          rgba(242, 236, 246, 0.10);
    --rule-strong:   rgba(242, 236, 246, 0.22);
    --field-border:  #8a7894;

    --alert:         #ff6b8a;
    --alert-ink:     #a3103c;
    --confirm-ink:   #1c6b3f;

    --font: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'Spline Sans Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --gutter: clamp(1rem, 0.4rem + 2.6vw, 3.5rem);
    --measure: 68ch;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --bar: 2.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 7.5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--desk);
    color: var(--text);
    font-family: var(--font);
    font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
    line-height: 1.6;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* the desk has air behind it: a survey grid drifting slowly under
   every panel, so the surface is never a flat fill */
body::before {
    content: '';
    position: fixed;
    inset: -20vmax;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(var(--rule) 1px, transparent 1px),
        linear-gradient(90deg, var(--rule) 1px, transparent 1px);
    background-size: 4.5rem 4.5rem;
    opacity: 0.5;
    will-change: transform;
    animation: desk-drift 40s linear infinite;
}
@keyframes desk-drift { to { transform: translate3d(4.5rem, 4.5rem, 0); } }

/* --- browser surfaces, themed --- */
::selection { background: var(--edge); color: #fff; }
:root { accent-color: var(--edge); caret-color: var(--edge-bright); scrollbar-color: var(--edge) var(--desk); }
:focus-visible { outline: 2px solid var(--edge-bright); outline-offset: 3px; border-radius: 2px; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: from-font; }

h1, h2, h3, h4 {
    font-weight: 700;
    font-stretch: 112%;
    letter-spacing: -0.03em;
    line-height: 1.04;
    margin: 0;
    text-wrap: balance;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--edge-bright);
    color: var(--ink);
    padding: 0.7rem 1rem;
    font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ============================================================
   MASTHEAD + TAPE — the chrome, and the one thing always running
   ============================================================ */

.masthead {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.75rem);
    padding: 0.7rem var(--gutter);
    background: color-mix(in oklab, var(--desk) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--rule-strong);
}
.mark { display: inline-flex; flex: 0 0 auto; }
.mark img { display: block; width: auto; height: clamp(20px, 2.2vw, 26px); }

.desk-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 auto 0 0.5rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
/* steady chrome, not a telemetry lamp: nothing on this page computes a
   live status, so nothing here may imply one */
.mark-live { fill: var(--edge); }

.masthead-nav { display: flex; align-items: center; gap: clamp(0.5rem, 1.5vw, 1.5rem); }
.masthead-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 0.35rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    transition: color 180ms var(--ease);
}
.masthead-nav a:hover { color: var(--text); }
.masthead-cta {
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    padding: 0 1rem !important;
    transition: border-color 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease);
}
.masthead-cta:hover {
    border-color: var(--edge);
    background: color-mix(in oklab, var(--edge) 22%, transparent);
}

.menu-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 0.9rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}
.menu-toggle-bars { display: grid; gap: 4px; }
.menu-toggle-bars span {
    display: block;
    width: 15px;
    height: 1.5px;
    background: currentColor;
    transition: transform 220ms var(--ease);
}
.menu-toggle[aria-expanded='true'] .menu-toggle-bars span:first-child { transform: translateY(2.75px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] .menu-toggle-bars span:last-child { transform: translateY(-2.75px) rotate(-45deg); }

.mobile-nav {
    position: sticky;
    top: 3.6rem;
    z-index: 39;
    background: var(--panel);
    border-bottom: 1px solid var(--rule-strong);
}
.mobile-nav a {
    display: flex;
    align-items: center;
    min-height: 3rem;
    padding: 0 var(--gutter);
    border-top: 1px solid var(--rule);
    color: var(--text);
    text-decoration: none;
}

/* the tape: capability names only. Nothing on this strip is a
   figure, because a running number here would read as a claim. */
.tape {
    position: sticky;
    top: 3.55rem;
    z-index: 38;
    display: flex;
    overflow: hidden;
    padding: 0.4rem 0;
    background: var(--chrome);
    border-bottom: 1px solid var(--edge);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 4rem, #000 calc(100% - 4rem), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 4rem, #000 calc(100% - 4rem), transparent);
}
.tape-run {
    display: flex;
    flex: 0 0 auto;
    will-change: transform;
    animation: tape-roll 64s linear infinite;
}
@keyframes tape-roll { to { transform: translate3d(-100%, 0, 0); } }
.tape:hover .tape-run { animation-play-state: paused; }
.tape-item {
    flex: 0 0 auto;
    padding: 0 1.25rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--edge-bright);
    white-space: nowrap;
}
.tape-item::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    margin-left: 1.25rem;
    vertical-align: 0.2em;
    background: var(--edge);
}

/* ============================================================
   THE OPENING — acres of desk and one line
   ============================================================ */

.open {
    padding: clamp(4.5rem, 14vh, 11rem) var(--gutter) clamp(3.5rem, 9vh, 7rem);
}
.open-copy { max-width: 62rem; }
.open h1 {
    font-size: clamp(2.5rem, 1rem + 6.6vw, 6rem);
    font-stretch: 118%;
    letter-spacing: -0.04em;
    line-height: 0.98;
}
.open-blurb {
    max-width: 46ch;
    margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
    color: var(--text-soft);
    font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
}
.open .action { margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* ============================================================
   PANELS — the desk's modules
   ============================================================ */

.panel {
    position: relative;
    margin: 0 var(--gutter) clamp(1rem, 2vw, 1.75rem);
    background: color-mix(in oklab, var(--panel) 92%, transparent);
    border: 1px solid var(--rule-strong);
}
.panel:last-of-type { margin-bottom: clamp(2rem, 4vw, 3.5rem); }

.panel-head {
    display: flex;
    align-items: center;
    gap: clamp(0.6rem, 1.6vw, 1.25rem);
    min-height: var(--bar);
    padding: 0.5rem clamp(0.75rem, 2vw, 1.5rem);
    background: var(--chrome);
    border-bottom: 1px solid var(--edge);
}
.panel-key {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--edge-bright);
}
.panel-key::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 0.85em;
    margin-left: clamp(0.6rem, 1.6vw, 1.25rem);
    vertical-align: -0.1em;
    background: var(--edge);
}
.panel-head h2 {
    flex: 1 1 auto;
    font-size: clamp(0.9375rem, 0.85rem + 0.4vw, 1.125rem);
    font-stretch: 100%;
    letter-spacing: -0.01em;
}
/* state is a drawn mark first and a colour second */
.panel-state {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
}
.panel-state svg { flex: 0 0 auto; }
.panel-state[data-state='live'] { color: var(--edge-bright); }
.panel-state[data-state='live'] svg { fill: var(--edge-bright); }
.panel-state[data-state='caution'] { color: var(--caution); }
.panel-state[data-state='idle'] { color: var(--text-muted); }

.panel-body { padding: clamp(1.25rem, 3vw, 2.5rem) clamp(0.75rem, 2vw, 1.5rem); }

/* ============================================================
   ACTIONS
   ============================================================ */

.action, .action-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.35rem;
    border: 1px solid var(--edge);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}
.action:hover { background: var(--edge); color: #fff; }
.action-arrow { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease); }
.action:hover .action-arrow, .action-solid:hover .action-arrow { transform: translateX(3px); }
.action-solid { background: var(--edge); border-color: var(--edge); color: #fff; }
.action-solid:hover { background: var(--edge-bright); border-color: var(--edge-bright); color: var(--ink); }
.action-solid:disabled { opacity: 0.55; cursor: not-allowed; }
.action-solid:disabled:hover { background: var(--edge); color: #fff; }

.stack { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 1rem 0 0; padding: 0; }
.stack li {
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--rule-strong);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--text-soft);
}
.stack li:has(a) { padding: 0; }
.stack li a {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0 0.55rem;
    color: var(--edge-bright);
    text-decoration: none;
}
.stack li a:hover { text-decoration: underline; }

/* ============================================================
   THE BOARD — a blotter of what changed
   ============================================================ */

.board-ledger { padding: clamp(0.5rem, 1.5vw, 1rem) 0 clamp(1.25rem, 3vw, 2rem); }
.ledger { list-style: none; margin: 0; padding: 0; }

.result { border-top: 1px solid var(--rule); }
.result:first-child { border-top: none; }
.result details > summary {
    display: grid;
    grid-template-columns: minmax(9rem, 20rem) minmax(0, 1fr) auto 1.5rem;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.75rem);
    padding: clamp(0.85rem, 1.6vw, 1.25rem) clamp(0.75rem, 2vw, 1.5rem);
    cursor: pointer;
    list-style: none;
    transition: background 180ms var(--ease);
}
.result details > summary::-webkit-details-marker { display: none; }
.result details > summary:hover { background: color-mix(in oklab, var(--paper) 4%, transparent); }

.result-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.result-metric { font-weight: 600; }
.result-tag {
    font-family: var(--mono);
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--caution);
    border: 1px solid currentColor;
    padding: 0.1rem 0.3rem;
}

.result-change { display: flex; align-items: center; gap: clamp(0.6rem, 1.6vw, 1.1rem); }
.fig {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.fig-before { color: var(--text-muted); font-size: clamp(1rem, 0.9rem + 0.5vw, 1.375rem); font-weight: 400; }
.fig-after {
    color: var(--text);
    font-size: clamp(1.5rem, 0.9rem + 2vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}
.fig .unit { font-size: 0.75rem; font-weight: 400; letter-spacing: 0.06em; color: var(--text-muted); }
.track {
    flex: 1 1 auto;
    min-width: 1.5rem;
    height: 1px;
    background: linear-gradient(to right, var(--rule-strong), var(--edge));
    background-repeat: no-repeat;
    background-size: 100% 100%;
    transform-origin: left;
    position: relative;
}
/* The measurement is taken again, and again: each row's track re-prints on
   a rolling stagger so the board is never a frozen screen. Paint-only on a
   1px strip, suspended whenever the ledger is off screen. */
.ledger[data-running] .track { animation: track-print 9s var(--ease) infinite backwards; }
.ledger[data-running] .track::after { animation: head-print 9s var(--ease) infinite backwards; }
.ledger[data-running] .result:nth-child(2) .track,
.ledger[data-running] .result:nth-child(2) .track::after { animation-delay: 1.8s; }
.ledger[data-running] .result:nth-child(3) .track,
.ledger[data-running] .result:nth-child(3) .track::after { animation-delay: 3.6s; }
.ledger[data-running] .result:nth-child(4) .track,
.ledger[data-running] .result:nth-child(4) .track::after { animation-delay: 5.4s; }
.ledger[data-running] .result:nth-child(5) .track,
.ledger[data-running] .result:nth-child(5) .track::after { animation-delay: 7.2s; }
@keyframes track-print {
    0%          { background-size: 0% 100%; filter: brightness(1.9); }
    20%         { background-size: 100% 100%; filter: brightness(1.9); }
    /* the pass leaves a trace that decays, so a row reads as recently
       printed rather than as a line that is either drawing or drawn */
    52%, 100%   { background-size: 100% 100%; filter: brightness(1); }
}
@keyframes head-print {
    0%, 3%      { opacity: 0; transform: rotate(45deg) scale(0.6); }
    20%, 100%   { opacity: 1; transform: rotate(45deg) scale(1); }
}
.track::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -2.5px;
    width: 6px;
    height: 6px;
    background: var(--edge);
    transform: rotate(45deg);
    transform-origin: center;
}
.result-span {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.result-open { position: relative; width: 1.5rem; height: 1.5rem; justify-self: end; }
.result-open::before, .result-open::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 13px;
    height: 1.5px;
    margin: -0.75px 0 0 -6.5px;
    background: var(--edge-bright);
    transition: transform 260ms var(--ease);
}
.result-open::after { transform: rotate(90deg); }
.result details[open] .result-open::after { transform: rotate(0deg); }

.result-body { overflow: hidden; background: var(--panel-2); }
.result-body-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: clamp(1rem, 2.5vw, 2rem);
    padding: clamp(1.25rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.5rem);
}
.result-panel h3 {
    font-family: var(--mono);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-stretch: 100%;
    color: var(--edge-bright);
}
.result-panel p { margin: 0.6rem 0 0; color: var(--text-soft); font-size: 0.9375rem; }
.result-panel a { color: var(--edge-bright); }
.result-caveat { color: var(--caution) !important; font-size: 0.8125rem !important; }

.sample-notice {
    max-width: var(--measure);
    margin: 0 clamp(0.75rem, 2vw, 1.5rem) clamp(1rem, 2vw, 1.5rem);
    padding: 0.85rem 1rem;
    border: 1px solid var(--caution);
    color: var(--text-soft);
    font-size: 0.875rem;
    line-height: 1.55;
}
.sample-notice strong { color: var(--caution); font-weight: 700; }

/* ============================================================
   THE MACHINE — the schematic, running
   ============================================================ */

.machine {
    --diagram-col: clamp(24rem, 26vw, 28rem);
    --plate-h: clamp(11rem, 19vw, 17rem);
    --rail-x: calc(var(--diagram-col) - 0.5px);
    --spine-pad: clamp(0.75rem, 2vw, 1.5rem);
    --rail-abs: calc(var(--rail-x) + var(--spine-pad));
    --stage-pad: clamp(1.4rem, 2.2vw, 2.1rem);
}
.machine-intro {
    max-width: 46rem;
    padding: clamp(1.5rem, 3.5vw, 2.75rem) clamp(0.75rem, 2vw, 1.5rem) 0;
}
.machine-intro p { margin-top: 1rem; color: var(--text-soft); }

.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.75rem; margin-top: 1.75rem; }
.acts a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.25rem;
    padding-bottom: 0.3rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.acts .acts-range { font-size: 0.625rem; letter-spacing: 0.06em; color: var(--text-muted); font-variant-numeric: tabular-nums; transition: color 200ms var(--ease); }
.acts a:hover { color: var(--text); border-bottom-color: var(--rule-strong); }
.acts a[aria-current] { color: var(--edge-bright); border-bottom-color: var(--edge); }
.acts a[aria-current] .acts-range { color: var(--edge-bright); }

.spine { position: relative; padding: 0 var(--spine-pad) clamp(1rem, 2vw, 1.5rem); }
.spine::before, .spine::after {
    content: '';
    position: absolute;
    left: var(--rail-abs);
    width: 1px;
}
.spine::before { top: var(--rail-top, 0); bottom: var(--rail-bottom, 0); background: var(--rule-strong); }
.spine::after {
    top: var(--rail-top, 0);
    bottom: var(--rail-bottom, 0);
    background: linear-gradient(to bottom, var(--edge) 0, var(--edge) 88%, var(--edge-bright) 100%);
    transform: scaleY(var(--drawn, 1));
    transform-origin: top;
    transition: transform 700ms var(--ease);
}

/* a packet travelling the rail: the machine is never idle */
.rail-packet {
    position: absolute;
    left: calc(var(--rail-abs) - 1.5px);
    top: var(--rail-top, 0);
    width: 4px;
    height: 34px;
    border-radius: 2px;
    background: linear-gradient(to bottom, transparent, var(--edge-bright));
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}
.spine[data-running] .rail-packet {
    animation: packet-run var(--packet-time, 5.5s) linear infinite;
    animation-delay: var(--packet-delay, 0s);
}
@keyframes packet-run {
    0%        { transform: translateY(0); opacity: 0; }
    6%        { opacity: 1; }
    92%       { opacity: 1; }
    100%      { transform: translateY(var(--rail-span, 0px)); opacity: 0; }
}

.loop {
    --loop-x: 0.4rem;
    position: absolute;
    inset: 0;
    color: var(--edge);
    display: none;
}
.spine[data-enhanced] .loop { display: block; }
.spine[data-init] .loop-out, .spine[data-init] .loop-line, .spine[data-init] .loop-head,
.spine[data-init]::after, .spine[data-init] .stage-plate::after,
.spine[data-init] .stage-io,
.spine[data-init] .stage-index { transition: none; }

.loop-out, .loop-line {
    position: absolute;
    background: var(--edge);
    transform-origin: right center;
    transform: scaleX(0);
    transition: transform 700ms var(--ease);
}
.loop-out {
    top: calc(var(--loop-top, 0) + var(--loop-height, 0));
    left: var(--loop-x);
    width: calc(var(--rail-abs) - var(--loop-x));
    height: 1px;
}
.loop-line {
    top: var(--loop-top, 0);
    left: var(--loop-x);
    width: 1px;
    height: var(--loop-height, 0);
    transform-origin: bottom center;
    transform: scaleY(0);
    transition: transform 700ms var(--ease);
}
.spine[data-loop='on'] .loop-out { transform: scaleX(1); }
.spine[data-loop='on'] .loop-line { transform: scaleY(1); }
.loop-head {
    position: absolute;
    top: -1px;
    left: -7.5px;
    display: block;
    color: var(--edge-bright);
    opacity: 0;
    transition: opacity 300ms var(--ease);
}
.spine[data-loop='on'] .loop-head { opacity: 1; }

.act { position: relative; }
.act-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: clamp(1.75rem, 3vw, 2.75rem);
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-stretch: 100%;
    color: var(--text-muted);
    transition: color 420ms var(--ease);
}
.act:first-child .act-label { padding-top: clamp(1.25rem, 2.5vw, 2rem); }
.act-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.act[data-state='active'] .act-label { color: var(--edge-bright); }

.act-stages { list-style: none; margin: 0; padding: 0; }

.stage {
    display: grid;
    grid-template-columns: var(--diagram-col) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 3rem);
    padding: var(--stage-pad) 0;
    border-top: 1px solid var(--rule);
    position: relative;
}
.act:first-child .act-stages > .stage:first-child { border-top: none; }
/* the landing ring is added by the script only when an act link was
   activated from the keyboard, so a mouse click on a stage draws nothing */
.stage.is-landed {
    outline: 2px solid var(--edge-bright);
    outline-offset: 4px;
    border-radius: 2px;
}

.stage-marker { text-align: right; }
.stage-index {
    display: block;
    padding-right: 0.65rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    transition: color 420ms var(--ease);
}
/* The plate. Its right edge sits exactly on the rail, so the node can be
   its own pseudo-element and lands on the rail at the plate's centre
   without any measured offset. */
.stage-plate {
    position: relative;
    height: var(--plate-h);
    margin-top: 0.85rem;
    overflow: hidden;
    border: 1px solid var(--rule-strong);
    background: var(--panel-2);
}
.stage-plate picture, .stage-plate img {
    display: block;
    width: 100%;
    height: 100%;
}
.stage-plate img {
    object-fit: cover;
    transform: scale(1.01);
    transition: transform 900ms var(--ease);
}
.stage:hover .stage-plate img { transform: scale(1.05); }

.stage-plate::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    margin-top: -3.5px;
    width: 7px;
    height: 7px;
    background: var(--edge);
    transition: background 420ms var(--ease), box-shadow 420ms var(--ease);
}

.stage-io {
    display: block;
    margin-top: 0.85rem;
    padding-right: 0.65rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    transition: color 420ms var(--ease);
}

.spine[data-enhanced] .stage[data-state='upcoming'] .stage-plate::after { background: var(--text-muted); }
.spine[data-enhanced] .stage[data-state='upcoming'] .stage-io { color: var(--text-muted); }
.stage[data-state='passed'] .stage-io { color: var(--text-soft); }
.stage[data-state='active'] .stage-plate::after { background: var(--edge-bright); }
.stage[data-state='active'] .stage-plate { border-color: var(--edge); }
.stage[data-state='active'] .stage-io,
.stage[data-state='active'] .stage-index { color: var(--edge-bright); }
.stage:target .stage-plate, .stage.is-landed .stage-plate { border-color: var(--edge); }
.stage:target .stage-plate::after, .stage.is-landed .stage-plate::after { background: var(--edge-bright); }

.stage-content h4 { font-size: clamp(1.25rem, 0.95rem + 1.2vw, 1.75rem); }
.stage-produces { margin-top: 0.7rem; color: var(--edge-bright); font-weight: 600; font-size: 0.9375rem; }
.stage-content > p:last-child { margin-top: 0.9rem; max-width: var(--measure); color: var(--text-soft); }

/* ============================================================
   WORKING WITH US — the standing terms, as a spec block
   ============================================================ */

.working-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
    gap: clamp(1.25rem, 3vw, 2.5rem);
    padding: clamp(1.5rem, 3.5vw, 2.75rem) clamp(0.75rem, 2vw, 1.5rem);
}
.working-item { border-top: 1px solid var(--edge); padding-top: 1rem; }
.working-item h3 { font-size: 1.0625rem; font-stretch: 100%; }
.working-item p { margin: 0.7rem 0 0; max-width: var(--measure); color: var(--text-soft); font-size: 0.9375rem; }

/* ============================================================
   CONTACT — the ticket, printed on paper on the desk
   ============================================================ */

.contact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}
.contact .panel-head { grid-column: 1 / -1; }
.contact-copy, .contact-form {
    background: var(--paper);
    color: var(--ink);
    padding: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1rem, 2.5vw, 2rem);
}
.contact-copy h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); }
.contact-copy > p { max-width: 38ch; margin: 1rem 0 0; color: var(--ink-soft); }
.contact :focus-visible { outline-color: var(--ink-soft); }

.contact-details { list-style: none; margin: 1.75rem 0 0; padding: 0; }
.contact-details li { display: flex; align-items: center; gap: 0.7rem; min-height: 2.5rem; }
.contact-details svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.contact-details a { color: var(--ink); text-underline-offset: 0.2em; }

.field { margin-bottom: 1rem; }
.field label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.field input, .field textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--field-border);
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
.field textarea { resize: vertical; }
.field input:hover, .field textarea:hover { border-color: var(--ink-soft); }
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--edge);
    box-shadow: 0 1px 0 0 var(--edge), 0 4px 12px -6px color-mix(in oklab, var(--edge) 60%, transparent);
}
.field [aria-invalid='true'] { border-color: var(--alert-ink); }
.field-error { margin: 0.4rem 0 0; color: var(--alert-ink); font-size: 0.8125rem; }
.form-status { margin: 0.9rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }
.form-status[data-state='sent'] { color: var(--confirm-ink); font-weight: 600; }
.form-status[data-state='error'] { color: var(--alert-ink); font-weight: 600; }

/* ============================================================
   FOOTER
   ============================================================ */

.footer { border-top: 1px solid var(--rule-strong); padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 1.5rem; }
.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: clamp(1.5rem, 3vw, 3rem);
}
.footer-brand img { display: block; width: auto; height: 22px; }
.footer-brand p {
    margin: 0.9rem 0 0;
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.footer h2 {
    font-family: var(--mono);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-stretch: 100%;
    color: var(--edge-bright);
}
.footer ul { list-style: none; margin: 0.9rem 0 0; padding: 0; }
.footer li { min-height: 2.25rem; display: flex; align-items: center; color: var(--text-soft); font-size: 0.9375rem; }
.footer a { color: var(--text-soft); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom {
    margin: clamp(2rem, 4vw, 3rem) 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 64rem) {
    .result details > summary { grid-template-columns: minmax(7rem, 16rem) minmax(0, 1fr) auto 1.5rem; }

    /* The machine stacks here: below this the diagram column cannot hold a
       380px motif at 1:1 beside readable prose, and scaling the SVG down
       would shrink its labels with it. The rail moves to the right-hand
       edge and the motifs are NOT mirrored — mirroring would flow each
       diagram against its own readout and invert stage two's trend line. */
    .machine { --rail-x: calc(100% - 0.5px); }
    .machine { --rail-abs: calc(100% - var(--spine-pad) - 0.5px); }

    .stage {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: baseline;
        gap: 0.35rem 1rem;
    }
    .stage-marker, .stage-content { display: contents; }
    .stage-index { grid-column: 1; grid-row: 1; padding-right: 0; }
    .stage-io { grid-column: 2; grid-row: 1; margin-top: 0; justify-self: end; }
    .stage-content h4 { grid-column: 1 / -1; grid-row: 2; margin-top: 0.7rem; }
    .stage-produces { grid-column: 1 / -1; grid-row: 3; }
    .stage-content > p:last-child { grid-column: 1 / -1; grid-row: 4; }
    .stage-plate {
        grid-column: 1 / -1;
        grid-row: 5;
        height: clamp(9rem, 34vw, 13rem);
        margin: 1.1rem 0 0;
    }
    .stage-plate::after { right: -4px; }
    .loop, .spine[data-enhanced] .loop { display: none; }
}

@media (max-width: 48rem) {
    .masthead-nav { display: none; }
    .menu-toggle { display: inline-flex; }
    .desk-status span { display: none; }

    .result details > summary {
        grid-template-columns: minmax(0, 1fr) 1.5rem;
        grid-template-areas: "head open" "change change" "span span";
        gap: 0.45rem 1rem;
    }
    .contact { grid-template-columns: minmax(0, 1fr); }
    .contact-copy { padding-bottom: 0; }

    .result-head { grid-area: head; }
    .result-change { grid-area: change; }
    .result-span { grid-area: span; justify-self: start; }
    .result-open { grid-area: open; }
}

@media (max-width: 22rem) {
    .result-change { flex-wrap: wrap; row-gap: 0.15rem; }
    .track { flex-basis: 100%; margin: 0.5rem 0 0.6rem; }
}

/* ============================================================
   MOTION

   Everything that loops is ambient chrome — the tape, the desk
   grid, the rail packets. All of it stops here, and the page
   still reads as a finished desk.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    body::before { animation: none; }
    .tape-run { animation: none; }
    .rail-packet { display: none; }
    .ledger[data-running] .track,
    .ledger[data-running] .track::after { animation: none; }
}

/* ============================================================
   THE PALETTE LAW, ENFORCED

   --live appears here and nowhere else: on a value in the moment
   it changes, decaying back to its resting colour afterwards.
   If you find yourself reaching for it for emphasis, the answer
   is --edge-bright.
   ============================================================ */

.fig-after .num { transition: color 1200ms var(--ease); }
.fig-after.is-live .num { color: var(--live); transition-duration: 60ms; }

.stage-index, .stage-io { --live-decay: 1200ms; }
.stage.is-live .stage-index, .stage.is-live .stage-io { color: var(--live); transition-duration: 60ms; }

/* a word-valued result is still a figure, but it steps down a notch:
   at the numeral's size a word swamps the row it sits in */
.fig-after.is-word .num {
    font-size: clamp(1.25rem, 0.85rem + 1.3vw, 1.875rem);
    letter-spacing: -0.02em;
}

/* ============================================================
   THE STATE LAW, ENFORCED

   A state that only exists as a colour fails in greyscale, and
   the value the palette law protects is exactly the one that was
   failing. Every state below now carries drawn geometry too.
   ============================================================ */

/* a value in the moment it changes: colour AND a delta mark */
.fig-delta {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    align-self: center;
    color: var(--live);
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 1200ms var(--ease), transform 1200ms var(--ease);
}
.fig-after.is-live .fig-delta {
    opacity: 1;
    transform: translateY(0);
    transition-duration: 60ms;
}

/* an arriving stage: colour AND the node's ring */
/* the arriving stage: colour AND a drawn ring on the node */
.stage.is-live .stage-plate::after {
    background: var(--live);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--live) 34%, transparent);
}

/* the act carrying the reader: colour AND a leading block */
.act-label::before {
    content: '';
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border: 1.5px solid currentColor;
    transition: background 420ms var(--ease);
}
.act[data-state='active'] .act-label::before { background: currentColor; }

/* form outcome: colour AND a distinct shape per outcome */
.form-status[data-state]::before {
    content: '';
    display: inline-block;
    margin-right: 0.5rem;
    vertical-align: 0;
}
.form-status[data-state='sent']::before {
    width: 8px;
    height: 8px;
    background: var(--confirm-ink);
}
.form-status[data-state='error']::before {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid var(--alert-ink);
}

/* ============================================================
   THE ASSEMBLY

   Scattered points resolving into ordered rows — the Structure
   verb, made physical. Borrowed in concept from a scroll-built
   object; here the object being built is the data itself.

   Both canvases are decoration over content that is already
   complete: the opening reads with the canvas absent, and the
   footer keeps its real wordmark until the particles are ready
   to take over from it.
   ============================================================ */

.open {
    position: relative;
    display: flex;
    align-items: center;
    min-height: min(86vh, 780px);
    overflow: hidden;
}
.open-copy { position: relative; z-index: 2; }

/* The plate. The image carries the left third into near-black on its own;
   the scrim only guarantees it, so the headline never depends on where a
   filament happened to land. */
.open-plate, .open-plate img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.open-plate img { object-fit: cover; object-position: 62% 50%; display: block; }
/* The moving plate sits over the still, which stays as the fallback for
   reduced motion, data-saver, and any browser that will not play it. */
.open-motion {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 62% 50%;
    display: block;
}

/* Measured, not guessed: across the clip the left third climbs from luma 20
   to 82 as the push-in fills it with strands. The scrim therefore holds full
   strength well past the headline's right edge, so the ground under the type
   never visibly brightens as the loop plays. */
.open-scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        100deg,
        var(--desk) 0,
        var(--desk) 30%,
        color-mix(in oklab, var(--desk) 90%, transparent) 46%,
        color-mix(in oklab, var(--desk) 38%, transparent) 70%,
        transparent 90%
    );
}


.footer-mark { position: relative; display: inline-block; }
.footer-mark img { transition: opacity 400ms var(--ease); }
.footer-mark canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms var(--ease);
}
/* the swap only happens once the particles actually exist */
.footer-mark[data-assembled] img { opacity: 0; }
.footer-mark[data-assembled] canvas { opacity: 1; }
.footer-brand img { height: 56px; }

@media (max-width: 48rem) {
    /* the plate loses its empty left third when it is this narrow, so the
       scrim takes the whole job */
    .open { min-height: min(78vh, 620px); }
    .open-plate img, .open-motion { object-position: 72% 50%; }
    .open-scrim {
        background: linear-gradient(
            170deg,
            var(--desk) 0,
            color-mix(in oklab, var(--desk) 86%, transparent) 46%,
            color-mix(in oklab, var(--desk) 55%, transparent) 100%
        );
    }
    .footer-brand img { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    /* no motion in the opening: the still plate underneath is already a
       finished hero, so the video simply is not shown */
    .open-motion { display: none; }
    .footer-mark[data-assembled] img { opacity: 1; }
    .footer-mark[data-assembled] canvas { opacity: 0; }
}

/* ============================================================
   THE THREE ACTS

   A full-bleed chapter between the board and the machine: the
   tagline as three images, edge to edge, breaking the panel
   rhythm the way a printed chapter break does. Not cards — the
   tiles touch, carry no container, and are all image.
   ============================================================ */

.acts-band {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: clamp(1rem, 2vw, 1.75rem) 0;
    border-top: 1px solid var(--edge);
    border-bottom: 1px solid var(--edge);
}

.act-tile {
    position: relative;
    height: clamp(22rem, 34vw, 30rem);
    overflow: hidden;
}
.act-tile + .act-tile { border-left: 1px solid var(--rule-strong); }
.act-tile picture, .act-tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.act-tile img {
    display: block;
    object-fit: cover;
    transform: scale(1.02);
    transition: transform 900ms var(--ease);
}
.act-tile:hover img, .act-tile:focus-within img { transform: scale(1.07); }

/* the copy sits on its own ground, so legibility never depends on
   which part of the image landed underneath it */
.act-tile-copy {
    position: absolute;
    inset: auto 0 0 0;
    padding: clamp(1.25rem, 2.5vw, 2rem);
    background: linear-gradient(
        to top,
        var(--desk) 0,
        color-mix(in oklab, var(--desk) 82%, transparent) 55%,
        transparent 100%
    );
}
.act-tile-copy h3 {
    font-size: clamp(1.375rem, 1rem + 1.4vw, 2rem);
    font-stretch: 118%;
    letter-spacing: -0.035em;
}
.act-tile-copy h3 a { color: var(--text); text-decoration: none; }
.act-tile-copy h3 a:hover { color: var(--edge-bright); }
/* the whole tile is the target, not just the four words */
.act-tile-copy h3 a::after { content: ''; position: absolute; inset: 0; }
.act-tile-copy p {
    max-width: 34ch;
    margin: 0.6rem 0 0;
    color: var(--text-soft);
    font-size: 0.9375rem;
    line-height: 1.55;
}

@media (max-width: 48rem) {
    .acts-band { grid-template-columns: minmax(0, 1fr); }
    .act-tile { height: 15rem; }
    .act-tile + .act-tile { border-left: none; border-top: 1px solid var(--rule-strong); }
}
