/* ==========================================================================
   Vegetile brand tokens (brand guide v1: BRAND.md + tokens.json).
   Every colour, type, space and radius value on the site comes from here.
   ========================================================================== */
:root {
    /* Colour */
    --root: #123B2C;        /* deep brand green: dark sections, footer, big brand blocks */
    --leaf: #1C7449;        /* brand green: primary buttons, links, active states */
    --fern: #3A8F45;        /* logo only, never text */
    --sprout: #B6E35A;      /* accent, ONLY on --root grounds; never text on light */
    --dew: #246A8E;         /* water data only: pH, EC, level, flow, reservoir */
    --soil: #AE4423;        /* errors and alerts only */
    --paper: #F5F2E8;       /* page background, never pure white */
    --paper-sunk: #EBE6D6;  /* cards, tiles, set-back sections */
    --ink: #13251C;         /* body text and headings */
    --ink-muted: #556259;   /* secondary text, captions, input borders */
    --line: #D9D2BE;        /* decorative dividers only, never a control border */
    --scrim: rgba(18, 59, 44, 0.82); /* --root at 82% behind modal dialogs */

    /* Type */
    --font-display: "Bricolage Grotesque", Onest, system-ui, sans-serif;
    --font-sans: Onest, system-ui, sans-serif;

    /* Space: 4px grid */
    --space-1: 4px;
    --space-2: 8px;
    --space-4: 16px;
    --space-8: 32px;

    /* Radius */
    --radius-sm: 6px;    /* inputs, chips, small badges */
    --radius-md: 12px;   /* buttons, small cards */
    --radius-tile: 24px; /* big cards, tiles, image frames */

    /* Layout */
    --max-width: 1160px;
    --header-height: 72px;
    --tap: 44px;         /* minimum touch target */
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    color: var(--ink);
    background: var(--paper);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > main {
    flex: 1 0 auto;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    color: inherit;
    text-wrap: balance;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
video {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

[id] {
    scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

:focus-visible {
    outline: 2px solid var(--leaf);
    outline-offset: 2px;
}

.on-root :focus-visible,
.site-footer :focus-visible {
    outline-color: var(--sprout);
}

.container {
    width: min(100% - 2 * var(--space-8), var(--max-width));
    margin: 0 auto;
}

/* ---------- Type styles ---------- */
.kicker {
    display: inline-block;
    margin-bottom: var(--space-2);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--leaf);
}

.on-root .kicker {
    color: var(--sprout);
}

.section-title {
    margin: 0 0 var(--space-4);
    font-size: 40px;
    line-height: 44px;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.section-lead {
    margin: 0 0 var(--space-8);
    max-width: 70ch;
    color: var(--ink-muted);
}

.on-root .section-lead {
    color: var(--paper);
}

.label {
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

/* Names and units with fixed case, like pH, stay as written inside label styles. */
.keep-case,
.metric-card[data-metric="ph"] .kicker {
    text-transform: none;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    transition: transform 240ms var(--ease);
}

/* Phones only (main.js adds it): slid up out of view while scrolling down. */
.site-header.is-hidden {
    transform: translateY(-100%);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--header-height);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
}

.brand img {
    height: 36px;
    width: auto;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    min-width: var(--tap);
    padding: 0 var(--space-4);
    border: 1px solid var(--ink-muted);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 12px;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    font-weight: 600;
}

.nav-link:hover {
    color: var(--ink);
    background: var(--paper-sunk);
}

.nav-link.active {
    color: var(--paper);
    background: var(--leaf);
}

/* The one button in the navigation */
.nav-link.navcta {
    margin-left: var(--space-2);
    border: 1px solid var(--ink-muted);
    color: var(--ink);
}

.nav-link.navcta:hover {
    background: var(--paper-sunk);
}

/* ---------- Buttons ---------- */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-8);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn-primary {
    background: var(--leaf);
    border-color: var(--leaf);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--root);
    border-color: var(--root);
}

.btn-secondary {
    background: transparent;
    border-color: var(--ink-muted);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--paper-sunk);
}

.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Buttons on root grounds: sprout fill takes ink text; outlines go paper. */
.on-root .btn-primary {
    background: var(--sprout);
    border-color: var(--sprout);
    color: var(--ink);
}

.on-root .btn-primary:hover {
    background: var(--paper);
    border-color: var(--paper);
}

.on-root .btn-secondary {
    border-color: var(--paper);
    color: var(--paper);
}

.on-root .btn-secondary:hover {
    background: transparent;
    border-color: var(--sprout);
    color: var(--sprout);
}

/* ---------- Sections ---------- */
.section {
    padding: 64px 0;
}

/* Full-width deep-green band */
.band-root {
    background: var(--root);
    color: var(--paper);
}

.quiet-section {
    background: var(--paper-sunk);
}

/* ---------- Hero: one photo edge to edge, the product on the right, the words on the calm wall ---------- */
.hero {
    position: relative;
    display: grid;
    align-items: center;
    height: min(calc(100svh - var(--header-height)), 62vw);
    min-height: 560px;
    overflow: hidden;
    background: var(--paper-sunk);
    color: var(--ink);
}

.hero-photo {
    position: absolute;
    inset: 0;
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 60% 55%;
}

.hero-copy {
    position: relative;
    z-index: 1;
}

/* The words stay on the calm wall, clear of the tower on the right. */
.hero-body {
    max-width: min(600px, 52vw);
}

.hero-copy h1 {
    margin: 0 0 var(--space-4);
    font-size: clamp(48px, 6.8vw, 104px);
    line-height: 0.92;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--ink);
}

.hero-copy .hero-sub {
    margin: 0;
    max-width: 22ch;
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--leaf);
}

.hero-body {
    margin-top: 24px;
}

.hero-body p {
    margin: 0;
    max-width: 44ch;
    color: var(--ink);
}

.hero-credit {
    position: absolute;
    z-index: 1;
    left: max(var(--space-8), calc((100% - var(--max-width)) / 2));
    bottom: var(--space-4);
    margin: 0;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

/* One settle on load: the photo eases into place and the words follow it. */
@media (prefers-reduced-motion: no-preference) {
    .hero-photo img {
        animation: hero-settle 1400ms var(--ease) both;
    }

    .hero-head,
    .hero-body {
        animation: hero-rise 700ms var(--ease) both;
    }

    .hero-head {
        animation-delay: 200ms;
    }

    .hero-body {
        animation-delay: 360ms;
    }
}

@keyframes hero-settle {
    from {
        transform: scale(1.04);
    }
    to {
        transform: none;
    }
}

@keyframes hero-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.eyebrow-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* Units keep their case: mS/cm is not MS/CM. */
.unit {
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ---------- The gap: a statement on paper ---------- */
.statement {
    padding: 96px 0 32px;
}

.statement-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-8) 64px;
    align-items: end;
    padding-top: var(--space-8);
    border-top: 1px solid var(--line);
}

