/* Grundlagen, die im Prototyp das Artifact-Gerüst setzt */
html{-webkit-text-size-adjust:100%}
body{margin:0}
img{max-width:100%}
[hidden]{display:none!important}

/* Layout: a dendrochronology specimen sheet. Calculator first, the cross-section
   grows one ring per tree year; below it the unit, the examples, the caveats.
   Palette: lichen paper, spruce ink, sap amber for tree years, smoke for CO₂. */
:root{
  --lichen:#E6EAE1;     /* page */
  --bark-paper:#F4F6F1; /* surfaces */
  --spruce:#16271F;     /* ink */
  --needle:#43554B;
  --moss-grey:#6E7D73;
  --sap:#B4690E;        /* tree years: the answer */
  --smoke:#5E5B78;      /* CO₂: the problem */
  --bark:#6B4A2B;

  --bg:var(--lichen);
  --surface:var(--bark-paper);
  --text:var(--spruce);
  --text-2:var(--needle);
  --text-3:var(--moss-grey);
  --rule:rgba(22,39,31,0.14);
  --accent:var(--sap);
  --accent-soft:rgba(180,105,14,0.12);
  --heat:var(--smoke);
  --ring:var(--bark);
  --ring-fill:#E7DCC8;
  --mockline:rgba(22,39,31,0.11);
  --tray:#DDE3D7;
  --code-bg:#16271F; --code-text:#D8E2D9; --code-dim:#8FA197; --code-rule:rgba(216,226,217,0.12); --code-accent:#E8A84A;

  --display:'Fraunces', Georgia, 'Times New Roman', serif;
  --body:'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  --mono:'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --bg:#0F1A15; --surface:#16241D; --text:#E4EAE0; --text-2:#AEBBB2; --text-3:#7E8D84;
    --rule:rgba(228,234,224,0.13); --accent:#E8A84A; --accent-soft:rgba(232,168,74,0.14);
    --heat:#A9A5CF; --ring:#C29A6B; --ring-fill:#231F18; --mockline:rgba(228,234,224,0.11); --tray:#122019; --code-bg:#0A120E;
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0F1A15; --surface:#16241D; --text:#E4EAE0; --text-2:#AEBBB2; --text-3:#7E8D84;
  --rule:rgba(228,234,224,0.13); --accent:#E8A84A; --accent-soft:rgba(232,168,74,0.14);
  --heat:#A9A5CF; --ring:#C29A6B; --ring-fill:#231F18; --mockline:rgba(228,234,224,0.11); --tray:#122019; --code-bg:#0A120E;
}

*{box-sizing:border-box}
body{
  background:var(--bg); color:var(--text);
  font-family:var(--body); font-size:1.0625rem; line-height:1.6;
  -webkit-font-smoothing:antialiased;
  padding-left:max(16px, env(safe-area-inset-left, 0px));
  padding-right:max(16px, env(safe-area-inset-right, 0px));
}
.wrap{max-width:1040px; margin:0 auto; padding-block:48px 72px; display:flex; flex-direction:column; gap:88px}
h1,h2,h3{font-family:var(--display); font-weight:600; font-variation-settings:"SOFT" 100, "WONK" 1; letter-spacing:-0.02em; line-height:1.05; margin:0; text-wrap:balance}
.specimen{display:flex; gap:18px; flex-wrap:wrap; font-family:var(--mono); font-size:0.72rem; letter-spacing:0.08em; text-transform:uppercase; color:var(--text-3); border-top:1px solid var(--rule); padding-top:10px; margin-top:12px; font-variant-numeric:tabular-nums}
.specimen b{font-weight:500; color:var(--text-2)}
p{margin:0}
.label{font-family:var(--mono); font-size:0.6875rem; letter-spacing:0.16em; text-transform:uppercase; color:var(--text-3)}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent); outline-offset:3px; border-radius:4px}

