/* ═══════════════════════════════════════════════════════════
   The Ginger Grower's Compendium — stylesheet
   Palette: warm rhizome golds, leaf greens, paper cream
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:        #faf6ee;
  --bg-2:      #f3ecdd;
  --surface:   #fffdf8;
  --border:    #e6dcc8;
  --border-2:  #d4c5a5;
  --text:      #35301f;
  --muted:     #83795f;

  --leaf:      #2f6b3a;
  --leaf-2:    #4d9152;
  --leaf-soft: #e3efe0;
  --leaf-band: #35723e;

  --rhizome:   #d9a441;
  --rhizome-2: #b97f2e;
  --accent:    #b45d16;
  --accent-2:  #f0c36d;

  /* Focus ring: high contrast against the page background, unlike --leaf-soft. */
  --focus:     #1c4f2a;

  --danger-bg:   #fbeaea;
  --danger-bd:   #d99a9a;
  --warn-bg:     #fdf3d8;
  --warn-bd:     #e2c884;
  --good-bg:     #e9f4e6;
  --good-bd:     #a4c9a0;
  --info-bg:     #eaf2f6;
  --info-bd:     #a7c4d4;

  --radius:      12px;
  --sidebar-w:   290px;

  --serif: Georgia, 'Times New Roman', serif;
  --sans:  system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono:  ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
}

/* Dark mode — toggled by adding [data-theme=dark] to <html> */
[data-theme="dark"] {
  --bg:        #171512;
  --bg-2:      #1e1b16;
  --surface:   #211e18;
  --border:    #3a3427;
  --border-2:  #524935;
  --text:      #ece4d2;
  --muted:     #a89a7c;

  --leaf:      #7cba82;
  --leaf-2:    #a4d3a6;
  --leaf-soft: #24301f;
  --leaf-band: #2c5c33;

  --rhizome:   #e2b45a;
  --rhizome-2: #c58f3a;
  --accent:    #e8935a;
  --accent-2:  #8a6a2f;

  --focus:     #ffc46b;

  --danger-bg:   #3a2020;
  --danger-bd:   #7a4a4a;
  --warn-bg:     #372e1a;
  --warn-bd:     #6e5c2e;
  --good-bg:     #1f2f1e;
  --good-bd:     #4c6b48;
  --info-bg:     #1e2a31;
  --info-bd:     #47606e;

  --radius:    12px;
}

/* ── Reset-ish ── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

::selection { background: var(--accent-2); color: #2a2005; }

/* ── Keyboard focus ──
   Every interactive element gets one visible ring, in both themes. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
/* These two opt out of the UA ring in their base rules, so they have to opt back
   in with matching specificity. */
.searchbar input:focus-visible,
.calc__input-row input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ── Reading progress bar ── */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 60; pointer-events: none;
}
.progress__bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--leaf-2), var(--rhizome));
  transition: width .1s linear;
}

/* ── Layout shell ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 24px 18px 32px;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 0 clamp(20px, 4vw, 72px) 60px;
}

/* ── Brand ── */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.brand__logo { width: 44px; height: 44px; flex-shrink: 0; }
.brand__title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand__sub { font-size: .72rem; color: var(--muted); font-family: var(--mono); }

/* ── TOC ── */
.toc-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 6px 8px 8px; font-weight: 700;
}
.toc { display: flex; flex-direction: column; }
.toc a {
  display: flex; align-items: baseline; gap: 10px;
  color: var(--text); text-decoration: none;
  font-size: .875rem;
  padding: 7px 10px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}
.toc a:hover { background: var(--surface); }
.toc a.active {
  background: var(--surface);
  border-left-color: var(--rhizome);
  font-weight: 700;
  color: var(--leaf);
}
.toc__num {
  font-family: var(--mono); font-size: .68rem; color: var(--muted);
  min-width: 20px; text-align: right; flex-shrink: 0;
}
.toc__cross { color: var(--leaf) !important; font-style: italic; }
.toc__cross:hover { border-left-color: var(--leaf) !important; }