.statement h2 {
    max-width: 16ch;
    margin: 0;
    font-size: 40px;
    line-height: 44px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.statement p {
    max-width: 60ch;
    margin: 0;
    color: var(--ink-muted);
}

/* ---------- Tiles ---------- */
.grid {
    display: grid;
    gap: var(--space-2);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.card {
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.card h3 {
    margin: 0 0 var(--space-2);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card p {
    margin: 0;
    color: var(--ink-muted);
}

.card-image {
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--ink);
}

.card-image img {
    width: 100%;
    height: 260px;
    object-fit: contain;
}

.card-image.cover img {
    object-fit: cover;
}

.section-head {
    max-width: 760px;
}

/* ---------- Inside Vegetile Pro: the exploded render beside its parts ---------- */
.parts {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 64px;
    align-items: center;
}

.parts-figure {
    margin: 0;
}

/* Layers share one 4:5 canvas. Apart = where the exploded render put them; assembled = slid down onto each other.
   The drops come from the renders (grid onto the Hub, canopy onto the grid). Assembled, the unit only fills
   y 57–95% of the canvas, so the whole stack scales up and lifts to sit in the middle of the frame. */
.parts-stage {
    --grid-drop: 27.45%;
    --canopy-drop: 50.44%;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
    cursor: pointer;
    isolation: isolate;
}

.parts-backdrop,
.parts-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.parts-stack {
    position: absolute;
    inset: 0;
    transform-origin: 50% 76%;
    transition: transform 700ms var(--ease);
}

.parts-stage[data-state="assembled"] .parts-stack {
    transform: translateY(-26%) scale(1.45);
}

.parts-layer {
    transition: transform 700ms var(--ease), opacity 360ms var(--ease);
}

.parts-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.parts-stage.is-fallback .parts-layer,
.parts-stage.is-fallback .parts-backdrop,
.parts-stage.is-fallback .parts-tag {
    display: none;
}

.parts-stage[data-state="assembled"] .parts-layer[data-layer="grid"] {
    transform: translateY(var(--grid-drop));
}

.parts-stage[data-state="assembled"] .parts-layer[data-layer="canopy"] {
    transform: translateY(var(--canopy-drop));
}

/* Coming apart, the canopy lifts first and the grid follows; going back together, the grid settles first. */
.parts-stage[data-state="apart"] .parts-layer[data-layer="grid"] {
    transition-delay: 60ms;
}

.parts-stage[data-state="assembled"] .parts-layer[data-layer="canopy"] {
    transition-delay: 60ms;
}

/* The part in focus stays; the rest step back. */
.parts-stage[data-focus="canopy"] .parts-layer:not([data-layer="canopy"]),
.parts-stage[data-focus="grid"] .parts-layer:not([data-layer="grid"]),
.parts-stage[data-focus="hub"] .parts-layer:not([data-layer="hub"]),
.parts-stage[data-focus="floor"] .parts-layer[data-layer="hub"] {
    opacity: 0.22;
}

.parts-tag {
    position: absolute;
    left: 77%;
    z-index: 1;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    color: var(--ink);
    opacity: 0;
    transform: translateY(-50%) translateX(-8px);
    transition: opacity 240ms var(--ease), transform 360ms var(--ease), background-color 240ms var(--ease), color 240ms var(--ease);
}

.parts-tag[data-tag="canopy"] {
    top: 18%;
}

.parts-tag[data-tag="grid"] {
    top: 49%;
}

.parts-tag[data-tag="hub"] {
    top: 84%;
}

.parts-stage[data-state="apart"] .parts-tag {
    opacity: 1;
    transform: translateY(-50%);
    transition-delay: 240ms;
}

.parts-stage[data-focus="canopy"] .parts-tag[data-tag="canopy"],
.parts-stage[data-focus="grid"] .parts-tag[data-tag="grid"],
.parts-stage[data-focus="hub"] .parts-tag[data-tag="hub"],
.parts-stage[data-focus="floor"] .parts-tag[data-tag="canopy"],
.parts-stage[data-focus="floor"] .parts-tag[data-tag="grid"] {
    background: var(--leaf);
    color: var(--paper);
}

.parts-tabs {
    display: none;
}

.parts-hint {
    margin-top: 12px;
    font-size: 14px;
    line-height: 20px;
    color: var(--ink-muted);
    text-align: center;
}

.parts-list {
    display: grid;
    gap: var(--space-8);
}

/* A floor is a grid under a canopy: one leaf rule ties the two parts together. */
.parts-floor {
    display: grid;
    gap: 24px;
    padding-left: 24px;
    border-left: 2px solid var(--leaf);
}

.parts-floor-head p {
    margin: 0;
    max-width: 52ch;
    color: var(--ink-muted);
}

.parts-floor-head .parts-floor-label {
    margin-bottom: var(--space-1);
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--leaf);
}

.part {
    margin-left: calc(-1 * var(--space-4));
    padding: 12px var(--space-4) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 240ms var(--ease);
}

.part.is-active {
    background: var(--paper-sunk);
}

.part h3 {
    margin: 0 0 var(--space-1);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* The part names are the controls: plain text that reads as a heading, with a real button underneath. */
.part-trigger {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.part.is-active .part-trigger,
.parts-floor.is-active .parts-floor-label .part-trigger,
.part-trigger:hover {
    color: var(--leaf);
}

.parts-floor {
    transition: border-color 240ms var(--ease);
}

.parts-floor.is-active {
    border-left-color: var(--root);
}

.parts-floor-head {
    cursor: pointer;
}

.part p {
    margin: 0;
    max-width: 56ch;
    color: var(--ink-muted);
}

.part .feature-list {
    margin-top: 12px;
}

/* The Hub sits outside the floor's rule; its tile lines up with the floor parts' tiles. */
.part-hub {
    margin-left: 10px;
}

.spec-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
    margin: var(--space-8) 0 0;
}

.spec {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-4) 24px;
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
}

.spec dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 32px;
    line-height: 36px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.spec.is-water dd {
    color: var(--dew);
}

/* Feature lists: small leaf tiles as markers */
.feature-list {
    list-style: none;
    margin: var(--space-4) 0 0;
    padding: 0;
    display: grid;
    gap: var(--space-2);
}

.feature-list li {
    position: relative;
    padding-left: 24px;
    color: var(--ink);
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--leaf);
}

.on-root .feature-list li {
    color: var(--paper);
}

.on-root .feature-list li::before {
    background: var(--sprout);
}

/* ---------- Three grids at launch ---------- */
.grids-section {
    background: var(--paper-sunk);
}

.grid-types {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.grid-type {
    overflow: hidden;
    border-radius: var(--radius-tile);
    background: var(--paper);
}

.grid-type img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--paper);
}

.grid-type-body {
    padding: var(--space-4) var(--space-8) var(--space-8);
}

.grid-type-count {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin: 0 0 var(--space-2);
    font-weight: 600;
    color: var(--ink-muted);
}

.grid-type-count strong {
    font-family: var(--font-display);
    font-size: 64px;
    line-height: 56px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--leaf);
    font-variant-numeric: tabular-nums;
}

.grid-type h3 {
    margin: 0 0 var(--space-1);
    font-size: 24px;
    line-height: 28px;
    font-weight: 700;
}

