/* Leaf: one quiet column of serif prose. Structure is hairlines and whitespace.
   All colours live in :root; the dark block below swaps them. */
:root {
  --paper: #ffffff;
  --ink: #12391f;            /* text is green on white */
  --muted: #4e6a57;
  --line: #dbe8de;
  --wash: #f3faf4;           /* the faintest green, for panels */
  --green: #18793a;          /* links, actions */
  --leaf: #3aa757;           /* strokes in diagrams and animations */
  --marker: #d3f2b5;         /* soft highlight behind calls to action */
  --amber: #8a5200;
  --amber-line: #d9a84e;
  --rain: #9fb3a6;
  --glass: rgba(255, 255, 255, .84);   /* frosted panels over the rainforest */
  --glass-solid: rgba(255, 255, 255, .94);
  --glass-line: rgba(255, 255, 255, .7);
  --serif: Newsreader, "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 3vw, 36px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c140f; --ink: #d9f2df; --muted: #93b39c; --line: #22352a; --wash: #102018;
    --green: #7fd492; --leaf: #5cc477; --marker: #2f5a22; --amber: #f0b45b; --amber-line: #9a7228;
    --rain: #4b5f53;
    --glass: rgba(11, 20, 15, .8); --glass-solid: rgba(11, 20, 15, .92); --glass-line: rgba(140, 200, 160, .14);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 clamp(19px, 1.6vw, 22px)/1.45 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; font: 500 15px var(--sans); z-index: 10; }
.skip:focus { left: 8px; }

/* the rainforest canvas (rainforest.js) sits behind every page */
html { background: var(--paper); }
body:has(#forest) { background: transparent; }
#forest { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; opacity: 0; transition: opacity .8s ease; }
#forest.ready { opacity: 1; }

/* site header, shared by every page */
.site { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter); border-bottom: 1px solid var(--glass-line); background: var(--glass-solid); font-family: var(--sans); }
@supports (backdrop-filter: blur(1px)) { .site { background: var(--glass); backdrop-filter: blur(16px) saturate(1.2); } }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); line-height: 1; }
.mark { width: 22px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.word { font: 500 1.35rem/1 var(--serif); letter-spacing: -.01em; }
.brand:hover { color: var(--green); }
.nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 15px; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--green); text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 1px; }
.nav .nav-cta { padding: 8px 14px; border: 1px solid var(--ink); border-radius: 999px; }
.nav .nav-cta:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
@media (max-width: 720px) { .nav .wide { display: none; } }

/* the column */
.page { flex: 1; width: 100%; margin: 0 auto; max-width: calc(34em + 2 * var(--gutter)); padding: clamp(40px, 8vh, 88px) var(--gutter) 64px; }
body.calm .page { width: calc(100% - 2 * var(--gutter)); margin: clamp(20px, 5vh, 56px) auto; padding: clamp(28px, 5vh, 56px) clamp(18px, 4vw, 48px) 48px; background: var(--glass-solid); border: 1px solid var(--glass-line); border-radius: 24px; }
@supports (backdrop-filter: blur(1px)) { body.calm .page { background: var(--glass); backdrop-filter: blur(14px) saturate(1.15); } }
@media (max-width: 640px) { body.calm .page { border-radius: 18px; } }
.page > * + * { margin-top: 2.2em; }
.intro > * + * { margin-top: 1.1em; }
.lede { font-weight: 500; }
.try { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); text-underline-offset: .18em; text-decoration-thickness: 1px; transition: text-decoration-color .15s; }
.try:hover { text-decoration-color: var(--green); }