.sidebar-foot { margin-top: 28px; padding: 0 8px; }
.theme-toggle {
  font: inherit; font-size: .8rem; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-note { font-size: .72rem; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* ── Hero ── */
.hero { padding: clamp(28px, 5vh, 56px) 0 8px; }
.hero__kicker {
  text-transform: uppercase; letter-spacing: .18em; font-size: .72rem;
  color: var(--accent); font-weight: 700; margin: 0 0 10px;
}
.hero__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.08; margin: 0 0 16px; letter-spacing: -0.02em;
}
.hero__lede { font-size: 1.08rem; max-width: none; color: var(--text); }
.hero__stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 28px 0 8px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--rhizome);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat__num {
  display: block; font-size: 1.5rem; font-weight: 800;
  color: var(--leaf); letter-spacing: -0.02em; font-family: var(--serif);
}
.stat__label { font-size: .78rem; color: var(--muted); }

/* ── Search ── */
.searchbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  padding: 14px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.searchbar svg { color: var(--muted); flex-shrink: 0; }
.searchbar input {
  flex: 1; font: inherit; font-size: 1rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 10px;
  padding: 10px 14px; outline: none;
}
.searchbar input:focus { border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
.searchbar__clear {
  font: inherit; font-size: .8rem; background: none; border: none;
  color: var(--accent); cursor: pointer; font-weight: 600;
}
.searchmeta { font-size: .82rem; color: var(--muted); margin: 0 0 18px; }

/* Search highlight */
mark.search-hit { background: var(--accent-2); color: #2a2005; border-radius: 3px; padding: 0 2px; }

/* Section hidden by search filter */
.chapter.filtered-out { display: none; }

/* ── Article typography ──
   The article fills the width left over beside the sidebar rather than sitting
   in a fixed 78ch column that left most of the right-hand side empty. Wide
   blocks (calculators, tables, callouts, grids) grow with it. */
.article { max-width: none; }

.chapter {
  padding: 34px 0 26px;
  border-top: 1px solid var(--border);
}
.chapter:first-of-type { border-top: none; }

.chapter__kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--rhizome-2);
  margin: 0 0 6px; font-weight: 700;
}
/* Chapter prose headings. The page <h1> carries the chapter title, so chapter
   bodies start at h2 — these levels track what build_site.shift_headings()
   produces, not the levels written in _src/index-monolith.html. */
.chapter h2 {
  font-family: var(--serif); font-size: 1.25rem; margin: 30px 0 12px;
  color: var(--leaf);
}
.chapter h3 {
  font-size: 1em; font-weight: 700; margin: 1.33em 0;
}
.chapter p { margin: 0 0 14px; }
.chapter ul, .chapter ol { margin: 0 0 16px; padding-left: 22px; }
.chapter li { margin-bottom: 8px; }
.chapter a { color: var(--accent); }

strong { font-weight: 700; }
mark { background: var(--accent-2); color: #2a2005; padding: 0 3px; border-radius: 3px; }

.footnote { font-size: .8rem; color: var(--muted); font-style: italic; }
.refs li { font-size: .9rem; margin-bottom: 10px; }

/* ── Numbered rule lists ("commandments", protocols) ── */
ol.rules { list-style: none; counter-reset: rules; padding-left: 0; }
ol.rules li {
  counter-increment: rules;
  position: relative; padding: 10px 12px 10px 46px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
ol.rules li::before {
  content: counter(rules);
  position: absolute; left: 12px; top: 12px;
  width: 24px; height: 24px;
  background: var(--leaf); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
}

/* ── Cards ── */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px; margin: 16px 0 20px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.card h4 { margin: 0 0 8px; font-size: .95rem; color: var(--leaf); }
.card p { margin: 0; font-size: .9rem; }
.card--good { background: var(--good-bg); border-color: var(--good-bd); }
.card--good h4 { color: var(--leaf); }
.card--warn { background: var(--warn-bg); border-color: var(--warn-bd); }
.card--warn h4 { color: var(--accent); }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 16px 0 20px;
}
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
caption {
  text-align: left; padding: 12px 16px 10px;
  font-weight: 700; font-size: .82rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
  caption-side: top;
}
th {
  text-align: left; padding: 10px 14px;
  background: var(--leaf-soft); color: var(--text);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 2px solid var(--leaf);
  white-space: nowrap;
}
td {
  padding: 10px 14px; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--leaf-soft) 45%, transparent); }

/* ── Callouts ── */
.callout {
  border-radius: var(--radius);
  padding: 14px 18px; margin: 18px 0;
  border: 1px solid; border-left-width: 4px;
  font-size: .95rem;
}
.callout p { margin: 0; }
.callout--tip  { background: var(--good-bg);  border-color: var(--good-bd); }
.callout--warn { background: var(--warn-bg);  border-color: var(--warn-bd); }
.callout--note { background: var(--info-bg);  border-color: var(--info-bd); }

