/* Agrovisus marketing site — tokens, base, layout, header, hero.
   Brand: logo near-black + logo green, circuit-trace motif. Light default, full dark theme. */

:root {
  --paper: #F6F7F2;
  --surface: #FFFFFF;
  --surface-2: #EDF0E7;
  --sunk: #E6EADF;
  --ink: #101411;
  --ink-2: #333B35;
  --muted: #5A635C;
  --line: #D8DDD2;
  --line-2: #C3CABD;
  --green: #22B24C;          /* logo green: fills, marks, large display only */
  --green-deep: #13773A;     /* text-safe green on light (5.6:1 on paper) */
  --green-ink: #0B4D25;
  --green-soft: #DDF3E2;
  --mint: #9EEBBE;           /* circuit highlight from the logo */
  --plot-1: #CBE8D2; --plot-2: #B5DFC0; --plot-3: #A2D6AE; --plot-nursery: #F1E6C8;
  --palm: rgba(19, 119, 58, .28);
  --warn-bg: #FFF1D6; --warn-ink: #7A4B00;
  --ok-bg: #DDF3E2; --ok-ink: #0B5A2A;
  --err: #B42318;
  --shadow: 0 1px 2px rgba(16,20,17,.05), 0 8px 24px -8px rgba(16,20,17,.12);
  --shadow-lg: 0 2px 4px rgba(16,20,17,.04), 0 24px 60px -18px rgba(16,20,17,.25);
  --focus: 0 0 0 3px var(--paper), 0 0 0 5px var(--green-deep);
  --radius: 14px;
  --radius-lg: 22px;
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0C100D;
  --surface: #141A16;
  --surface-2: #19211B;
  --sunk: #0F1510;
  --ink: #EDF1EB;
  --ink-2: #C9D1C8;
  --muted: #9AA59C;
  --line: #27302A;
  --line-2: #354037;
  --green: #22B24C;
  --green-deep: #52D17F;     /* text-safe green on dark (9:1) */
  --green-ink: #B9F2CC;
  --green-soft: #133A21;
  --mint: #7FE2A8;
  --plot-1: #16301E; --plot-2: #1B3B25; --plot-3: #21462C; --plot-nursery: #3A3320;
  --palm: rgba(127, 226, 168, .22);
  --warn-bg: #3A2A0B; --warn-ink: #FFD58A;
  --ok-bg: #133A21; --ok-ink: #9EEBBE;
  --err: #FF8A80;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 24px 60px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.6 var(--f-body); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .35s var(--ease), color .35s var(--ease);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; letter-spacing: -.022em; line-height: 1.08; font-weight: 700; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--green-deep); text-underline-offset: 3px; }
em { font-style: normal; }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::selection { background: var(--green); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
html { scrollbar-color: var(--line-2) var(--paper); }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(1200px, 100% - 64px); } }

[data-theme="dark"] .only-light, :root:not([data-theme="dark"]) .only-dark { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--surface); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 16px/1 var(--f-body); letter-spacing: -.005em; text-decoration: none; cursor: pointer;
  padding: 14px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--bg); color: var(--fg);
  transition: transform .25s var(--ease), background-color .25s, box-shadow .25s, border-color .25s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary { --bg: var(--ink); --fg: var(--paper); box-shadow: 0 8px 20px -10px rgba(16,20,17,.6); }
