/* PYLON — UNDER THE SPAN */
@font-face { font-family: "Archivo"; src: url(../fonts/archivo-var.woff2) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(../fonts/b612mono-normal-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url(../fonts/b612mono-normal-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* sky: three cel arcs from ice (near the sun) to cerulean */
  --sky-0: #D9E7F1; --sky-1: #B3CDE5; --sky-2: #8DB1D8; --sky-3: #6F99CA;
  /* ground: frost-sage */
  --ground: #C9D6CC; --ground-2: #D3DFD5; --ground-3: #BDCDC1;
  /* ink, stepped with distance */
  --ink: #141E28; --ink-2: #34475A; --ink-3: #5F7487; --ink-4: #8EA0B0; --ink-5: #B3C2CD;
  /* plates: ice paper */
  --plate: #EEF3F6; --plate-2: #E1E9EE;
  /* the one live colour: dark cobalt ink with an ice core. UI uses it only for small state marks */
  --live: #24408C; --core: #E6F0FA;
  --rule: 1px;
  --sans: "Archivo", system-ui, sans-serif;
  --mono: "B612 Mono", ui-monospace, monospace;
  --gutter: 16px;
  --world-h: 54svh;
}
* { box-sizing: border-box; }
html { background: var(--panel-ground, #E2EAF0); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: #E2EAF0; font: 400 16px/1.5 var(--sans); font-stretch: 100%; overflow-x: hidden; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- the world ---------------- */
.world { position: sticky; top: 0; z-index: 3; height: var(--world-h); min-height: 330px; overflow: hidden; background: var(--sky-1); border-bottom: 1.5px solid var(--ink); }
.world canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
body.mode-gen .world canvas { cursor: grab; }
body.dragging .world canvas { cursor: grabbing; }
.title { position: absolute; left: var(--gutter); top: 14px; margin: 0; pointer-events: none; transition: opacity .5s;
  font: 200 clamp(48px, 15.5vw, 200px)/0.86 var(--sans); font-stretch: 125%; letter-spacing: 0.01em; color: var(--ink); }
body.mode-gen .title { opacity: 0; }
.title { color: transparent; }                 /* the canvas draws it, knocked out of the wires */
.world-read { position: absolute; left: var(--gutter); bottom: 9px; margin: 0; pointer-events: none; font: 400 10.5px/1.3 var(--mono); letter-spacing: 0.04em; color: var(--ink); }
.world-read > span { background: rgba(238, 243, 246, 0.9); padding: 3px 5px 2px; }
.subtitle { position: absolute; left: var(--gutter); top: calc(14px + clamp(48px, 15.5vw, 200px) * 0.86 + 6px); margin: 0; pointer-events: none; font: 400 15px/1.2 var(--sans); color: var(--ink); transition: opacity .5s; }
.subtitle span { background: rgba(238, 243, 246, 0.9); padding: 1px 5px 2px; }
body.mode-gen .subtitle, .subtitle.on-wire { opacity: 0; }
/* B612 Mono gives . and : a full cell; inside numbers they sit tight */
/* measured: both glyphs sit at the LEFT of a 0.65em cell (ink 0.07–0.23em), so pull mostly from the right */
.p { display: inline-block; margin: 0 -0.36em 0 -0.06em; padding: 0 !important; background: none !important; }
.p.c { margin: 0 -0.35em 0 -0.05em; }

/* ---------------- below the picture: its own ground ---------------- */
main { position: relative; z-index: 1; padding: 0 var(--gutter); }
#generator .plate, #schedule { scroll-margin-top: calc(var(--world-h) + 148px); }
#original { scroll-margin-top: var(--world-h); }
.sec { max-width: 520px; margin: 0 auto; }
.lab { font: 400 10.5px/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }

/* a nameplate: hairline rule, label in the top-left corner, no box */
.plate { position: relative; border-top: var(--rule) solid var(--ink); padding: 30px 0 22px; }
.plate-label { position: absolute; top: 0; left: 0; margin: 0; background: var(--ink); color: var(--plate); font: 400 10.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 8px 4px; }
#original .plate { border-top: 0; padding-top: 26px; }
#original .plate-label { top: 0; }
p { margin: 0 0 12px; }
.lede { font-size: 17px; }
.quiet { color: var(--ink-2); font-size: 15px; }
.note { font-size: 14px; color: var(--ink-2); }

/* a plate button: flat, ink outline; live = ink fill and a small cobalt mark */
.plate-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px;
  background: var(--plate); border: 1.5px solid var(--ink); cursor: pointer; font: 400 17px/1.1 var(--sans); font-stretch: 112%; }
.plate-btn.primary { min-height: 58px; font-size: 19px; }
.plate-btn .ico { width: 13px; height: 13px; flex: none; }
.plate-btn[aria-pressed="true"] { background: var(--ink); color: var(--plate); }
.plate-btn .lamp { position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border: 1px solid currentColor; }
.plate-btn[aria-pressed="true"] .lamp { background: var(--live); border-color: var(--core); }
.plate-btn:active { transform: translateY(1px); }
.plate-btn[disabled] { opacity: 0.55; cursor: progress; }
.row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.row .plate-btn { font-size: 15px; min-height: 48px; }

/* the original */
.clock { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 2px; }
.big { font: 400 34px/1 var(--mono); font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums; }

.phase-line { display: flex; gap: 12px; align-items: baseline; font: 400 14px/1.4 var(--mono); margin: 6px 0 10px; }
.lock { font-size: 14px; color: var(--ink-2); margin: 0 0 16px; }

/* generator bar: Start/Stop and the survey plate; on phone it rides directly under the picture */
.genbar .plate-btn #genlbl { white-space: nowrap; }
.plate-btn.two { flex-direction: column; gap: 2px; }
.plate-btn.two small { font: 400 11px/1.2 var(--mono); color: var(--ink-2); letter-spacing: 0.02em; }
.gloss { margin: 0; font-size: 13px; color: var(--ink-2); }
.genbar { position: sticky; top: var(--world-h); z-index: 2; background: #E2EAF0; padding: 10px 0 10px; border-bottom: var(--rule) solid var(--ink); display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: stretch; }
.genbar .plate-btn { min-height: 64px; height: 100%; font-size: 15px; flex-direction: column; gap: 4px; padding: 0 6px; }
.genbar .plate-btn .lamp { right: 6px; top: 8px; margin: 0; }
/* the live reading: the generator is synthesising now, on this page */
.livestat { grid-column: 1 / -1; order: 3; margin: 0; display: flex; align-items: center; gap: 8px; font: 400 11px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.livestat .dot { width: 7px; height: 7px; border: 1px solid var(--ink-2); flex: none; }
.livestat.on { color: var(--ink); }
.livestat.on .dot { background: var(--live); border-color: var(--live); animation: livepulse 4.8s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .livestat.on .dot { animation: none; } }
.plate-btn.small { min-height: 44px; font-size: 14px; width: auto; padding: 0 14px; }
.extra { margin-top: 18px; padding-top: 12px; border-top: var(--rule) solid var(--ink-4); }
/* the away report: a quiet line after a locked phone comes back */
.away { grid-column: 1 / -1; order: 4; border-left: 2px solid var(--live); padding: 2px 0 2px 10px; }
.away p { margin: 0 0 4px; font: 400 12px/1.45 var(--mono); color: var(--ink); }
.away .lab { margin-right: 6px; }
.away-q { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.away-q > span { margin-right: 4px; color: var(--ink-2); }
.tiny { min-height: 44px; min-width: 44px; padding: 0 10px; border: 1px solid var(--ink); background: var(--plate); color: var(--ink); font: 400 12px/1 var(--mono); cursor: pointer; }
.tiny[aria-pressed="true"] { background: var(--ink); color: var(--plate); }
.away-json { width: 100%; height: 120px; font: 400 11px/1.3 var(--mono); margin-top: 6px; }
/* the survey data plate: two columns, readings right-aligned */
.survey { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; border-top: var(--rule) solid var(--ink); border-left: var(--rule) solid var(--ink); background: var(--plate); }
.survey > div { border-right: var(--rule) solid var(--ink); border-bottom: var(--rule) solid var(--ink); padding: 4px 7px 5px; min-width: 0; }
.survey dt { font: 400 9.5px/1.2 var(--mono); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.survey dd { margin: 2px 0 0; font: 400 14px/1.2 var(--mono); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* listening: a two-position knife switch */
.knife-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.knife-row .knife { flex: 1; justify-content: start; }
.knife { display: grid; grid-template-columns: auto 120px auto 1fr; align-items: center; gap: 10px; min-height: 56px; text-align: left; background: transparent; border: 0; padding: 0; cursor: pointer; }
.knife .side { font: 400 16px/1.2 var(--sans); color: var(--ink-2); }
.knife[aria-checked="false"] #l-ears, .knife[aria-checked="true"] #l-coil { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.knife svg { width: 120px; height: 48px; overflow: visible; }
.knife .blade { transform-origin: 60px 38px; transition: transform .3s cubic-bezier(.3, 1.3, .5, 1); transform: rotate(-60deg); }
.knife[aria-checked="true"] .blade { transform: rotate(60deg); }

/* places: stations on a single-line diagram */
.sld { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; margin: 4px -16px 8px; padding: 0 16px 8px; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5px, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 5px, #000 calc(100% - 22px), transparent 100%); }
.sld::after { content: ""; flex: none; width: 16px; }
.station, .conv { position: relative; flex: none; scroll-snap-align: start; }
.station { width: 120px; min-height: 104px; background: transparent; border: 0; padding: 34px 6px 4px 0; text-align: left; cursor: pointer; }
.station::before, .conv::before { content: ""; position: absolute; left: 0; right: 0; top: 17px; border-top: 2px solid var(--ink); }
.station .tick { position: absolute; left: 4px; top: 4px; width: 22px; height: 26px; }
.station .tag { display: inline-block; font: 700 11px/1 var(--mono); letter-spacing: 0.04em; padding: 3px 4px 2px; border: 1px solid var(--ink); background: var(--plate); }
.station b { display: block; font: 400 14px/1.2 var(--sans); margin-top: 5px; }
.station small { display: block; font: 400 10.5px/1.2 var(--mono); color: var(--ink-2); margin-top: 2px; }
.station[aria-pressed="true"] .tag { background: var(--ink); color: var(--plate); }
.station[aria-pressed="true"] .here { position: absolute; left: 11px; top: 13px; width: 9px; height: 9px; background: var(--live); border: 1px solid var(--core); }
.conv { width: 104px; padding: 34px 8px 4px 8px; scroll-snap-align: start; font: 400 10.5px/1.25 var(--mono); color: var(--ink-2); }
.conv svg { position: absolute; left: 22px; top: 4px; width: 26px; height: 26px; }
.blurb { font-size: 14px; color: var(--ink-2); min-height: 3em; }

/* revision table: a shared link is a revision of the line */
.revs { width: 100%; border-collapse: collapse; margin-top: 10px; font: 400 11.5px/1.4 var(--mono); }
.revs th { text-align: left; font-weight: 400; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--ink); padding: 3px 4px; }
.revs td { border-bottom: 1px solid var(--ink-4); padding: 4px; vertical-align: top; word-break: break-all; }
.bar { height: 6px; border: 1px solid var(--ink); margin: 8px 0; position: relative; display: none; }
.bar.on { display: block; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); }
.dl { display: flex; align-items: center; min-height: 44px; margin: 4px 0 8px; font: 400 14px/1.3 var(--mono); }
#take { margin-bottom: 10px; }

/* the schedule */
details.schedule > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 48px; border: 1.5px solid var(--ink); padding: 0 14px; font: 400 17px/1.1 var(--sans); font-stretch: 112%; background: var(--plate); }
details.schedule > summary::-webkit-details-marker { display: none; }
details[open].schedule > summary { background: var(--ink); color: var(--plate); margin-bottom: 14px; }
.group { border-top: var(--rule) solid var(--ink); padding: 12px 0 4px; margin-top: 10px; }
.group h3 { margin: 0 0 2px; font: 400 17px/1.2 var(--sans); }
.group > p { font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.param { padding: 6px 0 2px; }
.param .ph { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.param label { font: 400 15px/1.25 var(--sans); }
.param output { font: 400 12px/1.3 var(--mono); text-align: right; color: var(--ink); }
.span { position: relative; height: 54px; }
.span svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.span input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.span input:focus-visible + svg .damper { stroke: var(--live); }

/* the ground line */
.groundline { border-top: 2px solid var(--ink); margin: 30px calc(-1 * var(--gutter)) 0; padding: 14px var(--gutter) 40px; font: 400 12px/1.6 var(--mono); background: var(--ground-3); }
.groundline p { margin: 0 auto; max-width: 520px; }

/* ---------------- desktop: the picture, and beside it the panels on their own ground ---------------- */
@media (min-width: 1000px) {
  :root { --world-h: 100vh; --panel: max(400px, 32vw); }
  .world { position: fixed; left: 0; top: 0; width: calc(100vw - var(--panel)); height: 100vh; border-bottom: 0; border-right: 1.5px solid var(--ink); }
  .title { left: 48px; top: 36px; font-size: 150px; }
  .world-read { left: 48px; bottom: 24px; font-size: 11px; }
  main { margin-left: calc(100vw - var(--panel)); width: var(--panel); padding: 28px 32px 0; min-height: 100vh; }
  .subtitle { left: 48px; top: 172px; font-size: 19px; }
  .lede { font-size: 16px; } .quiet { font-size: 14px; line-height: 1.5; }
  .sec { max-width: none; }
  .genbar { position: static; grid-template-columns: 1fr; border-bottom: 0; padding: 0 0 18px; }
  .genbar .plate-btn { flex-direction: row; min-height: 58px; }
  .sld { margin: 4px 0 8px; padding: 0 0 6px; }
  #generator .plate, #schedule, #original { scroll-margin-top: 24px; }
  .groundline { margin: 40px -36px 0; padding: 16px 36px 40px; }
  #original { min-height: 100vh; }
  #generator { padding-top: 4vh; }
}

/* lock-screen artwork mode: one square frame */
body.artwork { overflow: hidden; background: var(--sky-1); }
body.artwork main, body.artwork .world-read, body.artwork .subtitle { display: none; }
body.artwork .world { position: fixed; inset: 0; width: 100vw; height: 100vh; border: 0; }
body.artwork .title { top: 5%; left: 5.5%; font-size: 14vw; opacity: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

[hidden] { display: none !important; }