.grid-type-body p:last-child {
    margin: 0;
    color: var(--ink-muted);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.product-card h3 {
    margin: 0 0 var(--space-2);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.product-card p {
    margin: 0;
    color: var(--ink-muted);
}

/* One tile at home, forty in a farm: the plan seen from above. */
.farm-plan-wrap {
    margin-top: auto;
    padding-top: var(--space-8);
}

.farm-plan {
    display: grid;
    grid-template-columns: repeat(10, 20px);
    gap: 6px;
}

.farm-plan-caption {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: var(--ink-muted);
}

.farm-plan-tile,
.farm-plan-leaf svg {
    display: block;
    width: 20px;
    height: 20px;
}

.farm-plan-tile {
    border-radius: 4px;
    background: var(--leaf);
}

.farm-plan-leaf svg {
    fill: var(--fern);
}

/* ---------- Ask your farm: the AI, shown as a real-looking conversation ---------- */
.ai-section-inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 64px;
    align-items: center;
}

.ai-convo {
    margin: 0;
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--root);
    color: var(--paper);
}

.ai-convo-head {
    display: grid;
    gap: var(--space-1);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid rgba(245, 242, 232, 0.16);
}

.ai-convo-head strong {
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 28px;
    font-weight: 700;
}

.ai-convo-head span,
.ai-convo figcaption {
    font-size: 14px;
    line-height: 20px;
    color: rgba(245, 242, 232, 0.78);
}

.ai-convo-log {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-convo figcaption {
    margin-top: var(--space-4);
}

/* The conversation plays once when it scrolls into view (only when motion is welcome; see home.js). */
.ai-convo.is-armed .chat-message {
    opacity: 0;
    transform: translateY(12px);
}

.ai-convo.is-playing .chat-message {
    animation: convo-in 480ms var(--ease) both;
}

.ai-convo.is-playing .chat-message:nth-child(2) {
    animation-delay: 700ms;
}

.ai-convo.is-playing .chat-message:nth-child(3) {
    animation-delay: 1700ms;
}

.ai-convo.is-playing .chat-message:nth-child(4) {
    animation-delay: 2400ms;
}

@keyframes convo-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Stacking: the tower rises in a tall, centre-cropped frame ---------- */
.stack-scene {
    background: var(--paper);
}

.stack-scene-inner {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 64px;
    align-items: center;
}

.stack-scene-frame {
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

/* Cover + centre: the tower stays in frame whatever the clip's width. */
.stack-scene-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
}

.stack-copy {
    max-width: 440px;
}

.stack-copy .section-lead {
    margin-bottom: 0;
}

/* ---------- Contact: a deep green close with the form on paper ---------- */
.contact-section {
    padding: 96px 0;
    background: var(--root);
    color: var(--paper);
}

.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "intro form"
        "list form";
    gap: 0 64px;
    align-items: start;
}

.contact-intro {
    grid-area: intro;
}

.contact-form {
    grid-area: form;
}

.contact-list :focus-visible {
    outline-color: var(--sprout);
}

.contact-title {
    margin: 0 0 var(--space-4);
    font-size: clamp(40px, 5vw, 64px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--paper);
}

.contact-lead {
    margin: 0;
    max-width: 40ch;
    font-size: 18px;
    line-height: 28px;
    color: var(--paper);
}

.contact-list {
    grid-area: list;
    display: grid;
    gap: var(--space-4);
    margin: 40px 0 0;
    padding-top: 24px;
    border-top: 1px solid rgba(245, 242, 232, 0.2);
}

.contact-list div {
    display: grid;
    gap: var(--space-1);
}

.contact-list dt {
    color: var(--sprout);
}

.contact-list dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 28px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.contact-list a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--paper);
    text-decoration: underline;
    text-decoration-color: rgba(245, 242, 232, 0.4);
    text-underline-offset: 6px;
}

.contact-list a:hover {
    color: var(--sprout);
    text-decoration-color: var(--sprout);
}

.contact-form {
    position: relative;
    display: grid;
    gap: var(--space-4);
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper);
    color: var(--ink);
}

.topic-field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.topic-field legend {
    margin-bottom: var(--space-2);
    padding: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.topic-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.topic-option {
    position: relative;
    display: block;
}

.topic-option input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.topic-option span {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
    color: var(--ink);
    transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.topic-option:hover span {
    border-color: var(--ink-muted);
}

.topic-option input:checked + span {
    border-color: var(--leaf);
    background: var(--leaf);
    color: var(--paper);
}

.topic-option input:focus-visible + span {
    outline: 2px solid var(--leaf);
    outline-offset: 2px;
}

.contact-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.contact-form label,
.auth-form label {
    display: grid;
    gap: var(--space-2);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: var(--ink);
}

.contact-form .topic-option {
    display: block;
}

.contact-form input,
.contact-form textarea,
.auth-form input,
.chat-form input {
    width: 100%;
    min-height: 48px;
    padding: 11px 12px;
    border: 1px solid var(--ink-muted);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
}

.contact-form textarea {
    min-height: 144px;
    resize: vertical;
}

.contact-form ::placeholder,
.chat-form ::placeholder {
    color: var(--ink-muted);
    opacity: 1;
}

.contact-honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-status {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.contact-status.is-error {
    color: var(--soil);
}

.contact-status.is-success {
    color: var(--leaf);
}

.contact-form .btn {
    width: 100%;
}

/* The contact band runs straight into the footer: a hairline marks the seam. */
.home .site-footer {
    border-top: 1px solid rgba(245, 242, 232, 0.16);
}

/* Dots for swipe rows exist only on phones (see the 760px block). */
.swipe-dots {
    display: none;
}

/* ---------- Footer ---------- */
.site-footer {
    padding: var(--space-8) 0;
    background: var(--root);
    color: var(--paper);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
    align-items: center;
}

.footer-inner p {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
}

.footer-nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    font-size: 14px;
    font-weight: 600;
    color: var(--paper);
}

.footer-nav a:hover {
    color: var(--sprout);
}

/* The on-root lockup carries its own root panel and clear space;
   pull it left so the visible mark lines up with the container edge. */
.footer-brand img {
    height: 64px;
    width: auto;
    margin-left: calc(-64px * 40 / 196);
}

/* ---------- Pills (dashboard controls and status) ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: var(--space-1) 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--paper-sunk);
    color: var(--ink);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

/* Status pills sitting on a paper-sunk tile need the lighter ground to show. */
.card .pill:not(button) {
    background: var(--paper);
}

button.pill {
    min-height: var(--tap);
    border-color: var(--ink-muted);
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
}

button.pill:hover {
    background: var(--paper-sunk);
}

.pill.active,
button.pill.active {
    background: var(--leaf);
    border-color: var(--leaf);
    color: var(--paper);
}

.pill.has-alert {
    position: relative;
}

.pill.has-alert::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--soil);
    border: 2px solid var(--paper);
}

#system-status {
    border-width: 2px;
    border-color: var(--ink-muted);
}

/* ---------- Dashboard ---------- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.metric-card {
    min-width: 0;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 24px;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.metric-card .kicker {
    margin-bottom: 0;
    color: var(--ink-muted);
}

.metric-card > strong,
.metric-card-main > strong {
    display: block;
    font-family: var(--font-display);
    font-size: 32px;
    line-height: 36px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.metric-card span {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

/* Water data uses dew */
.metric-card[data-metric="water_temp"] .metric-card-main > strong,
.metric-card[data-metric="ec"] .metric-card-main > strong,
.metric-card[data-metric="ph"] .metric-card-main > strong,
.metric-card[data-metric="flow"] .metric-card-main > strong,
.metric-card[data-metric="water_temp"] .sparkline,
.metric-card[data-metric="ec"] .sparkline,
.metric-card[data-metric="ph"] .sparkline,
.metric-card[data-metric="flow"] .sparkline,
.metric-card[data-metric="water_temp"] .detail-chart,
.metric-card[data-metric="ec"] .detail-chart,
.metric-card[data-metric="ph"] .detail-chart,
.metric-card[data-metric="flow"] .detail-chart {
    color: var(--dew);
}