/* ---------- masthead ---------- */
.mast{display:flex; justify-content:space-between; align-items:baseline; gap:16px; flex-wrap:wrap}
.wordmark{font-family:var(--display); font-weight:700; font-variation-settings:"SOFT" 100, "WONK" 1; font-size:1.35rem; letter-spacing:-0.02em; display:flex; align-items:center; gap:10px}
.wordmark svg{width:30px; height:30px; color:var(--accent)}
.factors{display:flex; flex-wrap:wrap; gap:8px; list-style:none; padding:0; margin:0}
.factors li{font-family:var(--mono); font-size:0.78rem; padding:5px 12px; border:1px solid var(--rule); border-radius:100px; color:var(--text-2)}
.after{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:32px 48px}
@media (max-width:820px){.after{grid-template-columns:1fr; gap:24px}}
.after-head{grid-column:1/-1; display:flex; flex-direction:column; gap:14px; max-width:62ch}
.after-head h2{font-size:clamp(1.6rem,3vw,2.2rem)}
.after-head p{color:var(--text-2)}
.after h3{font-size:1.15rem; letter-spacing:-0.02em; margin-bottom:8px}
.after p{color:var(--text-2); font-size:0.98rem}
.feel{font-family:var(--display); font-variation-settings:"SOFT" 100, "WONK" 1; font-weight:500; font-size:clamp(1.5rem,3.2vw,2.3rem); line-height:1.2; letter-spacing:-0.02em; max-width:30ch; text-wrap:balance}
.feel em{color:var(--accent)}
.src{font-size:0.82rem; color:var(--text-3); display:flex; flex-direction:column; gap:4px}
.src a{color:var(--text-3)}

/* ---------- calculator ---------- */
.calc{display:flex; flex-direction:column; gap:40px}
.c-head .lede{max-width:60ch}
.equation{display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1.15fr); gap:28px; align-items:start; background:var(--surface); border:1px solid var(--rule); border-radius:20px; padding:32px}
.eq-in, .eq-out{display:flex; flex-direction:column; gap:12px; min-width:0}
.eq-in .input-row, .eq-in .presets{margin-top:0}
.eq-in .field{background:var(--bg)}
.eq-sign{align-self:center; font-family:var(--display); font-size:clamp(2.6rem,5vw,4rem); font-weight:400; color:var(--text-3); line-height:1}
.eq-out-row{display:flex; align-items:center; gap:24px}
.eq-out .stump{flex:0 0 clamp(110px,14vw,160px); margin:0; max-width:none}
.eq-out .specimen{display:none}
.eq-out .stump figcaption{font-size:0.68rem; margin-top:8px; white-space:nowrap}
.eq-out .stump svg *{vector-effect:non-scaling-stroke}
.eq-out .result{margin-top:0; min-width:0}
.eq-out .result .big{font-size:clamp(2.4rem,5vw,4rem)}
@media (min-width:821px){.eq-out .result .big{white-space:nowrap}}
.eq-out .result .big.long{font-size:clamp(2rem,3.6vw,3rem)}
.eq-out .result .sentence{font-size:1.02rem}
.calc-unit{display:flex; flex-direction:column}
.equation{position:relative; z-index:1}
.take{position:relative; z-index:0; margin:-20px 28px 0; padding:52px 32px 32px; background:var(--tray); border-radius:0 0 20px 20px}
.eq-out .exact{display:none}
.take{display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,0.8fr); gap:32px 40px; align-items:center}
.take-text{display:flex; flex-direction:column; gap:14px; align-items:flex-start}
.take-text h2{font-size:clamp(1.5rem,2.6vw,2rem)}
.take-text p{color:var(--text-2)}
.take-text .embed-actions{flex-direction:column; align-items:flex-start; gap:10px}
.take-text textarea{width:100%}
@media (max-width:820px){
  .equation{grid-template-columns:1fr; padding:22px; gap:16px}
  .eq-sign{align-self:center; font-size:2.4rem}
  .take{grid-template-columns:1fr; gap:24px; margin:-16px 12px 0; padding:40px 18px 22px}
}
input[type=number]{-moz-appearance:textfield; appearance:textfield}
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none; margin:0}
.calc h1{font-size:clamp(2.4rem,5.6vw,4.3rem); font-weight:500; letter-spacing:-0.03em; line-height:1.0}
.calc h1 em{font-style:italic; color:var(--accent)}
.lede{color:var(--text-2); max-width:46ch; margin-top:18px}

.input-row{display:flex; gap:10px; margin-top:32px; flex-wrap:wrap; align-items:stretch}
.field{display:flex; align-items:center; background:var(--surface); border:1px solid var(--rule); border-radius:12px; padding:0 6px 0 18px; flex:1 1 220px; min-width:0}
.field:focus-within{border-color:var(--heat)}
.field input{flex:1; min-width:0; border:0; background:transparent; color:var(--text); font-family:var(--mono); font-size:1.6rem; padding:14px 0; font-variant-numeric:tabular-nums}
.field input:focus{outline:none}
.field select{border:0; background:transparent; color:var(--heat); font-family:var(--mono); font-size:1rem; padding:10px; cursor:pointer}
.co2{font-family:var(--mono); color:var(--heat); font-size:0.95rem; padding-right:6px}