/* form, written like part of the page */
.drop { display: block; cursor: pointer; padding: 6px 0; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-text { color: var(--muted); }
.link { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.drop:hover .link, .drop:focus-within .link, .drop.over .link { color: var(--green); }
.drop.over { background: color-mix(in srgb, var(--marker) 35%, transparent); }
.drop img { display: block; width: 100%; max-width: 360px; max-height: 300px; object-fit: cover; margin-bottom: 10px; }

.field { display: block; margin-top: 1.5em; }
.field-label { display: block; font: 500 .72em var(--sans); color: var(--muted); letter-spacing: .01em; margin-bottom: 4px; }
.opt { font-weight: 400; margin-left: 6px; }
textarea, input {
  display: block; width: 100%; padding: 6px 0 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--ink); font: inherit; resize: vertical; transition: border-color .15s;
}
textarea::placeholder, input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea:focus, input:focus { outline: none; border-bottom-color: var(--green); }

/* the one call to action: serif text on a soft marker, a chevron after */
.cta {
  appearance: none; display: inline-flex; align-items: center; gap: 10px; margin-top: 1.7em; padding: 0; border: 0;
  background: none; color: var(--ink); font: inherit; cursor: pointer;
}
.cta-text { background: linear-gradient(transparent 62%, var(--marker) 62%, var(--marker) 94%, transparent 94%); }
.cta:hover .cta-text { background: linear-gradient(transparent 40%, var(--marker) 40%, var(--marker) 94%, transparent 94%); }
.chev { width: .7em; height: .7em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.cta:hover .chev { transform: translateX(3px); }
.cta:disabled { opacity: .5; cursor: progress; }
.cta-small { margin-top: 0; font-size: .9em; }
.status { min-height: 1.45em; margin-top: 14px; font-size: .85em; color: var(--muted); }

/* quiet run progress, shown only while Leaf works */
.run { margin-top: 18px; font: 400 .72em/1.5 var(--sans); color: var(--muted); }
.run-state { display: block; margin-bottom: 8px; font-weight: 500; }
.nodes { list-style: none; padding: 0; }
.node { display: grid; grid-template-columns: 14px minmax(9.5em, auto) 1fr auto; gap: 8px; align-items: baseline; padding: 3px 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--muted); align-self: center; }
.node-name { color: var(--ink); }
.node-model { overflow-wrap: anywhere; }
.node-time { color: var(--green); font-weight: 500; }
.node.active .dot { background: var(--green); border-color: var(--green); animation: pulse 1.2s ease-in-out infinite; }
.node.done .dot { background: var(--green); border-color: var(--green); }
.node.skipped { opacity: .5; }
.node.skipped .node-name { text-decoration: line-through; }
.node.failed .dot { border-color: var(--amber); background: var(--amber); }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 520px) { .node { grid-template-columns: 14px 1fr auto; } .node-model { grid-column: 2 / 4; } }

/* results: same column, same type, separated by hairlines */
.results { border-top: 1px solid var(--line); padding-top: 2.2em; }
.results > * + * { margin-top: 2.2em; }
.banner { font-weight: 500; }
.banner.warn { color: var(--amber); border-left: 2px solid var(--amber-line); padding-left: 16px; }
/* the verdict is the one loud thing on the results page */
.verdict > * + * { margin-top: .5em; }
.verdict-word { font-family: var(--serif); font-size: clamp(1.6em, 4vw, 2.1em); line-height: 1.15; font-weight: 500; }
.verdict.confident .verdict-word { color: var(--green); }
.verdict.lab { border-left: 2px solid var(--amber-line); padding-left: 16px; }
.verdict.lab .verdict-word { color: var(--amber); }
.verdict .banner { font-weight: 400; }
.watch { border-top: 1px solid var(--line); padding-top: .8em; }
.watch ul { padding-left: 1.2em; }
.watch li + li { margin-top: .3em; }
.watch #sample-if { margin-top: .7em; }
.block h2 { font-size: 1em; font-weight: 600; margin-bottom: .5em; }
.block > * + * { margin-top: .8em; }
.muted { color: var(--muted); }
.small { font-size: .8em; }

.candidates { list-style: none; padding: 0; }
.cand { padding: 14px 0; border-top: 1px solid var(--line); }
.cand:first-child { border-top: 0; padding-top: 4px; }
.cand-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 500; }
.chip { font: 400 .65em var(--sans); color: var(--muted); margin-left: 10px; }
.bar { height: 2px; background: var(--line); margin: 8px 0 6px; }
.bar > span { display: block; height: 100%; background: var(--green); }
.evidence { font-size: .85em; color: var(--muted); margin: 0; padding-left: 1.1em; }

.steps { padding-left: 1.4em; }
.steps li { margin: .7em 0; padding-left: .2em; }
.steps li::marker { color: var(--muted); font-size: .85em; }
.why { display: block; color: var(--muted); font-size: .82em; line-height: 1.4; margin-top: 2px; }
.cite { font: 500 .62em var(--sans); color: var(--green); text-decoration: none; margin-left: 4px; vertical-align: .35em; }
.cite:hover { text-decoration: underline; }
.checkin { color: var(--green); }
.sources { padding-left: 1.4em; font-size: .85em; }
.sources li { margin: .4em 0; overflow-wrap: anywhere; }
.sources li::marker { color: var(--muted); }
.sources a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.sources a:hover { text-decoration-color: var(--green); color: var(--green); }
.q { display: block; margin-bottom: 1.2em; }

