/* ==========================================================================
   CLEREL Crop Diversification — interactive report
   Palette tuned to every.farm: white paper, dark green primary, lime + coral
   accents from the Crop Picker logo, serif display, sans body.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@400;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0a0a0a;
  --ink-muted: #4a4a4a;
  --ink-soft: #6e6e6e;
  --paper: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7f5f0;
  --panel-warm: #f3efe6;
  --rule: #e7e3d8;
  --rule-soft: #efece4;

  /* every.farm-derived greens */
  --green: #1a5d3a;
  --green-dark: #134a2e;
  --green-mid: #2d7a4f;
  --leaf: #a3d977;
  --leaf-soft: #d8ebbf;

  /* Coral / red from the Crop Picker logo center */
  --coral: #e8556e;
  --coral-dark: #c43a52;

  /* Cornell red — kept as a deep secondary accent for institutional touches */
  --cornell-red: #B31B1B;

  --amber: #c47e1e;
  --slate: #2c3e50;
  --slate-soft: #6b7c8c;

  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lift: 0 6px 16px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.06);
  --radius: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --serif: "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0 0 1em; }
a { color: var(--green); text-decoration: none; border-bottom: 1px solid rgba(26, 93, 58, 0.25); transition: border-color 120ms ease, color 120ms ease; }
a:hover { color: var(--green-dark); border-bottom-color: var(--green); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.15;
}
h1 { font-size: clamp(2.2rem, 4.6vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.4rem); margin-top: 2em; }
h3 { font-size: 1.35rem; line-height: 1.3; }
h4 { font-size: 1.05rem; font-family: var(--sans); font-weight: 700; letter-spacing: -0.005em; }

.lede {
  font-size: 1.2rem;
  color: var(--ink-muted);
  line-height: 1.5;
  max-width: 50em;
  font-family: var(--serif);
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.6em;
  font-family: var(--sans);
}

button {
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
  border-bottom: none;
}
.btn:hover { background: var(--green); border-bottom: none; color: #fff; }
.btn.btn-green { background: var(--green); }
.btn.btn-green:hover { background: var(--green-dark); }
.btn.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.btn-outline:hover { background: var(--ink); color: #fff; }
.btn .arrow { transition: transform 200ms ease; }
.btn[aria-expanded="true"] .arrow { transform: rotate(180deg); }

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}
.container-narrow { max-width: 760px; }

section {
  padding: 80px 0;
  border-top: 1px solid var(--rule-soft);
}
section:first-of-type { border-top: none; }

.section-head { margin-bottom: 28px; }

/* ==========================================================================
   Top nav
   ========================================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  border: none;
  color: var(--ink);
  font-family: var(--serif);
}
.brand .accent { color: var(--green); }
.brand-mark {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}
.nav-links {
  display: flex;
  gap: 26px;
  font-size: 0.9rem;
  align-items: center;
}
.nav-links a {
  color: var(--ink-muted);
  border: none;
  font-weight: 500;
  transition: color 120ms ease;
}
.nav-links a:hover { color: var(--green); }
@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ==========================================================================
   Logo strip (institutional bar)
   ========================================================================== */
.logo-strip {
  background: white;
  border-bottom: 1px solid var(--rule-soft);
  padding: 22px 0;
}
.logo-strip-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}
.logo-slot {
  display: inline-flex;
  align-items: center;
  height: 50px;
  filter: grayscale(0%);
  opacity: 0.92;
  transition: opacity 200ms ease;
  border-bottom: none;
  text-decoration: none;
  color: inherit;
}
.logo-slot:hover { opacity: 1; border-bottom: none; }
.logo-slot img {
  max-height: 50px;
  max-width: 200px;
  width: auto;
  height: auto;
  display: block;
}
.logo-slot.placeholder {
  border: 1.5px dashed var(--rule);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-family: var(--mono);
}
@media (max-width: 720px) {
  .logo-strip-inner { gap: 28px; }
  .logo-slot img { max-height: 38px; max-width: 140px; }
}

/* ==========================================================================
   Statement banner + collapsible
   ========================================================================== */