.presets{display:flex; flex-wrap:wrap; gap:8px; margin-top:16px}
.presets button{
  font:500 0.85rem var(--body); color:var(--text-2); background:transparent;
  border:1px solid var(--rule); border-radius:100px; padding:7px 14px; cursor:pointer;
  transition:border-color .15s, color .15s;
}
.presets button:hover{border-color:var(--accent); color:var(--text)}
.presets button[aria-pressed="true"]{background:var(--accent-soft); border-color:var(--accent); color:var(--text)}

.result{margin-top:36px; display:flex; flex-direction:column; gap:6px}
.result .big{font-family:var(--display); font-weight:700; font-variation-settings:"SOFT" 100, "WONK" 0; font-size:clamp(2.8rem,6.4vw,4.8rem); letter-spacing:-0.03em; line-height:1; color:var(--accent); font-variant-numeric:tabular-nums}
.result .sentence{font-size:1.15rem; max-width:44ch}
.result .exact{font-family:var(--mono); font-size:0.8rem; color:var(--text-3); font-variant-numeric:tabular-nums}

.stump{position:relative; max-width:400px; width:100%; margin-inline:auto}
.stump svg{width:100%; height:auto; aspect-ratio:1; display:block}
.stump figcaption{font-family:var(--mono); font-size:0.75rem; color:var(--text-3); text-align:center; margin-top:10px}

/* ---------- why ---------- */
.why{display:grid; grid-template-columns:minmax(0,0.9fr) minmax(0,1.1fr); gap:56px}
@media (max-width:820px){.why{grid-template-columns:1fr; gap:24px}}
.why h2{font-size:clamp(1.8rem,3.6vw,2.6rem)}
.prose{display:flex; flex-direction:column; gap:16px; max-width:62ch; color:var(--text-2)}
.prose strong{color:var(--text); font-weight:600}

/* ---------- examples ---------- */
.examples h2{font-size:clamp(1.6rem,3vw,2.2rem); margin-bottom:28px}
.table-wrap{overflow-x:auto}
table{width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; min-width:560px}
th{font-family:var(--mono); font-size:0.6875rem; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-3); font-weight:400; text-align:left; padding:0 16px 12px 0; border-bottom:1px solid var(--rule)}
td{padding:18px 16px 18px 0; border-bottom:1px solid var(--rule); vertical-align:baseline}
td.num{font-family:var(--mono); white-space:nowrap}
td.co2v{color:var(--heat)}
td.ty{color:var(--accent); font-weight:500}
td .note{display:block; font-size:0.85rem; color:var(--text-3); margin-top:2px}
th.num, td.num{text-align:right}

/* ---------- unit ---------- */
.unit{background:var(--surface); border:1px solid var(--rule); border-radius:16px; padding:40px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:40px}
@media (max-width:820px){.unit{grid-template-columns:1fr; padding:28px 22px; gap:28px}}
.unit h2{font-size:clamp(1.6rem,3vw,2.2rem); margin-bottom:16px}
.formula{font-family:var(--mono); font-size:clamp(1.1rem,2.6vw,1.5rem); line-height:1.5; padding:24px 0; border-top:1px solid var(--rule); border-bottom:1px solid var(--rule)}
.formula .k{color:var(--accent)} .formula .c{color:var(--heat)}
pre{font-family:var(--mono); font-size:0.85rem; background:var(--bg); border:1px solid var(--rule); border-radius:10px; padding:16px 18px; margin:16px 0 0; overflow-x:auto; color:var(--text-2)}
.license{margin-top:16px; font-size:0.9rem; color:var(--text-3)}

