/* ============================================================================
   LIVERPOOL STREET STATION — LAYOUT & COMPOSITION
   
   Structure: Full-width editorial scroll narrative.
   Content sections are either contained (--section-max-width ≈ 900px)
   or wide (--section-wide-width ≈ 1200px) for grids/cards.
   
   Composition maths:
   - Vertical rhythm: sections padded with --space-2xl (4rem)
   - Flow gaps within prose: --space-base (1rem)
   - Card grids: minmax(320px, 1fr) auto-fill
   - Footer: 3-col auto-fit, collapses gracefully
   - Header: sticky, z-1000, with bottom signal stripe
   ============================================================================ */

/* ==================== RESET & BASE ==================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;                  /* 16px base for rem calculations */
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;         /* clear sticky header on anchor jump */
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--surface-paper);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--duration-slow) var(--ease-platform),
              color var(--duration-slow) var(--ease-platform);
}

/* ==================== SKIP LINK ==================== */

.skip-link {
  position: absolute;
  top: var(--space-base);
  left: var(--space-base);
  padding: var(--space-sm) var(--space-base);
  background: var(--rail-blue);
  color: var(--text-inverse);
  font-family: var(--font-display);
  text-decoration: none;
  border: 2px solid var(--warning-yellow);
  z-index: 9999;
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-signal);
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid var(--warning-yellow);
  outline-offset: 2px;
}

/* ==================== HEADER ==================== */

.shrine-header {
  background: var(--rail-blue);
  color: var(--text-inverse);
  padding: var(--space-base) 0;
  border-bottom: 3px solid var(--signal-red);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.shrine-header-inner {
  max-width: var(--section-wide-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-base);
}

.site-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-tagline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--warning-yellow);
  margin-top: var(--space-2xs);
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-base);
  list-style: none;
}

.primary-nav a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--text-inverse);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid transparent;
  transition: border-color var(--duration-fast) var(--ease-platform),
              background-color var(--duration-fast) var(--ease-platform);
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  border-color: var(--warning-yellow);
  background-color: rgba(255, 215, 0, 0.1);
  outline: none;
}

.primary-nav a:focus-visible {
  outline: 2px solid var(--warning-yellow);
  outline-offset: 2px;
}

.primary-nav a.active {
  border-color: var(--warning-yellow);
  background-color: rgba(255, 215, 0, 0.15);
}

/* ==================== SIDEBAR TOGGLE (hamburger in header) ==================== */

.sidebar-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--duration-fast) var(--ease-platform);
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: var(--warning-yellow);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--warning-yellow);
  outline-offset: 2px;
}

.sidebar-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-inverse);
  transition: transform var(--duration-base) var(--ease-signal),
              opacity var(--duration-base) var(--ease-signal);
}

/* Hamburger → X transform when sidebar is open */
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bar:nth-child(2) {
  opacity: 0;
}
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==================== SIDEBAR NAVIGATION ==================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--ink-black);
  color: var(--text-inverse);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform var(--duration-slow) var(--ease-signal);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.sidebar.is-open {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-base) var(--space-md);
  border-bottom: 2px solid var(--rail-blue);
}

.sidebar-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--warning-yellow);
}

.sidebar-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-inverse);
  font-size: var(--text-xl);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: border-color var(--duration-fast) var(--ease-platform);
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  border-color: var(--signal-red);
  color: var(--signal-red);
}

.sidebar-close:focus-visible {
  outline: 2px solid var(--signal-red);
  outline-offset: 2px;
}

.sidebar-nav {
  list-style: none;
  padding: var(--space-base) 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-sm) var(--space-md);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-family: var(--font-display);
  border-left: 3px solid transparent;
  transition: color var(--duration-fast) var(--ease-platform),
              border-color var(--duration-fast) var(--ease-platform),
              background-color var(--duration-fast) var(--ease-platform);
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  color: var(--text-inverse);
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--warning-yellow);
}

.sidebar-link:focus-visible {
  outline: 2px solid var(--warning-yellow);
  outline-offset: -2px;
}

.sidebar-link.active {
  color: var(--warning-yellow);
  border-left-color: var(--warning-yellow);
  background: rgba(255, 215, 0, 0.08);
}

.sidebar-act-num {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  min-width: 2ch;
}

