/* Radios On — chapter reader
   book page, adventure-game dialog */

body.story {
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(255, 220, 170, 0.08), transparent 50%),
    radial-gradient(800px 600px at 100% 100%, rgba(0, 0, 0, 0.28), transparent 55%),
    var(--desk);
  color: var(--cream);
}

body.story::before {
  content: none;
}

/* ---------- mast ---------- */

.mast {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 8px;
}

.mast-back {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--peach);
  text-decoration: none;
}

.mast-back:hover {
  text-decoration: underline;
}

.mast-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  align-items: end;
  margin: 28px 0 12px;
}

.freq {
  grid-row: 1 / span 2;
  margin: 0;
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--dawn);
  border-right: 1px solid rgba(224, 112, 56, 0.45);
  padding-right: 10px;
}

.mast h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 450;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--cream);
}

.mast-tag {
  margin: 6px 0 0;
  color: var(--peach);
  font-size: 1.15rem;
}

.mast-note {
  max-width: 38em;
  margin: 0 0 8px;
  font-family: var(--type-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--foam);
  opacity: 0.75;
}

/* ---------- chapter rail ---------- */

.chapters {
  display: flex;
  gap: 6px;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 24px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chapters::-webkit-scrollbar {
  display: none;
}

.chapters a,
.chapters span {
  flex: 0 0 auto;
  display: grid;
  gap: 2px;
  min-width: 92px;
  padding: 10px 12px 12px;
  border: 0;
  border-radius: 3px 3px 0 0;
  text-decoration: none;
  color: inherit;
  background: rgba(0, 0, 0, 0.18);
}

.chapters .n {
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

.chapters .t {
  font-size: 0.95rem;
}

.chapters a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chapters a.is-current {
  background: var(--cream);
  color: var(--ink);
}

.chapters a.is-current .n {
  color: var(--dawn);
  opacity: 1;
}

.chapters span.is-soon {
  opacity: 0.45;
  cursor: default;
}

/* ---------- toolbar ---------- */

.toolbar {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 24px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mode {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 3px;
}

.mode button {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--foam);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

.mode button.is-on {
  background: var(--cream);
  color: var(--ink);
}

.mode-hint {
  margin: 0;
  font-family: var(--type-mono);
  font-size: 11px;
  color: var(--foam);
  opacity: 0.7;
}

/* ---------- chapter (read) ---------- */

.chapter {
  background-color: var(--cream);
  background-image: var(--paper-tooth);
  background-size: 440px;
  background-blend-mode: multiply;
  color: var(--ink);
  max-width: 920px;
  margin: 0 auto 0;
  padding: 48px 48px 80px;
  box-shadow: var(--shadow);
}

body.is-play .chapter,
body.is-play .story-end {
  display: none;
}

.chapter-hed .kicker {
  margin: 0 0 10px;
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dawn);
}

.chapter-hed h2 {
  margin: 0 0 12px;
  font-family: var(--type-display);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 450;
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-transform: none;
}

.chapter-hed .pull {
  margin: 0 0 36px;
  max-width: 22em;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--ink-soft);
}

.scene + .scene {
  margin-top: 56px;
  padding-top: 8px;
}

.scene-plate {
  margin: 0 -48px 28px;
}

.scene-plate img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #1a2a30;
}

.scene-plate figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 48px 0;
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--graphite);
}

