﻿/* ============================================================
   EDUCATE TO SAVE — Impact Report
   A4 print document. Warm, human, photo-led editorial system.
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600&family=Mulish:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,500&display=swap');

/* ---------- Palettes (switchable via [data-palette]) ---------- */
:root,
[data-palette="heritage"] {
  --ink:        #2a2018;
  --ink-soft:   #5c5042;
  --ink-faint:  #8a7c6b;
  --paper:      #ffffff;
  --cream:      #f7f1e6;
  --cream-deep: #efe5d2;
  --line:       #e2d6c0;
  --primary:    #b9701b;   /* saffron / amber */
  --primary-deep:#8f5310;
  --accent:     #2e4d38;   /* deep green */
  --accent-soft:#42664e;
  --gold:       #c79a3b;
  --gold-bright:#f0c869;
  --overlay:    rgba(42,32,24,0.46);
}
[data-palette="terracotta"] {
  --ink:        #2c211b;
  --ink-soft:   #5d4d42;
  --ink-faint:  #8d7a6c;
  --paper:      #ffffff;
  --cream:      #f6ede1;
  --cream-deep: #efe1cf;
  --line:       #e4d4c0;
  --primary:    #b1502c;   /* terracotta */
  --primary-deep:#883a1d;
  --accent:     #4a6657;   /* sage */
  --accent-soft:#5d7868;
  --gold:       #c08a45;
  --gold-bright:#eeb45f;
  --overlay:    rgba(44,33,27,0.46);
}
[data-palette="trust"] {
  --ink:        #1d2733;
  --ink-soft:   #44505e;
  --ink-faint:  #7a8794;
  --paper:      #ffffff;
  --cream:      #f1f0ea;
  --cream-deep: #e6e4da;
  --line:       #d8d8cc;
  --primary:    #1f4068;   /* deep blue */
  --primary-deep:#152d49;
  --accent:     #b58b34;   /* gold */
  --accent-soft:#caa758;
  --gold:       #c79a3b;
  --gold-bright:#f0c869;
  --overlay:    rgba(20,30,44,0.5);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.impact-report-root {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: 'Mulish', system-ui, sans-serif;
  font-size: 10.5pt;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Page shell (A4) ---------- */
.page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 22px auto;
  background: var(--paper);
  box-shadow: 0 6px 28px rgba(0,0,0,0.16);
  overflow: hidden;
  padding: 20mm 18mm 18mm;
  display: flex;
  flex-direction: column;
}
.page--flush { padding: 0; }
.page--cream { background: var(--cream); }
.page--ink   { background: var(--accent); color: var(--cream); }

/* ---------- Typography ---------- */
.serif { font-family: 'Spectral', Georgia, serif; }
h1, h2, h3, .display { font-family: 'Spectral', Georgia, serif; font-weight: 600; line-height: 1.12; margin: 0; }
.eyebrow {
  font-family: 'Mulish', sans-serif;
  font-weight: 700;
  font-size: 8.5pt;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
}
.eyebrow--light { color: var(--gold); }
.lead { font-size: 12.5pt; line-height: 1.55; color: var(--ink-soft); }
p { margin: 0 0 0.9em; }
strong { font-weight: 700; color: var(--ink); }
em { font-style: italic; }

/* ---------- Reusable bits ---------- */
.rule { height: 2px; width: 56px; background: var(--primary); border: 0; margin: 0; }
.rule--gold { background: var(--gold); }
.kicker-num {
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: 13pt;
  color: var(--primary);
}
.page-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7.5pt;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}
.page--ink .page-foot { color: rgba(247,241,230,0.6); border-top-color: rgba(247,241,230,0.2); }

/* image-slot defaults */
image-slot {
  --slot-bg: var(--cream-deep);
  display: block;
  background: var(--cream-deep);
}

