/* ===================================================================
   LeafGuard - fresh, modern agri-tech interface
   Palette (field + lab):
     pine    #14361f  deep foliage, primary text and dark surfaces
     canopy  #2c7a44  primary green, actions
     sprout  #57b368  fresh accent
     signal  #b6e94a  bright lime, interactive highlight (used sparingly)
     soil    #6b5138  warm brown, grounding accent
     mist    #f4f7f1  cool off-white background
     card    #ffffff  surfaces
     line    #dbe4d8  hairlines
   Type: Space Grotesk (display / technical) + Inter (body)
   =================================================================== */

:root {
  --pine:   #14361f;
  --canopy: #2c7a44;
  --sprout: #57b368;
  --signal: #b6e94a;
  --soil:   #6b5138;
  --mist:   #f4f7f1;
  --card:   #ffffff;
  --line:   #dbe4d8;
  --ink:    #14361f;
  --muted:  #5d6b5d;
  --shadow: rgba(20, 54, 31, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--mist);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 5vw, 4rem);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 247, 241, 0.92);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--pine); }
.brand-badge {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--pine); color: var(--signal);
  display: grid; place-items: center; flex: none;
}
.brand-badge svg { width: 20px; height: 20px; }
.brand-text {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 1.35rem; letter-spacing: -0.02em;
}
.brand-text b { color: var(--canopy); font-weight: 600; }
.site-nav { display: flex; gap: 1.6rem; align-items: center; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-weight: 500;
  font-size: 0.95rem; padding-bottom: 3px;
  border-bottom: 2px solid transparent; transition: border-color .15s;
}
.site-nav a:hover { border-bottom-color: var(--sprout); }

/* ---------- Layout ---------- */
.site-main {
  max-width: 940px; margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 5vw, 2rem) 3.5rem;
}

/* ---------- Flash ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 0.6rem;
  margin-bottom: 1.75rem; }
.flash {
  padding: 0.9rem 1.15rem; border-radius: 12px; font-size: 0.95rem;
  border: 1px solid; display: flex; align-items: flex-start; gap: 0.6rem;
}
.flash::before { content: ""; flex: none; width: 6px; align-self: stretch;
  border-radius: 3px; margin: -0.9rem 0; }
.flash-error { background: #fdeee7; color: #8a3d1c; border-color: #f0cdb9; }
.flash-error::before { background: #d9772f; }
.flash-success { background: #e9f6ec; color: #1c5230; border-color: #c2e4c9; }
.flash-success::before { background: var(--canopy); }

/* ---------- Hero ---------- */
.hero { margin-bottom: 3rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--canopy); font-weight: 600; margin-bottom: 1.1rem;
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; background: var(--sprout);
}
.hero-title {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: clamp(2.3rem, 6.5vw, 3.7rem); line-height: 1.06;
  letter-spacing: -0.03em; color: var(--pine); max-width: 18ch;
}
.hero-title .highlight { color: var(--canopy); }
.hero-sub {
  margin-top: 1.4rem; font-size: 1.12rem; max-width: 40rem; color: #3c4c3f;
}

/* ---------- Scan panel (signature element) ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: clamp(1.5rem, 4vw, 2.4rem);
  box-shadow: 0 20px 48px -30px var(--shadow); margin-bottom: 3.5rem;
}
.panel-head { display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 1.5rem; }
.panel-head h2 {
  font-family: "Space Grotesk", sans-serif; font-size: 1.15rem;
  font-weight: 600; color: var(--pine); letter-spacing: -0.01em;
}
.panel-head .tag {
  margin-left: auto; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--canopy); background: #eaf5 ec; background: #e9f6ec;
  padding: 0.3rem 0.6rem; border-radius: 999px;
}

.detect-form { display: flex; flex-direction: column; gap: 1.6rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field-label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600; font-size: 0.92rem; color: var(--pine);
  display: flex; align-items: baseline; gap: 0.4rem;
}
.field-label .unit { color: var(--soil); font-weight: 500; font-size: 0.82rem; }
.field-hint { font-size: 0.82rem; color: var(--muted); }

input[type="number"] {
  font-family: inherit; font-size: 1.05rem; padding: 0.85rem 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--mist);
  color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type="number"]:focus {
  outline: none; border-color: var(--canopy); background: var(--card);
  box-shadow: 0 0 0 3px rgba(87, 179, 104, 0.25);
}

/* Specimen viewfinder dropzone */
.dropzone {
  position: relative; border-radius: 16px; background: var(--mist);
  min-height: 210px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid var(--line);
  transition: background .15s;
}
.dropzone::before, .dropzone::after,
.dropzone .corner-tr, .dropzone .corner-bl {
  content: ""; position: absolute; width: 22px; height: 22px;
  border: 2px solid var(--canopy); pointer-events: none; z-index: 2;
  transition: border-color .15s;
}
.dropzone::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0;
  border-top-left-radius: 6px; }
.dropzone::after { bottom: 12px; right: 12px; border-left: 0; border-top: 0;
  border-bottom-right-radius: 6px; }
