/* ===========================================================================
   Canadian Climate Values
   Direction: a plain-spoken public notice. One typeface (JetBrains Mono),
   Canada red on black and warm white, square corners, hard rules, no
   gradients, glows or grain. The billboard images carry the colour; the page
   around them stays blunt and readable.
   =========================================================================== */

/* JetBrains Mono, self-hosted (SIL OFL, fonts/OFL-jetbrains-mono.txt): no font
   CDN call, so visitors' IPs never leave our origin. */
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 800; font-display: swap; src: url("fonts/jetbrains-mono-latin-800-normal.woff2") format("woff2"); }

:root {
  /* Colour. Black matches the photos' black bottoms, so images melt in. */
  --bg:       #000;
  --ink:      #f5f2ec;   /* warm white, like paper stock (19:1 on black) */
  --muted:    #b3ada3;   /* secondary text (9.6:1 on black) */
  --line:     #2e2c29;   /* rules on black */
  --red:      #d80621;   /* Canada red: fills (white on it: 5.3:1) */
  --red-text: #ff5446;   /* red for TEXT on black (6.2:1); --red itself is too dark for small type */
  --paper:    #f5f2ec;   /* fact cards */
  --paper-ink:#111;
  --yellow:   #ffde59;   /* focus rings only, echoing the billboard lettering */

  /* Type scale (mono reads large, so the body stays modest) */
  --step--1: clamp(.78rem, .76rem + .1vw, .84rem);
  --step-0:  clamp(.94rem, .9rem + .2vw, 1.04rem);
  --step-1:  clamp(1.1rem, 1rem + .45vw, 1.3rem);
  --step-2:  clamp(1.45rem, 1.2rem + 1.1vw, 2rem);
  --step-3:  clamp(1.9rem, 1.4rem + 2.3vw, 3.2rem);
  --step-4:  clamp(2.3rem, 1.5rem + 4vw, 5rem);

  --gutter: 16px;
  --measure: 64ch;
  --bar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
@media (min-width: 40rem) { :root { --gutter: 32px; } }

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.7 "JetBrains Mono", ui-monospace, monospace;
  font-variant-ligatures: none;   /* no code ligatures in prose */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; }
p { margin: 0 0 1.1em; }
strong { font-weight: 800; color: inherit; }
cite { font-style: normal; font-weight: 700; }
q { quotes: "\201C" "\201D"; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--red-text); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.cite-link { text-decoration: underline dotted; }

h2 {
  margin: 0 0 1.25rem;
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------------
   Hero: the billboard, unframed
   --------------------------------------------------------------------------- */
.hero { max-width: 1600px; margin: 0 auto; }
.hero picture { display: block; }
.hero img { display: block; width: 100%; height: auto; }

/* ---------------------------------------------------------------------------
   Lede
   --------------------------------------------------------------------------- */
.lede {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) clamp(2.5rem, 6vw, 4.5rem);
}
.lede h2 { font-size: var(--step-4); max-width: 14ch; }
/* red rule under the lede headline: the flag-red stripe at the top */
.lede h2::after { content: ""; display: block; width: 3.5rem; height: 6px; margin-top: 1.4rem; background: var(--red); }
.lede-body { max-width: var(--measure); }
.sub { font-size: var(--step-1); line-height: 1.6; }
@media (min-width: 64rem) {
  .lede { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: end; }
  .lede h2 { margin: 0; }
}

/* ---------------------------------------------------------------------------
   Buttons: one call to action, styled one way
   --------------------------------------------------------------------------- */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 52px;
  padding: .85em 1.4em;
  border: 2px solid transparent;
  font: 800 var(--step-0)/1.1 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #fff; color: var(--red); }
