:root {
  --bg: #0b0e13;
  --bg-2: #12171f;
  --panel: #171d27;
  --panel-2: #1e2633;
  --line: rgba(228, 214, 186, 0.14);
  --line-strong: rgba(228, 214, 186, 0.28);
  --text: #ece6db;
  --muted: #a79d90;
  --faint: #746b60;
  --gold: #e0c48a;
  --gold-deep: #b88b45;
  --msq: #e4c56b;
  --side: #7dcb86;
  --seal: #e39455;
  --kisk: #1a1d22;
  --kisk-ink: #f2f0ea;
  --warn: #f0c27a;
  --info: #9ec0dc;
  --ok: #b7e0bf;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar: 248px;
  --measure: 68ch;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(184, 139, 69, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
}
img { max-width: 100%; display: block; }
button, a { font: inherit; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #f3e2c0; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--gold);
  color: #1a140c;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: transparent;
  z-index: 30;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), #fff4d8);
  transform-origin: left center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(11, 14, 19, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
}
.brand-mark .wing { transform-origin: 18px 28px; }
.brand strong { display: block; font-weight: 560; letter-spacing: 0.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.top-links { display: flex; gap: 8px; align-items: center; }
.top-links a, .menu-toggle {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 14px;
}
.top-links a:hover, .menu-toggle:hover { border-color: var(--line-strong); color: white; }
.menu-toggle { display: none; cursor: pointer; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 28px;
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 80px;
}
main { min-width: 0; }

.toc {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding-right: 8px;
}
.toc p {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 14px;
  line-height: 1.35;
  border: 1px solid transparent;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.toc a small { color: var(--faint); font-size: 12px; }
.toc a[aria-current="true"] {
  color: var(--text);
  background: linear-gradient(90deg, rgba(224, 196, 138, 0.16), transparent 80%);
  border-color: var(--line);
}
.toc a.pinned small::before { content: "● "; color: var(--gold); }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 420px;
  border: 1px solid var(--line);
  background: #07090d;
  box-shadow: var(--shadow);
}
.hero-photo {
  position: absolute;
  inset: -8%;
  background:
    linear-gradient(90deg, rgba(7, 9, 13, 0.94) 0%, rgba(7, 9, 13, 0.72) 42%, rgba(7, 9, 13, 0.28) 100%),
    url("../images/atmosphere/bg.jpg") center / cover no-repeat;
  transform: scale(1.04);
}
.hero-motes, .hero-motes::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 236, 196, 0.7) 0 1px, transparent 1.6px);
  background-size: 140px 110px;
  opacity: 0.35;
}
.hero-motes::after {
  content: "";
  background-size: 90px 160px;
  opacity: 0.5;
}
.hero-copy {
  position: relative;
  z-index: 1;
  padding: 42px 40px 28px;
  max-width: 640px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
}
.hero h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 0.96;
  letter-spacing: -0.03em;
}
.lede { margin: 0; color: #d9d1c4; max-width: var(--measure); }
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.stats li {
  min-width: 116px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(10, 12, 16, 0.55);
  border: 1px solid var(--line);
}
.stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 560;
  line-height: 1;
}
.stats span { color: var(--muted); font-size: 13px; }

.rail {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 8px 28px 22px;
}
.rail::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--side), var(--seal), var(--gold));
  background-size: 200% 100%;
  opacity: 0.7;
}
.rail a {
  position: relative;
  z-index: 1;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  padding-top: 8px;
}
.rail i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gold);
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
}
.rail a:hover i, .rail a[aria-current="true"] i { background: var(--gold); color: #1c140b; }
.rail b { display: block; font-weight: 560; font-size: 14px; }
.rail em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.runner {
  position: absolute;
  top: 13px;
  left: 6%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: 0 0 0 4px rgba(224, 196, 138, 0.25), 0 0 16px var(--gold);
  offset-path: path("M0,0");
  z-index: 2;
  pointer-events: none;
}

.panel, .phase, .legend, .notes {
  margin-top: 28px;
}
.panel, .phase {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 80px), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 28px 8px;
}
.phase { padding-bottom: 18px; }
h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }
h2 { font-size: 34px; margin: 0 0 8px; line-height: 1.1; }
h3 { font-size: 22px; margin: 28px 0 8px; }
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.kicker::before {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--gold);
  transform-origin: left center;
}
.phase-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.pin {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.pin[aria-pressed="true"] {
  color: #1c140b;
  background: var(--gold);
  border-color: var(--gold);
}
.prose { max-width: 72ch; color: #ddd6cb; }
.prose p { margin: 0 0 12px; }

.steps, .checklist { list-style: none; margin: 14px 0 18px; padding: 0; display: grid; gap: 8px; }
.steps li, .checklist li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.num, .check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: #241c12;
  color: var(--gold);
  border: 1px solid rgba(224, 196, 138, 0.4);
}
.checklist { counter-reset: none; }
.check {
  appearance: none;
  margin: 2px 0 0;
  cursor: pointer;
  background: transparent;
}
.check:checked {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 6px #241c12;
}
.checklist label { cursor: pointer; }
.checklist li:has(.check:checked) { opacity: 0.62; }
.checklist li:has(.check:checked) label { text-decoration: line-through; text-decoration-color: rgba(236, 230, 219, 0.45); }

.callout {
  margin: 8px 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(158, 192, 220, 0.08);
  border-left: 3px solid var(--info);
}
.callout strong { color: white; }
.callout.warn {
  background: rgba(240, 194, 122, 0.08);
  border-left-color: var(--warn);
}
.callout.ok {
  background: rgba(125, 203, 134, 0.08);
  border-left-color: var(--side);
}
.callout.seal {
  background: rgba(227, 148, 85, 0.08);
  border-left-color: var(--seal);
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
}
.legend-table th, .legend-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.legend-table th { color: var(--faint); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 560; }
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 560;
}
.arrow {
  width: 64px;
  height: 18px;
  overflow: visible;
}
.arrow path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.arrow .shaft { stroke-dasharray: 8 6; }
.swatch.msq .arrow path { stroke: var(--msq); }
.swatch.side .arrow path { stroke: var(--side); }
.swatch.seal .arrow path { stroke: var(--seal); }
.swatch.kisk .arrow path { stroke: #1a1d22; }
.swatch.kisk {
  background: #efece4;
  color: #1a1d22;
  border-radius: 999px;
  padding: 4px 10px 4px 6px;
}

.chart {
  margin: 8px 0 22px;
  min-width: 0;
}
.chart-open {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: #0a0c10;
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: inset 0 0 0 1px var(--line);
}
.chart-open img { width: 100%; height: auto; }
.chart-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(10, 12, 16, 0.78);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.chart figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}
.chart-kicker { color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }

