/* ================= The Carbon Capture Gap — broadsheet editorial ================= */
/* Directory essays are self-contained: this file carries the shared base (tokens,
   body, masthead, site-back, footer, tooltip, svg text) plus the widget-specific
   rules. Base block mirrors essays/climate/css/style.css so the series stays
   visually consistent. */

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

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -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;
  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; }

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

/* ---------- masthead (lighter than the series hero: widget-first) ---------- */
.masthead {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(3rem, 9vw, 5.5rem) 1.5rem 2.5rem;
  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;
  letter-spacing: -.01em;
}
.masthead h1 em { font-style: italic; color: var(--perception); }
.masthead h1 em.real { color: var(--reality); }

/* ---------- content column ---------- */
main { padding-bottom: 2rem; }
.intro {
  max-width: 42rem;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}
.intro p { font-size: 1.2rem; }

/* ---------- the widget ---------- */
#gap-widget { max-width: 860px; margin: 2rem auto; padding: 0 1.5rem; }
.gap-controls { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; }
.gap-control label { display: block; font: 600 .72rem/1.4 var(--mono); color: var(--ink-soft); letter-spacing: .06em; text-transform: uppercase; }
.gap-control select { font: 500 .95rem var(--serif); padding: .4rem .5rem; margin-top: .3rem; background: var(--paper); border: 1px solid var(--rule); }
.gap-hint { font-size: .82rem; color: var(--ink-soft); max-width: 42rem; margin: .25rem 0 1rem; }
.gap-verdict { margin-top: 1rem; font-family: var(--mono); font-size: .9rem; line-height: 1.5; color: var(--ink); }
#gap-chart svg { display: block; width: 100%; height: auto; }

/* ---------- CDR composition panel ---------- */
#gap-composition h4 { font: 600 .8rem var(--mono); margin: 1.4rem 0 .6rem; letter-spacing: .04em; }
/* first column holds the spelled-out labels, e.g. "Bioenergy + capture (BECCS)" */
.comp-row { display: grid; grid-template-columns: 13rem 1fr 4rem; align-items: center; gap: .5rem; font-size: .82rem; margin: .25rem 0; font-family: var(--mono); }
.comp-bar { height: .8rem; background: var(--reality); border-radius: 2px; min-width: 2px; }

/* ---------- prose: takeaways, callout, appendix ---------- */
.takeaways, .appendix { max-width: 42rem; margin: 3rem auto 0; padding: 0 1.5rem; }
.takeaways h3, .appendix h3 {
  font-family: var(--display);
  font-weight: 720;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  line-height: 1.1;
  margin: 0 0 1rem;
}
.appendix h4 { margin: 1.6rem 0 .3rem; font: 600 .9rem var(--mono); }
.callout {
  border-left: 4px solid var(--reality);
  background: rgba(255,255,255,.5);
  padding: 1rem 1.3rem;
  margin: 1.8rem 0;
}
.callout h4 { margin: 0 0 .5rem; font: 600 .82rem var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.callout p:last-child { margin-bottom: 0; }
.glossary { margin: .5rem 0 0; }
.glossary dt { font: 600 .85rem var(--mono); margin-top: .8rem; color: var(--ink); }
.glossary dd { margin: .15rem 0 0; font-size: .95rem; }

/* ---------- tooltip + chart text (shared with the series) ---------- */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: .74rem;
  padding: .5rem .7rem;
  max-width: 240px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 50;
}
svg text { font-family: var(--mono); fill: var(--ink); }
svg .axis text, svg .tick text { font-size: .68rem; fill: var(--ink-soft); }
svg .axis line, svg .axis path, svg .tick line, svg .domain { stroke: var(--rule); }

/* ---------- footer / sources ---------- */
.methodology {
  border-top: 3px double var(--rule);
  margin: 5rem auto 0;
  padding: 2.5rem 1.5rem 4rem;
  max-width: 46em;
  font-size: .88rem;
  color: var(--ink-soft);
}
.methodology h3 { font-family: var(--display); color: var(--ink); }
#sources-list { font-family: var(--mono); font-size: .74rem; line-height: 2; }
#sources-list a { color: var(--reality); }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .gap-controls { flex-direction: column; gap: .75rem; }
  .comp-row { grid-template-columns: 9rem 1fr 3.5rem; }
}
@media (max-width: 480px) {
  .masthead h1 { font-size: clamp(1.9rem, 12vw, 2.6rem); }
}

/* read-next: curated related essays with one-line summaries */
.read-next-section {
  max-width: 46em;
  margin: 4rem auto 0;
  padding: 0 1.5rem;
}
.read-next-section h3 { font-family: var(--display, inherit); }
.read-next p {
  font-size: .92rem;
  color: var(--ink-soft);
  margin: .5rem 0;
  line-height: 1.55;
}
.read-next a { font-weight: 600; }