/* JS adds an arrow that flips when the letter panel is open */
.js [data-take-action]::after { content: "\2193"; font-weight: 800; }
.btn-primary[aria-expanded="true"] { background: #fff; color: var(--red); }
.btn-primary[aria-expanded="true"]::after { content: "\2191"; }
.btn-sm { min-height: 46px; padding: .6em 1.1em; font-size: var(--step--1); }

/* ---------------------------------------------------------------------------
   Chapters: numbered sections, heading left, body right on wide screens
   --------------------------------------------------------------------------- */
.chapter {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) var(--gutter);
}
.chapter-num {
  display: block;
  margin-bottom: 1rem;
  color: var(--red-text);
  font-weight: 800;
  font-size: var(--step--1);
  letter-spacing: .12em;
}
.chapter-num::after { content: " \2014\2014\2014"; letter-spacing: 0; }
.chapter-body { max-width: var(--measure); }
.chapter-body > :last-child { margin-bottom: 0; }
@media (min-width: 64rem) {
  .chapter { display: grid; grid-template-columns: 5fr 7fr; column-gap: 4rem; align-items: start; }
  .chapter-head h2 { margin: 0; }
  .chapter-body { grid-column: 2; }
  .chapter > .action-panel { grid-column: 2; }
}

/* Seven values, set as a numbered table */
.values {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  counter-reset: v;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
}
.values li {
  counter-increment: v;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  column-gap: .75rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}
.values li::before {
  content: counter(v, decimal-leading-zero);
  color: var(--red-text);
  font-weight: 800;
  grid-row: span 2;
  line-height: 1.6;
}
.values strong { font-size: var(--step-1); line-height: 1.3; }
.v-desc { color: var(--muted); grid-column: 2; }
@media (min-width: 64rem) {
  .values li { grid-template-columns: 4rem 16rem 1fr; align-items: baseline; }
  .values li::before { grid-row: auto; }
  .v-desc { grid-column: auto; }
}

/* ---------------------------------------------------------------------------
   Image breaks: full bleed, no frame
   --------------------------------------------------------------------------- */
.break { margin: 0 auto; max-width: 1600px; }
.break picture { display: block; }
.break img { display: block; width: 100%; height: auto; }
@media (min-width: 64rem) {
  /* keep a break from swallowing the whole screen; the lettering is at the top */
  .break img { max-height: 86vh; object-fit: cover; object-position: top; }
}

/* ---------------------------------------------------------------------------
   Pull-quote
   --------------------------------------------------------------------------- */