.route {
  list-style: none;
  margin: 12px 0 20px;
  padding: 0 0 0 18px;
  border-left: 1px solid var(--line-strong);
  display: grid;
  gap: 0;
}
.route li {
  position: relative;
  padding: 0 0 18px 18px;
}
.route li::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gold);
}
.route .where { color: var(--gold); font-weight: 560; }

.credits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 8px;
}
.credits a {
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 180px;
}
.credits a span { display: block; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.credits a:hover { border-color: var(--gold); }
.fine {
  color: var(--faint);
  font-size: 13px;
  margin-top: 18px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 6, 8, 0.86);
  display: grid;
  place-items: center;
  padding: 28px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(1200px, 100%);
  max-height: calc(100vh - 80px);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.lightbox button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #151920;
  color: white;
  cursor: pointer;
}

.reveal { animation: rise 0.7s ease both; }
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.25s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes arrive {
  from { transform: translateY(12px); }
  to { transform: none; }
}
.arrive { animation: arrive 0.65s ease both; }
@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 140px -80px, -90px 120px; }
}
@keyframes ken {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(-2%, -1%, 0); }
}
@keyframes march {
  to { stroke-dashoffset: -28; }
}
@keyframes flow {
  from { background-position: 0 0; }
  to { background-position: 200% 0; }
}
@keyframes travel {
  from { left: 6%; }
  to { left: calc(94% - 12px); }
}
@keyframes wing {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-6deg); }
}
@keyframes pulse-line {
  0%, 100% { box-shadow: inset 3px 0 0 var(--warn); }
  50% { box-shadow: inset 3px 0 0 var(--warn), 0 0 0 4px rgba(240, 194, 122, 0.08); }
}
@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.hero-photo { animation: ken 28s ease-in-out infinite alternate; }
.hero-motes { animation: drift 36s linear infinite; }
.rail::before { animation: flow 8s linear infinite; }
.runner { animation: travel 9s ease-in-out infinite alternate; }
.arrow .shaft { animation: march 2.8s linear infinite; }
.brand-mark .wing { animation: wing 4.8s ease-in-out infinite; }
.callout.warn { animation: pulse-line 3.6s ease-in-out infinite; }
.kicker::before { animation: draw 0.7s ease both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); width: min(100% - 28px, 900px); }
  .toc {
    position: fixed;
    inset: 64px 12px auto 12px;
    max-height: min(70vh, 520px);
    background: #12171f;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    z-index: 18;
    box-shadow: var(--shadow);
    display: none;
  }
  .toc.open { display: block; }
  .menu-toggle { display: inline-flex; flex: none; }
  .top-links a:not(.keep) { display: none; }
  .brand { min-width: 0; }
  .hero-copy { padding: 28px 16px 18px; }
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats li { min-width: 0; padding: 10px 8px; }
  .stats strong { font-size: 22px; }
  .stats span { font-size: 11px; line-height: 1.3; }
  .phase, .panel { padding: 20px 16px 8px; }
  .phase-head { flex-direction: column; }
  .rail { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 4px 12px 16px; }
  .rail a { min-width: 0; }
  .rail b, .rail em { font-size: 11px; }
  .topbar { padding: 12px 12px; }
  .legend-table { display: block; overflow-x: auto; }
}

@media print {
  .topbar, .toc, .progress, .pin, .chart-zoom, .menu-toggle, .runner { display: none !important; }
  body { background: white; color: black; }
  .shell { display: block; width: auto; }
  .hero, .phase, .panel { break-inside: avoid; box-shadow: none; }
}