.metric-card .detail-stat strong {
    display: inline;
    color: var(--ink);
    font-size: 16px;
    line-height: 20px;
}

.metric-card-wide {
    min-height: auto;
    gap: var(--space-2);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.dashboard-header .section-lead {
    margin-bottom: var(--space-2);
}

.last-updated {
    margin: 0;
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

.device-selector {
    margin-top: 0;
    margin-bottom: 24px;
}

.metric-group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin: var(--space-8) 0 var(--space-4);
}

.metric-group-heading h2 {
    margin: 0;
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.metric-group-heading span {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

.dashboard-metrics {
    margin-bottom: var(--space-8);
}

.dashboard-metrics.is-loading .metric-card {
    animation: dashboard-pulse 1.4s ease-in-out infinite;
}

.dashboard-metrics.is-loading .metric-card strong,
.dashboard-metrics.is-loading .metric-card span:not(.kicker),
.dashboard-metrics.is-loading .sparkline,
.dashboard-metrics.is-loading .metric-expand-btn {
    opacity: 0.4;
}

@keyframes dashboard-pulse {
    50% {
        opacity: 0.6;
    }
}

/* Chart.js draws into these boxes; their text colour is the line colour. */
.sparkline {
    position: relative;
    height: 56px;
    margin: var(--space-2) 0;
    color: var(--leaf);
}

.sparkline-empty {
    display: flex;
    align-items: center;
    height: 100%;
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

.sparkline-empty[hidden],
.detail-chart-empty[hidden] {
    display: none;
}

.metric-card-expandable {
    gap: 0;
}

.metric-card-main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    min-height: 140px;
}

.metric-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-expand-btn {
    width: var(--tap);
    height: var(--tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--ink-muted);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: transform 200ms ease, color 200ms ease, background-color 200ms ease;
}

.metric-expand-btn svg {
    width: 16px;
    height: 16px;
}

.metric-expand-btn:hover {
    background: var(--paper);
}

.metric-card-expandable.is-expanded {
    grid-column: 1 / -1;
}

.metric-card-expandable.is-expanded .metric-expand-btn {
    transform: rotate(180deg);
    color: var(--paper);
    background: var(--leaf);
    border-color: var(--leaf);
}

.metric-card-detail {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    display: grid;
    gap: var(--space-4);
}

.metric-card-detail[hidden] {
    display: none;
}

.detail-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.detail-chart-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.detail-range {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.detail-stat {
    display: inline-flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 72px;
    padding: var(--space-2) 12px;
    border-radius: var(--radius-md);
    background: var(--paper);
}

.detail-stat span {
    color: var(--ink-muted);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.detail-stat strong {
    color: var(--ink);
    font-size: 16px;
    line-height: 20px;
}

.detail-chart {
    position: relative;
    height: 280px;
    padding: var(--space-4) var(--space-4) var(--space-2);
    border-radius: var(--radius-md);
    background: var(--paper);
    color: var(--leaf);
}

.detail-chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--ink-muted);
}

.camera-card {
    padding: 24px;
}

.camera-card h3 {
    margin: 0;
}

.camera-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.camera-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

#camera-source button:disabled {
    opacity: 0.6;
    cursor: progress;
}

.camera-frame {
    background: var(--ink);
    height: min(380px, 55vw);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.camera-frame img {
    max-height: 100%;
    width: 100%;
    object-fit: contain;
}

/* ---------- The AI chat: dashboard panel, phone sheet and the landing example ---------- */
/* One component, two moods: light where it sits among the dashboard cards, dark when it fills a phone
   screen or stands alone on the landing page. Only these tokens change. */
.chat-card,
.ai-convo {
    --chat-bg: var(--paper-sunk);
    --chat-ink: var(--ink);
    --chat-muted: var(--ink-muted);
    --chat-line: var(--line);
    --chat-user-bg: var(--leaf);
    --chat-user-ink: var(--paper);
    --chat-leaf: var(--leaf);
    --chat-row-bg: var(--paper);
    --chat-row-line: var(--line);
    --chat-field-bg: var(--paper);
    --chat-field-line: var(--line);
    --chat-send-bg: var(--leaf);
    --chat-send-ink: var(--paper);
    --chat-focus: var(--leaf);
}

.ai-convo {
    --chat-bg: var(--root);
    --chat-ink: var(--paper);
    --chat-muted: rgba(245, 242, 232, 0.74);
    --chat-line: rgba(245, 242, 232, 0.16);
    --chat-user-bg: var(--sprout);
    --chat-user-ink: var(--ink);
    --chat-leaf: var(--sprout);
    --chat-row-bg: rgba(245, 242, 232, 0.08);
    --chat-row-line: rgba(245, 242, 232, 0.22);
    --chat-field-line: transparent;
    --chat-send-bg: var(--sprout);
    --chat-send-ink: var(--ink);
    --chat-focus: var(--sprout);
}

.chat-card {
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    color: var(--chat-ink);
}

.chat-card h3 {
    font-size: 24px;
    line-height: 28px;
    color: var(--chat-ink);
}

.chat-card :focus-visible {
    outline-color: var(--chat-focus);
}

.chat-header {
    align-items: flex-start;
    flex-wrap: nowrap;
    margin-bottom: 0;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--chat-line);
}

.card p.chat-sub {
    margin: var(--space-1) 0 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--chat-muted);
}

.chat-log {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 160px;
    max-height: 480px;
    overflow-y: auto;
    padding: 20px 2px;
}

/* Before the first question: a welcome, not an empty box. */
.chat-empty {
    display: grid;
    justify-items: start;
    gap: var(--space-2);
    margin: auto 0 0;
}

.chat-empty-leaf {
    width: 28px;
    height: 28px;
    fill: var(--chat-leaf);
}

.card p.chat-empty-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--chat-ink);
}

.card p.chat-empty-text {
    margin: 0;
    font-size: 15px;
    line-height: 22px;
    color: var(--chat-muted);
}

.chat-message {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Your question: a small chip on the right. */
.chat-message.from-user {
    align-self: flex-end;
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md) var(--radius-md) var(--space-1) var(--radius-md);
    background: var(--chat-user-bg);
    color: var(--chat-user-ink);
    font-size: 15px;
    line-height: 22px;
}

/* The answer: full-width text under a small label, so long replies read like a note, not a bubble. */
.chat-message.from-assistant {
    display: grid;
    gap: 6px;
    color: var(--chat-ink);
}

.chat-who {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--chat-muted);
}

.chat-who svg {
    width: 12px;
    height: 12px;
    fill: var(--chat-leaf);
}

.chat-text {
    display: grid;
    gap: var(--space-2);
    font-size: 15px;
    line-height: 23px;
}

.chat-text p,
.card .chat-text p {
    margin: 0;
    color: inherit;
}

.chat-text ul {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.chat-text li {
    position: relative;
    padding-left: var(--space-4);
}

.chat-text li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--chat-leaf);
}

.chat-message.is-pending .chat-text {
    color: var(--chat-muted);
}

