@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,600;0,700;1,300;1,400;1,600&family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;1,14..32,400&display=swap');

/* ── Base ─────────────────────────────────────────────────────────────────── */

body {
  background-color: #f5f3ec;
  color: #26342d;
  font-family: 'Inter', "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #3d6f58;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

h1.title,
.quarto-title-meta {
  display: none;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero-block {
  min-height: 92vh;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 8rem clamp(1.5rem, 7vw, 7rem) 5.5rem;
  background:
    radial-gradient(circle at 84% 18%, rgba(226, 188, 102, 0.32), transparent 31%),
    linear-gradient(145deg, #f8f1df 0%, #e4eadc 48%, #cadde6 100%);
  border-bottom: 1px solid rgba(86, 111, 95, 0.22);
  color: #26342d;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: left;
  overflow: hidden;
  position: relative;
}

.hero-block > * {
  position: relative;
  z-index: 1;
}

.hero-block h1 {
  max-width: 900px;
  margin: 0 0 1rem;
  color: #24382e;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(2.8rem, 6.5vw, 6rem);
  font-weight: 700;
  font-style: italic;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.hero-block strong {
  display: block;
  max-width: 700px;
  color: #53665d;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  margin-bottom: 1.6rem;
  letter-spacing: 0;
}

.hero-block em {
  color: #738278;
  font-family: 'Inter', "Helvetica Neue", sans-serif;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  margin-top: 0.5rem;
}

.hero-kpis {
  display: flex;
  gap: 2.8rem;
  flex-wrap: wrap;
  max-width: 760px;
  margin: 1.8rem 0 1.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(86, 111, 95, 0.22);
}

.hero-kpi {
  background: transparent;
  padding: 0;
  font-family: 'Inter', "Helvetica Neue", sans-serif;
  min-width: 8rem;
}

.hero-kpi p {
  margin: 0;
  color: #24382e;
  font-size: clamp(1.8rem, 3.5vw, 2.9rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hero-kpi span {
  display: block;
  margin-top: 0.35rem;
  color: #66776c;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.hero-signal {
  align-self: stretch;
  min-height: 66vh;
  display: grid;
  grid-template-columns: repeat(8, minmax(1.1rem, 1fr));
  gap: clamp(0.4rem, 0.9vw, 0.75rem);
  align-items: end;
  padding: 1.75rem;
  border: 1px solid rgba(86, 111, 95, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12)),
    rgba(86, 111, 95, 0.08);
}

.signal {
  min-height: 3rem;
  height: var(--h);
  border-radius: 1px 1px 0 0;
}

.signal.fossil   { background: linear-gradient(180deg, #d9634f, #6b2820); }
.signal.renewable { background: linear-gradient(180deg, #5eaf74, #1f5c37); }
.signal.poverty  { background: linear-gradient(180deg, #e8b84a, #8a5a1e); }
.signal.carbon   { background: linear-gradient(180deg, #c94036, #2e100e); }

/* ── Spotlight ────────────────────────────────────────────────────────────── */

.spotlight-block {
  width: min(1080px, calc(100vw - 2rem));
  margin: 5rem auto;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4.5rem);
  background: #f8f7f3;
  border-top: 1.5px solid #c3d0ca;
  border-bottom: 1.5px solid #c3d0ca;
  border-left: none;
  box-shadow: none;
}

.spotlight-block h2 {
  margin: 0 0 1rem;
  color: #0f1311;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.1;
}

.spotlight-block p {
  max-width: 820px;
  color: #2a2a2a;
  font-family: 'Inter', "Helvetica Neue", sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  font-weight: 400;
  line-height: 1.72;
  margin: 0;
}

/* ── Closing ──────────────────────────────────────────────────────────────── */

.closing-block {
  background: #e6eee5;
  color: #26342d;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 6rem min(7vw, 6rem);
  text-align: left;
}

.closing-block h2 {
  max-width: 820px;
  color: #2f5e49;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.1;
  margin: 0 0 1.75rem;
}

.closing-block p {
  max-width: 700px;
  color: #425048;
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.8;
  margin: 0 0 1rem;
}

.closing-block em {
  color: #8a612a;
  font-style: italic;
  font-family: "Spectral", Georgia, serif;
  font-size: 1.15em;
}

/* ── Closeread layout ─────────────────────────────────────────────────────── */

.cr-section {
  background: #f0f1eb;
  min-height: 100vh;
}

/* Closeread's overflow:hidden clips sticky images, override on both col and
   stack so static PNGs render the same as interactive widgets */
.cr-section .sticky-col {
  overflow: visible;
}

.cr-section .sticky-col .sticky-col-stack {
  overflow: visible;
}

.cr-section.overlay-left,
.cr-section.overlay-left.sidebar-left {
  grid-template-columns: 1fr !important;
}

.cr-section.overlay-left .sticky-col,
.cr-section.overlay-left.sidebar-left .sticky-col {
  grid-column: 1 !important;
  background: transparent;
}

.cr-section.overlay-left .narrative-col,
.cr-section.overlay-left.sidebar-left .narrative-col {
  grid-column: 1 !important;
  z-index: 5 !important;
  width: min(380px, 88vw);
  margin-left: clamp(1rem, 4vw, 4.5rem);
  pointer-events: none;
}

/* Show first sticky before JS fires */
.sticky-col-stack:not(:has(.cr-active)) .sticky:first-child {
  opacity: 1;
}

.sticky-col-stack {
  min-height: 100vh;
}

.sticky {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 4rem)
    clamp(1rem, 3vw, 2.5rem) clamp(26rem, 31vw, 38rem);
}

.narrative-col {
  background-color: transparent !important;
  padding: 2.6rem min(4vw, 3rem);
}

/* ── Narrative cards ──────────────────────────────────────────────────────── */

.narrative-card {
  max-width: 400px;
  background: rgba(254, 253, 250, 0.97) !important;
  border: none;
  border-radius: 0;
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
  padding: 1.5rem 1.6rem 1.4rem;
  margin: 0 0 1.2rem;
  position: relative;
}

.narrative-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(55, 90, 72, 0.3);
}

.narrative-card h3 {
  margin: 0 0 0.65rem;
  color: #5c7a68;
  font-family: 'Inter', "Helvetica Neue", sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.narrative-card p {
  color: #1e1e1e;
  font-family: 'Inter', "Helvetica Neue", sans-serif;
  font-size: 0.94rem;
  line-height: 1.68;
  margin: 0 0 0.65rem;
}

.narrative-card p:last-child {
  margin-bottom: 0;
}

.narrative-card strong {
  color: #1a4030;
  font-weight: 600;
}

/* ── Embedded plots ───────────────────────────────────────────────────────── */

.girafe_container_std,
.html-widget,
.plotly,
.cell-output-display {
  width: 100% !important;
  max-width: 100%;
}

.cell {
  width: 100%;
}

.sticky .cell,
.sticky .cell-output-display,
.sticky .cell-output-display > div,
.sticky .girafe,
.sticky .html-widget {
  width: 100% !important;
}

.sticky .girafe,
.sticky .html-widget {
  height: min(78vh, 820px) !important;
  min-height: min(78vh, 820px) !important;
}

.sticky figure {
  width: 100%;
  margin: 0;
  display: block;
}

.sticky figure p {
  margin: 0;
  display: block;
  line-height: 0;
}

.sticky img,
.sticky svg {
  width: 100%;
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

svg text {
  font-family: 'Inter', "Helvetica Neue", Arial, sans-serif;
}

/* Wide sections */

.wide-section {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
  padding: 5rem clamp(1.25rem, 5vw, 5rem) 5.5rem;
  background: #f4f4ee;
}

.wide-section h2 {
  max-width: 860px;
  margin: 0 0 0.75rem;
  color: #0f1311;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.6rem, 3.5vw, 3.2rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.05;
}

.wide-section > p {
  max-width: 720px;
  margin: 0 0 2rem;
  color: #3a3c39;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.72;
}

.wide-section .cell,
.wide-section .cell-output-display {
  display: block !important;
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 1600px;
  margin: 0 auto;
}

/* Chapter breaks */

.chapter-break {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem clamp(2rem, 8vw, 10rem);
  text-align: center;
  background: #eceee8;
  position: relative;
}

.chapter-break::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(180px, 35%);
  height: 1.5px;
  background: rgba(39, 100, 74, 0.32);
}

.chapter-break p {
  color: #1e201c;
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.15rem, 2.2vw, 1.85rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.55;
  max-width: 720px;
  margin: 0;
}

.chapter-break strong {
  color: #205a3a;
  font-weight: 600;
  font-style: normal;
}

/* ── Dark cr-section ──────────────────────────────────────────────────────── */

.cr-section.dark-section {
  background: #0c1210;
}

.cr-section.dark-section .narrative-card {
  background: rgba(14, 24, 20, 0.9) !important;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.cr-section.dark-section .narrative-card::before {
  background: rgba(240, 198, 106, 0.4);
}

.cr-section.dark-section .narrative-card h3 {
  color: rgba(240, 198, 106, 0.75);
}

.cr-section.dark-section .narrative-card p {
  color: rgba(255, 255, 255, 0.78);
}

.cr-section.dark-section .narrative-card strong {
  color: #f0c66a;
}

/* ── Key-finding narrative card ───────────────────────────────────────────── */

.narrative-card.key-finding {
  background: #0f1311 !important;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.narrative-card.key-finding::before {
  background: rgba(240, 198, 106, 0.55);
}

.narrative-card.key-finding h3 {
  color: rgba(240, 198, 106, 0.75);
}

.narrative-card.key-finding p {
  color: rgba(255, 255, 255, 0.78);
}

.narrative-card.key-finding strong {
  color: #f0c66a;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .hero-block {
    min-height: 86vh;
    padding: 5rem 1.4rem 3.5rem;
  }

  .hero-kpis {
    gap: 1.8rem;
  }

  .closing-block {
    padding: 4rem 1.4rem;
  }

  .narrative-col {
    padding: 1.4rem 1rem;
  }

  .cr-section.overlay-left .narrative-col {
    width: auto;
    margin-inline: 1rem;
  }

  .sticky {
    width: 100vw;
    min-height: 70vh;
    padding: 0.75rem;
    align-items: start;
  }

  .sticky .girafe,
  .sticky .html-widget {
    min-height: 48vh !important;
  }

  .narrative-card {
    max-width: none;
    padding: 1.2rem 1.3rem;
  }

  .narrative-card p,
  .closing-block p {
    font-size: 0.93rem;
  }

  .wide-section {
    padding: 3.5rem 1rem;
  }

  .chapter-break {
    padding: 2.5rem 1.4rem;
  }

  .chapter-break p {
    font-size: 1.1rem;
  }
}