/* ---------- embed ---------- */
.embed{margin-top:36px; padding-top:24px; border-top:1px solid var(--rule); display:flex; flex-direction:column; gap:10px}
.mock{background:var(--surface); border:1px solid var(--rule); border-radius:12px; overflow:hidden; color:var(--text)}
.mock-bar{display:flex; align-items:center; gap:6px; padding:10px 12px; border-bottom:1px solid var(--rule)}
.mock-bar i{width:9px; height:9px; border-radius:50%; background:var(--mockline)}
.mock-url{margin-left:10px; height:14px; flex:0 1 46%; border-radius:7px; background:var(--mockline)}
.mock-page{display:flex; flex-direction:column; gap:12px; padding:22px 22px 26px}
.ml{display:block; height:9px; border-radius:5px; background:var(--mockline)}
.ml-h{height:16px; width:48%; margin-bottom:6px}
.mock-row{display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:0.95rem}
#badge-slot{flex:none; max-width:100%}
.embed textarea{width:100%; resize:vertical; font-family:var(--mono); font-size:0.74rem; line-height:1.5; color:var(--text-2); background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:12px 14px; word-break:break-all}
.embed textarea:focus{outline:2px solid var(--accent); outline-offset:1px}
.embed-actions{display:flex; align-items:center; gap:14px; flex-wrap:wrap}
#copy-btn{font:700 0.95rem var(--body); color:var(--bg); background:var(--text); border:0; border-radius:100px; padding:11px 20px; cursor:pointer; transition:background .15s}
#copy-btn:hover{background:var(--accent)}
#show-btn{font:500 0.9rem var(--body); color:var(--text-2); background:transparent; border:1px solid var(--rule); border-radius:100px; padding:10px 18px; cursor:pointer}
#show-btn:hover{color:var(--text); border-color:var(--text-3)}
.cc{display:inline-flex; align-items:center; gap:10px; margin-top:16px; font-size:0.9rem; color:var(--text-3)}
.cc-mark{display:inline-flex; border:1.5px solid var(--text-2); border-radius:6px; overflow:hidden; font-family:var(--mono); font-size:0.72rem; font-weight:500; line-height:1; color:var(--text)}
.cc-mark span{padding:5px 7px}
.cc-mark span:first-child{background:var(--text); color:var(--bg)}
#copy-msg{font-size:0.9rem; color:var(--accent)}