.chat-message.is-pending .chat-who svg {
    animation: chat-thinking 1.2s ease-in-out infinite;
}

@keyframes chat-thinking {
    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

.chat-message.is-error .chat-text {
    padding-left: 12px;
    border-left: 3px solid var(--soil);
}

.chat-suggestions {
    display: grid;
    gap: var(--space-2);
}

.chat-suggestions[hidden] {
    display: none;
}

.chat-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: var(--tap);
    padding: 10px 14px;
    border: 1px solid var(--chat-row-line);
    border-radius: var(--radius-md);
    background: var(--chat-row-bg);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    color: var(--chat-ink);
    cursor: pointer;
    transition: border-color 160ms var(--ease);
}

.chat-suggestion svg {
    flex: none;
    width: 12px;
    height: 12px;
    fill: var(--chat-leaf);
}

.chat-suggestion:hover {
    border-color: var(--chat-leaf);
}

.chat-suggestion:disabled {
    opacity: 0.5;
    cursor: default;
}

/* One field with the send button inside it. */
.chat-form {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: 12px;
    padding: var(--space-1) var(--space-1) var(--space-1) 14px;
    border: 1px solid var(--chat-field-line);
    border-radius: var(--radius-md);
    background: var(--chat-field-bg);
}

.chat-form:focus-within {
    outline: 2px solid var(--chat-focus);
    outline-offset: 2px;
}

.chat-form input,
.chat-form input:disabled {
    flex: 1;
    min-width: 0;
    min-height: var(--tap);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
}

.chat-form input:focus-visible {
    outline: none;
}

.chat-send {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--chat-send-bg);
    color: var(--chat-send-ink);
    cursor: pointer;
}

.chat-send svg {
    width: 20px;
    height: 20px;
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: default;
}

.auth-pending main {
    visibility: hidden;
}

.dashboard-account {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

#crops-button.needs-setup {
    background: var(--leaf);
    border-color: var(--leaf);
    color: var(--paper);
}

.account-email {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.alert-list {
    display: grid;
    gap: var(--space-2);
    margin-bottom: 24px;
}

.alert-list[hidden] {
    display: none;
}

.alert-item {
    padding: 12px var(--space-4);
    border: 1px solid var(--soil);
    border-radius: var(--radius-md);
    background: var(--paper);
    color: var(--soil);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.dashboard-metrics.is-stale .metric-card > strong,
.dashboard-metrics.is-stale .metric-card-main > strong {
    opacity: 0.5;
}

.demo-banner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: var(--space-4) 24px;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.demo-banner[hidden] {
    display: none;
}

.demo-banner strong {
    display: block;
    color: var(--leaf);
}

.demo-banner span {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

.demo-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* ---------- Vegetile AI on the dashboard ---------- */
/* Wide screens: readings on the left, the AI in a panel that stays beside them while you scroll. */
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: var(--space-8);
    align-items: start;
}

.dashboard-main {
    min-width: 0;
}

.ai-panel {
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
    border-radius: var(--radius-tile);
}

.ai-panel .chat-card {
    max-height: calc(100vh - var(--header-height) - var(--space-8));
    margin-top: 0;
}

.ai-panel .chat-log {
    flex: 1 1 auto;
    min-height: 200px;
    max-height: none;
}

.chat-close {
    display: none;
}

/* A question sent from a card: the panel flashes once so you see where the answer lands. */
.ai-panel.is-called {
    animation: ai-called 900ms var(--ease);
}

@keyframes ai-called {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(182, 227, 90, 0);
    }
    30% {
        box-shadow: 0 0 0 4px var(--sprout);
    }
}

/* "Ask why" / "Ask AI about this" on the cards */
.ask-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    align-self: flex-start;
    min-height: var(--tap);
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--leaf);
    cursor: pointer;
}

.ask-link:hover {
    color: var(--root);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.ask-link:disabled {
    opacity: 0.5;
    cursor: default;
}

.ask-leaf {
    width: 12px;
    height: 12px;
    flex: none;
    fill: currentColor;
}

.ai-launcher {
    display: none;
}

/* Narrower screens: the AI lives behind a button that is always in reach, and opens full screen. */
@media (max-width: 1000px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-page {
        padding-bottom: 104px;
    }

    /* The sheet starts clipped to the button that opened it (--sheet-from, set in ai-chat.js)
       and grows to the full screen; closing runs it back into the button. */
    .ai-panel {
        position: fixed;
        inset: 0;
        z-index: 1100;
        display: none;
        border-radius: 0;
        clip-path: inset(var(--sheet-from, 100% 0 0 0) round var(--radius-md));
        transition: clip-path 420ms var(--ease);
    }

    .ai-panel.is-open {
        display: flex;
    }

    .ai-panel.is-expanded {
        clip-path: inset(0 0 0 0 round 0);
    }

    .ai-panel .chat-card {
        --chat-bg: var(--root);
        --chat-ink: var(--paper);
        --chat-muted: rgba(245, 242, 232, 0.74);
        --chat-line: rgba(245, 242, 232, 0.16);
        --chat-user-bg: var(--sprout);
        --chat-user-ink: var(--ink);
        --chat-leaf: var(--sprout);
        --chat-row-bg: rgba(245, 242, 232, 0.08);
        --chat-row-line: rgba(245, 242, 232, 0.22);
        --chat-field-line: transparent;
        --chat-send-bg: var(--sprout);
        --chat-send-ink: var(--ink);
        --chat-focus: var(--sprout);
        flex: 1 1 auto;
        max-height: none;
        border-radius: 0;
        padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    }

    /* The contents fade in once the green has started to fill the screen, and out first on close. */
    .ai-panel .chat-card > * {
        transition: opacity 220ms var(--ease) 160ms;
    }

    .ai-panel:not(.is-expanded) .chat-card > * {
        opacity: 0;
        transition-delay: 0ms;
    }

    .chat-close {
        display: inline-flex;
        flex: none;
        min-height: var(--tap);
        background: rgba(245, 242, 232, 0.1);
        color: var(--paper);
    }

    body.ai-sheet-open {
        overflow: hidden;
    }

    .ai-launcher {
        position: fixed;
        right: var(--space-4);
        bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
        z-index: 1050;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        min-height: 52px;
        padding: 0 20px;
        border: 0;
        border-radius: var(--radius-md);
        background: var(--root);
        color: var(--paper);
        font: inherit;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 4px 16px rgba(18, 59, 44, 0.24);
    }

    .ai-launcher .ask-leaf {
        width: 14px;
        height: 14px;
        fill: var(--sprout);
    }

    .ai-sheet-open .ai-launcher {
        display: none;
    }
}

/* ---------- Modals, onboarding, tour ---------- */
.plant-modal,
.onboard-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    background: var(--scrim);
    overflow: auto;
}

.plant-modal {
    z-index: 40;
}

.onboard-modal {
    z-index: 45;
}

.plant-modal[hidden],
.onboard-modal[hidden],
.tour-overlay[hidden] {
    display: none;
}

body.plant-modal-open,
body.onboard-open {
    overflow: hidden;
}

/* Tour must be able to scroll targets into view; only the bubble captures clicks. */
body.tour-open {
    overscroll-behavior: none;
}

.plant-modal-card,
.onboard-card {
    width: min(720px, 100%);
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper);
}

