/* ============ What It Takes to Offset a Flight — broadsheet editorial ============ */

:root {
  --paper: #f7f1e5;
  --paper-deep: #efe6d2;
  --ink: #191410;
  --ink-soft: #4a4238;
  --rule: #d8ccb4;
  --perception: #a84a10;   /* ember — the flight, the debt */
  --perception-soft: #e6b596;
  --reality: #1e5f4a;      /* forest — the cuts, what is measured */
  --reality-soft: #a3c4b4;
  --gold: #a87b2d;
  --dark: #0f1410;
  --dark-paper: #efe6d2;
  --serif: "Newsreader", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* stop mobile Chrome/Safari from inflating font sizes (breaks the centered
     masthead: the boosted title overflows and clips) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.62;
  /* paper grain */
  background-image:
    radial-gradient(ellipse at top, rgba(255,255,255,.5), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

a { color: var(--reality); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- masthead ---------- */

.masthead {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  border-bottom: 3px double var(--rule);
}

.kicker {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
}

.masthead h1 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 0, "WONK" 0;
  font-weight: 600;
  font-size: clamp(2.5rem, 7.5vw, 5.2rem);
  line-height: 1.02;
  margin: 0 0 2rem;
  letter-spacing: -.01em;
}

.masthead h1 em { font-style: italic; color: var(--perception); }

.standfirst {
  max-width: 38em;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 300;
  margin: 0 auto 1.4rem;
}

.byline {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-soft);
  max-width: 46em;
  margin: 0 auto 2rem;
}

.scroll-cue {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-soft);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .scroll-cue { animation: none; }
}

/* ---------- prose sections ---------- */

.prose {
  max-width: 42em;
  margin: 0 auto;
  padding: 5rem 1.5rem 1rem;
}

.prose h2 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 0, "WONK" 1;
  font-weight: 720;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.08;
  margin: 0 0 1.2rem;
}

.section-no {
  display: block;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--perception);
  margin-bottom: .8rem;
}
.section-no::after {
  content: "";
  display: block;
  width: 3.2rem;
  border-bottom: 3px solid var(--perception);
  margin-top: .5rem;
}

/* ---------- scrolly ---------- */

.scrolly {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: 0 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  padding: clamp(1.25rem, 6vh, 2.5rem) 0 2rem;
  box-sizing: border-box;
  grid-column: 1;
  grid-row: 1;
}

.steps { grid-column: 2; grid-row: 1; padding-bottom: 60vh; }

/* Step height doubles as the scroll-distance encoding: trivial rungs get a
   taller --step-h, so the reader scrolls farther for a smaller pour. */
.step {
  min-height: var(--step-h, 85vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: .28;
  transition: opacity .4s;
}
.step.active { opacity: 1; }

.step p {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--gold);
  box-shadow: 0 2px 14px rgba(25,20,16,.07);
  padding: 1.3rem 1.5rem;
  margin: 0;
  font-size: 1.08rem;
}

.step-kicker {
  font-family: var(--mono) !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  font-size: .78rem !important;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 0 .5rem 0 !important;
}

/* Per-rung readout inside a step, filled from cuts.json by JS */
.rung-readout {
  font-family: var(--mono) !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: .6rem 0 0 0 !important;
  font-size: .92rem !important;
  color: var(--reality);
  font-weight: 600;
}
.rung-readout .rung-pct { color: var(--ink-soft); font-weight: 400; }

/* ---------- the tank ---------- */

.tank-svg {
  display: block;
  width: min(420px, 88vw);
  height: auto;
  max-height: calc(100svh - 8rem);
  flex-shrink: 0;
}

.tank-svg .vessel { fill: none; stroke: var(--ink); stroke-width: 3; }
.tank-svg .liquid { fill: var(--reality); }
.tank-svg .liquid.draining { fill: var(--reality-soft); }
.tank-svg .rim-line { stroke: var(--perception); stroke-width: 2; stroke-dasharray: 6 4; }
.tank-svg .ghost-line { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 2 4; }
.tank-svg .notch { stroke: var(--ink-soft); stroke-width: 1.5; }
.tank-svg text { font-family: var(--mono); fill: var(--ink); }
.tank-svg .notch-label { font-size: .62rem; fill: var(--ink-soft); }
.tank-svg .rim-label { font-size: .68rem; fill: var(--perception); font-weight: 600; }
.tank-svg .ghost-label { font-size: .6rem; fill: var(--gold); }

.attempt-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--perception);
  text-align: center;
  margin: 0 0 .6rem;
  min-height: 1.2em;
}

.tank-label {
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--ink-soft);
  text-align: center;
  margin: .6rem 0 0;
  min-height: 2.8em;
}
.tank-label strong { color: var(--reality); }

@media (prefers-reduced-motion: no-preference) {
  .tank-svg .liquid { transition: y .5s ease-out, height .5s ease-out; }
}

/* ---------- price strip (paid offsets) ---------- */

.price-strip {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.price-row { font-family: var(--mono); font-size: .82rem; }
.price-row .price-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .3rem;
}
.price-row .price-name { color: var(--ink); font-weight: 600; }
.price-row .price-range { color: var(--ink-soft); }
.price-bar-track {
  position: relative;
  height: 14px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
}
.price-bar {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--reality-soft);
}
.price-bar.removal { background: var(--reality); }
.price-bar.avoided { background: var(--gold); }
.price-kind {
  font-size: .68rem;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}
.price-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: .45rem;
}
.price-swatch.removal { background: var(--reality); }
.price-swatch.avoided { background: var(--gold); }
.price-flight-chip {
  display: inline-block;
  margin-top: .35rem;
  padding: .15rem .55rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  color: var(--perception);
  font-weight: 600;
}