/* ---------- Stat blocks ---------- */
.stat-num {
  font-family: 'Spectral', serif;
  font-weight: 300;
  line-height: 0.92;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.stat-label {
  font-weight: 700;
  font-size: 8.5pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Tweaks panel host (hidden by default) ---------- */
#tweaks-root { position: fixed; top: 0; right: 0; z-index: 9999; }

/* ============================================================
   DATA VISUALIZATION SYSTEM
   ============================================================ */
.viz-source { font-size: 7pt; color: var(--ink-faint); letter-spacing: 0.04em; margin-top: 10px; }
.page--ink .viz-source { color: rgba(247,241,230,0.55); }
.viz-est { font-style: italic; }

/* Machine-readable table for AEO/SEO — visually hidden, present in DOM */
.sr-data { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* --- Bar chart (horizontal) --- */
.barchart { display: flex; flex-direction: column; gap: 12px; }
.barrow { display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: 12px; }
.barrow__label { font-weight: 700; font-size: 9pt; color: var(--ink); }
.barrow__track { height: 16px; background: var(--cream-deep); border-radius: 8px; overflow: hidden; }
.page--ink .barrow__track { background: rgba(247,241,230,0.16); }
.barrow__fill { display: block; height: 100%; border-radius: 8px; background: var(--primary); }
.barrow__fill--accent { background: var(--accent); }
.barrow__fill--gold { background: var(--gold); }
.barrow__val { font-family: 'Spectral', serif; font-weight: 600; font-size: 12pt; color: var(--primary); min-width: 56px; text-align: right; }
.page--ink .barrow__val { color: var(--gold-bright); }

/* --- Donut --- */
.donut-wrap { display: flex; align-items: center; gap: 26px; }
.donut { position: relative; width: 168px; height: 168px; flex: none; }
.donut svg { transform: rotate(-90deg); }
.donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend__item { display: flex; align-items: flex-start; gap: 10px; }
.legend__dot { width: 13px; height: 13px; border-radius: 3px; flex: none; margin-top: 3px; }

/* --- Credential badges --- */
.cred-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
.cred { border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; text-align: center; background: var(--paper); }
.cred__tag { font-family: 'Spectral', serif; font-weight: 600; font-size: 12.5pt; color: var(--primary); line-height: 1; }
.cred__desc { font-size: 6.8pt; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-top: 6px; line-height: 1.35; }

/* --- Map --- */
.indiamap { width: 100%; height: auto; }
.indiamap .state { fill: var(--cream-deep); stroke: var(--paper); stroke-width: 1.4; transition: fill .2s; }
.indiamap .state--on { fill: var(--primary); }
.map-dot { fill: var(--accent); stroke: #fff; stroke-width: 1; }
.map-hq { fill: var(--gold-bright); stroke: var(--accent); stroke-width: 2; }

/* --- FAQ --- */
.faq { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 30px; margin-top: 18px; }
.faq__q { font-family: 'Spectral', serif; font-weight: 600; font-size: 11pt; line-height: 1.3; color: var(--ink); margin: 0 0 5px; }
.faq__a { font-size: 8.6pt; line-height: 1.5; color: var(--ink-soft); margin: 0 0 14px; }
.faq__item { break-inside: avoid; border-bottom: 1px solid var(--line); padding-bottom: 8px; }

/* --- Academy directory --- */
.directory { column-count: 4; column-gap: 18px; margin-top: 14px; }
.dir-state { margin-bottom: 2px; }
.dir-state__head { display: flex; justify-content: space-between; align-items: baseline; background: var(--primary); color: var(--cream); border-radius: 5px; padding: 3px 8px; font-family: 'Spectral', serif; font-weight: 600; font-size: 9.5pt; margin: 9px 0 5px; break-after: avoid; }
.directory > .dir-state:first-child .dir-state__head { margin-top: 0; }
.dir-state__head span { color: var(--gold-bright); font-size: 8.5pt; }
.dir-dist { break-inside: avoid; margin-bottom: 6px; }
.dir-dist__name { font-size: 6.3pt; letter-spacing: 0.11em; text-transform: uppercase; color: var(--accent); font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-bottom: 3px; }
.dir-list { list-style: none; margin: 0; padding: 0; }
.dir-list li { font-size: 7.4pt; line-height: 1.48; color: var(--ink-soft); }

/* ============================================================
   PRINT
   ============================================================ */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .impact-report-root { background: transparent; }
  #tweaks-root { display: none !important; }
  .page {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    /* Clamp every sheet to just under A4 so sub-pixel rounding can't spill a
       blank page. The bottom ~18mm is empty padding, so clipping here is safe. */
    height: 296mm;
    min-height: 296mm;
    max-height: 296mm;
    overflow: hidden;
    break-after: page;
    page-break-after: always;
  }
  /* Tighten vertical padding on content pages so text never hits the bottom edge.
     Flush pages (cover, back cover) have padding:0 and are unaffected. */
  .page:not(.page--flush) {
    padding-top: 16mm !important;
    padding-bottom: 14mm !important;
  }
  /* Compact the sponsorship-panel widget so it fits without overflow on ink pages */
  .panel { padding: 9px 20px 10px !important; }
  .panel__total { font-size: 46pt !important; }
  .panel__totlab { margin-top: 6px !important; }
  .panel__bar { margin-top: 14px !important; height: 36px !important; }
  .panel__key { margin-top: 8px !important; }
  /* Story links: keep visible and underlined so they are clickable in PDF */
  .story-link {
    display: inline-flex !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
  }
  /* The last .page is followed by #tweaks-root + scripts, so :last-child never
     matches it — target the last section element instead to drop its break. */
  .page:last-of-type { break-after: auto; page-break-after: auto; }
  .no-print { display: none !important; }
  section, .stat, li, tr, .quote, .story { break-inside: avoid; }
}
