/* ═══════════════════════════════════════════════════════════════════════════
   Bonsai — the document pages: /mission, /impact, /privacy, /terms

   The bench, set as a single reading column. Same materials bench.css and
   tools.css use — cream card stock, the punched specimen tag, the typewriter
   label, the letterpress button — and the same rule underneath all of them:

     EVERY SURFACE CATCHES LIGHT ON ITS TOP EDGE.

   One stylesheet for four pages rather than four. They were four before: two
   files and two inline <style> blocks, which is how /privacy and /terms came to
   be styled by a near-copy of each other. Anything specific to one page is
   marked with the page it belongs to.

   A file rather than a <style> block for the reason bench.css is: inline CSS
   can only be permitted by 'unsafe-inline', and a statically served page has no
   build step able to hand out nonces. Moving /privacy and /terms out here is
   what lets those two carry a Content-Security-Policy at all.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── paper & ink ── */
  --paper:        #efe6d3;
  --paper-lit:    #f7f0df;
  --paper-panel:  #f6efdf;
  --paper-deep:   #e5d9bd;
  --ink:          #2b2618;
  --ink-soft:     #5b5340;
  --ink-faint:    #6f6450;
  --ink-ghost:    #8d8168;
  --line:         #d6c8a8;
  --line-strong:  #c3b290;

  /* ── the garden ── */
  --forest:       #34503a;
  --forest-deep:  #25402b;
  --forest-dark:  #1e3423;
  --leaf:         #4c6b46;

  /* ── the correction ink: /impact's warnings, weak-confidence tags ── */
  --seal:         #8f3b2c;
  --seal-deep:    #6f2c20;
  --seal-wash:    rgba(143, 59, 44, .09);

  /* One typewriter, not two. /impact used to reach for a system mono stack to
     avoid a second webfont download; Courier Prime is already on the page for
     every tag and label, so its figures, formulas and tables use it too. */
  --mono: 'Courier Prime', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-tag:   0.6875rem;
  --t-typed: 0.75rem;

  --maxw: 1180px;
  --col:  48rem;
  --rail-h: 3.25rem;

  --lip:       inset 0 1px 0 rgba(255,255,255,.72);
  --lip-soft:  inset 0 1px 0 rgba(255,255,255,.5);
  --lift-1:    0 1px 2px rgba(43,38,24,.10);
  --lift-2:    0 2px 4px rgba(43,38,24,.10), 0 14px 26px -18px rgba(43,38,24,.42);

  --ease: cubic-bezier(.22,.8,.32,1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }

/* The bench surface: paper grain, a faint field-notebook grid, and a vignette
   so the middle of the page reads as the lit part of the desk. */
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 80% at 50% 0%, rgba(255,252,242,.55), transparent 60%),
    radial-gradient(100% 60% at 50% 100%, rgba(90,74,53,.06), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120,100,60,.055) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(120,100,60,.045) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(120,100,60,.02) 0 1px, transparent 1px 3px);
  background-attachment: fixed, fixed, scroll, scroll, scroll;
  color: var(--ink);
  font-family: 'Spectral', Georgia, 'Times New Roman', serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(52,80,58,.2); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2rem); }
.col  { width: 100%; max-width: var(--col); margin-inline: auto; }
img, svg { display: block; max-width: 100%; }

a { color: var(--forest); text-decoration-color: var(--line-strong);
    text-decoration-thickness: 1px; text-underline-offset: 3px;
    transition: color .18s ease, text-decoration-color .18s ease; }
a:hover { color: var(--forest-deep); text-decoration-color: var(--forest); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; border-radius: 2px; }


/* ═══ MATERIALS ══════════════════════════════════════════════════════════════ */

/* TAG — the punched typed label that opens every page on the bench. */
.tag {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 27px; padding: 0 .7rem 0 .55rem;
  background: linear-gradient(180deg, #fbf6e9, #ede3cb);
  border: 1px solid var(--line-strong); border-radius: 2px;
  box-shadow: var(--lip), var(--lift-1);
  font-family: var(--mono);
  font-size: var(--t-tag); font-weight: 700; letter-spacing: .17em;
  text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255,255,255,.85);
  text-decoration: none;
}
.tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--paper-deep);
  box-shadow: inset 0 1px 1.5px rgba(43,38,24,.5), 0 1px 0 rgba(255,255,255,.6);
}
.tag-leaf::before { background: var(--leaf); box-shadow: inset 0 1px 1px rgba(255,255,255,.35); }