.sidebar-act-name {
  font-size: var(--text-base);
}

.sidebar-footer {
  padding: var(--space-base) var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.sidebar-meta {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}

/* Overlay behind sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-slow) var(--ease-platform),
              visibility var(--duration-slow);
}

.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-overlay { transition: none; }
}

/* ==================== TICKER ==================== */

.ticker-wrapper {
  background: var(--warning-yellow);
  color: var(--ink-black);
  overflow: hidden;
  height: 2rem;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--ink-black);
  border-bottom: 1px solid var(--ink-black);
}

.ticker {
  display: flex;
  white-space: nowrap;
  font-family: var(--font-ticker);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  animation: scroll-left 40s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ticker {
    animation: none;
    justify-content: center;
  }
}

.ticker span {
  padding-inline: var(--space-xl);
}

.ticker span::after {
  content: " \2022 ";          /* bullet */
  padding-left: var(--space-xl);
  color: var(--signal-red);
}

@keyframes scroll-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ==================== MAIN CASE STUDY CONTAINER ==================== */

.case-study {
  display: flex;
  flex-direction: column;
  gap: 0;                          /* sections handle own padding */
}

/* ==================== ACT DIVIDERS ==================== */
/* Full-width blue bars that separate the 8 acts */

.act-divider {
  background: var(--rail-blue);
  color: var(--text-inverse);
  padding: var(--space-xl) var(--gutter);
  text-align: center;
  border-top: var(--act-divider-height) solid var(--warning-yellow);
  border-bottom: var(--act-divider-height) solid var(--warning-yellow);
  scroll-margin-top: 5rem;         /* clear sticky header */
}

.act-label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--warning-yellow);
  margin-bottom: var(--space-xs);
}

.act-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ==================== SECTION CONTAINERS ==================== */
/* Two widths: contained (reading) and wide (grids/cards) */

.shrine-section {
  padding: var(--space-2xl) var(--gutter);
  scroll-margin-top: 5rem;
}

.section-contained {
  max-width: var(--section-max-width);
  margin-inline: auto;
}

.section-wide {
  max-width: var(--section-wide-width);
  margin-inline: auto;
}

.section-header {
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--rail-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-style: italic;
}

/* Dark section header variant */
.section-header-dark { text-align: center; }
.section-title-light  { color: var(--warning-yellow); }
.section-subtitle-light { color: rgba(255, 255, 255, 0.6); }

/* ==================== HERO SECTION ==================== */

.hero-section {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse at top left, rgba(0, 60, 127, 0.06) 0%, transparent 60%),
    var(--surface-paper);
}

.hero-content {
  max-width: var(--section-max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.hero-overline {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-tertiary);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.reveal-line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s var(--ease-signal) forwards;
}
.reveal-line:nth-child(1) { animation-delay: 0.1s; }
.reveal-line:nth-child(2) { animation-delay: 0.3s; }
.reveal-line:nth-child(3) { animation-delay: 0.6s; }

.reveal-accent { color: var(--signal-red); }

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-line {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

.hero-subtext {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--measure-default);
}

.hero-subtext-muted {
  font-size: var(--text-base);
  color: var(--text-tertiary);
  font-style: italic;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-top: var(--border-platform);
  border-bottom: var(--border-platform);
  width: 100%;
}

.hero-stat {
  text-align: center;
  min-width: 120px;
}

.hero-stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--rail-blue);
}

.hero-stat-label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-2xs);
}

.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  animation: bounce 2s ease-in-out infinite;
}

.scroll-arrow { font-size: var(--text-lg); }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-indicator { animation: none; }
}

/* ==================== PERSONA GRID ==================== */

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* ==================== PERSONA CARD LAYOUT ==================== */
/* Card-top = illustration + name side by side. Body flows below. */

.persona-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  margin-bottom: var(--space-base);
}

.persona-card-top .persona-header {
  flex: 1;
  min-width: 0;
}

/* ==================== PERSONA & GHOST ILLUSTRATIONS ==================== */
/* Line art with transparency. Dynamic fluid sizing. */

