/* Shadowy — shadowy.studio
 *
 * The page is the Studio. Every token below is the value the iOS app actually uses, taken
 * from Theme.swift, so the hero is a recreation of the real screen rather than an artist's
 * impression of it: same surfaces, same accent, same three bundled typefaces, same controls
 * in the same order.
 *
 * Note there are two greens and they are not interchangeable. --neon (#afff00) outlines the
 * word being spoken; --rec-idle (#a3ff12) is the record button. The app distinguishes them
 * (neonGreen vs studioAccent) and so does this.
 */

:root {
  --ink: #031427;              /* surface */
  --ink-lowest: #000f21;       /* surfaceContainerLowest */
  --ink-low: #0b1c30;          /* surfaceContainerLow */
  --ink-high: #1b2b3f;         /* surfaceContainerHigh */
  --glass: rgba(19, 27, 46, 0.7);
  --paper: #d3e4fe;            /* onSurface */
  --paper-dim: #c4c6cd;        /* onSurfaceVariant */
  --muted: #8e9197;            /* outline */
  --rule: #44474d;             /* outlineVariant */
  --neon: #afff00;             /* the spoken word */
  --rec-idle: #a3ff12;         /* studioAccent — the record button */
  --rec-live: #ffb4ab;         /* error — recording */
  --echo: #aec6ff;             /* secondary */

  --display: "Hanken Grotesk", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --measure: 60ch;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--paper); text-decoration-color: var(--rule); text-underline-offset: 0.25em; }
a:hover { text-decoration-color: var(--neon); }

:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; border-radius: 3px; }

.wrap { width: 100%; max-width: 66rem; margin-inline: auto; padding-inline: var(--gutter); }

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

/* ---- Masthead ------------------------------------------------------------ */

.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-block: 1.75rem; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
}
.wordmark .dot { color: var(--rec-idle); }
.masthead nav {
  display: flex; gap: 1.5rem; font-family: var(--mono);
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
}

/* ---- Hero ---------------------------------------------------------------- */

.hero { padding-block: clamp(2rem, 6vw, 4rem) clamp(2.5rem, 7vw, 4.5rem); }

.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 1.25rem;
}

.hero h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.3rem, 6.8vw, 4.25rem);
  line-height: 1.03; letter-spacing: -0.03em;
  margin: 0 0 1.15rem; max-width: 15ch;
}

.hero .standfirst {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  max-width: 44ch; opacity: 0.82; font-size: 1.1em;
}

/* ---- THE SIGNATURE: the Studio stage, rebuilt ---------------------------- */

/* Same order as StudioStageView: header, panes, progress, transcript, transport. */
.studio {
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--ink-lowest);
  padding: clamp(0.9rem, 2.5vw, 1.35rem);
  max-width: 40rem;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}

.st-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }

.st-x, .st-gear {
  flex: none; width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  color: var(--paper); opacity: 0.8;
  font-family: var(--mono); font-size: 0.85rem;
  background: none; border: 0; padding: 0;
}