.plant-modal-card .section-lead {
    margin-bottom: 24px;
}

.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-2);
}

.plant-card,
.onboard-option {
    display: grid;
    gap: var(--space-1);
    text-align: left;
    padding: var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.plant-card:hover,
.onboard-option:hover {
    border-color: var(--ink-muted);
}

.plant-card.is-selected,
.onboard-option.is-selected {
    border-color: var(--leaf);
    box-shadow: inset 0 0 0 1px var(--leaf);
}

.plant-card strong,
.onboard-option strong {
    color: var(--leaf);
    font-weight: 700;
}

.plant-card span,
.onboard-option span {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

.plant-card-meta {
    margin-top: var(--space-1);
    font-weight: 600;
    color: var(--ink) !important;
}

.plant-conflict {
    margin: var(--space-4) 0 0;
    padding: 12px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
    color: var(--leaf);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.plant-tile-step {
    margin-top: 24px;
}

.plant-tile-step h3 {
    margin: 0 0 var(--space-1);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
}

.plant-tile-step .section-lead {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 20px;
}

.plant-tile-row {
    display: grid;
    gap: var(--space-2);
    margin-bottom: 12px;
}

.plant-modal-actions,
.onboard-actions {
    margin-top: 24px;
}

.tour-section {
    display: block;
}

.tour-section .metric-group-heading:first-child {
    margin-top: var(--space-8);
}

.onboard-progress {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.onboard-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--line);
}

.onboard-dot.is-done {
    background: var(--leaf);
}

.onboard-dot.is-active {
    width: 24px;
    background: var(--leaf);
}

.onboard-options {
    display: grid;
    gap: var(--space-2);
}

.onboard-rec-headline {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--leaf);
}

.onboard-rec-summary {
    margin: 0 0 var(--space-4);
    color: var(--ink-muted);
}

.onboard-rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.onboard-rec-card {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
}

.onboard-rec-card strong {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 600;
    color: var(--ink);
}

.onboard-rec-card span:last-child {
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 20px;
}

.onboard-why {
    margin: 0 0 var(--space-4);
    padding-left: 20px;
    color: var(--ink);
}

.onboard-why li {
    margin-bottom: var(--space-1);
}

.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: transparent;
    pointer-events: none;
}

.tour-overlay .tour-bubble,
.tour-overlay .tour-actions .btn {
    pointer-events: auto;
}

/* The spread is the dimmed backdrop around the highlighted element, not a drop shadow. */
.tour-spotlight {
    position: fixed;
    border-radius: var(--radius-tile);
    box-shadow: 0 0 0 9999px var(--scrim);
    border: 2px solid var(--sprout);
    pointer-events: none;
    /* No position transition: scrolling + animating the hole makes it drift mid-step. */
}

.tour-bubble {
    position: fixed;
    z-index: 51;
    max-width: 360px;
    padding: var(--space-4) 24px;
    border-radius: var(--radius-tile);
    background: var(--paper);
}

.tour-bubble strong {
    display: block;
    margin: var(--space-1) 0 var(--space-2);
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--ink);
}

.tour-bubble p {
    margin: 0 0 var(--space-4);
    color: var(--ink-muted);
}

.tour-actions {
    margin-top: 0;
}

/* ---------- Auth pages (log in, verify, demo) ---------- */
.auth-card {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.auth-card .section-lead {
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: 24px;
}

.auth-form {
    display: grid;
    gap: var(--space-4);
}

.auth-form label[hidden],
.auth-form p[hidden] {
    display: none;
}

.auth-hint,
.auth-error {
    margin: calc(-1 * var(--space-2)) 0 0;
    font-size: 14px;
    line-height: 20px;
}

.auth-hint {
    color: var(--ink-muted);
}

.auth-error {
    color: var(--soil);
    font-weight: 600;
}

.auth-form .btn {
    margin-top: var(--space-2);
}

.auth-form[hidden],
.auth-tabs[hidden],
.auth-sent[hidden],
.auth-notice[hidden] {
    display: none;
}

.auth-sent {
    display: grid;
    gap: var(--space-4);
}

.auth-sent p {
    margin: 0;
}

.auth-sent strong {
    overflow-wrap: anywhere;
}

.auth-sent .auth-hint {
    margin: 0;
}

.auth-notice {
    padding: 12px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--paper);
    color: var(--leaf);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.auth-back {
    justify-self: center;
    min-height: var(--tap);
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.auth-demo-link.auth-demo-after {
    margin: 24px 0 0;
}

.auth-demo-link {
    margin: calc(-1 * var(--space-2)) 0 24px;
    color: var(--ink-muted);
}

.auth-demo-link a {
    /* Inline link: pad the hit area to 44px without moving the line. */
    display: inline-block;
    padding: 12px 0;
    margin: -12px 0;
    color: var(--leaf);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ---------- How it works: one closed loop, told at full size ---------- */
.how-hero {
    padding: 64px 0 var(--space-8);
}

.how-hero-grid,
.how-split {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 64px;
    align-items: center;
}

.how-title {
    margin: 0 0 24px;
    font-size: clamp(44px, 5.6vw, 80px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.how-lead {
    margin: 0;
    max-width: 56ch;
    font-size: 20px;
    line-height: 30px;
    color: var(--ink-muted);
}

.how-hero-media,
.how-figure {
    position: relative;
    margin: 0;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.how-hero-media img,
.how-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.how-hero-media img {
    object-position: 50% 100%;
}

.how-hero-media figcaption {
    position: absolute;
    left: var(--space-4);
    bottom: var(--space-4);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

/* The loop: three big tiles that jump to their step. */
.how-loop-band {
    padding-bottom: var(--space-8);
}

.how-loop {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.how-loop a {
    display: grid;
    align-content: start;
    gap: var(--space-2);
    height: 100%;
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--root);
    color: var(--paper);
    transition: background-color 160ms var(--ease);
}

.how-loop a:hover {
    background: var(--leaf);
}

.how-loop-index {
    font-family: var(--font-display);
    font-size: 64px;
    line-height: 56px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--sprout);
}

.how-loop strong {
    font-family: var(--font-display);
    font-size: 32px;
    line-height: 36px;
    font-weight: 700;
}

.how-loop a > span:last-child {
    font-size: 18px;
    line-height: 26px;
}

.how-step {
    padding: 112px 0;
}

.how-step-sunk {
    background: var(--paper-sunk);
}

.how-step-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 var(--space-4);
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--leaf);
}

.how-step-label span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--leaf);
    color: var(--paper);
}

.how-step-title {
    margin: 0 0 24px;
    font-size: clamp(36px, 4.4vw, 56px);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.how-step-head {
    max-width: 760px;
    margin-bottom: 48px;
}

.how-measures {
    display: grid;
    margin: 40px 0 0;
}

.how-measures div {
    display: grid;
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
    gap: 24px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
}

.how-measures div:last-child {
    border-bottom: 1px solid var(--line);
}

.how-measures dt {
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 28px;
    font-weight: 700;
}

.how-measures dd {
    margin: 0;
    font-size: 18px;
    line-height: 28px;
    color: var(--ink-muted);
}

.how-features {
    margin-top: var(--space-8);
    gap: 12px;
}

.how-features li {
    font-size: 18px;
    line-height: 28px;
}

.how-features li::before {
    top: 10px;
}

/* Example status: the three states the AI can give, with the current one picked out. */
.how-status {
    padding: 40px;
    border-radius: var(--radius-tile);
    background: var(--paper);
}

.how-status-scale {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    margin: var(--space-4) 0 var(--space-8);
    padding: 0;
    list-style: none;
}

.how-status-scale li {
    padding: 12px var(--space-2);
    border-top: 4px solid transparent;
    border-radius: var(--radius-md);
    background: var(--paper-sunk);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    text-align: center;
    color: var(--ink-muted);
}

.how-status-scale .is-healthy {
    border-top-color: var(--leaf);
}

.how-status-scale .is-watch {
    border-top-color: var(--ink);
}

.how-status-scale .is-action {
    border-top-color: var(--soil);
}

.how-status-scale .is-current {
    background: var(--ink);
    color: var(--paper);
}

.how-status-word {
    display: block;
    margin-bottom: var(--space-4);
    font-family: var(--font-display);
    font-size: 64px;
    line-height: 60px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.how-status p:last-child {
    margin: 0;
    font-size: 18px;
    line-height: 28px;
    color: var(--ink-muted);
}

.how-actuators {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.how-actuator {
    display: flex;
    flex-direction: column;
    padding: var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.how-actuator h3 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 36px;
    font-weight: 700;
}

.how-actuator p {
    margin: 0;
    font-size: 18px;
    line-height: 28px;
    color: var(--ink-muted);
}

/* Each actuator's three modes, with auto picked: a picture of the setting, not a control. */
.how-actuator .how-modes {
    display: flex;
    gap: var(--space-1);
    margin-top: auto;
    padding-top: var(--space-8);
}

.how-modes span {
    flex: 1;
    padding: var(--space-2) 0;
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    text-align: center;
    color: var(--ink-muted);
}

.how-modes .is-on {
    background: var(--leaf);
    color: var(--paper);
}

#see-it {
    padding-top: 0;
}

.how-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-8);
    align-items: end;
    padding: 64px;
    border-radius: var(--radius-tile);
    background: var(--root);
    color: var(--paper);
}

.how-cta .how-step-title,
.how-cta .how-lead {
    color: var(--paper);
}

.how-cta .how-step-title {
    margin-bottom: var(--space-4);
}

.how-cta .button-group {
    margin-top: 0;
}

/* ---------- Catalog ---------- */
/* Panel and picture as two tiles side by side; the picture crops from its centre. */
.catalog-hero {
    padding: var(--space-8) 0 64px;
}

.catalog-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-2);
}