.btn--primary:hover { --bg: var(--green-ink); }
[data-theme="dark"] .btn--primary { --bg: var(--green); --fg: #06140A; box-shadow: 0 8px 24px -10px rgba(34,178,76,.55); }
[data-theme="dark"] .btn--primary:hover { --bg: #3BC865; }
.btn--ghost { --bg: transparent; border-color: var(--line-2); }
.btn--ghost:hover { --bg: var(--surface); border-color: var(--ink-2); }
.btn--sm { padding: 10px 16px; font-size: 15px; }
.btn--lg { padding: 17px 26px; font-size: 17px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }

.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color .2s, transform .3s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

/* ---------- header ---------- */
.nav { position: sticky; top: 0; z-index: 50; transition: background-color .3s, box-shadow .3s, border-color .3s; border-bottom: 1px solid transparent; }
.nav.is-stuck {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: var(--line);
}
.nav__row { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand__mark { width: 40px; height: auto; transition: transform .6s var(--ease); }
.brand:hover .brand__mark { transform: rotate(-6deg) scale(1.05); }
.brand__word { width: 124px; height: auto; margin-top: 4px; }
.nav__links { display: flex; gap: 4px; }
.nav__links a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; padding: 8px 12px; border-radius: 999px; transition: background-color .2s, color .2s; }
.nav__links a:hover { background: var(--surface-2); color: var(--ink); }
.nav__actions { display: flex; align-items: center; gap: 10px; }
.show-sm { display: none; }

@media (max-width: 900px) {
  .show-sm { display: grid; }
  .hide-sm { display: none; }
  .nav__links {
    position: absolute; left: 16px; right: 16px; top: 72px; flex-direction: column; gap: 2px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px;
    box-shadow: var(--shadow-lg); transform-origin: top; transform: translateY(-8px) scale(.98); opacity: 0; visibility: hidden;
    transition: opacity .25s var(--ease), transform .3s var(--ease), visibility .25s;
  }
  .nav__links a { padding: 14px 16px; font-size: 17px; }
  .nav.is-open .nav__links { opacity: 1; visibility: visible; transform: none; }
  .nav.is-open { background: var(--paper); }
}

/* ---------- hero ---------- */
.hero { position: relative; padding: 40px 0 72px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--green) 16%, transparent), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero__grid { position: relative; z-index: 1; display: grid; gap: 48px; align-items: center; }
@media (min-width: 1000px) { .hero { padding: 56px 0 96px; } .hero__grid { grid-template-columns: 1.1fr 1fr; gap: 48px; } }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--green-deep);
  background: var(--green-soft); padding: 7px 14px 7px 12px; border-radius: 999px; margin-bottom: 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(34,178,76,.6); animation: ping 2.4s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(34,178,76,0); } 100% { box-shadow: 0 0 0 0 rgba(34,178,76,0); } }