.price-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--ink-soft);
  margin-top: .2rem;
}

/* callout box, carbon-gap register */
.callout {
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 1.3rem 1.5rem;
  margin: 2rem 0;
  font-size: 1.02rem;
}
.callout .callout-kicker {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--perception);
  display: block;
  margin-bottom: .5rem;
}

/* ---------- reckoning (double-spend finale) ---------- */

.reckoning-svg {
  display: block;
  width: min(520px, 88vw);
  height: auto;
  max-height: calc(100svh - 8rem);
  flex-shrink: 0;
}
.reckoning-svg text { font-family: var(--mono); fill: var(--ink); }
.reckoning-svg .anno { font-size: .66rem; fill: var(--ink-soft); }
.reckoning-svg .year-bar { fill: var(--ink-soft); }
.reckoning-svg .paris-line { stroke: var(--reality); stroke-width: 2; stroke-dasharray: 6 4; }
.reckoning-svg .gap-shade { fill: var(--perception-soft); opacity: .55; }
.reckoning-svg .cuts-block { fill: var(--reality); }
.reckoning-svg .flight-block { fill: var(--perception); }
@media (prefers-reduced-motion: no-preference) {
  .reckoning-svg .fade { transition: opacity .5s; }
}

/* ---------- close & footer ---------- */

.fin {
  font-family: var(--display);
  font-weight: 550;
  font-size: 1.35rem;
  line-height: 1.45;
  border-top: 3px double var(--rule);
  padding-top: 1.6rem;
  margin-top: 2.4rem;
}
.essay-trail {
  margin-top: 2rem;
  font-size: .9rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
.essay-trail p { margin: 0; }
.essay-trail a { color: var(--ink-soft); text-underline-offset: 3px; }
.essay-trail a:hover { color: var(--ink); }
.essay-trail--before-sources {
  margin: 0 0 1.25rem;
  padding: 0;
  max-width: none;
}

.methodology {
  border-top: 3px double var(--rule);
  margin-top: 5rem;
  padding: 2.5rem 1.5rem 4rem;
  max-width: 46em;
  margin-left: auto;
  margin-right: auto;
  font-size: .88rem;
  color: var(--ink-soft);
}
.methodology h3 { font-family: var(--display); color: var(--ink); }
#sources { position: relative; z-index: 1; background: var(--paper); }
#sources-list { font-family: var(--mono); font-size: .74rem; line-height: 2; }
.read-next { margin-bottom: 2.2rem; }
.read-next p {
  font-size: .92rem;
  color: var(--ink-soft);
  margin: .5rem 0;
  line-height: 1.55;
}
.read-next a { font-weight: 600; }

.series-nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: .5rem 0 1.5rem;
}
.series-nav a { color: var(--ink); text-decoration: none; }
.series-nav a:hover { text-decoration: underline; }
.series-nav .series-here { color: var(--ink-soft); font-style: italic; }

/* sources definition list generated from the data JSONs */
.sources-list dt { font-weight: 600; margin-top: .9rem; }
.sources-list dd { margin: .1rem 0 0 0; font-size: .95rem; color: var(--ink-soft); }

.sources-note {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-soft);
  margin-top: 1.5rem;
  line-height: 1.6;
}

/* back link to the Notes & Tones home */
.site-back {
  font-family: "IBM Plex Mono", monospace;
  font-size: .8rem;
  letter-spacing: .04em;
  padding: .9rem clamp(1.2rem, 5vw, 2.4rem);
  border-bottom: 1px solid #d8ccb4;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem 1.5rem;
}
.site-back a { color: #1e5f4a; text-decoration: none; }
.site-back a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- mobile ---------- */

@media (max-width: 820px) {
  .scrolly { grid-template-columns: 1fr; }
  /* Compact pinned graphic: fixed height, always fully visible. Steps read
     in the clear zone below it — never overlaid, never clipped mid-read. */
  .sticky {
    height: 38vh; height: 38svh;
    align-self: start;
    grid-column: 1;
    z-index: 1;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: .6rem 0 .4rem;
    justify-content: flex-start;
  }
  .steps { grid-column: 1; }
  /* Full-viewport steps with content anchored just above the fold: when the
     scroller centers a step (making it active), its card sits in the clear
     zone below the pinned graphic. Taller phase-2 steps keep their inflated
     --step-h on top of the 100svh floor. */
  .step {
    min-height: max(var(--step-h, 85vh), 100svh);
    justify-content: flex-end;
    padding-bottom: 1.25rem;
  }
  .step p { font-size: .95rem; line-height: 1.5; padding: .9rem 1.1rem; }
  .tank-svg {
    width: auto;
    height: calc(38svh - 4rem);
    max-height: calc(38svh - 4rem);
  }
  .reckoning-svg {
    width: auto;
    height: calc(38svh - 4rem);
    max-height: calc(38svh - 4rem);
  }
  .tank-label { font-size: .72rem; margin-top: .3rem; min-height: 2.2em; }
  .attempt-label { font-size: .62rem; margin-bottom: .3rem; }
}

/* Short phones: shrink the pinned panel further so every step card still
   fits the clear zone beneath it. */
@media (max-width: 820px) and (max-height: 700px) {
  .sticky { height: 34vh; height: 34svh; }
  .tank-svg, .reckoning-svg { height: calc(34svh - 4rem); max-height: calc(34svh - 4rem); }
}

/* very narrow screens: let the title shrink below its desktop minimum */
@media (max-width: 480px) {
  .masthead h1 { font-size: clamp(1.6rem, 11.5vw, 2.5rem); }
}