.persona-illustration {
  display: block;
  width: clamp(72px, 10vw, 120px);
  height: auto;
  flex-shrink: 0;
  opacity: 0.8;
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* CRT theme inversion */
[data-theme="crt"] .persona-illustration {
  mix-blend-mode: screen;
  opacity: 0.65;
  filter: hue-rotate(120deg) saturate(0.5);
}

/* ---- Ghost / editorial illustrations — float into margin ---- */

.ghost-illustration {
  display: block;
  width: clamp(100px, 15vw, 180px);
  height: auto;
  opacity: 0.5;
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Alternate sides: odd floats right, even floats left */
.ghost-illustration {
  float: right;
  margin: 0 0 var(--space-base) var(--space-lg);
  /* Pull into the empty gutter space on the right */
  margin-right: calc(var(--space-lg) * -1);
  shape-outside: margin-box;
}

.ghost-illustration:nth-of-type(even) {
  float: left;
  margin: 0 var(--space-lg) var(--space-base) 0;
  margin-left: calc(var(--space-lg) * -1);
}

[data-theme="crt"] .ghost-illustration {
  mix-blend-mode: screen;
  opacity: 0.35;
  filter: hue-rotate(120deg) saturate(0.3);
}

/* ---- Section-aside illustration — positioned in margin of dark sections ---- */

.voices-section-with-figure {
  position: relative;
  overflow: hidden;
}

.section-aside-illustration {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(100px, 12vw, 180px);
  height: auto;
  opacity: 0.12;
  mix-blend-mode: screen;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  z-index: 0;
}

[data-theme="paper"] .section-aside-illustration {
  opacity: 0.08;
  mix-blend-mode: normal;
  filter: brightness(3) contrast(0.5);
}

/* ==================== CONVERGENCE BLOCK ==================== */

.convergence-block {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: rgba(0, 0, 0, 0.03);
  border: var(--border-platform);
}

.convergence-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--signal-red);
  margin-bottom: var(--space-sm);
}

.convergence-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-style: italic;
}

/* ==================== TRUTH GRID ==================== */

.truth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: var(--space-base);
}

/* ==================== STAT ROWS ==================== */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}
.stat-row-large     { padding: var(--space-2xl) 0; }
.stat-row-secondary { padding: var(--space-lg) 0; border-top: var(--border-platform); }

/* ==================== DOCUMENTARY SECTIONS ==================== */

.documentary-section {
  background: var(--ghost-surface);
  color: var(--text-inverse);
}

.scene-sequence {
  max-width: var(--section-max-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: var(--space-xl) 0;
}

.voices-container {
  max-width: var(--section-max-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}

/* ==================== TIMELINE ==================== */

.timeline-viz {
  max-width: var(--section-wide-width);
  margin-inline: auto;
  padding: var(--space-xl) 0;
}

.timeline-row {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 200px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  margin-bottom: var(--space-base);
}

.timeline-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.timeline-time {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--warning-yellow);
  position: absolute;
  bottom: -1.8rem;
}

.timeline-label {
  font-family: var(--font-display);
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  position: absolute;
  bottom: -3rem;
  white-space: nowrap;
}

.timeline-bar {
  width: 80%;
  height: var(--bar-height, 50%);
  background: linear-gradient(to top, var(--rail-blue), var(--warning-yellow));
  opacity: 0.8;
  transition: height 1s var(--ease-signal);
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: center;
  padding-top: var(--space-2xl);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  flex-wrap: wrap;
}

.timeline-legend-bar {
  display: inline-block;
  width: 20px;
  height: 10px;
  background: linear-gradient(to right, var(--rail-blue), var(--warning-yellow));
}

.timeline-legend-line {
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--signal-red);
  margin-left: var(--space-base);
}

/* ==================== RECKONING ==================== */

.reckoning-section {
  text-align: center;
  padding: var(--space-3xl) var(--gutter);
  background: rgba(0, 0, 0, 0.03);
}

.reckoning-content {
  max-width: var(--section-max-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.reckoning-line     { font-family: var(--font-body); font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--text-secondary); }
.reckoning-heavy    { font-weight: var(--weight-bold); color: var(--text-primary); font-size: var(--text-xl); }
.reckoning-break    { font-size: var(--text-2xl); color: var(--text-tertiary); }
.reckoning-question { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--signal-red); line-height: var(--leading-snug); }

/* ==================== DESIGN BRIEF ==================== */