.hero h1 { font-size: clamp(42px, 5.6vw, 76px); font-weight: 800; letter-spacing: -.035em; line-height: .98; }
.hero h1 em { color: var(--green-deep); position: relative; white-space: nowrap; }
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .04em; height: .14em; border-radius: 99px;
  background: var(--green); opacity: .28; transform-origin: left; transform: scaleX(0); animation: underline 1.1s .7s var(--ease) forwards;
}
@keyframes underline { to { transform: scaleX(1); } }
.lede { font-size: clamp(18px, 1.6vw, 20px); color: var(--ink-2); margin-top: 22px; max-width: 36em; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero__facts { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.hero__facts li { padding: 16px 16px 0 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--muted); }
.hero__facts li + li { padding-left: 16px; border-left: 1px solid var(--line); }
.hero__facts strong { font-family: var(--f-display); font-size: 17px; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
@media (max-width: 560px) {
  .hero__facts { grid-template-columns: 1fr; }
  .hero__facts li, .hero__facts li + li { padding: 12px 0; border-left: 0; border-bottom: 1px solid var(--line); flex-direction: row; gap: 8px; align-items: baseline; flex-wrap: wrap; }
}

/* ---------- hero stage: field -> ledger ---------- */
.stage { position: relative; aspect-ratio: 560 / 520; width: 100%; max-width: 620px; margin-inline: auto; }
.stage__map { position: absolute; inset: 0 0 auto 0; width: 100%; height: auto; overflow: visible; }
.plots path { stroke: var(--paper); stroke-width: 3; stroke-linejoin: round; transition: fill .6s var(--ease), transform .6s var(--ease); transform-box: fill-box; transform-origin: center; }
.plots path:nth-child(1) { fill: var(--plot-2); } .plots path:nth-child(2) { fill: var(--plot-1); }
.plots path:nth-child(3) { fill: var(--plot-3); } .plots path:nth-child(4) { fill: var(--plot-2); }
.plots path:nth-child(5) { fill: var(--plot-1); } .plots path.nursery { fill: var(--plot-nursery); }
.plots path.is-active { fill: var(--green); transform: scale(1.03); }
.plot-tex path { fill: url(#rows); pointer-events: none; }
.palm { fill: var(--palm); }
.labels text { font: 600 12px var(--f-mono); fill: var(--ink-2); opacity: .75; }
.traces path { fill: none; stroke: var(--line-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pulses path { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 14 200; stroke-dashoffset: 14; opacity: 0; }
.pulses path.is-running { animation: pulse-run 1.5s var(--ease) forwards; }
@keyframes pulse-run { 0% { stroke-dashoffset: 14; opacity: 1; } 90% { opacity: 1; } 100% { stroke-dashoffset: -100; opacity: 0; } }
.nodes circle { fill: var(--surface); stroke: var(--green); stroke-width: 2; }

.capture {
  position: absolute; left: 0; top: 74%; width: 47%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 13px;
  box-shadow: var(--shadow-lg); transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.capture.is-swapping { opacity: 0; transform: translateY(8px); }
.capture__top { display: flex; justify-content: space-between; font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.capture__gps { color: var(--green-deep); }
.capture__title { font: 700 16px/1.25 var(--f-display); letter-spacing: -.01em; }
.capture__meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.capture__who { font-size: 12px; color: var(--muted); margin-top: 6px; }

.ledger {
  position: absolute; right: 0; bottom: 0; width: 50%; min-width: 250px;
  background: var(--ink); color: #E8EEE8; border-radius: 18px; padding: 14px 16px 12px;
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .ledger { background: #1C241E; border: 1px solid var(--line-2); }
.ledger__head, .ledger__foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #A9B6AC; }
.ledger__head { font-weight: 600; letter-spacing: .02em; }
.ledger__head span:first-child { display: inline-flex; align-items: center; gap: 8px; color: #fff; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; animation: ping 2.4s infinite; }
.ledger__rows { list-style: none; margin: 10px 0 8px; padding: 0; min-height: 214px; display: flex; flex-direction: column; gap: 8px; }
.ledger__rows li { border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; font-size: 12.5px; line-height: 1.35; }
.ledger__rows li.is-new { animation: row-in .7s var(--ease); }
.ledger__rows li.is-new .amt { color: var(--mint); }
@keyframes row-in { from { opacity: 0; transform: translateY(-10px); background: rgba(34,178,76,.18); } to { opacity: 1; transform: none; background: transparent; } }
.ledger__desc { color: #fff; font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.ledger__line { display: flex; justify-content: space-between; gap: 10px; color: #A9B6AC; font-family: var(--f-mono); font-size: 11.5px; }
.ledger__line b { font-weight: 400; color: #7F8C82; margin-right: 4px; }
.amt { transition: color 1.2s; }
.ledger__foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: 8px; }
.ledger__foot span:first-child::before { content: "✓ "; color: var(--mint); }
.stage__chip { position: absolute; right: 0; top: 2%; display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--f-mono); color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; box-shadow: var(--shadow); }
.stage__note { position: absolute; left: 0; bottom: -26px; font: 500 11px var(--f-mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 560px) {
  .stage { aspect-ratio: auto; display: grid; gap: 12px; }
  .stage__map { position: relative; width: 100%; }
  .capture, .ledger { position: relative; inset: auto; width: 100%; min-width: 0; }
  .capture { margin-top: -34%; width: 72%; }
  .ledger__rows { height: auto; }
  .ledger__rows li:nth-child(n+4) { display: none; }
  .stage__note { position: static; }
}

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