.chatlog { display: flex; flex-direction: column; gap: .8em; }
.chatlog:empty { display: none; }
.msg { max-width: 100%; }
.msg.user { color: var(--muted); }
.msg.user::before { content: "You: "; font: 500 .7em var(--sans); }
.msg.bot { border-left: 2px solid var(--line); padding-left: 14px; }
.chatform { display: flex; gap: 18px; align-items: baseline; }
.chatform input { flex: 1; min-width: 0; }
.chatform .cta { margin-top: 0; }

.trace summary { cursor: pointer; font-weight: 600; }
.trace summary:hover { color: var(--green); }
.table-wrap { overflow-x: auto; }
.trace table { width: 100%; border-collapse: collapse; font: 400 .7em/1.4 var(--sans); }
.trace th, .trace td { text-align: left; padding: 7px 14px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.trace th { font-weight: 500; color: var(--muted); }
.trace td.model { overflow-wrap: anywhere; }

.trust { font-size: .8em; color: var(--muted); max-width: 32em; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 28px; padding: 20px var(--gutter); border-top: 1px solid var(--glass-line); background: var(--glass-solid); font: 400 13px var(--sans); color: var(--muted); }
.foot a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- Leaf v2: modes, photos, live case */

.mode { border: 0; margin: 0 0 1.6em; padding: 0; }
.mode .field-label { margin-bottom: 8px; padding: 0; }
.mode-opt { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: baseline; padding: 6px 0; cursor: pointer; }
.mode-opt input { accent-color: var(--green); width: 16px; height: 16px; margin: 0; transform: translateY(2px); }
.mode-name { font-weight: 600; }
.mode-opt input:checked + span .mode-name { background: linear-gradient(transparent 62%, var(--marker) 62%, var(--marker) 94%, transparent 94%); }
.mode-note { color: var(--muted); font-size: .85em; }

.photos { margin-top: .4em; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 6px; }
@media (max-width: 520px) { .slots { grid-template-columns: 1fr; } }
.slot { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 2px; font-size: .85em; min-height: 64px; justify-content: center; }
.slot img { width: 100%; max-height: 120px; object-fit: cover; margin: 0; }
.slot.over { background: color-mix(in srgb, var(--marker) 35%, transparent); }
.slot:focus-within { border-color: var(--green); }
.slot-text { color: var(--muted); }

.textbtn { appearance: none; background: none; border: 0; padding: 0; margin-top: 8px; font: 500 13px var(--sans); color: var(--green); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.textbtn:disabled { color: var(--muted); cursor: progress; }

/* the live case: the one place this page spends its boldness */
.live { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.differential { list-style: none; padding: 0; margin: 6px 0 0; }
.differential li { position: relative; padding: 6px 0 8px; transition: transform .35s ease; }
.differential .d-head { display: flex; justify-content: space-between; gap: 12px; font-size: .9em; }
.differential .d-name { font-weight: 500; }
.differential .d-name.second { font-style: italic; }
.differential .d-pct { font: 500 13px var(--sans); color: var(--muted); }
.differential .d-bar { height: 3px; background: var(--line); margin-top: 5px; }
.differential .d-bar > span { display: block; height: 100%; background: var(--green); transition: width .45s ease; }
.differential li:first-child .d-name { font-weight: 600; }

.log { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.log li { position: relative; padding: 2px 0 12px 18px; font-size: .85em; }
.log li::before { content: ""; position: absolute; left: -4px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); border: 1px solid var(--muted); }
.log li.running::before { background: var(--green); border-color: var(--green); animation: pulse 1.2s ease-in-out infinite; }
.log li.done::before { background: var(--green); border-color: var(--green); }
.log li.skipped::before { border-style: dashed; }
.log li.note::before { border-color: var(--amber-line); background: var(--amber-line); }
.log .l-what { font: 500 13px/1.4 var(--sans); color: var(--ink); }
.log .l-why { display: block; color: var(--muted); font-style: italic; }
.log .l-got { display: block; margin-top: 2px; }
.log li.skipped .l-got { color: var(--muted); }

.confidence { font-weight: 500; }
.why-box { font-size: .85em; }
.why-box summary { cursor: pointer; color: var(--muted); font: 500 13px var(--sans); }
.why-box ul { margin: 8px 0 0; padding-left: 1.2em; }

.handoff { border-left: 2px solid var(--amber-line); padding-left: 16px; }
.handoff h2 { color: var(--amber); }
.print-only { display: none; }

.weather-strip svg { display: block; width: 100%; max-width: 32em; height: 64px; }
.weather-strip .wet { fill: color-mix(in srgb, var(--green) 55%, transparent); }
.weather-strip .rain { fill: var(--ink); }
.weather-strip .axis { stroke: var(--line); }
.indices { padding-left: 1.2em; }
.indices li { margin: .3em 0; }

.evidence-list { list-style: none; padding: 0; }
.evidence-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.evidence-list li:first-child { border-top: 0; }
.ev-id { font: 500 12px var(--sans); color: var(--green); margin-right: 6px; }
.ev-tool { font: 500 12px var(--sans); color: var(--muted); margin-right: 6px; }
.step-flag { display: block; font-size: .8em; color: var(--amber); font-style: italic; }

@media print {
  #forest { display: none !important; }
  body.calm .page { background: #fff !important; border: 0; backdrop-filter: none !important; margin: 0; width: 100%; }
  .site, .intro, .intake, .foot, .trust, .chat, .trace, #followups, #evidence-block, #weather, #second, #print, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .results { border: 0; padding: 0; }
  .handoff { border: 0; padding: 0; }
  .print-only { display: block; }
  .print-photos { display: flex; gap: 8px; flex-wrap: wrap; }
  .print-photos img { width: 30%; max-height: 180px; object-fit: cover; }
  a { color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; }
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .9em; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------------------------------------------------------------- garden preferences, safety labels */
.garden { border: 0; margin: 1.5em 0 0; padding: 0; }
.check { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; cursor: pointer; font-size: .92em; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); transform: translateY(2px); flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font: 500 12px/1.2 var(--sans); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.tag.warn { color: var(--amber); border-color: var(--amber-line); }
.tag.bad { color: var(--paper); background: var(--amber); border-color: var(--amber); }
.tag.plain { border-style: dashed; }
.caution-line { color: var(--amber); }
.cautions { list-style: none; padding: 0; border-left: 2px solid var(--amber-line); padding-left: 14px; }
.cautions li + li { margin-top: .4em; }
.remind { font-family: var(--sans); }
.remind a { color: var(--green); }
.remind .textbtn { margin: 0 0 0 10px; }

/* ---------------------------------------------------------------- spray window */
.spray-best { font-size: .95em; }
.spray-grid { margin-top: 18px; display: grid; grid-template-columns: 3.2em repeat(14, minmax(0, 1fr)); gap: 3px; max-width: 30em; font: 500 11px var(--sans); color: var(--muted); align-items: center; }
.spray-grid .gh { text-align: left; }
.spray-grid .cell { height: 18px; border-radius: 3px; background: var(--line); }
.spray-grid .cell.good { background: var(--leaf); }
.spray-grid .cell.ok { background: color-mix(in srgb, var(--leaf) 40%, var(--paper)); }
.spray-grid .cell.pick { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-family: var(--sans); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--line); vertical-align: -1px; }
.sw.good { background: var(--leaf); }
.sw.ok { background: color-mix(in srgb, var(--leaf) 40%, var(--paper)); }
.sw.pick { background: transparent; outline: 2px solid var(--ink); outline-offset: -2px; }
.spray-others { padding-left: 1.2em; margin-top: 12px; }
.spray-others:empty { display: none; }

/* ---------------------------------------------------------------- My plants */
.page-title { font: 500 clamp(2rem, 5vw, 2.8rem)/1.1 var(--serif); letter-spacing: -.015em; }
.plants { list-style: none; padding: 0; }
.plant { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.plant:first-child { border-top: 0; }
.plant-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; background: var(--wash); display: block; }
.plant-name { font-size: 1.05em; font-weight: 600; }
.plant-meta { color: var(--muted); margin-top: 2px; }
.plant-due { margin-top: 6px; color: var(--green); font-weight: 500; }
.plant.due .plant-due::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); margin-right: 8px; vertical-align: 2px; }
.plant-due.late { color: var(--amber); }
.plant-actions { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-family: var(--sans); align-items: baseline; }
.plant-actions a { color: var(--green); }
.plant-actions .textbtn { margin: 0; }
@media (max-width: 480px) { .plant { grid-template-columns: 72px 1fr; gap: 14px; } .plant-photo { width: 72px; height: 72px; } }
.plant-actions a, .plant-actions .textbtn, .remind a, .remind .textbtn { font: 500 14px/1.4 var(--sans); }