.design-brief {
  background: rgba(255, 255, 255, 0.8);
  border: var(--border-platform);
  padding: var(--space-xl);
  box-shadow: var(--shadow-base);
}

.brief-section {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--platform-concrete);
}
.brief-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.brief-heading {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--rail-blue);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brief-section p  { line-height: var(--leading-relaxed); }
.brief-section ul { line-height: var(--leading-relaxed); padding-left: var(--space-lg); }
.brief-section li { margin-bottom: var(--space-xs); }
.brief-section em { font-size: var(--text-lg); line-height: var(--leading-relaxed); }

/* ==================== SUB-BRIEF GRID ==================== */

.sub-brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: var(--space-lg);
}

/* ==================== MANIFESTO ==================== */

.manifesto-section {
  text-align: center;
  padding: var(--space-3xl) var(--gutter);
  background: var(--ink-black);
  color: var(--text-inverse);
}

.manifesto-content {
  max-width: var(--section-max-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-base);
}

.manifesto-line  { font-family: var(--font-body); font-size: var(--text-base); line-height: var(--leading-relaxed); color: rgba(255, 255, 255, 0.7); }
.manifesto-lead  { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--warning-yellow); margin-bottom: var(--space-lg); }
.manifesto-final { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--signal-red); margin-top: var(--space-lg); }

.manifesto-body,
.manifesto-coda {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
}
.manifesto-body { border-top: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.manifesto-coda .manifesto-line { color: rgba(255, 255, 255, 0.9); font-weight: var(--weight-bold); }

/* ==================== CTA SECTION ==================== */

.cta-section {
  text-align: center;
  padding: var(--space-3xl) var(--gutter);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 60, 127, 0.06) 100%),
    var(--surface-paper);
  position: relative;
}

/* Bottom signal stripe */
.cta-section::after {
  content: "";
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--warning-yellow) 0,
    var(--warning-yellow) 20px,
    transparent 20px,
    transparent 40px
  );
}

.cta-inner {
  max-width: var(--section-max-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.cta-headline {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--signal-red);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cta-text {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--measure-default);
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-base);
  margin-top: var(--space-base);
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-sm) var(--space-xl);
  border: 3px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-platform),
    border-color var(--duration-fast) var(--ease-platform),
    transform var(--duration-fast) var(--ease-platform),
    box-shadow var(--duration-fast) var(--ease-platform);
}

.cta-button:focus-visible {
  outline: 2px solid var(--warning-yellow);
  outline-offset: 4px;
}

.cta-button--primary {
  background: var(--rail-blue);
  color: var(--text-inverse);
  border-color: var(--rail-blue);
}

.cta-button--primary:hover {
  background: var(--rail-blue-dark);
  border-color: var(--rail-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 60, 127, 0.3);
}

.cta-button--secondary {
  background: transparent;
  color: var(--signal-red);
  border-color: var(--signal-red);
}

.cta-button--secondary:hover {
  background: rgba(220, 20, 60, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 20, 60, 0.12);
}

.cta-footnote {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  max-width: var(--measure-default);
}

@media (prefers-reduced-motion: reduce) {
  .cta-button,
  .cta-button:hover {
    transition: none;
    transform: none;
  }
}

@media (max-width: 640px) {
  .cta-headline { font-size: var(--text-xl); }
  .cta-actions { flex-direction: column; align-items: stretch; }
  .cta-button { text-align: center; }
}

/* ==================== NEXT PROJECT ==================== */

.next-project-section {
  text-align: center;
  padding: var(--space-3xl) var(--gutter);
  background:
    radial-gradient(ellipse at bottom right, rgba(0, 60, 127, 0.08) 0%, transparent 60%),
    var(--surface-paper);
}

.next-project-content { max-width: var(--section-max-width); margin-inline: auto; }

.next-project-overline { font-family: var(--font-display); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-tertiary); margin-bottom: var(--space-base); }
.next-project-title    { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--rail-blue); line-height: var(--leading-tight); margin-bottom: var(--space-lg); }
.next-project-text     { font-family: var(--font-body); font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--text-secondary); margin-bottom: var(--space-base); }
.next-project-muted    { color: var(--text-tertiary); font-style: italic; }