.statement-banner {
  background: var(--panel-warm);
  border-bottom: 1px solid var(--rule);
}
.statement-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.statement-banner-text {
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1 1 320px;
}
.statement-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--serif);
  flex-shrink: 0;
}
.statement-banner-text strong {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
}
.statement-banner-text .sub {
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.statement-panel {
  background: var(--panel-warm);
  overflow: hidden;
  max-height: 0;
  transition: max-height 400ms ease;
  border-bottom: 1px solid transparent;
}
.statement-panel.open {
  max-height: 4000px;
  border-bottom-color: var(--rule);
}
.statement-panel-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 28px 36px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
}
.statement-panel-inner h1,
.statement-panel-inner h2,
.statement-panel-inner h3 {
  font-family: var(--serif);
  margin-top: 1.4em;
}
.statement-panel-inner h1 { font-size: 1.5rem; }
.statement-panel-inner h2 { font-size: 1.25rem; margin-top: 1.6em; }
.statement-panel-inner h3 { font-size: 1.05rem; }
.statement-panel-inner blockquote {
  margin: 1em 0;
  padding: 8px 18px;
  border-left: 3px solid var(--green);
  color: var(--ink-muted);
  font-style: italic;
}
.statement-panel-inner ul, .statement-panel-inner ol { padding-left: 22px; }
.statement-panel-inner code {
  font-family: var(--mono);
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.statement-attribution {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-style: normal;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 80px 0 64px;
  border-top: none;
  position: relative;
}
.hero-eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
  margin-bottom: 1em;
  font-family: var(--sans);
}
.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  margin-bottom: 0.4em;
  max-width: 18em;
  letter-spacing: -0.02em;
}
.hero h1 em {
  color: var(--green);
  font-style: italic;
  font-weight: 700;
}
.hero .lede { font-size: 1.3rem; max-width: 42em; line-height: 1.5; }

.hero-meta {
  display: flex;
  gap: 32px;
  margin-top: 2.4em;
  font-size: 0.92rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
  font-family: var(--sans);
}
.hero-meta strong { color: var(--ink); font-weight: 600; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  margin-top: 3em;
  background: var(--panel-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.hero-stat {
  padding: 22px 24px;
  border-right: 1px solid var(--rule-soft);
}
.hero-stat:last-child { border-right: none; }
@media (max-width: 760px) {
  .hero-stat { border-right: none; border-bottom: 1px solid var(--rule-soft); }
  .hero-stat:last-child { border-bottom: none; }
}
.hero-stat .num {
  display: block;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.02em;
  font-family: var(--serif);
}
.hero-stat .lbl {
  display: block;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Pipeline diagram
   ========================================================================== */
.pipeline {
  background: var(--panel-soft);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  margin-top: 24px;
}
.pipeline-svg {
  width: 100%;
  height: auto;
  max-height: 420px;
  display: block;
}
.pipeline-svg .node-rect {
  fill: #fff;
  stroke: var(--rule);
  stroke-width: 1.5;
  transition: all 200ms ease;
  cursor: pointer;
}
.pipeline-svg .node-rect:hover,
.pipeline-svg .node-rect.active {
  stroke: var(--green);
  stroke-width: 2.5;
  fill: #f3f9f5;
}
.pipeline-svg .node-label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
  pointer-events: none;
}
.pipeline-svg .node-sub {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-soft);
  pointer-events: none;
}
.pipeline-svg .edge {
  stroke: var(--slate-soft);
  stroke-width: 1.8;
  fill: none;
  marker-end: url(#arrowhead);
}
.pipeline-svg .edge-label {
  font-family: var(--sans);
  font-size: 10px;
  fill: var(--ink-soft);
  font-weight: 600;
}
.pipeline-detail {
  margin-top: 20px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-height: 100px;
  transition: opacity 200ms ease;
}
.pipeline-detail h4 { margin-top: 0; color: var(--green); font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.pipeline-detail .placeholder {
  color: var(--ink-soft);
  font-style: italic;
}

/* ==========================================================================
   Cards / grids
   ========================================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 28px 0;
}
.card h3 { margin-top: 0; }
.card-eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.6em;
  font-family: var(--sans);
}

/* Dataset chip list */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}
.chip-list li {
  background: #fff;
  border: 1px solid var(--rule);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  color: var(--ink-muted);
  font-weight: 500;
}
.chip-list li.green { background: var(--leaf-soft); color: var(--green-dark); border-color: var(--leaf); }
.chip-list li.coral { background: var(--coral); color: #fff; border-color: var(--coral); }

/* Screenshot embed */
.screenshot-embed {
  margin: 24px 0 8px;
  text-align: center;
}
.screenshot-embed img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--rule);
  background: var(--panel-soft);
}
.screenshot-embed.placeholder {
  background: var(--panel-soft);
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  padding: 60px 20px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.85rem;
  text-align: center;
}
.screenshot-caption {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

/* ==========================================================================
   Crops catalog scatter
   ========================================================================== */
.catalog-explorer {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.catalog-canvas-wrap {
  position: relative;
  height: 420px;
  margin: 16px 0;
}
.catalog-tooltip {
  position: absolute;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 10;
  max-width: 240px;
  box-shadow: var(--shadow-lift);
}
.catalog-tooltip.show { opacity: 1; }
.catalog-tooltip strong { display: block; font-size: 0.95rem; margin-bottom: 4px; color: #fff; }
.catalog-tooltip .meta { font-size: 0.78rem; color: #d0d0d0; }
.catalog-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--ink-muted);
}
.catalog-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

/* ==========================================================================
   Map + sidebar
   ========================================================================== */
.map-wrap {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  margin-top: 28px;
}
@media (max-width: 880px) {
  .map-wrap { grid-template-columns: 1fr; }
}
#map {
  height: 580px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  background: var(--panel-soft);
  z-index: 0;
}
.map-controls {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px;
  font-size: 0.92rem;
  max-height: 580px;
  overflow-y: auto;
}
.map-controls h4 {
  margin-top: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-family: var(--sans);
}
.layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.layer-toggles label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.layer-toggles input { margin: 0; accent-color: var(--green); }
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 4px 0;
}
.legend-row .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.zone-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.zone-panel-header h4 { margin: 0; }
.zone-panel-flag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--green);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.zone-panel-flag.show {
  opacity: 1;
  transform: translateY(0);
}