.st-titles { min-width: 0; flex: 1; }
.st-kicker {
  display: block; font-family: var(--mono); font-size: 0.6rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.st-title {
  display: block; font-family: var(--mono); font-size: 0.72rem;
  color: var(--paper-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* The REC pill only exists while a take is rolling — as in the app. */
.st-pill {
  display: none; align-items: center; gap: 0.35rem; flex: none;
  border: 1px solid rgb(255 180 171 / 0.3); border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--rec-live);
}
.studio.is-recording .st-pill { display: inline-flex; }
.st-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--rec-live); animation: blink 1.1s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* Panes: the app's collapsed state — both 16:9 at the same height, so the strip reads as
   one thing rather than two mismatched tiles, exactly as StudioStageView describes it.
   Deliberately small here: expanded, the source is an empty gradient that reads as a
   loading placeholder and swallows the hero, and the transcript is the story anyway.
   Diagrams rather than fake screenshots — the app plays real video through someone else's
   channel, and inventing a frame of it here would be a lie. */
.st-panes { display: flex; gap: 0.5rem; }

.st-pane {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--rule); width: 7.5rem; max-width: 40%; aspect-ratio: 16 / 9;
  flex: none;
}
.st-pane span {
  position: absolute; left: 0.5rem; bottom: 0.4rem;
  font-family: var(--mono); font-size: 0.55rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper);
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.8);
}
.st-source { background: linear-gradient(140deg, #14324f, #071a2c 60%, #0b1c30); }
.st-camera { background: linear-gradient(140deg, #2a2340, #12172b); }
.st-camera::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 55% at 50% 42%, rgb(174 198 255 / 0.28), transparent 70%);
}
.studio.is-recording .st-camera { border-color: rgb(255 180 171 / 0.55); }

.st-progress { height: 3px; border-radius: 2px; background: var(--ink-high); margin: 0.85rem 0 1rem; overflow: hidden; }
.st-progress i { display: block; height: 100%; width: 34%; background: var(--paper); opacity: 0.65; border-radius: 2px; }

/* The transcript. The active line sits on a card, exactly as the teleprompter draws it. */
.st-lines { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.st-line {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(0.98rem, 2.9vw, 1.25rem);
  line-height: 1.5; margin: 0; opacity: 0.42;
  padding: 0.45rem 0.65rem; border-radius: 12px;
}
.st-line.is-active { opacity: 1; background: rgb(11 28 48 / 0.7); }

.st-words { display: flex; flex-wrap: wrap; gap: 0.08em 0.36em; }
.st-words span { padding: 0.02em 0.18em; margin: -0.02em -0.18em; border-radius: 5px; }
.st-line.is-active .st-words span.spoken { box-shadow: inset 0 0 0 2px var(--neon); }

.st-sentence {
  display: block; margin-top: 0.35rem;
  font-family: var(--body); font-weight: 400; font-size: 0.72rem;
  color: var(--paper-dim); opacity: 0.85; letter-spacing: 0;
}

/* Transport. Glass panel, controls in the app's order: back 5, play, REC, speed. */
.st-transport {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  background: var(--glass); border: 1px solid rgb(255 255 255 / 0.06);
  border-radius: 999px; padding: 0.5rem;
  backdrop-filter: blur(12px);
}

.st-btn {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 0; background: rgb(255 255 255 / 0.06); color: var(--paper);
  display: grid; place-items: center; cursor: pointer;
  font-family: var(--mono); font-size: 0.7rem;
}
.st-btn:hover { background: rgb(255 255 255 / 0.12); }

.st-rec {
  height: 2.6rem; min-width: 6.2rem; padding-inline: 1.1rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--rec-idle); color: var(--ink-lowest);
  font-family: var(--mono); font-weight: 500; font-size: 0.74rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  transition: background 160ms ease;
}
.studio.is-recording .st-rec { background: var(--rec-live); }
.st-rec .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

/* While rolling, the label is replaced by a waveform — as the app does. */
.st-wave { display: none; align-items: center; gap: 3px; height: 1rem; }
.studio.is-recording .st-wave { display: inline-flex; }
.studio.is-recording .st-rec .label, .studio.is-recording .st-rec .dot { display: none; }
.st-wave i {
  width: 3px; border-radius: 2px; background: var(--ink-lowest);
  animation: wave 900ms ease-in-out infinite;
}
.st-wave i:nth-child(1) { height: 40%; animation-delay: 0ms; }
.st-wave i:nth-child(2) { height: 85%; animation-delay: 120ms; }
.st-wave i:nth-child(3) { height: 60%; animation-delay: 240ms; }
.st-wave i:nth-child(4) { height: 95%; animation-delay: 90ms; }
.st-wave i:nth-child(5) { height: 50%; animation-delay: 300ms; }
@keyframes wave { 50% { transform: scaleY(0.35); } }

/* Takes land here when you stop. Empty until you do — an empty state that invites the act. */
.st-takes { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--rule); }
.st-takes-label {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 0.55rem;
}
.st-take-list { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 1.9rem; align-items: center; }
.st-empty { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.st-take {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.3rem 0.6rem; background: var(--ink-low);
  font-family: var(--mono); font-size: 0.66rem; color: var(--paper-dim);
  animation: drop 260ms ease-out;
}
.st-take b { color: var(--rec-idle); font-weight: 500; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

.hint {
  margin: 1rem 0 0; font-family: var(--mono);
  font-size: 0.68rem; letter-spacing: 0.06em; color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.4rem; margin-top: 2.25rem; }
.btn {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none; font-weight: 500;
  padding: 0.9rem 1.5rem; border-radius: 999px;
  background: var(--rec-idle); color: var(--ink-lowest);
  transition: transform 140ms ease;
}
.btn:hover { transform: translateY(-2px); }
.aside-note { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }

/* ---- Sections ------------------------------------------------------------ */

.band { padding-block: clamp(3.25rem, 9vw, 6rem); border-top: 1px solid var(--rule); }
.band h2 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.7rem, 4.4vw, 2.7rem);
  letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 0.85rem; max-width: 19ch;
}
.band .lede { margin: 0 0 clamp(2rem, 4.5vw, 3rem); max-width: var(--measure); opacity: 0.8; }

.split { display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: start; }
@media (min-width: 54rem) { .split { grid-template-columns: 1fr 19rem; } }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.facts h3 { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin: 0 0 0.3rem; letter-spacing: -0.01em; }
.facts p { margin: 0; opacity: 0.78; font-size: 0.95em; max-width: var(--measure); }

.card { border: 1px solid var(--rule); border-radius: 14px; background: var(--ink-low); padding: 1.5rem; }
.card .headword { font-family: var(--display); font-weight: 800; font-size: 1.8rem; letter-spacing: -0.02em; margin: 0; }
.card .pos {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.12rem 0.55rem; margin: 0.6rem 0 1.1rem;
}
.card .gloss { font-family: var(--display); font-weight: 700; font-size: 1.45rem; color: var(--neon); letter-spacing: -0.01em; margin: 0 0 1.35rem; }
.card dt { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.card dd { margin: 0 0 1.1rem; font-size: 0.92em; }
.card dd:last-child { margin-bottom: 0; }
.card .stamp { font-family: var(--mono); color: var(--neon); font-size: 0.85em; margin-right: 0.45rem; }

/* ---- Footer -------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--rule); padding-block: 2.75rem 3.5rem;
  font-family: var(--mono); font-size: 0.73rem; letter-spacing: 0.06em; color: var(--muted);
}
.foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--paper); }

/* ---- Long-form (privacy, terms) ------------------------------------------ */

.prose { padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(3rem, 8vw, 6rem); }
.prose h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 5.5vw, 3.1rem); letter-spacing: -0.025em; line-height: 1.08; margin: 0 0 0.6rem; }
.prose .updated { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 2.75rem; }
.prose h2 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; margin: 2.75rem 0 0.75rem; max-width: var(--measure); }
.prose p, .prose li { max-width: var(--measure); }
.prose p { margin: 0 0 1rem; opacity: 0.85; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.5rem; opacity: 0.85; }
.prose strong { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn:hover { transform: none; }
}
