/* Type and colour ported from the manuscript. See site/AESTHETIC_PORT.md.
   Text face: XCharter (latex/alphaurbanism.cls:45).
   Running-head sans: Latin Modern Sans (cls:61, PDF embeds LMSans8-Regular).
   Typewriter: Latin Modern Mono (cls:48, zlmtt scaled 1.1).
   Figure label face: the plates use macOS Helvetica (lib/style_lock.py:115),
   which cannot ship; IBM Plex Sans stands in for it. */

@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/XCharter-Roman.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/XCharter-Bold.woff2") format("woff2");
  font-style: normal; font-weight: 600 800; font-display: swap;
}
@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/XCharter-Italic.woff2") format("woff2");
  font-style: italic; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "XCharter";
  src: url("assets/fonts/XCharter-BoldItalic.woff2") format("woff2");
  font-style: italic; font-weight: 600 800; font-display: swap;
}
@font-face {
  font-family: "LM Sans";
  src: url("assets/fonts/LMSans10-Regular.woff2") format("woff2");
  font-style: normal; font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: "LM Mono";
  src: url("assets/fonts/LMMono10-Regular.woff2") format("woff2");
  font-style: normal; font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-style: normal; font-weight: 500 600; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-Bold.woff2") format("woff2");
  font-style: normal; font-weight: 700 800; font-display: swap;
}

:root {
  /* Ground and ink — house_style.py:44-47, :100-103;
     render_si_sphere_context_kde.py:95-99. */
  --paper: #ffffff;
  --panel: #f8fafc;
  --ink: #202735;
  --muted: #667085;
  --structure: #c7d1dc;
  --grid: #e8eef4;
  --rule: #9aa5b2;
  --limb: #717c8b;

  /* Categorical accents — the v3 camera-ready layer. */
  --navy: #294976;
  --blue: #4f88bf;
  --teal: #2c7a7b;
  --green: #4d9372;
  --gold: #d99b32;
  --purple: #8c508d;
  --plum: #9d3157;
  --accent: #c84c4c;   /* paper CRIMSON, 77_heading_speed_attractors.py */
  --reading: #e33d3d;  /* progress-sphere CORAL, render_page_progress_spheres.py:33 */

  --shadow: 0 14px 34px rgba(32, 39, 53, 0.07);

  --serif: "XCharter", Charter, "Bitstream Charter", Georgia, serif;
  --sans: "LM Sans", "IBM Plex Sans", Helvetica, Arial, sans-serif;
  --mono: "LM Mono", "IBM Plex Mono", ui-monospace, monospace;
  --figsans: "IBM Plex Sans", Helvetica, Arial, sans-serif;
  --title: var(--serif);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

/* --- masthead: the class's running head, 1pt gray rule (cls:184-189) ----- */

.masthead {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 28px;
  min-height: 52px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 11.5px; letter-spacing: 0.12em;
}
.masthead .mark { width: 26px; height: 2px; background: var(--accent); }
.masthead .context { margin-left: auto; color: var(--muted); }

/* The progress sphere: the class's page-progress motif (cls:95-146),
   re-shaded on canvas in app.js. */
#progress-sphere {
  display: block;
  width: 52px; height: 42px;
  margin: -6px -6px -6px 16px;
  flex: 0 0 auto;
}

.kicker {
  font-family: var(--sans);
  font-size: 11.5px; letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 18px;
}

.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 12vh 28px 10vh;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(40px, 6.2vw, 74px);
  line-height: 1.05;
  letter-spacing: -0.012em;
  margin: 0 0 30px;
}
.hero .lede { max-width: 34em; font-size: 20px; }
.hero-note {
  max-width: 34em;
  font-family: var(--serif); font-style: italic; font-size: 15px;
  color: var(--muted);
  border-left: 2px solid var(--gold);
  padding-left: 14px;
}
.hero-stats {
  display: flex; gap: 26px; flex-wrap: wrap;
  margin-top: 40px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em;
  color: var(--muted);
}

.scrolly { position: relative; }
.sticky {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  overflow: hidden;
}
#field { display: block; }

/* Stage furniture is figure furniture: the plates' small, flat, letterspaced
   Helvetica labels (house_style.py:96, :138-139), no frames (:147). */