.prose {
  max-width: 38em;
  font-size: 1.14rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.prose p {
  margin: 0 0 1em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.stage {
  margin: 1.4rem 0;
  font-family: var(--type-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dawn);
  text-align: center;
}

/* ---------- dialog lines ---------- */

.line {
  --who: var(--dawn);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px;
  gap: 18px;
  align-items: center;
  margin: 0.7rem 0;
  padding: 8px 0;
}

.prose + .line,
.stage + .line,
.prop + .line {
  margin-top: 1.35rem;
}

.line + .line {
  margin-top: 8px;
}

.portrait {
  width: 92px;
  height: 104px;
  padding: 4px;
  background: #100e0c;
  border: 1px solid var(--spine);
  justify-self: center;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% 18%;
  background: #e8dcc8;
}

.portrait.is-dim {
  opacity: 0.45;
}

.portrait.is-live {
  box-shadow: 0 0 0 1px var(--who, var(--spine)), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.portrait.is-empty {
  visibility: hidden;
}

.portrait.is-live {
  opacity: 1;
}

.speech {
  text-align: center;
  max-width: 34em;
  margin: 0 auto;
  width: 100%;
}

.line[data-who="julia"] .speech {
  text-align: left;
  margin-left: 0;
  margin-right: auto;
}

.speech .who {
  display: block;
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--who);
  font-weight: 500;
  white-space: nowrap;
}

.speech p {
  margin: 6px 0 0;
  font-size: 1.18rem;
  line-height: 1.45;
  color: var(--ink);
}

.line[data-who="julia"] { --who: var(--dawn); }
.line[data-who="stephen"] { --who: #5c6b74; }
.line[data-who="christopher"] { --who: #b5683a; }
.line[data-who="steve"] { --who: var(--sea); }

.line.is-thought {
  grid-template-columns: 92px minmax(0, auto);
  width: fit-content;
  max-width: 100%;
  gap: 16px;
  padding: 10px 18px 10px 10px;
  border: 1px dashed #c9b79a;
}

.line.is-thought .portrait.is-empty {
  display: none;
}

.line.is-thought .portrait.is-live {
  background: transparent;
  box-shadow: none;
}

.line.is-thought .speech {
  max-width: 28em;
}

.line.is-thought .speech p {
  font-style: italic;
  color: var(--ink-soft);
}

.prop {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 28em;
  margin: 1.6rem auto;
  padding: 12px 16px;
  background: #f3ebe0;
  border: 1px solid #d8c7a6;
}

.prop .prop-mark {
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dawn);
}

.prop p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ---------- play stage ---------- */

.play-stage {
  max-width: 920px;
  margin: 0 auto 48px;
  background: #10181b;
  box-shadow: var(--shadow);
}

.play-plate {
  margin: 0;
  position: relative;
}

.play-plate img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.play-plate figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 28px 16px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f3ebe0;
}

.tray {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 108px;
  gap: 12px;
  align-items: stretch;
  min-height: 132px;
  padding: 12px;
  background: #14110e;
  color: #f3ebe0;
  border-top: 1px solid #3a332c;
}

.tray-port {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 6px;
  opacity: 0.28;
  transition: opacity 0.2s var(--ease);
}

.tray-port.is-live {
  opacity: 1;
}

.tray-port img {
  width: 92px;
  height: 104px;
  object-fit: cover;
  object-position: 30% 18%;
  background: #e8dcc8;
  border: 1px solid #c4a574;
}

.tray-port span {
  font-family: var(--type-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.tray-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8px 12px;
  max-width: 36em;
  margin: 0 auto;
  width: 100%;
}

.tray-kicker {
  margin: 0 0 6px;
  font-family: var(--type-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dawn);
}

.tray-line {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.45;
}

.tray.is-narration {
  grid-template-columns: 1fr;
}

.tray.is-narration .tray-port {
  display: none;
}

.tray.is-narration .tray-body {
  max-width: 38em;
  margin: 0 auto;
  text-align: left;
}

.tray.is-narration .tray-line {
  font-style: italic;
  color: #d9d0c4;
}

.tray.is-thought .tray-line {
  font-style: italic;
}

.tray.is-stage .tray-line {
  font-family: var(--type-mono);
  font-size: 13px;
  color: var(--dawn);
  text-align: center;
}

.play-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 14px;
  background: #14110e;
}

.play-bar button {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--dawn);
  color: #1c1916;
  border: 0;
  padding: 8px 14px;
  cursor: pointer;
}

.play-bar #play-back {
  background: transparent;
  color: var(--peach);
  border: 1px solid rgba(232, 180, 150, 0.35);
}

.play-bar p {
  margin: 0;
  margin-right: auto;
  font-family: var(--type-mono);
  font-size: 11px;
  color: #a89b8c;
}

/* ---------- end ---------- */

.story-end {
  max-width: 920px;
  margin: 0 auto 64px;
  padding: 28px 48px 40px;
  background: #ead9bc;
  color: var(--ink);
}

.story-end p {
  margin: 0 0 8px;
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dawn);
}

.story-end a {
  color: inherit;
}

.story-end h2 {
  margin: 0 0 8px;
  font-family: var(--type-display);
  font-size: 1.8rem;
  font-weight: 450;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--ink);
}

.story-end .muted {
  font-family: var(--type-display);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}

/* ---------- mobile ---------- */

@media (max-width: 720px) {
  .mast,
  .chapters,
  .toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chapter {
    padding: 28px 18px 56px;
  }

  .scene-plate {
    margin-left: -18px;
    margin-right: -18px;
  }

  .scene-plate figcaption {
    padding-left: 18px;
    padding-right: 18px;
  }

  .line {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    gap: 8px;
    padding: 8px;
  }

  .line.is-thought {
    grid-template-columns: 68px minmax(0, auto);
    padding: 8px 12px 8px 8px;
  }

  .portrait {
    width: 68px;
    height: 78px;
  }

  .speech .who {
    white-space: normal;
  }

  .speech p {
    font-size: 1.02rem;
  }

  .tray {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 8px;
    padding: 8px;
    min-height: 110px;
  }

  .tray-port img {
    width: 64px;
    height: 74px;
  }

  .tray-line {
    font-size: 1.02rem;
  }

  .story-end {
    padding: 22px 18px 32px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .line {
    animation: rise 0.35s var(--ease);
  }

  @keyframes rise {
    from { transform: translateY(6px); }
    to { transform: none; }
  }
}
