/* ---------- Design tokens and base styles ---------- */
:root {
  --night: #123b4e;
  --panel: #1b4f66;
  --ink: #edf2f4;
  --muted: #aebbc6;
  --line: #265066;
  --cyan: #55d6c2;
  --gold: #f1b854;
  --paper: #f3efe6;
  --paper-ink: #14202a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

main,
footer {
  max-width: 1180px;
  margin: auto;
}

/* ---------- Shared header and controls ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: 1180px;
  margin: auto;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand small {
  color: var(--muted);
  font-weight: 400;
}

.site-header nav {
  display: flex;
  gap: 28px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus {
  color: var(--ink);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
.button:focus {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.primary {
  background: var(--cyan);
  color: #071710;
}

.secondary {
  background: transparent;
  color: var(--cyan);
}

.text-link {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
  text-underline-offset: 4px;
}

.kicker,
.section-label {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h2 {
  margin: 14px 0;
  font-family: Georgia, serif;
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  line-height: 1.05;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  min-height: 680px;
  padding: 76px 28px 80px;
  gap: 70px;
}

.hero h1 {
  margin: 24px 0 34px;
  font-family: Georgia, serif;
  font-size: clamp(4.2rem, 9vw, 7.8rem);
  letter-spacing: -0.065em;
  line-height: 0.82;
}

.lede {
  max-width: 600px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 36px 0 18px;
}

.meta {
  color: #8293a2;
  font-size: 0.85rem;
}

.hero-art {
  position: relative;
  height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(#24647e, #123b4e 68%);
  clip-path: polygon(7% 0, 100% 0, 100% 93%, 0 100%, 0 8%);
}

.moon {
  position: absolute;
  top: 12%;
  right: 14%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #e8e7d8;
  box-shadow: 0 0 60px #dbe6e080;
}

.route {
  position: absolute;
  bottom: -30px;
  left: 50%;
  width: 2px;
  height: 420px;
  background: repeating-linear-gradient(
    var(--gold) 0 25px,
    transparent 25px 48px
  );
  transform-origin: bottom;
}

.route-a { transform: rotate(-17deg); }
.route-b { transform: rotate(17deg); }

.car {
  position: absolute;
  bottom: 42px;
  left: calc(50% - 50px);
  width: 100px;
  height: 52px;
  border: 1px solid #60768a;
  border-radius: 28px 28px 10px 10px;
  background: #2c5c73;
}

.car span {
  position: absolute;
  bottom: -8px;
  width: 22px;
  height: 22px;
  border: 4px solid #2c5c73;
  border-radius: 50%;
  background: #081f29;
}

.car span:first-child { left: 11px; }
.car span:last-child { right: 11px; }

.signal {
  position: absolute;
  top: 57%;
  font: 600 0.75rem ui-monospace, monospace;
  letter-spacing: 0.08em;
}

.signal::before {
  display: block;
  width: 8px;
  height: 8px;
  margin: auto auto 7px;
  border-radius: 50%;
  box-shadow: 0 0 0 6px currentColor;
  content: "";
}

.navis { left: 18%; color: var(--cyan); }
.lumen { right: 16%; color: var(--gold); }

/* ---------- Editorial content ---------- */
.story,
.companion {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin: 0 28px;
  padding: 92px 0;
  border-top: 1px solid var(--line);
}

.companion-copy {
  color: var(--muted);
  font-size: 1.08rem;
}

.companion-copy .actions { margin-bottom: 0; }

.story-copy {
  color: var(--muted);
  font-size: 1.15rem;
}

/* ---------- Podcast feature ---------- */
.podcast {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 72px;
  margin: 0 28px;
  padding: 92px 0;
  border-top: 1px solid var(--line);
}

.podcast-visual {
  position: relative;
  display: block;
  align-self: start;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #397087;
  border-radius: 14px;
  background: #dff8fa;
  box-shadow: 0 22px 60px #061a2455;
}

.podcast-visual::before {
  display: none;
}

.podcast-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.podcast-visual figcaption {
  position: absolute;
  top: 22px;
  left: 22px;
  padding: 8px 12px;
  border: 1px solid #7ce0d266;
  border-radius: 999px;
  background: #071b2be6;
  color: #c8f5ef;
  font: 700 0.72rem ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.podcast-content { align-self: center; }

.podcast-content h2 {
  max-width: 680px;
  font-size: clamp(2.7rem, 5.5vw, 4.8rem);
}

.podcast-intro {
  max-width: 66ch;
  color: var(--muted);
  font-size: 1.12rem;
}

.episode-list {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.audio-card {
  margin-top: 0;
  padding: 24px;
  border: 1px solid #397087;
  border-radius: 12px;
  background: #0f3445;
  box-shadow: 0 18px 50px #061a2440;
}

.audio-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.audio-heading div { display: grid; }
.audio-heading span { color: var(--muted); font-size: 0.82rem; }

.episode-number {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan);
  color: #071710 !important;
  font: 800 0.75rem ui-monospace, monospace !important;
}

.audio-card audio {
  display: block;
  width: 100%;
  accent-color: var(--cyan);
}

.audio-links {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-note {
  max-width: 70ch;
  margin-top: 20px;
  color: #93a5b2;
  font-size: 0.82rem;
}

.podcast-faq {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 72px;
  margin: 0 28px;
  padding: 84px 0 92px;
  border-top: 1px solid var(--line);
}

.podcast-faq h2 { font-size: clamp(2.4rem, 4vw, 3.7rem); }
.faq-list { display: grid; gap: 12px; }

.faq-list details {
  border: 1px solid #397087;
  border-radius: 8px;
  background: #173f52;
}

.faq-list summary {
  position: relative;
  padding: 19px 52px 19px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  position: absolute;
  top: 18px;
  right: 20px;
  color: var(--cyan);
  content: "+";
  font-size: 1.35rem;
  line-height: 1;
}

.faq-list details[open] summary::after { content: "−"; }

.faq-list details p {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted);
}

.themes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 28px 110px;
  border: 1px solid var(--line);
}

.themes article {
  min-height: 220px;
  padding: 34px;
}

.themes article + article { border-left: 1px solid var(--line); }
.themes span { color: var(--gold); font-family: ui-monospace, monospace; }
.themes h3 { margin: 35px 0 10px; font-size: 1.25rem; }
.themes p { margin: 0; color: var(--muted); }

.feedback {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 80px;
  margin: 0 28px 90px;
  padding: 72px;
  background: var(--paper);
  color: var(--paper-ink);
}

.feedback > div > p:last-child { color: #53636d; }
.feedback form { display: grid; gap: 10px; }
.feedback label { font-size: 0.88rem; font-weight: 700; }

.feedback select,
.feedback textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #aab4b6;
  border-radius: 2px;
  background: #fff;
  font: inherit;
}

.feedback textarea { resize: vertical; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 0 10px;
  font-weight: 400 !important;
}

.check input { margin-top: 5px; }
.form-note { margin: 0; color: #66747c; font-size: 0.8rem; }

/* Honeypot: available to bots, outside the visible viewport for readers. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ai-note {
  margin: 0 28px 90px;
  padding: 42px;
  border: 1px solid var(--line);
}

.ai-note h2 { font-size: 2rem; }
.ai-note p:last-child { max-width: 75ch; color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 28px 48px;
  border-top: 1px solid var(--line);
  color: #8293a2;
  font-size: 0.85rem;
}

footer p { margin: 0; }
footer nav { text-align: right; }

/* ---------- PDF viewer ---------- */
.viewer-page {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.viewer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-brand img {
  display: block;
  width: 46px;
  height: 46px;
}

.optional-files {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
}

.optional-files p { margin: 0 0 6px; color: var(--muted); }

.viewer-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.viewer-meta span {
  color: var(--muted);
  font-size: 0.85rem;
}

.reader-navigation {
  display: grid;
  grid-template-columns: auto minmax(190px, 320px);
  align-items: center;
  gap: 2px 10px;
}

.reader-navigation label {
  color: var(--muted);
  font-size: 0.8rem;
}

.reader-navigation select {
  min-height: 42px;
  padding: 6px 34px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

#current-section {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-controls button {
  min-width: 42px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.zoom-controls button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.zoom-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.viewer-main {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  max-width: none;
  min-height: 0;
}

#pdf-frame,
#story-frame,
#handout-frame {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 95px);
  border: 0;
}

#pdf-frame {
  background: #333;
}

#story-frame {
  background: white;
}

.viewer-fallback {
  margin: 0;
  padding: 8px 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Responsive behavior ---------- */
@media (max-width: 800px) {
  .site-header nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 52px; }
  .hero h1 { font-size: clamp(4rem, 20vw, 6rem); }
  .hero-art { height: 380px; }
  .story,
  .podcast,
  .podcast-faq,
  .companion,
  .feedback { grid-template-columns: 1fr; gap: 30px; }
  .podcast-visual { width: min(100%, 560px); }
  .themes { grid-template-columns: 1fr; }
  .themes article + article { border-top: 1px solid var(--line); border-left: 0; }
  .feedback { padding: 40px 26px; }
  footer { flex-direction: column; }
  footer nav { text-align: left; }
  .viewer-header { flex-wrap: wrap; }
  .reader-navigation { order: 3; width: 100%; }
  .reader-navigation select { width: 100%; }
}

@media (max-width: 520px) {
  .podcast { padding-top: 64px; }
  .audio-card { padding: 18px; }
  .audio-links { align-items: flex-start; flex-direction: column; gap: 4px; }
  .viewer-header { align-items: stretch; flex-direction: column; }
  .viewer-header .button { width: 100%; }
  .reader-navigation { grid-template-columns: 1fr; }
  .reader-navigation label,
  #current-section { text-align: left; }
  .zoom-controls { justify-content: center; }
  .zoom-controls button { flex: 1; }
  .viewer-meta { text-align: left; }
  #pdf-frame,
  #story-frame,
  #handout-frame { min-height: calc(100vh - 160px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
}