.pullquote {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 7vw, 6rem);
}
.pullquote blockquote {
  margin: 0;
  padding-left: clamp(1rem, 3vw, 2rem);
  border-left: 6px solid var(--red);
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.25;
  letter-spacing: -.02em;
  max-width: 32ch;
}
.pullquote figcaption {
  margin-top: 1rem;
  padding-left: calc(clamp(1rem, 3vw, 2rem) + 6px);
  color: var(--muted);
  font-size: var(--step--1);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.pullquote figcaption::before { content: "\2014 "; }

/* ---------------------------------------------------------------------------
   Factoid bands: full-width paper strips with a red top edge, like a
   newspaper data box. Facts sit in columns separated by hard rules, so they
   belong to the page instead of floating on it.
   --------------------------------------------------------------------------- */
.facts {
  display: grid;
  gap: 2.5rem var(--gutter);
  margin: 0;
  /* full bleed band, content held to the same 76rem column as the chapters */
  padding: clamp(2.5rem, 6vw, 4rem) max(var(--gutter), calc((100% - 76rem) / 2 + var(--gutter)));
  background: var(--paper);
  color: var(--paper-ink);
  border-top: 10px solid var(--red);
}
@media (min-width: 48rem) { .facts { grid-template-columns: 1fr 1fr; column-gap: 3rem; } }
/* two bands in a row read as one strip */
.facts + .facts { border-top: 0; padding-top: 0; }
.facts--single { grid-template-columns: 1fr !important; }
.facts--single .fact { max-width: 46rem; }
/* breathing room before the next black section */
.facts + .break, .facts + .chapter, .facts + .closing { margin-top: 0; }

.fact {
  margin: 0;
  display: flex;
  flex-direction: column;
  padding-top: 1.25rem;
  border-top: 3px solid var(--paper-ink);
  scroll-margin-top: 2rem;
}
.fact:target { outline: 4px solid var(--red); outline-offset: 8px; }
.fact-num {
  margin: 0 0 .75rem;
  color: var(--red);
  font-weight: 800;
  font-size: var(--step-4);
  line-height: 1;
  letter-spacing: -.05em;
}
.fact-unit { font-size: .38em; letter-spacing: -.01em; color: var(--paper-ink); }
.fact-text { margin-bottom: 1.25rem; max-width: 52ch; }
.fact-source {
  margin-top: auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap;
  padding-top: .9rem;
  border-top: 1px solid #cfc9be;
  font-size: var(--step--1);
}
/* plain-text citation: no outbound links */
.fact-cite { flex: 1 1 14rem; font-style: normal; color: #4a4741; line-height: 1.5; }

/* Comparison bars and the target gap, drawn flat */
.fact-viz { margin: 0 0 1.25rem; font-size: var(--step--1); }
.bar-row { display: grid; grid-template-columns: 4.5rem 1fr 3.5rem; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.bar { position: relative; height: 12px; background: #e3ded4; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: var(--v); background: var(--red); transform-origin: left; }
.bar-fill--ref { background: var(--paper-ink); }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.gap-track { position: relative; height: 14px; background: #e3ded4; }
.gap-track > span { position: absolute; top: 0; bottom: 0; }
.gap-achieved { left: 0; width: 42%; background: var(--red); transform-origin: left; }   /* 21 on a 0–50 scale */
.gap-missing { left: 42%; width: 38%; top: 6px !important; bottom: 6px !important; background: repeating-linear-gradient(90deg, var(--paper-ink) 0 6px, transparent 6px 10px); } /* 21 -> 40 */
.gap-target { left: 80%; width: 10%; background: var(--paper-ink); }                    /* 40 -> 45 */
.gap-ticks { position: relative; height: 1.5em; margin-top: .4rem; font-weight: 700; }
.tick { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.tick--now { left: 42%; color: var(--red); }
.tick--target { left: 85%; }

/* ---------------------------------------------------------------------------
   Share control (built by site.js): one small button, options slide out
   --------------------------------------------------------------------------- */
.share { position: relative; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.share-toggle {
  display: inline-flex; align-items: center; gap: .45em;
  min-height: 36px;
  padding: .3em .8em;
  border: 2px solid var(--paper-ink);
  background: transparent;
  color: var(--paper-ink);
  font: 800 var(--step--1)/1 "JetBrains Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}
.share-toggle:hover, .share-toggle[aria-expanded="true"] { background: var(--paper-ink); color: var(--paper); }
.share-toggle svg { width: 1.05em; height: 1.05em; }
.share-options { display: flex; gap: .3rem; margin: 0; padding: 0; list-style: none; order: -1; }
.share-options[hidden] { display: none; }
.share-options li { opacity: 0; transform: translateX(8px); animation: share-in .22s var(--ease) forwards; }
.share-options li:nth-child(2) { animation-delay: .03s; }
.share-options li:nth-child(3) { animation-delay: .06s; }
.share-options li:nth-child(4) { animation-delay: .09s; }
.share-options li:nth-child(5) { animation-delay: .12s; }
.share-options li:nth-child(6) { animation-delay: .15s; }
@keyframes share-in { to { opacity: 1; transform: none; } }
.share-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 0;
  background: var(--paper-ink);
  color: var(--paper);
  cursor: pointer;
}
.share-btn:hover { background: var(--red); color: #fff; }
.share-btn svg { width: 17px; height: 17px; }
@media (max-width: 30rem) {
  .share { flex: 1 1 auto; }
  /* options come after the toggle in the DOM; wrap below it so focus order matches */
  .share-options { order: 0; flex-basis: 100%; flex-wrap: wrap; justify-content: flex-end; }
}
.share-note {
  position: absolute; right: 0; bottom: calc(100% + .5rem);
  padding: .45em .8em;
  background: var(--paper-ink); color: var(--paper);
  font-size: var(--step--1); font-weight: 700;
  white-space: nowrap;
}
.share-note:empty { display: none; }

/* ---------------------------------------------------------------------------
   Closing ask: a solid red band
   --------------------------------------------------------------------------- */
.closing { background: var(--red); color: #fff; }
.closing-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) var(--gutter);
}
.closing h2 { font-size: var(--step-4); }
.closing p { font-size: var(--step-1); line-height: 1.6; max-width: 46ch; }
.closing .btn-primary { background: #fff; color: var(--red); }
.closing .btn-primary:hover, .closing .btn-primary[aria-expanded="true"] { background: #000; color: #fff; }
.closing a:hover { color: #000; }
.closing :focus-visible { outline-color: #fff; }

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
footer {
  padding: 2rem var(--gutter) 2.5rem;
  color: var(--muted);
  font-size: var(--step--1);
  text-align: center;
}
footer p { margin: 0 auto; max-width: 60ch; }
footer .footer-org { margin-bottom: .75rem; color: var(--ink); }
footer a { color: var(--ink); }
.js body.has-bar footer { padding-bottom: calc(var(--bar-h) + 2.5rem); }

/* ---------------------------------------------------------------------------
   Sticky "write" bar (index only; shown by site.js)
   --------------------------------------------------------------------------- */
.action-bar {
  position: fixed;
  z-index: 50;
  left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  padding: 8px var(--gutter) max(8px, env(safe-area-inset-bottom));
  background: #000;
  border-top: 2px solid var(--red);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform .25s var(--ease), visibility 0s .25s;
}
.action-bar.is-shown { transform: none; visibility: visible; transition: transform .25s var(--ease), visibility 0s; }
.action-bar .btn { width: min(100%, 28rem); }

/* ---------------------------------------------------------------------------
   Letter tool panel (Climate Budget iframe), opened inline by take-action.js
   --------------------------------------------------------------------------- */
.action-panel {
  margin: 1.5rem 0 .5rem;
  border: 2px solid var(--ink);
  background: var(--ink);
  scroll-margin-top: 1rem;
}
.closing .action-panel { border-color: #fff; background: #fff; }
.action-panel:focus { outline: none; }
.action-panel:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem .5rem .5rem 1rem;
  background: #000;
  color: #fff;
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.panel-close {
  display: inline-flex; align-items: center; gap: .45em;
  min-height: 36px;
  padding: .3em .8em;
  border: 2px solid #fff;
  background: transparent;
  color: #fff;
  font: 800 var(--step--1)/1 "JetBrains Mono", ui-monospace, monospace;
  text-transform: uppercase;
  cursor: pointer;
}
.panel-close:hover { background: #fff; color: #000; }
.panel-close svg { width: .9em; height: .9em; }
.action-frame {
  display: block;
  width: 1px;            /* iOS iframe width bug: width:1px + min-width:100% */
  min-width: 100%;
  border: 0;
  background: #fff;      /* the tool renders on light */
  transition: height .3s var(--ease);
}
.action-panel.is-open { animation: panel-in .25s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------------------------------------------------------------------------
   Motion: a short rise on scroll, only where supported and wanted
   --------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; translate: 0 1rem; } }
@keyframes draw { from { scale: 0 1; } }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .lede h2 { animation: rise .6s var(--ease) .1s both; }
  .lede-body { animation: rise .6s var(--ease) .25s both; }
  @supports (animation-timeline: view()) {
    .chapter-head, .chapter-body, .fact, .pullquote blockquote, .values li {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
    .gap-achieved, .bar-fill { animation: draw linear both; animation-timeline: view(); animation-range: entry 40% cover 45%; }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .share-options li { opacity: 1; transform: none; }
  .action-bar { transform: none; opacity: 0; }
  .action-bar.is-shown { opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Subpage (/write/)
   --------------------------------------------------------------------------- */
.page-write .lede { display: block; max-width: 52rem; padding-top: clamp(1.5rem, 4vw, 3rem); }
.page-write .tool-wrap { max-width: 52rem; margin: 0 auto; padding: 0 var(--gutter) 4rem; }
.back-link { display: inline-block; margin-bottom: 2rem; color: var(--muted); font-size: var(--step--1); }
.h2-like {
  margin: 0 0 1.25rem;
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.h2-like::after { content: ""; display: block; width: 3.5rem; height: 6px; margin-top: 1.2rem; background: var(--red); }