.catalog-hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px var(--space-8) var(--space-8);
    border-radius: var(--radius-tile);
    background: var(--root);
    color: var(--paper);
}

.catalog-hero-media {
    min-height: min(72vh, 640px);
    overflow: hidden;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.catalog-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
}

.catalog-brand {
    margin: 0 0 var(--space-4);
}

/* On-root lockup: its own root panel and clear space blend into this panel. */
.catalog-brand img {
    height: 72px;
    width: auto;
    margin: calc(-72px * 40 / 196) 0 calc(-72px * 40 / 196) calc(-72px * 40 / 196);
}

.catalog-hero-title {
    margin: 0 0 var(--space-4);
    font-size: 40px;
    line-height: 44px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.catalog-hero-lead {
    margin: 0;
    color: var(--paper);
}

.catalog-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.catalog-steps li {
    display: grid;
    gap: var(--space-2);
    align-content: start;
    padding: 24px;
    border-radius: var(--radius-tile);
    background: var(--paper-sunk);
}

.catalog-steps strong {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--ink);
}

.catalog-steps span {
    color: var(--ink-muted);
}

.catalog-lineup {
    background: var(--paper-sunk);
}

.catalog-lineup-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px var(--space-8);
    margin-bottom: var(--space-8);
}

.catalog-lineup-header .section-lead {
    margin-bottom: 0;
}

.showcase-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-btn {
    min-height: var(--tap);
    padding: 0 var(--space-4);
    border: 1px solid var(--ink-muted);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}

.filter-btn:hover {
    background: var(--paper);
}

.filter-btn.active {
    background: var(--leaf);
    border-color: var(--leaf);
    color: var(--paper);
}

.catalog-status {
    margin: 0 0 24px;
    color: var(--ink-muted);
}

.catalog-status.is-error {
    color: var(--soil);
}

.catalog-list {
    display: grid;
    gap: 64px;
}

.catalog-item {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 48px;
    align-items: center;
    opacity: 1;
    transform: none;
    transition: opacity 420ms ease, transform 420ms ease;
    transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: no-preference) {
    .catalog-item:not(.is-visible) {
        opacity: 0;
        transform: translateY(16px);
    }
}

.catalog-item.is-visible {
    opacity: 1;
    transform: none;
}

.catalog-item:nth-child(even) {
    direction: rtl;
}

.catalog-item:nth-child(even) > * {
    direction: ltr;
}

.catalog-item[hidden] {
    display: none !important;
}

.catalog-item-media {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius-tile);
    background: var(--paper);
    min-height: clamp(240px, 36vw, 420px);
}

.catalog-item-media img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    object-fit: cover;
    object-position: center;
}

.catalog-badge {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    padding: var(--space-1) 12px;
    border-radius: var(--radius-sm);
    background: var(--root);
    color: var(--paper);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.catalog-item-copy h3 {
    margin: 0 0 var(--space-2);
    font-size: 28px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.catalog-tagline {
    margin: 0 0 var(--space-2);
    font-weight: 600;
    color: var(--leaf);
}

.catalog-desc {
    margin: 0 0 var(--space-4);
    max-width: 38rem;
    color: var(--ink-muted);
}

.catalog-specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
}

.catalog-specs div {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: 12px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--paper);
}

.catalog-specs dt {
    margin: 0;
    color: var(--ink-muted);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.catalog-specs dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 600;
    color: var(--ink);
}

.catalog-specs .is-water dd {
    color: var(--dew);
}

.catalog-features {
    margin-bottom: 0;
}

.catalog-cta-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px var(--space-8);
    padding: 48px;
    border-radius: var(--radius-tile);
    background: var(--root);
    color: var(--paper);
}

.catalog-cta-inner .section-lead {
    margin-bottom: 0;
    max-width: 36rem;
}