/* ── FAQ ── */
.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 12px 16px;
  font-weight: 700; font-size: .95rem; list-style: none;
  position: relative; padding-right: 40px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem; color: var(--accent); font-weight: 400;
  transition: transform .2s;
}
.faq details[open] summary::after { content: '–'; }
.faq summary:hover { color: var(--leaf); }
.faq details p { padding: 0 16px 14px; margin: 0; font-size: .9rem; }

/* ── Glossary ── */
.glossary dt { font-weight: 700; margin-top: 14px; color: var(--leaf); }
.glossary dd { margin: 2px 0 0 0; padding-left: 18px; font-size: .92rem; }

/* ── Footer ── */
.site-footer {
  border-top: 2px solid var(--leaf);
  margin-top: 30px; padding-top: 20px;
  font-size: .88rem;
}
.site-footer p { max-width: none; }

/* ── Search-empty state ── */
.search-empty { padding: 40px 0; text-align: center; color: var(--muted); font-style: italic; }

/* ── Multipage: chapter page header ── */
.chapter__h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.1;
  margin: 18px 0 8px;
  letter-spacing: -0.015em;
}
.crumbs { font-size: .8rem; color: var(--muted); margin: 14px 0 0; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--text); font-weight: 600; }

.pager {
  display: flex; justify-content: space-between; gap: 10px;
  margin: 0 0 8px;
}
.pager a {
  font-size: .85rem; font-weight: 700;
  color: var(--leaf);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 7px 14px;
  max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pager a:hover { border-color: var(--leaf); }
.pager a.pager__disabled { color: var(--muted); border-color: var(--border); pointer-events: none; }
.pager .pager__prev { margin-right: auto; }
.pager .pager__next { margin-left: auto; }

/* ── Multipage: home chapter grid ── */
.chgrid { margin-top: 34px; }
.chgrid__title {
  font-family: var(--serif); font-size: 1.5rem; margin: 0 0 16px;
  color: var(--leaf);
}
.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.chgrid__title { grid-column: 1 / -1; }
.chcard {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none; color: var(--text);
  transition: border-color .12s, transform .12s;
}
.chcard:hover { border-color: var(--leaf); transform: translateY(-2px); }
.chcard__num {
  font-family: var(--mono); font-size: .7rem; font-weight: 700;
  color: var(--rhizome-2); letter-spacing: .08em;
}
.chcard__title { font-weight: 800; font-size: .98rem; color: var(--leaf); }
.chcard__desc { font-size: .78rem; color: var(--muted); line-height: 1.45; }

/* ── Multipage: search results ── */
.sresult {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--rhizome);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 12px;
}
.sresult__title {
  font-weight: 800; font-size: 1.05rem; color: var(--leaf);
  text-decoration: none; display: block;
}
.sresult__title:hover { text-decoration: underline; }
.sresult__num {
  font-family: var(--mono); font-size: .68rem; color: var(--rhizome-2);
  margin-right: 6px;
}
.sresult__score {
  float: right;
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  letter-spacing: .04em;
}
.sresult__desc { font-size: .85rem; margin: 6px 0 4px; }
.sresult__snippet {
  font-size: .82rem; color: var(--muted); margin: 0;
  line-height: 1.55;
}
.sresult__snippet mark { background: var(--accent-2); color: #2a2005; border-radius: 3px; padding: 0 2px; }

kbd {
  font-family: var(--mono); font-size: .78em;
  background: var(--surface); border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px;
}

/* ── Fertilizer calculator ── */
.calc {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0 20px;
}
.calc__grid {
  display: grid;
  /* auto-fill, not auto-fit: with the wider article a short section would
     otherwise stretch one lone field across the whole row. */
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.calc__field label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--leaf);
  margin-bottom: 6px;
}
.calc__input-row { display: flex; gap: 6px; align-items: stretch; }
.calc__input-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
.calc__input-row input:focus { border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
.calc__input-row select {
  font: inherit;
  font-size: .85rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 6px;
  cursor: pointer;
}
.calc__unit {
  display: flex; align-items: center;
  font-size: .78rem; color: var(--muted);
  white-space: nowrap;
}
.calc__hint { font-size: .72rem; color: var(--muted); margin: 5px 0 0; }
.calc__presets {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 16px 0 4px;
}
.calc__presets-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.calc__preset {
  font: inherit; font-size: .78rem; font-weight: 700;
  color: var(--leaf);
  background: var(--leaf-soft);
  border: 1px solid var(--good-bd);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.calc__preset:hover { border-color: var(--leaf); }
.calc .table-wrap { margin: 16px 0 8px; }
.calc__grade {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  margin-left: 4px;
}
.calc__note { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }

/* ── Variety wizard ── */
.wiz__pick { margin-bottom: 14px; }
.wiz__q {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--leaf);
  margin-bottom: 8px;
}
.wiz__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.wiz__opt {
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.wiz__opt:hover { border-color: var(--leaf); }
.wiz__opt.is-selected {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}
.wiz__results { margin-top: 16px; }
.wiz__empty {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
  margin: 4px 0;
}
.wiz__match {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--leaf);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.wiz__match--top { border-left-color: var(--rhizome); background: var(--surface); }
.wiz__match-body { flex: 1; min-width: 0; }
.wiz__match-name { font-weight: 800; font-size: .95rem; }
.wiz__match-name .wiz__badge {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
}
.wiz__match-why { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.wiz__match-score {
  flex-shrink: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--leaf);
  min-width: 3.2em;
  text-align: right;
}
.wiz__bar {
  flex-shrink: 0;
  width: 74px; height: 7px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.wiz__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--leaf-2), var(--rhizome));
}
.wiz__match--top .wiz__match-score { color: var(--rhizome-2); }