/* TYPED — the field-journal typewriter voice. */
.typed {
  font-family: var(--mono);
  font-size: var(--t-typed); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-ghost);
}

/* BUTTON — letterpress, not plastic. Ink pressed into paper. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  padding: .8rem 1.6rem; border-radius: 3px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .18s ease,
              background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #3d5c42 0%, var(--forest) 45%, #2b4630 100%);
  color: #f5f0e3; border-color: #1f3324;
  text-shadow: 0 1px 0 rgba(0,0,0,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -2px 0 rgba(0,0,0,.2),
              0 2px 3px rgba(43,38,24,.16), 0 14px 26px -16px rgba(37,64,43,.8);
}
.btn-primary:hover { background: linear-gradient(180deg, #446649 0%, #375440 45%, #2c4a32 100%); color: #f5f0e3; }
.btn-primary:active { box-shadow: inset 0 2px 5px rgba(0,0,0,.34), 0 1px 1px rgba(43,38,24,.2); }
.btn-ghost {
  background: linear-gradient(180deg, #fbf6e9, #ece2c9);
  color: var(--forest-deep); border-color: var(--line-strong);
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
  box-shadow: var(--lip), var(--lift-1), 0 10px 20px -16px rgba(43,38,24,.5);
}
.btn-ghost:hover { border-color: var(--ink-ghost); color: var(--forest-dark); }
.btn-ghost:active { box-shadow: inset 0 2px 4px rgba(43,38,24,.2); }
.btn-lg { font-size: 1.0625rem; padding: .95rem 1.9rem; }


/* ═══ THE RAIL ═══════════════════════════════════════════════════════════════ */
.rail {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, rgba(247,240,223,.96), rgba(239,230,211,.92));
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
  backdrop-filter: blur(9px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.rail::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px;
  background: linear-gradient(180deg, rgba(43,38,24,.07), transparent);
  pointer-events: none;
}
.rail-inner { display: flex; align-items: center; gap: 1.5rem; height: var(--rail-h); }
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 1.0625rem; font-weight: 600; color: var(--forest-deep);
  text-decoration: none; flex: none;
}
.brand-leaf { width: 22px; height: 22px; object-fit: contain; }
.rail-links { display: flex; align-items: center; gap: 1.35rem; margin-inline: auto; }
.rail-links a {
  font-size: .9375rem; color: var(--ink-soft); text-decoration: none;
  position: relative; padding-block: .3rem; transition: color .18s ease;
}
.rail-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--leaf); transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.rail-links a:hover { color: var(--forest-deep); }
.rail-links a:hover::after, .rail-links a[aria-current="page"]::after { transform: scaleX(1); }
.rail-links a[aria-current="page"] { color: var(--forest-deep); }
.rail-end { display: flex; align-items: center; gap: .85rem; flex: none; margin-left: auto; }
.rail-signin { font-size: .9375rem; color: var(--ink-soft); text-decoration: none; }
.rail-signin:hover { color: var(--forest-deep); }
.rail .btn { padding: .5rem 1rem; font-size: .9375rem; }
.rail-links + .rail-end { margin-left: 0; }


/* ═══ THE ARTICLE ════════════════════════════════════════════════════════════ */
.page { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem); }

.masthead { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.masthead h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.15rem); font-weight: 500;
  line-height: 1.05; letter-spacing: -.02em; color: var(--forest-deep);
  text-wrap: balance;
}
.lead, .standfirst {
  font-size: 1.1875rem; line-height: 1.6; color: var(--ink-soft);
  text-wrap: pretty; max-width: 58ch;
}
/* /privacy, /terms — the revision line, typed like a stamp on a filed document */
.updated {
  font-family: var(--mono);
  font-size: var(--t-typed); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-ghost); margin-bottom: 0;
}
.rule-double { position: relative; height: 1px; background: var(--line-strong); margin-top: 2rem; }
.rule-double::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 1px; background: var(--line); }