.stage-caption {
  position: absolute; left: 28px; bottom: 24px;
  font-family: var(--figsans); font-size: 10.5px; letter-spacing: 0.09em;
  line-height: 1.55;
  color: var(--muted);
  max-width: 340px;
}
.legend {
  position: absolute; right: 28px; bottom: 24px;
  display: flex; flex-direction: column; gap: 5px;
  font-family: var(--figsans); font-size: 10px; letter-spacing: 0.05em;
  color: var(--muted);
}
.legend .item { display: flex; align-items: center; gap: 8px; }
.legend .swatch {
  width: 10px; height: 10px; border-radius: 1px;
  outline: 0.5px solid rgba(32, 39, 53, 0.18);
  outline-offset: -0.5px;
}

.steps {
  position: relative; z-index: 5;
  max-width: 440px;
  margin: -100vh 0 0 clamp(28px, 6vw, 90px);
  padding-bottom: 45vh;
  pointer-events: none;
}
/* Card chrome after house_style.add_card_container (house_style.py:280-299):
   #F8FAFC on a 0.8pt #E2E8F0-class border, small corner radius. */
.step {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--structure);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin: 0 0 78vh;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
.step:first-child { margin-top: 55vh; }
.step.active { opacity: 1; }
.step-index {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--accent); margin: 0 0 10px;
}
.step h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: 25px; line-height: 1.18; letter-spacing: -0.005em;
  margin: 0 0 12px;
}
.step p { margin: 0 0 10px; font-size: 16.5px; }
/* Fine print reads as a figure caption: the class sets captions in the text
   face with a pipe label separator (cls:289-295). */
.step .fine {
  font-family: var(--serif); font-size: 14.5px; line-height: 1.45;
  color: var(--muted);
  border-top: 1px solid var(--structure);
  padding-top: 10px; margin-top: 14px;
}

.metric-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 16px 0 4px;
}
.metric-card {
  border: 1px solid var(--structure);
  border-radius: 2px;
  background: var(--paper);
  padding: 12px 13px;
}
.metric-card .value {
  font-family: var(--serif); font-weight: 700;
  font-size: 25px; letter-spacing: -0.005em; line-height: 1.1;
  color: var(--navy);
}
.metric-card .label {
  font-family: var(--figsans); font-size: 9.5px; letter-spacing: 0.08em;
  color: var(--muted); margin-top: 5px; line-height: 1.5;
}

.outro {
  max-width: 720px;
  margin: 0 auto;
  padding: 14vh 28px 16vh;
  text-align: left;
}
.outro h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.12; letter-spacing: -0.008em;
  margin: 0 0 20px;
}
.outro p { max-width: 34em; }

footer {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 20px 28px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted);
}

/* The live Earth Engine app is the last page rather than a framed embed. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.earth-engine-finale {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: #0b1118;
}

.earth-engine-finale iframe {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  background: #0b1118;
}

.earth-engine-mobile-handoff { display: none; }

.masthead {
  transition: opacity 180ms ease, transform 180ms ease;
}

body.earth-engine-active .masthead {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

@media (max-width: 760px) {
  body { font-size: 17px; }
  .steps { max-width: none; margin: -100vh 16px 0; }
  .legend { display: none; }
  .stage-caption { max-width: 220px; }
  #progress-sphere { width: 40px; height: 32px; margin-left: 10px; }
  .earth-engine-finale { min-height: 100svh; }
}

@media (max-width: 680px) {
  .earth-engine-finale {
    min-height: 640px;
    color: #f5f3ec;
    background:
      radial-gradient(circle at 74% 30%, rgb(43 77 113 / 44%), transparent 34%),
      linear-gradient(145deg, #0b1118 18%, #142536 100%);
  }

  .earth-engine-finale iframe { display: none; }

  .earth-engine-mobile-handoff {
    display: flex;
    width: 100%;
    height: 100%;
    padding: max(38px, env(safe-area-inset-top)) 24px max(38px, env(safe-area-inset-bottom));
    flex-direction: column;
    justify-content: flex-end;
  }

  .earth-engine-mobile-handoff p {
    margin: 0 0 14px;
    color: #d9aa70;
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.16em;
  }

  .earth-engine-mobile-handoff h2 {
    max-width: 8.5em;
    margin: 0 0 28px;
    font-family: var(--serif);
    font-size: clamp(38px, 12vw, 56px);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.025em;
  }

  .earth-engine-mobile-handoff a {
    width: fit-content;
    color: #f5f3ec;
    font-family: var(--sans);
    font-size: 14px;
    letter-spacing: 0.04em;
    text-decoration-color: rgb(245 243 236 / 55%);
    text-underline-offset: 5px;
  }

  .earth-engine-mobile-handoff a:focus-visible {
    outline: 2px solid #f5f3ec;
    outline-offset: 6px;
  }
}

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