.zone-detail { font-size: 0.92rem; }
.zone-detail.empty {
  color: var(--ink-soft);
  font-style: italic;
  padding: 16px 0;
}
/* Click-feedback flash: a soft leaf-coloured wash that fades out */
.zone-detail.flash {
  animation: zone-flash 750ms ease-out;
}
@keyframes zone-flash {
  0%   { background: rgba(163, 217, 119, 0.45); box-shadow: inset 0 0 0 2px var(--green); }
  100% { background: transparent; box-shadow: inset 0 0 0 0 transparent; }
}

/* In-map Leaflet controls (layers + legend) */
.leaflet-control.map-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  box-shadow: var(--shadow);
  max-width: 240px;
  line-height: 1.45;
}
.leaflet-control.map-panel h5 {
  margin: 0 0 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-weight: 700;
}
.leaflet-control.map-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 4px 0;
}
.leaflet-control.map-panel input[type="checkbox"] {
  margin: 0;
  accent-color: var(--green);
}
.leaflet-control.map-panel .legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 3px 0;
}
.leaflet-control.map-panel .legend-row .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.leaflet-control.map-panel .hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
}
.zone-detail .ppz-id {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
  font-family: var(--serif);
}
.zone-detail .meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 12px 0;
  font-size: 0.85rem;
}
.zone-detail .meta-grid .key { color: var(--ink-soft); }
.zone-detail .meta-grid .val { color: var(--ink); font-weight: 600; }
.zone-detail .crops {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 12px;
}
.zone-detail .crops h5 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-family: var(--sans);
}
.zone-detail .crop-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.zone-detail .crop-row:last-child { border-bottom: none; }
.zone-detail .crop-name { font-weight: 600; }
.zone-detail .crop-meta { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.zone-detail .crop-fit {
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 700;
  font-family: var(--mono);
}

/* ==========================================================================
   Composite re-weighter
   ========================================================================== */
.reweighter {
  background: var(--panel-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 36px;
}
.reweighter-inner {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 36px;
}
@media (max-width: 880px) {
  .reweighter-inner { grid-template-columns: 1fr; }
}
.reweighter h3 { margin-top: 0; }
.weight-controls .weight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
  margin: 14px 0;
}
.weight-controls .weight-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.weight-controls .weight-label .swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}
.weight-controls .weight-label .name { font-weight: 600; font-size: 0.95rem; }
.weight-controls .weight-label .meaning {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 400;
  margin-top: 1px;
}
.weight-controls input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--green);
}
.weight-controls .weight-value {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: right;
  min-width: 4em;
}
.weight-presets {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.weight-preset {
  background: #fff;
  border: 1px solid var(--rule);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink-muted);
  font-family: inherit;
  font-weight: 500;
  transition: all 160ms ease;
}
.weight-preset:hover {
  border-color: var(--green);
  color: var(--green);
}
.weight-preset.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.weight-rank {
  background: #fff;
  border-radius: var(--radius);
  padding: 4px 0;
  border: 1px solid var(--rule);
}
.weight-rank-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule-soft);
  transition: background 240ms ease;
}
.weight-rank-row:last-child { border-bottom: none; }
.weight-rank-row.changed { background: #fff8e6; }
.weight-rank-row .rank {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 700;
}
.weight-rank-row .ppz-name { font-weight: 600; font-size: 0.95rem; }
.weight-rank-row .ppz-sub {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.weight-rank-row .ppz-c {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green);
}
.weight-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  position: relative;
  margin-right: 8px;
  vertical-align: middle;
}
.weight-bar .fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