/* ── Tool result tiles ── */
.calc__outs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.calc__out {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--leaf);
  border-radius: 10px;
  padding: 10px 14px;
}
.calc__out-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.calc__out-value {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--leaf);
  line-height: 1.15;
}

/* Tool card on the home grid */
.chcard--tool { border-top: 3px solid var(--rhizome); }
.chcard--tool .chcard__num { color: var(--accent); }

/* Budget dashboard */
.calc__sub {
  font-size: 1rem; font-weight: 800; color: var(--leaf);
  margin: 22px 0 10px; padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-2);
}
.calc__sub em { font-style: normal; font-weight: 600; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-left: 6px; }
.calc__inline { color: var(--leaf); }

.breakdown { margin-top: 18px; padding-top: 4px; }
.breakdown__title {
  font-size: .95rem; font-weight: 800; margin: 0 0 10px;
  color: var(--text);
}
.bd-row {
  display: grid;
  grid-template-columns: 110px 1fr 90px 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: .82rem;
}
.bd-label { font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-bar {
  height: 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden;
}
.bd-fill { display: block; height: 100%; border-radius: 999px; transition: width .25s ease; }
.bd-fill--seed   { background: var(--rhizome); }
.bd-fill--fert   { background: var(--leaf-2); }
.bd-fill--labour { background: var(--accent); }
.bd-fill--prot   { background: #8a5a9e; }
.bd-fill--other  { background: var(--muted); }
.bd-val { text-align: right; font-variant-numeric: tabular-nums; }
.bd-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 520px) {
  .bd-row { grid-template-columns: 90px 1fr 70px 36px; gap: 6px; }
}

/* Planning & record tools */
.calc__row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.btn--ghost {
  background: transparent; color: var(--leaf); border: 1px solid currentColor;
}
.btn--ghost:hover { background: var(--leaf-soft); }
.calc input[type="text"] { flex: 1; min-width: 100px; }
#sprayLog table td { white-space: nowrap; }
#sprayLog .sl-empty--msg { text-align: center; color: var(--muted); font-style: italic; }
.del-row {
  background: none; border: none; color: var(--danger);
  cursor: pointer; font: inherit; font-weight: 700; padding: 2px 6px;
}

/* Tool pages keep the article column comfortable */
.article .crumbs { margin-top: 20px; }
.article > .chapter__h1 { margin-top: 6px; }

/* ── Mobile ── */
.mobile-toggle {
  display: none;
  position: fixed; bottom: 18px; right: 18px; z-index: 50;
  align-items: center; gap: 8px;
  background: var(--leaf-band); color: #fff;
  border: none; border-radius: 999px;
  padding: 12px 20px; font: inherit; font-weight: 700; font-size: .9rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  cursor: pointer;
}
.mobile-toggle svg { width: 18px; height: 18px; }

@media (max-width: 960px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(320px, 85vw);
    transform: translateX(-105%);
    transition: transform .25s ease;
    z-index: 70;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
    height: 100dvh;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 0 18px 90px; }
  .mobile-toggle { display: flex; }
  .searchbar { top: 0; }
  .hero { padding-top: 20px; }
}