.next-project-redacted {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.redacted-block {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  padding: var(--space-base);
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0.03), rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.06) 10px, rgba(0,0,0,0.06) 20px);
  border: var(--border-platform);
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
}

/* ==================== FOOTER ==================== */

.shrine-footer {
  background: var(--platform-concrete);
  color: var(--text-primary);
  padding: var(--space-xl) var(--gutter);
  border-top: 4px double var(--rail-blue);
}

.footer-content {
  max-width: var(--section-wide-width);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: var(--space-lg);
}

.footer-section h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-base);
}

.footer-section p {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-links a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-platform);
}

.footer-links a:hover { color: var(--rail-blue); text-decoration: underline; }

.footer-attribution {
  max-width: var(--section-wide-width);
  margin-inline: auto;
  margin-top: var(--space-base);
  padding-top: var(--space-base);
  border-top: 1px solid var(--platform-concrete);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}

.footer-attribution a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-platform);
}

.footer-attribution a:hover {
  color: var(--rail-blue);
  text-decoration: underline;
}

.footer-meta {
  grid-column: 1 / -1;
  margin-top: var(--space-base);
  padding-top: var(--space-base);
  border-top: 1px solid var(--text-tertiary);
  text-align: center;
  font-size: var(--text-sm);
  font-family: var(--font-display);
}

.footer-meta-muted { opacity: 0.7; }

/* ==================== UTILITIES ==================== */

.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;
}

.flow > * + * {
  margin-top: var(--flow-space, var(--space-base));
}

/* Clearfix for floated ghost illustrations inside flow containers */
.flow::after {
  content: "";
  display: table;
  clear: both;
}

/* ==================== SCROLL REVEAL ==================== */

.reveal-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-signal), transform 0.8s var(--ease-signal);
}

.reveal-section.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==================== RESPONSIVE ==================== */
/*
   Breakpoint strategy (content-driven, not device-driven):
   - 360px  : small phones (Galaxy S series, iPhone SE)
   - 480px  : large phones / small phone landscape
   - 640px  : large phone landscape / small tablets
   - 768px  : tablets portrait (iPad Mini, standard tablets)
   - 1024px : tablets landscape / small laptops
   Fluid type (clamp) and fluid gutters handle the gaps between.
*/

/* ---- Large phones / phablets (≤768px) ---- */
@media (max-width: 768px) {
  .persona-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: var(--space-base);
  }

  .sub-brief-grid {
    grid-template-columns: 1fr;
    gap: var(--space-base);
  }

  .truth-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  }

  .stat-row {
    gap: var(--space-base);
  }

  .stat-row-large {
    padding: var(--space-xl) 0;
  }

  .timeline-row {
    height: 140px;
  }

  .timeline-time { font-size: 9px; }
  .timeline-label { display: none; }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: var(--space-base);
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-base);
  }

  /* Illustration sizing — tablet */
  .persona-illustration {
    width: clamp(64px, 16vw, 100px);
  }

  /* Ghost illustrations — smaller float on tablet */
  .ghost-illustration {
    width: clamp(80px, 14vw, 130px);
    margin-right: 0;
    margin-left: 0;
  }

  .ghost-illustration:nth-of-type(even) {
    margin-left: 0;
  }

  /* Aside illustration — hide on small viewports */
  .section-aside-illustration {
    display: none;
  }
}

