/* Shared by /music and /podcast. Tokens, chrome, stage and graph styles are copied from index.html's <style>
   (the source of truth); keep the two in step by hand until a third page earns a shared file. */
:root {
  --canvas: #FAF8F4; --raised: #F2EFE9;
  --hair: #E4E1DB; --rule: #C9C8C6;
  --ochre: #D08C3C; --ochre-soft: #EFD3A5;
  --ink: #16181B; --body: #43484E; --muted: #5C6167;
  --on-ochre: #16181B; --focus: #B0722C;
  --display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --d1: clamp(40px, 7vw, 84px);
  --d2: clamp(30px, 4.6vw, 52px);
  --d3: clamp(24px, 2.8vw, 34px);
  --t1: 19px; --t2: 17px; --t3: 14px; --t4: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --canvas: #16181B; --raised: #2E3238; --hair: #262A2F; --rule: #43484E;
  --ochre: #B0722C; --ochre-soft: #6A421B; --ink: #E4E1DB; --body: #CFCCC6; --muted: #A2A5A8;
  --on-ochre: #000; --focus: #D9A052; color-scheme: dark; } }
:root[data-theme="dark"] {
  --canvas: #16181B; --raised: #2E3238; --hair: #262A2F; --rule: #43484E;
  --ochre: #B0722C; --ochre-soft: #6A421B; --ink: #E4E1DB; --body: #CFCCC6; --muted: #A2A5A8;
  --on-ochre: #000; --focus: #D9A052; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--body); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: currentColor; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--ochre-soft); color: var(--ink); }
h1, h2, p { margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 24px; }

header { padding-block: 22px; border-bottom: 1px solid var(--hair); }
header .wrap { display: flex; align-items: center; gap: 10px; }
.mark { width: 20px; height: 20px; border-radius: 2px; background: linear-gradient(135deg, var(--ink) 0 49%, var(--ochre) 51% 100%); flex: none; }
.wordmark { font-weight: 500; font-size: var(--t3); color: var(--ink); }
header .addr { margin-left: auto; font-family: var(--mono); font-size: var(--t4); color: var(--muted); }

/* Site menu: a popover, so open/close, Esc, click-outside and focus return are the browser's. */
.menu-btn { margin-left: 8px; margin-block: -11px; width: 44px; height: 44px; padding: 0; flex: none; display: grid; place-items: center; border: 0; border-radius: 2px; background: transparent; color: var(--ink); cursor: pointer; }
.menu-btn:hover { background: var(--raised); }
.menu-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.menu { position: fixed; inset: 64px 24px auto auto; margin: 0; width: min(300px, calc(100vw - 32px)); padding: 8px 0; background: var(--canvas); color: var(--ink); border: 1px solid var(--hair); border-radius: 2px; box-shadow: 0 12px 32px rgb(0 0 0 / .12); overflow: visible; }
.menu::backdrop { background: transparent; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu ul ul { position: relative; }
.menu ul ul::before { content: ""; position: absolute; inset-block: 0; left: 20px; width: 1px; background: var(--hair); }
.menu a { display: block; padding: 10px 20px; font-family: var(--sans); font-size: var(--t3); line-height: 1.5; color: var(--ink); border-bottom: 0; }
.menu ul ul a { padding-left: 36px; color: var(--body); }
.menu a:hover { background: var(--raised); }
.menu a[aria-current="page"] { color: var(--ink); box-shadow: inset 2px 0 0 var(--ochre); }
@media (prefers-reduced-motion: no-preference) {
  .menu:popover-open { opacity: 1; transform: none; transition: opacity 140ms, transform 140ms; }
  @starting-style { .menu:popover-open { opacity: 0; transform: translateY(-4px); } }
}

/* Hero */
.hero { padding-block: 72px 28px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: var(--d1); line-height: 1.04; letter-spacing: -0.015em; color: var(--ink); max-width: 15ch; text-wrap: balance; }
.hero .cap { margin-top: 22px; font-size: var(--t1); max-width: 46ch; color: var(--body); }

/* The stage */
.stage { margin-top: 44px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
/* The graph stays in view beside a narrative taller than it (the finished still shows every line). */
.graph { padding: 28px 28px 20px 0; position: sticky; top: 0; align-self: start; min-width: 0; }
.graph svg { width: 100%; height: auto; display: block; overflow: visible; }
.stagebar { display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: var(--t4); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.stagebar button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 10px; min-height: 32px; cursor: pointer; }
.stagebar button:hover { border-color: var(--ink); }

/* Graph drawing */
.edge { stroke: var(--hair); stroke-width: 1.25; fill: none; transition: stroke 600ms; }
.edge.on { stroke: var(--rule); }
.edge.done { stroke: var(--ink); }
.node circle { fill: var(--canvas); stroke: var(--rule); stroke-width: 1.25; transition: fill 400ms, stroke 400ms; }
.node text { font-family: var(--mono); font-size: 11px; fill: var(--muted); letter-spacing: 0.04em; }
.node.ready circle { stroke: var(--ink); }
.node.running circle { fill: var(--ochre); stroke: var(--ochre); }
.node.running text { fill: var(--ink); }
.node.accepted circle { fill: var(--ink); stroke: var(--ink); }
.node.accepted text { fill: var(--ink); }
.node.refused circle { fill: var(--canvas); stroke: var(--ink); stroke-dasharray: 3 3; }
.node .ring { fill: none; stroke: var(--ochre); stroke-width: 1; opacity: 0; }
.node .gate rect { fill: var(--canvas); stroke: var(--rule); stroke-width: 1; opacity: 0; transition: opacity 200ms, fill 200ms; }
.node .gate rect.pass { fill: var(--ink); stroke: var(--ink); opacity: 1; }
.node .gate rect.fail { fill: var(--canvas); stroke: var(--ink); opacity: 1; }
.node .gate rect.show { opacity: 1; }
.brief-dot circle { fill: var(--ink); }
.brief-dot text { font-family: var(--mono); fill: var(--ink); font-weight: 500; }
/* --u is board units per screen pixel, set by the script, so labels hold 11px (12px on the compact board) at any scale. */
.node text, .brief-dot text { font-size: calc(11px * var(--u, 1.6)); }
svg.compact .node text, svg.compact .brief-dot text { font-size: calc(12px * var(--u, 1.5)); letter-spacing: 0; }
@media (prefers-reduced-motion: no-preference) {
  .node.running .ring { animation: pulse 1400ms ease-out infinite; }
  @keyframes pulse { 0% { opacity: .9; r: 11; } 100% { opacity: 0; r: 22; } }
  .node.refused { animation: shake 420ms cubic-bezier(.36,.07,.19,.97) both; }
  @keyframes shake { 10%, 90% { translate: -1px 0;} 20%, 80% { translate: 2px 0;} 30%, 50%, 70% { translate: -3px 0;} 40%, 60% { translate: 3px 0;} }
}

/* Contact */
.contact { border-top: 1px solid var(--hair); padding-block: 88px 96px; }
.contact h2 { font-family: var(--display); font-weight: 400; font-size: var(--d1); line-height: 1.04; letter-spacing: -0.015em; color: var(--ink); max-width: 14ch; text-wrap: balance; }
.contact .addr { margin-top: 28px; font-family: var(--mono); font-size: var(--t1); color: var(--ink); }
footer { border-top: 1px solid var(--hair); padding-block: 24px 40px; }
footer .wrap { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: var(--t4); color: var(--muted); }
footer a { color: var(--muted); }


/* ---- Below: only on the showcase pages ---- */
a.wordmark { border-bottom: 0; }
.node .lbl-up { dominant-baseline: auto; }
/* A person's step: drawn as a diamond, hollow in the ready stroke until it is decided. */
.node.person rect.body { fill: var(--canvas); stroke: var(--ink); stroke-width: 2; transition: fill 400ms, stroke 400ms; }
.node.person.waiting rect.body { stroke: var(--ochre); }
.node.person.accepted rect.body { fill: var(--ink); }
.node.waiting text { fill: var(--ink); }
/* The audio node's progress arc. */
.node .arc { fill: none; stroke: var(--ink); stroke-width: 2; transition: stroke-dashoffset 700ms linear; opacity: 0; }
.node.running .arc { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .node.waiting .ring { animation: pulse 1400ms ease-out infinite; }
}

/* The stage's phase: setup, running, waiting on a person, done. */
.stagebar .phase { margin-left: auto; color: var(--ink); white-space: nowrap; }
.stagebar .phase.wait::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; background: var(--ochre); }
.brief-dot { transition: opacity 400ms; }
.brief-dot.off { opacity: .2; }

/* The person: beside the chain (music) or standing on it (podcast). */
.who .glyph circle, .who .glyph path { fill: none; stroke: var(--ink); stroke-width: 1.5; transition: stroke 400ms, fill 400ms; }
.who text { font-family: var(--mono); fill: var(--ink); font-weight: 500; letter-spacing: 0.04em; font-size: calc(11px * var(--u, 1.6)); }
svg.compact .who text { font-size: calc(12px * var(--u, 1.5)); letter-spacing: 0; }
.who.waiting .glyph circle, .who.waiting .glyph path { stroke: var(--ochre); }
.who.waiting .glyph circle { fill: var(--ochre); }
.who.reached:not(.waiting) .glyph circle { fill: var(--ink); }
.who .link { fill: none; stroke: var(--rule); stroke-width: 1.25; stroke-dasharray: 3 4; transition: stroke 500ms; }
.who .link.done { stroke: var(--ink); }

/* The narrative: the setup, then the run, one line lit at a time while it plays. */
.narr { padding: 28px 0 20px 28px; min-width: 0; position: relative; border-left: 1px solid var(--hair); }
.narr h2 { font-family: var(--mono); font-weight: 500; font-size: var(--t4); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.narr ol + h2 { margin-top: 24px; }
.narr ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.narr li { font-size: 15px; line-height: 1.5; color: var(--body); display: grid; grid-template-columns: 7px 1fr; gap: 12px; transition: opacity 500ms, color 500ms; }
.narr li::before { content: ""; width: 7px; height: 7px; margin-top: 0.62em; background: var(--ink); transition: background 400ms; }
.narr li b { font-weight: 500; color: var(--ink); }
.narr a { border-bottom-color: var(--rule); }
.narr.live { max-height: 380px; padding-bottom: 48px; overflow-y: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(transparent, #000 72px, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(transparent, #000 72px, #000 calc(100% - 44px), transparent); }
.narr.live::-webkit-scrollbar { display: none; }
.narr.live:not(.done) li { opacity: .4; }
.narr.live:not(.done) li::before { background: var(--rule); }
.narr.live:not(.done) li.past { opacity: 1; }
.narr.live:not(.done) li.past::before { background: var(--ink); }
.narr.live:not(.done) li.on { opacity: 1; color: var(--ink); }
.narr.live:not(.done) li.on::before { background: var(--ochre); }

/* Under the stage: what the pattern is called, and the other page. */
.legend { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; }
.legend > p:first-child { font-size: var(--t2); max-width: 62ch; }
.legend .tag { font-family: var(--mono); font-size: var(--t4); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin-right: 10px; white-space: nowrap; }
.legend .cross { margin-top: 0; }

/* Sections */
.sec { padding-block: 72px; border-top: 1px solid var(--hair); }
.eyebrow { font-family: var(--mono); font-weight: 500; font-size: var(--t4); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin-bottom: 28px; }
.sec h2.big { font-family: var(--display); font-weight: 400; font-size: var(--d2); line-height: 1.05; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 22px; max-width: 18ch; text-wrap: balance; }
.prose { font-size: var(--t1); max-width: 54ch; }
.prose + .prose { margin-top: 16px; }
.cross { margin-top: 28px; font-family: var(--mono); font-size: var(--t3); }
.cross a { border-bottom-color: var(--rule); }

/* Listen */
.listen .wrap { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 36px; align-items: end; }
.listen .pic { display: block; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 5; background: var(--raised); }
.listen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listen .name { font-family: var(--display); font-size: var(--d3); line-height: 1.1; color: var(--ink); }
.listen .name a { border-bottom-color: var(--rule); }
.listen .note { margin-top: 12px; font-size: var(--t3); color: var(--muted); max-width: 40ch; }

@media (max-width: 860px) {
  /* The whole graph at full width, the narrative under it. */
  .stage { grid-template-columns: 1fr; }
  .graph { position: relative; padding: 20px 0 12px; }
  .graph svg { aspect-ratio: 16 / 11; }
  .stagebar { white-space: nowrap; gap: 12px; }
  .stagebar button { min-height: 44px; padding-inline: 14px; }
  .narr { padding: 18px 0 20px; border-left: none; border-top: 1px solid var(--hair); }
  .narr.live { max-height: 300px; }
  footer a { display: inline-block; padding-block: 12px; margin-block: -12px; }
}
@media (max-width: 860px) and (orientation: landscape) and (max-height: 500px) {
  .graph svg { max-height: calc(100vh - 150px); max-height: calc(100svh - 150px); }
}
@media (max-width: 520px) {
  .hero { padding-block: 48px 20px; }
  .sec { padding-block: 56px; }
  .run-pre { display: none; }
  header .addr { display: none; }
  .menu-btn { margin-left: auto; }
  .menu { inset: 60px 16px auto 16px; width: auto; }
  .menu a { display: flex; align-items: center; min-height: 44px; padding-block: 0; }
  .stagebar { gap: 10px; }
  .stagebar .phase { font-size: 11px; letter-spacing: 0.04em; }
  .listen .wrap { grid-template-columns: 1fr; gap: 20px; }
  .listen .pic { max-width: 240px; }
}