/* Small phones */
@media (max-width: 480px) {
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  th { white-space: normal; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress__bar, .sidebar, .faq summary::after { transition: none; }
}

/* ═══════════════════════════════════════════════════════════
   Video embeds — click-to-load facades (privacy + speed)
   ═══════════════════════════════════════════════════════════ */

.vidfacade {
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #14120e;
  box-shadow: 0 1px 3px rgba(40, 30, 10, 0.12);
}

.vidfacade__frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  background: #14120e;
  cursor: pointer;
  text-align: left;
}

.vidfacade__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.vidfacade__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.05) 55%);
}

.vidfacade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(20, 18, 14, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}

.vidfacade__play svg { margin-left: 3px; }

.vidfacade__frame:hover .vidfacade__play {
  transform: translate(-50%, -50%) scale(1.07);
  background: rgba(180, 93, 22, 0.88); /* --accent on hover */
}

.vidfacade__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  color: #fff;
}

.vidfacade__title {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.vidfacade__frame:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.vidfacade__credit {
  padding: 0.6rem 0.95rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.vidfacade__credit a { color: var(--leaf); }

.vidfacade--active .vidfacade__frame { display: none; }

.vidfacade iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* Embeds are meaningless on paper */
@media print {
  .vidfacade { display: none; }
}

/* Search results: video entries carry a ▶ num + accent */
.sresult--video .sresult__num { color: var(--accent); }
.sresult--video .sresult__title { color: var(--accent-2); }

/* “While you watch” checkpoints under each video embed */
.vidtakeaway {
  margin: 0 0 1.6rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--info-bd);
  border-left: 4px solid var(--leaf);
  border-radius: var(--radius);
  background: var(--info-bg);
}

.vidtakeaway__h {
  margin: 0 0 0.5rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leaf);
}

.vidtakeaway__list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.vidtakeaway__list li::marker { color: var(--leaf); }

/* Hub section ledes (Video library intro). Spans the grid like the title does,
   otherwise the intro is squeezed into a single 250px card column. */
