/* GROWTH-2: embedded calculators (/embed/<slug>.html) and the page with their code (/embed/). Light by default; dark with ?theme=dark,
   or following the visitor's device with ?theme=auto (js/embed.js sets data-theme on <html>). */

/* the code page */
.embed-theme { margin:0 0 20px; }
.embed-offer { display:grid; gap:20px; margin:0 0 24px; }
.embed-offer-item { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:18px 18px 14px; }
.embed-offer-item h2 { font-size:20px; margin:0 0 6px; }
.embed-offer-item p { margin:0 0 12px; }
.embed-code-label { display:block; font-weight:600; font-size:15px; margin:0 0 6px; }
.embed-code { width:100%; box-sizing:border-box; font-size:13px; line-height:1.45; padding:10px 12px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--paper); color:var(--ink); resize:vertical; overflow-wrap:anywhere; }

/* the embedded calculator */
body.embed { background:var(--paper); color:var(--ink); margin:0; }
body.embed main { padding:12px; }
.embed-wrap { max-width:760px; margin:0 auto; }
.embed-title { font-size:22px; line-height:1.25; margin:0 0 12px; text-wrap:balance; }
body.embed .tool-layout { margin:0; }
body.embed .result-strip { bottom:4px; }
.embed-note { font-size:13.5px; color:var(--muted); margin:14px 0 6px; }
.embed-credit { font-size:14px; margin:0 0 4px; }
.embed-credit a { color:var(--accent); font-weight:600; }

/* dark */
:root[data-theme="dark"] body.embed {
  --ink:#E6EBE4; --ink-2:#F2F5F0; --paper:#151B17; --paper-2:#1B231E; --panel:#1D2620;
  --line:#2F3B33; --line-strong:#43524A; --steel:#A9B6AC; --muted:#A3B0A6; --brass-text:#E2B66E;
  --accent:#8FCB9B; --accent-dark:#A6D8B0; --go:#8FCB9B; --go-bg:#21352A;
  --caution:#F0A64A; --caution-bg:#3A2C17; --alarm:#F08A8A; --alarm-bg:#3B1E1E;
  --brass:#D2A15A; --brass-soft:#3A3020; --sage:#1F2A23;
  --ring:0 0 0 3px rgba(143,203,155,0.35);
  color-scheme:dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] body.embed {
    --ink:#E6EBE4; --ink-2:#F2F5F0; --paper:#151B17; --paper-2:#1B231E; --panel:#1D2620;
    --line:#2F3B33; --line-strong:#43524A; --steel:#A9B6AC; --muted:#A3B0A6; --brass-text:#E2B66E;
    --accent:#8FCB9B; --accent-dark:#A6D8B0; --go:#8FCB9B; --go-bg:#21352A;
    --caution:#F0A64A; --caution-bg:#3A2C17; --alarm:#F08A8A; --alarm-bg:#3B1E1E;
    --brass:#D2A15A; --brass-soft:#3A3020; --sage:#1F2A23;
    --ring:0 0 0 3px rgba(143,203,155,0.35);
    color-scheme:dark;
  }
}
/* tools.css has a few literal white backgrounds and dark-on-light text; in dark they follow the tokens */
:root[data-theme="dark"] body.embed .tool-field input, :root[data-theme="dark"] body.embed .tool-field select,
:root[data-theme="dark"] body.embed .segmented, :root[data-theme="dark"] body.embed .working-formula { background:var(--paper-2); color:var(--ink); }
:root[data-theme="dark"] body.embed .segmented input:checked + span { background:var(--accent); color:#10160F; }
:root[data-theme="dark"] body.embed .result-strip { background:var(--panel); color:var(--ink); border:1px solid var(--line-strong); }
:root[data-theme="dark"] body.embed .result-warning, :root[data-theme="dark"] body.embed .ref-note { color:#F6D3A0; }
:root[data-theme="dark"] body.embed .btn-primary { background:var(--accent); border-color:var(--accent); color:#10160F; }
:root[data-theme="dark"] body.embed .btn-outline { color:var(--ink); border-color:var(--line-strong); background:transparent; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] body.embed .tool-field input, :root[data-theme="auto"] body.embed .tool-field select,
  :root[data-theme="auto"] body.embed .segmented, :root[data-theme="auto"] body.embed .working-formula { background:var(--paper-2); color:var(--ink); }
  :root[data-theme="auto"] body.embed .segmented input:checked + span { background:var(--accent); color:#10160F; }
  :root[data-theme="auto"] body.embed .result-strip { background:var(--panel); color:var(--ink); border:1px solid var(--line-strong); }
  :root[data-theme="auto"] body.embed .result-warning, :root[data-theme="auto"] body.embed .ref-note { color:#F6D3A0; }
  :root[data-theme="auto"] body.embed .btn-primary { background:var(--accent); border-color:var(--accent); color:#10160F; }
  :root[data-theme="auto"] body.embed .btn-outline { color:var(--ink); border-color:var(--line-strong); background:transparent; }
}
/* diagrams stay as drawn, dark on their white panel, in both themes */
:root[data-theme="dark"] body.embed .ref-visual, :root[data-theme="dark"] body.embed svg.vz {
  --ink:#28352A; --steel:#5C6B5F; --accent:#2F5D3A; --brass:#A9762F; --alarm:#B91C1C; --line:#DDE2D9; --paper:#F5F4F0; --panel:#FBFAF7; --go:#2F5D3A; --caution:#D97706;
}
:root[data-theme="dark"] body.embed .ref-visual figcaption { color:#A9B6AC; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] body.embed .ref-visual, :root[data-theme="auto"] body.embed svg.vz {
    --ink:#28352A; --steel:#5C6B5F; --accent:#2F5D3A; --brass:#A9762F; --alarm:#B91C1C; --line:#DDE2D9; --paper:#F5F4F0; --panel:#FBFAF7; --go:#2F5D3A; --caution:#D97706;
  }
  :root[data-theme="auto"] body.embed .ref-visual figcaption { color:#A9B6AC; }
}
