:root {
  color-scheme: dark;
  --bg: #070b12;
  --surface: #0d1420;
  --surface-soft: #111b29;
  --text: #eef2f7;
  --muted: #9ba9bb;
  --line: rgba(178, 198, 220, 0.18);
  --cyan: #74d8ef;
  --amber: #f2b65c;
  --danger: #ff6b66;
  --reading: 46rem;
  --wide: 76rem;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 18rem;
  color: var(--text);
  background:
    radial-gradient(circle at 75% 8%, rgba(33, 120, 164, 0.16), transparent 32rem),
    radial-gradient(circle at 15% 38%, rgba(242, 182, 92, 0.08), transparent 28rem),
    var(--bg);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: 1rem;
  padding: .65rem 1rem;
  color: #081019;
  background: var(--cyan);
  border-radius: .5rem;
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.hero {
  width: min(calc(100% - 2rem), var(--wide));
  margin: 1rem auto 0;
}

.hero-image {
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, .42);
}

.hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 11, 18, .68), transparent 48%);
  pointer-events: none;
}

.hero-copy {
  width: min(100%, var(--reading));
  margin: -5.5rem auto 0;
  position: relative;
  z-index: 1;
  padding: 0 1rem;
}

.eyebrow,
.meta,
.section-number,
.chapter-nav,
figcaption,
footer {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.eyebrow {
  margin: 0 0 .5rem;
  color: var(--amber);
  font-size: .85rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5.8rem);
  line-height: .98;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.dek {
  max-width: 42rem;
  margin: 1.5rem 0 0;
  color: #d6dee9;
  font-size: clamp(1.08rem, 2.5vw, 1.35rem);
  line-height: 1.55;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.chapter-nav {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
  width: fit-content;
  max-width: calc(100% - 1rem);
  margin: 3.5rem auto 0;
  padding: .45rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 14, 23, .88);
  box-shadow: 0 .8rem 2rem rgba(0, 0, 0, .24);
  backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.chapter-nav::-webkit-scrollbar { display: none; }

.chapter-nav span {
  padding: 0 .55rem;
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
}

.chapter-nav a {
  display: grid;
  place-items: center;
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0 .65rem;
  border-radius: 999px;
  color: #d9e1ec;
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}

.chapter-nav a:hover,
.chapter-nav a:focus-visible {
  color: #071018;
  background: var(--cyan);
  outline: none;
}

.story {
  width: min(calc(100% - 2rem), var(--reading));
  margin: 5rem auto 0;
}

.story-section {
  margin: 0 0 7rem;
  scroll-margin-top: 5rem;
}

h2 {
  margin: 0 0 2rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.section-number {
  display: block;
  margin-bottom: .65rem;
  color: var(--cyan);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.story p {
  margin: 0 0 1.5rem;
  color: #e1e6ed;
  font-size: clamp(1.05rem, 2vw, 1.16rem);
}

.story p:first-of-type::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  color: var(--amber);
  font-size: 3.6em;
  font-weight: 700;
  line-height: .78;
}

.cue {
  color: var(--muted) !important;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .96rem !important;
  font-style: italic;
}

.log {
  margin: 1.75rem 0;
  padding: 1.2rem 1.3rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: .7rem;
  color: #cbd8e8;
  background: linear-gradient(135deg, rgba(16, 28, 42, .92), rgba(9, 15, 24, .96));
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .85rem;
  line-height: 1.64;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.wide {
  width: min(calc(100vw - 2rem), var(--wide));
  margin-left: 50%;
  transform: translateX(-50%);
}

.story-image {
  margin-top: 0;
  margin-bottom: 7rem;
}

.story-image img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, .38);
}

.story-image.crisis img { border-color: rgba(255, 107, 102, .35); }
.story-image.resolution img { border-color: rgba(242, 182, 92, .34); }

figcaption {
  margin: .75rem .25rem 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: right;
}

footer {
  display: grid;
  justify-items: center;
  width: min(calc(100% - 2rem), var(--reading));
  margin: 2rem auto 0;
  padding: 4rem 0 6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

footer p { margin: .55rem 0 0; }
.bun { font-size: 2rem; }

@media (max-width: 700px) {
  body { font-size: 17px; }
  .hero { width: 100%; margin-top: 0; }
  .hero-image { border-inline: 0; border-radius: 0; }
  .hero-copy { margin-top: -2.8rem; padding-inline: 1rem; }
  .chapter-nav { justify-content: flex-start; margin-top: 2.5rem; border-radius: .8rem; }
  .chapter-nav span { display: none; }
  .story { margin-top: 4rem; }
  .story-section { margin-bottom: 5rem; }
  .story-image { margin-bottom: 5rem; }
  .log { margin-inline: -.25rem; padding: 1rem; font-size: .78rem; }
  .wide { width: 100vw; }
  .story-image img { border-inline: 0; border-radius: 0; }
  figcaption { margin-right: 1rem; }
}

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