.chgrid__lede {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: none;
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════════════════
   Walkthrough (First 90 Days) — phase tracker + phase cards
   ═══════════════════════════════════════════════════════════ */

.wt-tracker { margin: 1.2rem 0 1.8rem; }

.wt-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.wt-chip {
  display: inline-block;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wt-chip--on {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
  font-weight: 600;
}

.wt-phase {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wt-phase--now {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px var(--leaf-soft);
  background: var(--leaf-soft);
  scroll-margin-top: 5rem;
}

.wt-phase__when {
  display: inline-block;
  margin-left: 0.4rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.wt-check {
  margin: 0.8rem 0 0;
  padding: 0.55rem 0.9rem;
  border-left: 3px solid var(--good-bd);
  background: var(--good-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.92rem;
}

/* Print: keep each phase intact on paper */
@media print {
  .wt-tracker { display: none; }
  .wt-phase { break-inside: avoid; }
  .wt-phase--now { background: var(--surface); box-shadow: none; border-color: var(--border); }
}

/* ═══════════════════════════════════════════════════════════
   Figures, diagrams and charts
   Charts and diagrams are both generated as inline SVG by build_site.py
   (from `<!--chart:name-->` / `<!--diagram:name-->` placeholders). They share
   the `fig-*` classes below so they follow the theme instead of hard-coding
   colours.
   ═══════════════════════════════════════════════════════════ */

.figure { margin: 28px 0; }

.figure__frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
}
.figure__frame > svg { display: block; width: 100%; height: auto; }

.figure figcaption {
  margin-top: 10px;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--muted);
}
.figure figcaption strong { color: var(--text); }

/* The data behind the drawing, as a real table.
   A <details> rather than visually-hidden text: it costs nothing until asked
   for, but any reader can open it — a keyboard user, a screen reader, or
   someone on a phone who cannot read a 40px-tall bar label. */
.figure__data {
  margin: 10px 0 0;
  border-top: 1px dashed var(--border);
}
.figure__data > summary {
  cursor: pointer;
  padding: 9px 0 3px;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
}
.figure__data > summary:hover { color: var(--text); }
.figure__data .table-wrap { margin: 10px 0 6px; }
.figure__data table { font-size: .8rem; }
.figure__data th, .figure__data td { padding: 7px 12px; }

/* HTML legend above the drawing — real text, so screen readers get it */
.figure__legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 0 0 12px; font-size: .74rem; color: var(--muted);
}
.figure__legend span { display: inline-flex; align-items: center; gap: 6px; }
.figure__swatch {
  width: 11px; height: 11px; border-radius: 3px;
  display: inline-block; flex-shrink: 0;
}

/* ── SVG palette (class-based so it re-themes with the page) ── */
.fig-band      { fill: var(--leaf-soft); }
.fig-band-2    { fill: var(--bg-2); }
.fig-leaf      { fill: var(--leaf); }
.fig-leaf-2    { fill: var(--leaf-2); }
.fig-leaf-band { fill: var(--leaf-band); }
.fig-rhizome   { fill: var(--rhizome); }
.fig-rhizome-2 { fill: var(--rhizome-2); }
.fig-accent    { fill: var(--accent); }
.fig-surface   { fill: var(--surface); }
.fig-warn      { fill: var(--warn-bd); }
.fig-danger    { fill: var(--danger-bd); }
.fig-soil      { fill: var(--bg-2); }

/* ── Outlined shapes for the diagrams: fill + edge, so they read as objects ── */
.fig-solid   { fill: var(--leaf-soft);  stroke: var(--border-2); stroke-width: 1.5; }
.fig-earth   { fill: var(--bg-2);       stroke: var(--border-2); stroke-width: 1.5; }
.fig-plant   { fill: var(--leaf);       stroke: var(--border-2); stroke-width: 1.5; }
.fig-plant-2 { fill: var(--leaf-2);     stroke: var(--border-2); stroke-width: 1.5; }
.fig-store   { fill: var(--rhizome);    stroke: var(--border-2); stroke-width: 1.5; }
.fig-seed    { fill: var(--accent);     stroke: var(--border-2); stroke-width: 1.5; }
.fig-danger-s { fill: var(--danger-bd); stroke: var(--border-2); stroke-width: 1.5; }
.fig-root    { fill: none; stroke: var(--leaf-band); stroke-width: 1.6; }
.fig-dim     { stroke: var(--muted); stroke-width: 1; }
.fig-danger-stroke, .fig-cross { stroke: var(--danger-bd); stroke-width: 3; fill: none; stroke-linecap: round; }
.fig-arrow-head { fill: var(--accent); }
.fig-dot     { fill: var(--accent); }
.fig-bud     { fill: var(--leaf-band); stroke: none; }

.fig-text   { fill: var(--text);    font: 400 12px var(--sans); }
.fig-text-b { fill: var(--text);    font: 700 12px var(--sans); }
.fig-text-s { fill: var(--muted);   font: 400 10.5px var(--sans); }
.fig-text-m { fill: var(--muted);   font: 500 11.5px var(--sans); }
.fig-num    { fill: var(--text);    font: 700 11.5px var(--sans); }
.fig-cap    { fill: var(--muted);   font: 700 10.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; }

.fig-grid  { stroke: var(--border);   stroke-width: 1; }
.fig-axis  { stroke: var(--border-2); stroke-width: 1.5; }
.fig-rule  { stroke: var(--border-2); stroke-width: 1; stroke-dasharray: 4 3; }
.fig-line  { fill: none; stroke: var(--leaf-band); stroke-width: 2.5; stroke-linejoin: round; }
.fig-outline { fill: none; stroke: var(--border-2); stroke-width: 2; }
.fig-arrow { stroke: var(--accent); stroke-width: 2; fill: none; }

/* Print: keep each figure whole on paper */
@media print {
  .figure, .figure__data { break-inside: avoid; }
  .figure__frame { border-color: #bbb; background: #fff; }
  .fig-band, .fig-soil, .fig-band-2,
  .fig-solid, .fig-earth { fill: #f2f2f2 !important; }
  /* Print the numbers without needing a click to open the disclosure where the
     browser supports styling closed <details> content; harmless where it does
     not, and the summary is hidden so it reads as a plain table either way. */
  .figure__data > summary { display: none; }
  .figure__data::details-content { content-visibility: visible; height: auto; }
}