.dropzone .corner-tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0;
  border-top-right-radius: 6px; }
.dropzone .corner-bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0;
  border-bottom-left-radius: 6px; }
.dropzone:hover { background: #eef4ea; }
.dropzone:hover::before, .dropzone:hover::after,
.dropzone:hover .corner-tr, .dropzone:hover .corner-bl { border-color: var(--sprout); }
.dropzone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%; z-index: 3;
}
.dropzone-inner {
  display: flex; flex-direction: column; align-items: center; gap: 0.55rem;
  text-align: center; pointer-events: none; padding: 1.5rem; z-index: 1;
}
.dropzone-icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--pine);
  color: var(--signal); display: grid; place-items: center;
}
.dropzone-icon svg { width: 24px; height: 24px; }
.dropzone-text {
  font-family: "Space Grotesk", sans-serif; font-weight: 600; color: var(--pine);
}
.dropzone-hint { font-size: 0.82rem; color: var(--muted); }
.dropzone-preview { max-width: 100%; max-height: 320px; display: block; }

.btn-primary {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 1.02rem; background: var(--pine); color: #fff;
  border: none; border-radius: 13px; padding: 0.95rem 1.5rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--canopy); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary svg { width: 18px; height: 18px; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  text-decoration: none; color: var(--pine);
  border: 1px solid var(--canopy); border-radius: 12px;
  padding: 0.75rem 1.35rem; transition: background .15s;
}
.btn-secondary:hover { background: #e9f6ec; }

/* ---------- Process ---------- */
.how-title {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 1.55rem; color: var(--pine); margin-bottom: 1.75rem;
  letter-spacing: -0.02em;
}
.how-steps {
  list-style: none; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}
.how-steps li {
  display: flex; gap: 0.9rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.1rem 1.2rem;
}
.step-no {
  flex: none; width: 2rem; height: 2rem; border-radius: 8px;
  background: var(--mist); border: 1px solid var(--line);
  color: var(--canopy); font-weight: 600;
  font-family: "Space Grotesk", sans-serif; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.how-steps strong {
  font-family: "Space Grotesk", sans-serif; color: var(--pine);
  display: block; margin-bottom: 0.15rem; font-size: 0.98rem;
}
.how-steps p { font-size: 0.9rem; color: var(--muted); }

/* ---------- Result ---------- */
.result { display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.75rem;
  align-items: start; }
.result-card { padding: 2rem; border-radius: 20px; border: 1px solid var(--line); }
.result-healthy { background: linear-gradient(158deg, #e9f6ec, #d3ecd9); }
.result-diseased { background: linear-gradient(158deg, #fdf0e5, #f7ddc6); }
.result-eyebrow {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: #5a6b5d;
}
.result-label {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 2.9rem; line-height: 1.1; margin: 0.3rem 0 1.25rem;
  letter-spacing: -0.02em;
}
.result-healthy .result-label { color: var(--pine); }
.result-diseased .result-label { color: #b0561f; }
.result-confidence { margin-bottom: 1.25rem; }
.conf-bar {
  height: 10px; background: rgba(0,0,0,0.08); border-radius: 999px;
  overflow: hidden; margin-bottom: 0.5rem;
}
.conf-fill { height: 100%; border-radius: 999px; background: var(--canopy); }
.result-diseased .conf-fill { background: #d9772f; }
.conf-value { font-size: 0.9rem; font-weight: 600; color: #4a5a4e;
  font-family: "Space Grotesk", sans-serif; }
.result-note { font-size: 0.98rem; color: #3a4a3f; }
.result-detail { display: flex; flex-direction: column; gap: 1.1rem; }
.result-image { width: 100%; border-radius: 16px; border: 1px solid var(--line); }
.result-inputs {
  display: flex; gap: 1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem;
}
.result-inputs > div { flex: 1; }
.result-inputs dt {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 0.15rem;
}
.result-inputs dd {
  font-family: "Space Grotesk", sans-serif; font-size: 1.25rem;
  font-weight: 600; color: var(--pine);
}

/* ---------- Prose (about) ---------- */
.prose h1 {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.7rem); color: var(--pine);
  letter-spacing: -0.02em; margin-bottom: 1rem;
}
.prose h2 {
  font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.4rem;
  color: var(--pine); margin: 2rem 0 0.75rem; letter-spacing: -0.01em;
}
.prose p { margin-bottom: 1rem; max-width: 42rem; color: #2e3c32; }
.prose-list { margin: 0.5rem 0 1rem 1.2rem; max-width: 42rem; }
.prose-list li { margin-bottom: 0.5rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); text-align: center;
  padding: 2.25rem 1.5rem; color: var(--muted); font-size: 0.88rem;
}
.footer-meta { margin-top: 0.4rem; font-size: 0.8rem;
  font-family: "Space Grotesk", sans-serif; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
  .result { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; }
}
:focus-visible { outline: 3px solid var(--sprout); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