/* ---------- curve + badge ---------- */
.curve, .badge-sec{display:grid; grid-template-columns:minmax(0,0.9fr) minmax(0,1.1fr); gap:56px; align-items:center}
@media (max-width:820px){.curve, .badge-sec{grid-template-columns:1fr; gap:24px}}
.curve h2, .badge-sec h2{font-size:clamp(1.6rem,3vw,2.2rem); color:var(--text)}
.chart svg{width:100%; height:auto; display:block}
.chart-legend{display:flex; flex-wrap:wrap; gap:18px; font-size:0.85rem; color:var(--text-3); margin-top:10px}
.chart-legend span{display:flex; align-items:center; gap:8px}
.sw{display:inline-block; width:22px; height:0; border-top:3px solid var(--ring)}
.sw-line{border-top:2px dashed var(--accent)}
.sw-avg{border-top:2px dotted var(--text-2)}
.scale-sec{display:flex; flex-direction:column; gap:32px}
.scale-text{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:48px; color:var(--text-2)}
.scale-text strong{color:var(--text); font-weight:700}
@media (max-width:820px){.scale-text{grid-template-columns:1fr; gap:16px}}
.scale-sec h2{font-size:clamp(1.6rem,3vw,2.2rem)}
.scale{position:relative; height:210px; margin-inline:8px}
.scale-axis{position:absolute; left:0; right:0; top:104px; height:2px; background:var(--rule)}
.scale-end{position:absolute; top:84px; font-family:var(--mono); font-size:0.7rem; color:var(--text-3)}
.scale-tick{position:absolute; top:84px; transform:translateX(-50%); font-family:var(--mono); font-size:0.7rem; color:var(--text-3); font-variant-numeric:tabular-nums}
.scale-mark{position:absolute; transform:translateX(-50%); display:flex; flex-direction:column; align-items:center; gap:4px; width:11em; text-align:center}
@media (max-width:820px){.scale-mark{width:8em}}
@media (max-width:520px){.scale-mark{width:6.2em}.scale-mark span{font-size:0.7rem}}
.scale-mark .dot{width:12px; height:12px; border-radius:50%; background:var(--ring)}
.scale-mark b{font-family:var(--mono); font-size:0.85rem; font-weight:500; font-variant-numeric:tabular-nums}
.scale-mark span{font-size:0.78rem; line-height:1.3; color:var(--text-2)}
.scale-mark.up{bottom:100px; flex-direction:column-reverse}
.scale-mark.down{top:98px}
.scale-mark.ty .dot{background:var(--accent); width:16px; height:16px}
.scale-mark.ty b{color:var(--accent)}
.badges{display:flex; flex-direction:column; gap:12px; align-items:flex-start}
.ty-badge{display:inline-flex; align-items:center; gap:10px; padding:9px 18px 9px 11px; border-radius:100px; background:#9A5A0C; color:#FFFFFF; font-size:0.95rem; font-weight:500; box-shadow:0 1px 2px rgba(0,0,0,.18)}
.ty-badge svg{width:24px; height:24px; color:#FFFFFF; flex:none}
.ty-badge b{font-weight:800}
.badges pre{align-self:stretch}

.code-panel{grid-column:1/-1; background:var(--code-bg); border-radius:14px; overflow:hidden}
.code-head{display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:10px 16px; font-family:var(--mono); font-size:0.7rem; letter-spacing:0.06em; color:var(--code-dim); border-bottom:1px solid var(--code-rule)}
.code-head span:first-child{color:var(--code-accent); letter-spacing:0.14em}
.code-panel textarea{display:block; width:100%; border:0; resize:none; background:transparent; color:var(--code-text); font-family:var(--mono); font-size:0.74rem; line-height:1.6; padding:14px 16px; word-break:break-all; height:9.5em}
.code-panel textarea:focus{outline:none}
.code-panel textarea::selection{background:var(--code-accent); color:var(--code-bg)}
.calc h1 em{white-space:nowrap}
.badge-sec{background:var(--tray); border:1px solid var(--rule); border-radius:20px; padding:40px}
@media (max-width:820px){.badge-sec{padding:26px 20px}}
.pull{grid-column:1/-1; padding-block:clamp(40px,7vw,96px); display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:24px 56px; align-items:end}
@media (max-width:820px){.pull{grid-template-columns:1fr}}
.pull blockquote{margin:0; position:relative; padding-top:0.6em}
.pull blockquote::before{content:"\201C"; position:absolute; top:-0.28em; left:-0.06em; font-family:var(--display); font-size:clamp(6rem,12vw,9rem); line-height:1; color:var(--accent); opacity:0.35}
.pull blockquote p{position:relative; font-family:var(--display); font-style:italic; font-variation-settings:"SOFT" 100, "WONK" 1; font-weight:400; font-size:clamp(1.6rem,3.4vw,2.5rem); line-height:1.2; letter-spacing:-0.015em; text-wrap:balance; color:var(--text)}
.pull blockquote p em{font-style:normal; font-weight:600; color:var(--accent); white-space:nowrap}
.pull .pull-note{color:var(--text-2); max-width:44ch}
/* ---------- honest ---------- */
.honest{display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:32px}
@media (max-width:820px){.honest{grid-template-columns:1fr; gap:28px}}
.honest-head{grid-column:1/-1}
.honest-head h2{font-size:clamp(1.6rem,3vw,2.2rem)}
.honest h3{font-size:1.15rem; letter-spacing:-0.02em; margin-bottom:8px}
.honest p{color:var(--text-2); font-size:0.98rem}

footer{display:flex; flex-direction:column; gap:36px; padding-top:36px; border-top:1px solid var(--rule); color:var(--text-3); font-size:0.88rem}
.sources h2{margin-bottom:14px}
.sources ol{margin:0; padding-left:1.4em; display:flex; flex-direction:column; gap:8px; max-width:80ch; font-size:0.85rem}
.sources li::marker{font-family:var(--mono); color:var(--accent)}
.sources a{color:var(--text-2); text-decoration-color:var(--rule); text-underline-offset:3px}
.sources a:hover{color:var(--text)}
.sources li:target{color:var(--text)}
.foot-line{display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap}
.foot-line a{color:var(--text-2); text-underline-offset:3px}
.foot-line a:hover{color:var(--text)}
sup.fn{font-family:var(--mono); font-size:0.62em; line-height:0; margin-left:2px; vertical-align:super}
sup.fn a{color:var(--accent); text-decoration:none; padding:0 1px}
sup.fn a:hover{text-decoration:underline}

@media (prefers-reduced-motion: no-preference){
  .stump circle.r, .stump path.r{transition:opacity .4s ease}
}

/* ---------- imprint & privacy ---------- */
.cc0{display:block; flex:none}
.legal{max-width:68ch; display:flex; flex-direction:column; gap:48px}
.legal h1{font-size:clamp(2.2rem,5vw,3.4rem); font-weight:500}
.legal h2{font-size:1.5rem; margin-bottom:12px}
.legal h3{font-family:var(--body); font-size:1rem; font-weight:700; letter-spacing:0; margin:20px 0 4px}
.legal p, .legal li{color:var(--text-2)}
.legal p + p{margin-top:10px}
.legal ul{margin:8px 0 0; padding-left:1.2em; display:flex; flex-direction:column; gap:4px}
.legal .stand{font-family:var(--mono); font-size:0.8rem; color:var(--text-3); margin-top:12px}
.legal address{font-style:normal; color:var(--text)}
.legal dl{display:grid; grid-template-columns:max-content 1fr; gap:6px 24px; margin:12px 0 0}
.legal dt{color:var(--text-3)}
.legal dd{margin:0; color:var(--text)}
@media (max-width:520px){.legal dl{grid-template-columns:1fr; gap:2px} .legal dd{margin-bottom:10px}}
.back{font-family:var(--mono); font-size:0.8rem}