/* ---- Small tablets / large phone landscape (≤640px) ---- */
@media (max-width: 640px) {
  .hero-section {
    min-height: 80vh;
    padding: var(--space-xl) var(--gutter);
  }

  .hero-headline    { font-size: var(--text-2xl); }
  .hero-subtext     { font-size: var(--text-base); }
  .hero-stats       { gap: var(--space-base); }
  .hero-stat        { min-width: 100px; }

  .act-divider      { padding: var(--space-lg) var(--gutter); }
  .act-title        { font-size: var(--text-xl); }

  .shrine-section   { padding: var(--space-xl) var(--gutter); }

  .section-title    { font-size: var(--text-xl); }

  .reckoning-section { padding: var(--space-2xl) var(--gutter); }
  .reckoning-line   { font-size: var(--text-base); }
  .reckoning-heavy  { font-size: var(--text-lg); }
  .reckoning-question { font-size: var(--text-xl); }

  .manifesto-section { padding: var(--space-2xl) var(--gutter); }
  .manifesto-lead   { font-size: var(--text-lg); }
  .manifesto-final  { font-size: var(--text-xl); }

  .design-brief     { padding: var(--space-lg); }

  .cta-headline     { font-size: var(--text-xl); }
  .cta-text         { font-size: var(--text-base); }
  .cta-actions      { flex-direction: column; align-items: stretch; }
  .cta-button       { text-align: center; }

  .next-project-title { font-size: var(--text-xl); }
  .next-project-text  { font-size: var(--text-base); }

  .comparison-table {
    flex-direction: column;
  }

  .stat-row {
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
  }

  .persona-grid {
    grid-template-columns: 1fr;
  }

  /* Ghost illustrations — collapse float on small screens */
  .ghost-illustration,
  .ghost-illustration:nth-of-type(even) {
    float: none;
    margin: var(--space-base) auto;
    width: clamp(70px, 20vw, 110px);
    opacity: 0.4;
  }
}

/* ---- Large phones (≤480px) ---- */
@media (max-width: 480px) {
  .site-title       { font-size: var(--text-lg); }
  .site-tagline     { font-size: var(--text-xs); }

  .hero-section     { min-height: 70vh; }
  .hero-headline    { font-size: var(--text-xl); }
  .hero-stat        { min-width: 80px; }
  .hero-stat-number { font-size: var(--text-lg); }

  .act-title        { font-size: var(--text-lg); letter-spacing: 0.05em; }

  .section-title    { font-size: var(--text-lg); }

  .reckoning-question { font-size: var(--text-lg); }

  .manifesto-lead   { font-size: var(--text-base); }
  .manifesto-final  { font-size: var(--text-lg); }
  .manifesto-line   { font-size: var(--text-sm); }

  .convergence-title { font-size: var(--text-lg); }

  .design-brief     { padding: var(--space-base); }
  .brief-heading    { font-size: var(--text-base); }

  .solari-row       { grid-template-columns: 1fr 1fr; gap: var(--space-xs); }

  .rolling-stock-grid { grid-template-columns: 1fr; }

  .button-wall      { justify-content: center; }

  /* Illustration sizing — phone */
  .persona-illustration {
    width: clamp(56px, 18vw, 80px);
  }

  .persona-card-top {
    gap: var(--space-sm);
  }

  .cta-headline     { font-size: var(--text-lg); }
  .cta-text         { font-size: var(--text-sm); }

  .next-project-title { font-size: var(--text-lg); }
}

/* ---- Small phones (≤360px) ---- */
@media (max-width: 360px) {
  .hero-section     { min-height: 60vh; }
  .hero-headline    { font-size: var(--text-lg); }
  .hero-subtext     { font-size: var(--text-sm); }
  .hero-stats       { flex-direction: column; align-items: center; }

  .shrine-section   { padding: var(--space-lg) var(--gutter-sm); }
  .act-divider      { padding: var(--space-base) var(--gutter-sm); }

  .ticker-wrapper   { height: 1.6rem; }
  .ticker           { font-size: var(--text-xs); }

  .stat-number      { font-size: var(--text-lg); }

  .persona-illustration {
    width: 48px;
  }

  .sidebar {
    width: 90vw;
  }

  .cta-button {
    padding: var(--space-sm) var(--space-base);
    font-size: var(--text-sm);
  }
}

/* ---- Touch target sizing for mobile ---- */
@media (pointer: coarse) {
  .cta-button {
    min-height: 48px;
    padding: var(--space-base) var(--space-xl);
  }

  .sidebar-link {
    padding: var(--space-base) var(--space-md);
    min-height: 48px;
  }

  .sidebar-toggle,
  .sidebar-close {
    width: 44px;
    height: 44px;
  }

  .theme-toggle {
    width: 56px;
    height: 56px;
  }

  .footer-links a {
    display: inline-block;
    padding: var(--space-2xs) 0;
    min-height: 44px;
    line-height: 44px;
  }
}

/* ---- Landscape phones ---- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: var(--space-lg) var(--gutter);
  }

  .scroll-indicator { display: none; }

  .loading-board {
    padding: var(--space-base) var(--space-lg);
    min-width: auto;
  }
}