section { padding-top: clamp(2.25rem, 5vw, 3rem); }
section + section { border-top: 1px solid var(--line); margin-top: clamp(2.25rem, 5vw, 3rem); }

h1 + p, .rule-double + p, .updated + p { margin-top: 2rem; }

h2 {
  font-size: clamp(1.4rem, 3vw, 1.75rem); font-weight: 500; line-height: 1.18;
  letter-spacing: -.015em; color: var(--forest-deep);
  margin: 2.5rem 0 .85rem; text-wrap: balance;
}
section > h2:first-child { margin-top: 0; }
h3 {
  font-size: 1.0625rem; font-weight: 600; line-height: 1.35; color: var(--ink);
  margin: 1.75rem 0 .5rem;
}

p { margin-bottom: 1rem; max-width: 68ch; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }
sup { font-size: .7em; vertical-align: super; line-height: 0; }

ul, ol { margin: 0 0 1rem 1.35rem; max-width: 68ch; }
li { margin-bottom: .45rem; }
li:last-child { margin-bottom: 0; }
li::marker { color: var(--ink-ghost); }

code, .num { font-family: var(--mono); font-size: .875em; font-variant-numeric: tabular-nums; }
code {
  background: linear-gradient(180deg, #fbf6e9, #f0e7d1);
  border: 1px solid var(--line); border-radius: 2px; padding: .06em .34em;
  box-shadow: var(--lip-soft);
}
.num { font-weight: 700; color: var(--forest-deep); }

/* /mission — the model licence note, set small and quiet under its section */
.licences { font-size: .875rem; line-height: 1.65; color: var(--ink-faint); margin-top: 1rem; }


/* ═══ /impact ════════════════════════════════════════════════════════════════
   The methodology page's own furniture: headline figures, the derivation
   chain, the formula block, the constants table and the correction log.
   ═══════════════════════════════════════════════════════════════════════════ */

/* headline figures — three small plates */
.figures { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-top: 1.5rem; }
.fig {
  padding: 1.05rem 1.15rem; border-radius: 3px;
  background: linear-gradient(180deg, var(--paper-lit), var(--paper-panel) 50%, var(--paper-deep));
  border: 1px solid var(--line); box-shadow: var(--lip), var(--lift-2);
}
.fig-n {
  display: block; font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  color: var(--forest-deep); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.fig-l { display: block; font-size: .9375rem; line-height: 1.45; color: var(--ink-soft); margin-top: .35rem; }

/* the derivation chain — typed folios with a hairline spine, as on /tools */
.chain { list-style: none; counter-reset: step; margin: 1.5rem 0 0; display: flex; flex-direction: column; gap: 1.15rem; }
.chain li { counter-increment: step; position: relative; padding-left: 3.1rem; margin-bottom: 0; max-width: 68ch; }
.chain li::before {
  content: "No. " counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: .28em;
  font-family: var(--mono); font-size: .625rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--leaf);
  font-variant-numeric: tabular-nums;
}
.chain li::after {
  content: ""; position: absolute; left: 0; top: 2em; bottom: -.4rem; width: 1px; background: var(--line);
}
.chain li:last-child::after { display: none; }
.chain b { display: block; font-weight: 600; }
.chain span { color: var(--ink-soft); }

/* the formula — a sunken sheet, the way a plate's interior reads */
.formula {
  font-family: var(--mono); font-size: .875rem; line-height: 1.95;
  margin: 1.5rem 0; padding: 1.05rem 1.2rem; border-radius: 3px;
  background: linear-gradient(180deg, #fdfaf1, #f6efdd);
  border: 1px solid var(--line); border-left: 3px solid var(--leaf);
  box-shadow: inset 0 0 0 1px rgba(43,38,24,.05), inset 0 2px 6px -3px rgba(43,38,24,.18);
  color: var(--ink); overflow-x: auto; white-space: pre;
}

/* the constants table — ruled like the ledger on the landing page */
.scroller { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; width: 100%; min-width: 40rem; font-size: .9375rem; }
th, td { text-align: left; padding: .75rem 1rem .75rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--mono);
  font-size: .625rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-ghost); font-weight: 700; border-bottom: 1px solid var(--line-strong);
}
td.v { font-family: var(--mono); font-weight: 700; color: var(--forest-deep); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.s { color: var(--ink-soft); font-size: .875rem; }

/* how sure we are of a constant, said out loud on every row */
.conf {
  display: inline-block; white-space: nowrap;
  font-family: var(--mono); font-size: .5625rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .14rem .45rem; border-radius: 2px; box-shadow: var(--lip-soft);
}
.conf-firm { background: #dfe9dc; color: #2c4a32; border: 1px solid rgba(52,80,58,.28); }
.conf-mid  { background: #f2e7cf; color: #7a5a1e; border: 1px solid rgba(122,90,30,.3); }
.conf-weak { background: var(--seal-wash); color: var(--seal-deep); border: 1px solid rgba(143,59,44,.28); }

/* callouts: a note is filed, a warning is stamped */
.note, .warn {
  margin: 1.5rem 0; padding: 1rem 1.2rem; border-radius: 3px;
  font-size: .9375rem; line-height: 1.6; color: var(--ink-soft);
  border: 1px solid var(--line); box-shadow: var(--lip-soft), var(--lift-1);
}
.note {
  background: linear-gradient(180deg, rgba(244,246,238,.92), rgba(233,238,224,.75));
  border-left: 3px solid var(--forest);
}
.warn {
  background: linear-gradient(180deg, rgba(143,59,44,.09), rgba(143,59,44,.05));
  border-color: rgba(143,59,44,.24); border-left: 3px solid var(--seal);
}
.note p, .warn p { max-width: none; }
.note .lbl, .warn .lbl {
  display: block; margin-bottom: .4rem;
  font-family: var(--mono); font-size: .625rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
}
.note .lbl { color: var(--leaf); }
.warn .lbl { color: var(--seal); }
.note strong, .warn strong { color: var(--ink); }

/* the correction log — what we got wrong, kept on the page */
.defects { list-style: none; display: flex; flex-direction: column; gap: 1.15rem; margin: 1.25rem 0 0; }
.defects li { padding-left: 1.15rem; border-left: 2px solid var(--line-strong); margin-bottom: 0; max-width: 68ch; }
.defects b { display: block; font-weight: 600; }
.defects span { color: var(--ink-soft); }


/* ═══ THE CALL ═══════════════════════════════════════════════════════════════ */
.cta {
  margin-top: clamp(2.5rem, 5vw, 3.25rem); padding-top: 2rem;
  border-top: 1px solid var(--line-strong);
  display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.25rem;
}
.cta-note {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono);
  font-size: var(--t-typed); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-ghost);
}
.cta-note svg { width: 14px; height: 14px; color: var(--leaf); }


/* ═══ FOOTER ═════════════════════════════════════════════════════════════════ */
footer { padding-block: clamp(2.5rem, 5vw, 3.5rem); border-top: 1px solid var(--line-strong); }
footer::before { content: ""; display: block; height: 1px; background: var(--line); margin-top: -3px; margin-bottom: 2.5rem; }
.foot-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 3rem); align-items: start;
}
.foot-brand { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.foot-brand .typed { max-width: 30ch; text-transform: none; letter-spacing: .04em; line-height: 1.7; }
.foot-col h4 {
  font-family: var(--mono);
  font-size: var(--t-tag); font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .85rem;
}
.foot-col a { display: block; font-size: .9375rem; color: var(--ink-soft); text-decoration: none; padding-block: .28rem; }
.foot-col a:hover { color: var(--forest-deep); }
.foot-end {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 2.75rem; padding-top: 1.35rem; border-top: 1px solid var(--line);
}
.foot-copy { font-size: .8125rem; color: var(--ink-ghost); }
.foot-social { display: flex; gap: .35rem; }
.soc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none; border-radius: 3px;
  color: var(--ink-faint); border: 1px solid transparent; text-decoration: none;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}
.soc:hover { color: var(--forest-deep); background: var(--paper-panel); border-color: var(--line); }
.soc svg { width: 17px; height: 17px; }


/* ═══ RESPONSIVE ═════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .rail-links { display: none; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .formula { font-size: .78rem; }
  .cta { flex-direction: column; align-items: stretch; }
  .cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