.hidden {
    display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .grid-3,
    .parts,
    .grid-types,
    .statement-grid,
    .product-grid,
    .metric-grid,
    .contact-layout,
    .how-hero-grid,
    .how-split,
    .catalog-steps {
        grid-template-columns: minmax(0, 1fr);
    }

    .contact-layout,
    .how-hero-grid,
    .how-split {
        gap: var(--space-8);
    }

    .contact-layout {
        grid-template-rows: none;
        grid-template-areas:
            "intro"
            "form"
            "list";
    }

    .contact-list {
        margin-top: 0;
    }

    .how-loop,
    .how-actuators,
    .how-cta,
    .ai-section-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .how-hero-media {
        aspect-ratio: 1;
        max-width: 560px;
    }

    .how-hero-media img {
        object-position: 50% 85%;
    }

    .how-figure {
        max-width: 480px;
    }

    /* Single column: the picture, three part buttons under it, and only the chosen part's text. */
    .parts {
        gap: var(--space-4);
    }

    .parts-stage,
    .parts-tabs {
        width: min(100%, 320px);
        margin-left: auto;
        margin-right: auto;
    }

    .parts-hint {
        display: none;
    }

    .parts-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-2);
        margin-top: 12px;
    }

    .parts-tabs button {
        min-height: var(--tap);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        background: var(--paper-sunk);
        font: inherit;
        font-size: 15px;
        font-weight: 600;
        color: var(--ink);
        cursor: pointer;
    }

    .parts-tabs button[aria-pressed="true"] {
        border-color: var(--leaf);
        background: var(--leaf);
        color: var(--paper);
    }

    .parts-list {
        gap: 0;
    }

    .parts-list .part:not(.is-active),
    .parts-floor-head {
        display: none;
    }

    .parts-floor:has(.part.is-active) .parts-floor-head {
        display: block;
        margin-bottom: 12px;
    }

    .parts-floor {
        gap: 0;
        padding-left: 0;
        border-left: 0;
    }

    .part,
    .part-hub {
        margin-left: 0;
        padding: var(--space-4) 20px 20px;
    }

    .part h3 {
        font-size: 24px;
        line-height: 28px;
    }

    .spec-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stack-scene-inner {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .stack-scene-frame {
        aspect-ratio: 4 / 3;
    }

    .stack-copy {
        max-width: 60ch;
    }

    .catalog-hero-grid {
        grid-template-columns: 1fr;
    }

    .catalog-hero-media {
        min-height: 0;
        aspect-ratio: 4 / 3;
    }

    .catalog-item,
    .catalog-item:nth-child(even) {
        grid-template-columns: 1fr;
        gap: 24px;
        direction: ltr;
    }

    .catalog-item-media {
        min-height: 240px;
    }


    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .camera-frame {
        height: min(280px, 70vw);
    }

    .product-card {
        min-height: auto;
    }
}

@media (max-width: 760px) {
    .brand img {
        height: 28px;
    }

    .nav-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .nav-menu {
        position: absolute;
        top: var(--header-height);
        right: var(--space-4);
        left: var(--space-4);
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
        padding: var(--space-2);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        background: var(--paper);
        display: none;
        z-index: 1001;
    }

    .nav-menu.open {
        display: flex;
    }

    /* Phones: the photo becomes a block with the headline on its calm top; the rest follows on paper. */
    .hero {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        height: auto;
        min-height: 0;
        background: var(--paper);
    }

    .hero-photo {
        position: relative;
        inset: auto;
        grid-row: 1;
        grid-column: 1;
        height: min(140vw, 720px);
    }

    .hero-photo img {
        object-position: 50% 100%;
    }

    .hero-copy {
        display: contents;
    }

    .hero-head {
        grid-row: 1;
        grid-column: 1;
        z-index: 1;
        max-width: none;
        padding: var(--space-8) var(--space-8) 0;
    }

    .hero-body {
        grid-row: 2;
        max-width: none;
        margin: 0;
        padding: 24px var(--space-8) 0;
    }

    .hero-credit {
        position: relative;
        left: auto;
        bottom: auto;
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
        align-self: end;
        margin: 0 var(--space-8) var(--space-4);
    }

    .statement {
        padding: 64px 0 16px;
    }

    .grid-type-body {
        padding: var(--space-4) 24px 24px;
    }

    .ai-section-inner {
        gap: var(--space-8);
    }

    .ai-convo {
        padding: 24px var(--space-4);
    }

    .contact-section {
        padding: 64px 0;
    }

    .how-hero {
        padding-top: 40px;
    }

    .how-step {
        padding: 64px 0;
    }

    .how-lead {
        font-size: 18px;
        line-height: 28px;
    }

    .how-loop a {
        padding: 24px;
    }

    .how-measures div {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-1);
    }

    .how-status {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .how-status-word {
        font-size: 48px;
        line-height: 48px;
    }

    .contact-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .farm-plan {
        grid-template-columns: repeat(8, 20px);
    }

    .hero-copy h1 {
        font-size: 48px;
        line-height: 44px;
    }

    .hero-copy .hero-sub {
        max-width: none;
        font-size: 22px;
        line-height: 28px;
    }

    .section {
        padding: 48px 0;
    }

    .section-title,
    .statement h2,
    .catalog-hero-title {
        font-size: 32px;
        line-height: 36px;
    }

    .how-cta,
    .catalog-cta-inner {
        padding: var(--space-8) 24px;
    }

    .card,
    .product-card,
    .contact-form,
    .auth-card,
    .catalog-hero-panel,
    .how-status,
    .how-actuator,
    .plant-modal-card,
    .onboard-card {
        padding-left: 24px;
        padding-right: 24px;
    }

    .nav-link.navcta {
        margin-left: 0;
    }

    .product-card {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .spec {
        padding: var(--space-4);
    }

    /* Card groups become one swipeable row: each card nearly full width, the next one peeking in. */
    .grid-types,
    .how-loop,
    .how-actuators,
    .catalog-steps {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 80%;
        margin-left: calc(-1 * var(--space-8));
        margin-right: calc(-1 * var(--space-8));
        padding: 0 var(--space-8) var(--space-1);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--space-8);
        scrollbar-width: none;
    }

    .grid-types::-webkit-scrollbar,
    .how-loop::-webkit-scrollbar,
    .how-actuators::-webkit-scrollbar,
    .catalog-steps::-webkit-scrollbar {
        display: none;
    }

    .grid-types > *,
    .how-loop > *,
    .how-actuators > *,
    .catalog-steps > * {
        scroll-snap-align: start;
    }

    .swipe-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-top: var(--space-4);
    }

    .swipe-dots span {
        width: 8px;
        height: 8px;
        border-radius: 2px;
        background: var(--line);
        transition: width 200ms var(--ease), background-color 200ms var(--ease);
    }

    .swipe-dots span.is-active {
        width: 24px;
        background: var(--leaf);
    }

    .how-figure {
        display: none;
    }

    .catalog-specs div {
        padding: var(--space-2) 12px;
    }

    .catalog-specs dd {
        font-size: 15px;
        line-height: 20px;
    }

    .parts-stage {
        width: min(100%, 240px);
    }

    .parts-hint {
        margin-top: var(--space-2);
    }

    .spec dd {
        font-size: 24px;
        line-height: 28px;
    }

    .metric-card > strong,
    .metric-card-main > strong {
        font-size: 28px;
        line-height: 32px;
    }

    .detail-chart {
        height: 220px;
        padding: var(--space-2);
    }

    .button-group {
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .catalog-brand img {
        height: 56px;
        margin: calc(-56px * 40 / 196) 0 calc(-56px * 40 / 196) calc(-56px * 40 / 196);
    }
}

@media (max-width: 420px) {
    .header-inner {
        min-height: 64px;
    }

    .parts-figure {
        top: 64px;
    }

    .nav-menu {
        top: 64px;
    }
}

/* The smallest phones: show the whole photo and step the type down so the words stay above the tower. */
@media (max-width: 359px) {
    .hero-photo {
        height: 150vw;
    }

    .hero-copy h1 {
        font-size: 40px;
        line-height: 40px;
    }

    .hero-copy .hero-sub {
        font-size: 20px;
        line-height: 24px;
    }
}

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

    .catalog-item {
        opacity: 1 !important;
        transform: none !important;
    }
}
