:root {
  --canvas: #eef1ed;
  --ink: #122331;
  --muted: #52636b;
  --signal: #e05f2b;
  --signal-dark: #a53d1a;
  --night: #102734;
  --card: #ffffff;
  --line: #c5d0ce;
  --focus: #005f8c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

button, select { font: inherit; }

button:focus-visible, select:focus-visible, .masthead:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

body.dialog-open { overflow: hidden; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid #35515c;
  background: var(--night);
  color: #f5faf7;
}

.masthead {
  display: grid;
  color: inherit;
  text-decoration: none;
}

.masthead-kicker, .eyebrow, .story-label, .modal-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.masthead-kicker { color: #b7c8c4; }

.masthead-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

#date-picker {
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #6a7f87;
  border-radius: 3px;
  background: #f7faf8;
  color: var(--ink);
  font-size: 0.95rem;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 4rem) clamp(1rem, 3vw, 2rem) 4rem;
}

.brief-header {
  max-width: 720px;
  margin-bottom: 2rem;
}

.eyebrow, .story-label, .modal-label { color: var(--signal-dark); }

.brief-header h1, .section-heading h2, .story-panel h2, .modal h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.035em;
}

.brief-header h1 {
  max-width: 14ch;
  margin: 0.25rem 0 0.6rem;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 0.93;
}

.brief-meta {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.brief {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 0.85fr);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 18px 42px rgba(15, 39, 52, 0.11);
}

.visual-stage {
  position: relative;
  min-width: 0;
  padding: 1.3rem 1.3rem 1.3rem 3.8rem;
  background: var(--night);
}

.stage-rail {
  position: absolute;
  top: 1.35rem;
  bottom: 1.35rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  color: #d9e6e3;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

.stage-rule {
  width: 2px;
  flex: 1;
  min-height: 5rem;
  background: linear-gradient(to bottom, var(--signal) var(--progress, 0%), #48616b var(--progress, 0%));
}

.slide-figure {
  margin: 0;
  overflow: hidden;
  background: #091923;
}

.slide-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.slide-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 240ms ease;
}

.slide-open:hover img { transform: scale(1.015); }

.slide-figure figcaption {
  padding: 0.8rem 1rem;
  color: #e9f1ee;
  font-size: 0.9rem;
  font-weight: 700;
}

.story-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.story-panel h2 {
  margin: 0.35rem 0 1rem;
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 0.98;
}

.story-teaser {
  margin: 0;
  color: #334850;
  line-height: 1.6;
}

.nav-btn {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 750;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-btn:hover:not(:disabled) { background: var(--night); color: #fff; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }

.more-btn, .retry-btn {
  min-height: 48px;
  margin-top: 1.6rem;
  padding: 0.7rem 1rem;
  border: 0;
  background: var(--signal-dark);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.more-btn:hover, .retry-btn:hover { background: var(--night); }

.story-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 2rem;
}

.slide-counter {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.topics-section { margin-top: clamp(2.5rem, 6vw, 5rem); }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading .eyebrow { margin: 0; }
.section-heading h2 { margin: 0; font-size: 1.7rem; }

.topic-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.topic-button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  min-height: 66px;
  padding: 0.85rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.topic-button:nth-child(odd) { padding-right: 1rem; }
.topic-button:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--line); }

.topic-index {
  color: var(--signal-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.topic-title { font-size: 0.92rem; font-weight: 700; line-height: 1.25; }
.topic-button:hover, .topic-button[aria-current="step"] { color: var(--signal-dark); }
.topic-button[aria-current="step"] .topic-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.page-state {
  max-width: 38rem;
  margin: 2rem auto;
  padding: 2rem;
  border-left: 5px solid var(--signal);
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 39, 52, 0.08);
}

.page-state h2 { margin-top: 0; font-family: Georgia, "Times New Roman", serif; }
.page-state p { color: var(--muted); line-height: 1.5; }
.retry-btn { display: inline-block; margin-top: 0.5rem; text-align: center; }

#brief[hidden], .topics-section[hidden] { display: none; }

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(7, 22, 31, 0.76);
  z-index: 10;
}

.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  width: min(100%, 700px);
  max-height: 80vh;
  overflow-y: auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-top: 5px solid var(--signal);
  background: var(--card);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.modal h2 {
  margin: 0.35rem 2rem 1rem 0;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1;
}

.modal p:not(.modal-label) {
  white-space: pre-line;
  font-size: 1rem;
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 760px) {
  .brief { grid-template-columns: 1fr; }
  .story-panel { min-height: 23rem; }
  .topic-nav { grid-template-columns: 1fr; }
  .topic-button:nth-child(n) { padding-left: 0; padding-right: 0; border-left: 0; }
}

@media (max-width: 520px) {
  .site-header { align-items: flex-start; }
  #date-picker { max-width: 9rem; }
  .brief-header h1 { font-size: 2.75rem; }
  .visual-stage { padding: 0.8rem 0.8rem 0.8rem 2.8rem; }
  .stage-rail { top: 0.8rem; bottom: 0.8rem; left: 0.6rem; }
  .story-panel { padding: 1.4rem; }
  .story-navigation { padding-top: 1.5rem; }
  .nav-btn { min-width: 44px; padding-inline: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