/* ==========================================================================
   Sub-criteria gallery (tabs)
   ========================================================================== */
.criteria-gallery {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 36px;
}
.criteria-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 22px;
  overflow-x: auto;
}
.criteria-tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.criteria-tab:hover { color: var(--ink); }
.criteria-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}
.criteria-panel {
  display: none;
  align-items: center;
  gap: 28px;
}
.criteria-panel.active { display: flex; }
@media (max-width: 720px) {
  .criteria-panel { flex-direction: column; align-items: stretch; }
}
.criteria-panel img {
  max-width: 320px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.criteria-panel .text h4 { margin-top: 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.criteria-panel .text .formula {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--panel-soft);
  padding: 8px 12px;
  border-radius: var(--radius);
  margin: 8px 0;
  display: inline-block;
}

/* ==========================================================================
   Crop spotlight
   ========================================================================== */
.crop-spotlight {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 28px 0;
}
.crop-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);  /* override default link border */
}
.crop-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--green);
  color: inherit;
}
.crop-card:hover .crop-card-link { color: var(--green-dark); gap: 8px; }
.crop-card.featured:hover { border-color: var(--green); }
.crop-card-link {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 200ms ease, color 200ms ease;
}
.crop-card.featured { border-color: var(--green); border-width: 2px; }
.crop-card .swatch-band {
  height: 6px;
  background: linear-gradient(to right, var(--leaf), var(--green));
}
.crop-card.featured .swatch-band {
  background: linear-gradient(to right, var(--coral), var(--green));
}
.crop-card-body { padding: 22px 24px; }
.crop-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
}
.crop-tag {
  background: var(--panel-soft);
  padding: 3px 10px;
  border-radius: 4px;
  color: var(--ink-muted);
}
.crop-tag.fruit { background: #ffeaee; color: var(--coral-dark); }
.crop-tag.featured { background: var(--green); color: #fff; }
.crop-name { font-size: 1.4rem; font-weight: 700; margin: 4px 0 0; font-family: var(--serif); }
.crop-latin { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; margin-bottom: 14px; }
.crop-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.crop-stats .key { color: var(--ink-soft); font-size: 0.78rem; }
.crop-stats .val { font-weight: 700; color: var(--ink); }
.crop-stats .val.up { color: var(--green); }
.crop-snowflake {
  font-size: 0.85rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}
.crop-snowflake .num {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}
.deep-dive {
  margin-top: 36px;
  background: var(--panel-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.deep-dive h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.deep-dive h3 .pill {
  font-size: 0.7rem;
  background: var(--green);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--sans);
}
.deep-dive ul {
  margin: 8px 0;
  padding-left: 22px;
  line-height: 1.7;
}
.deep-dive ul li { margin: 6px 0; }
.deep-dive .caveat {
  margin-top: 18px;
  padding: 16px 20px;
  background: #fff8e6;
  border-left: 3px solid var(--amber);
  font-size: 0.92rem;
  color: var(--ink-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ==========================================================================
   Future research / next steps
   ========================================================================== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 28px;
}
.research-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.research-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--green);
}
.research-card .num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.research-card h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-family: var(--serif);
  font-weight: 600;
}
.research-card p {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin: 0;
}
.research-card .success {
  margin-top: 14px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--green);
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

/* ==========================================================================
   Comparison strip
   ========================================================================== */
.compare-strip {
  margin: 28px 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.compare-strip img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.compare-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 20px;
  text-align: center;
}
.compare-stats .stat .num {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--green);
  font-family: var(--serif);
}
.compare-stats .stat .lbl {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  border-top: 1px solid var(--rule);
  padding: 50px 0 70px;
  margin-top: 40px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--panel-soft);
}
footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
footer .footer-brand { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 1.05rem; margin-bottom: 6px; }
footer a { color: var(--green); }

/* ==========================================================================
   Small utilities
   ========================================================================== */
.callout {
  border-left: 3px solid var(--green);
  background: #f3f9f5;
  padding: 18px 22px;
  margin: 22px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1rem;
}
.callout.coral { border-left-color: var(--coral); background: #ffeef1; }
.callout.green { border-left-color: var(--green); background: #f3f9f5; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.88rem; }
hr.rule { border: none; border-top: 1px solid var(--rule); margin: 32px 0; }

/* Leaflet customization */
.leaflet-popup-content { font-family: var(--sans); margin: 12px 14px; min-width: 180px; }
.leaflet-popup-content strong { color: var(--green); }
.leaflet-control-attribution { font-size: 10px; }
