:root {
  color-scheme: light;
  --ink: #1c211d;
  --muted: #626b63;
  --line: #d8ded5;
  --paper: #fbfbf7;
  --field: #eef2e8;
  --moss: #345f45;
  --moss-2: #5e7e54;
  --river: #3e728c;
  --clay: #9d4d3d;
  --ochre: #bd8b2f;
  --violet: #6d597a;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(28, 33, 29, 0.09);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--field);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, max-content) 1fr;
  gap: 24px;
  align-items: center;
  padding: 14px clamp(18px, 4vw, 54px);
  background: rgba(251, 251, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--moss);
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 49%, var(--moss) 50% 55%, transparent 56%),
    radial-gradient(circle at 68% 32%, var(--ochre) 0 12%, transparent 13%),
    linear-gradient(180deg, var(--white) 0 45%, #dce8d6 46% 100%);
}

.brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.05;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.primary-nav {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab,
.chip,
.map-toolbar button,
.route-button,
.product-button,
.season-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
}

.nav-tab {
  padding: 0 14px;
  white-space: nowrap;
}

.nav-tab.active,
.chip.active,
.route-button.active,
.product-button.active,
.season-button.active {
  color: var(--white);
  border-color: var(--moss);
  background: var(--moss);
}

main {
  padding: 0 clamp(18px, 4vw, 54px) 64px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 28px;
  align-items: end;
  max-width: 1480px;
  margin: 0 auto;
  padding: 34px 0 24px;
}

.section-intro.compact {
  grid-template-columns: minmax(0, 900px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--clay);
  font-size: 0.75rem;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 980px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.5vw, 4.8rem);
  font-weight: 520;
  line-height: 0.98;
}

h2 {
  margin-bottom: 12px;
  font-size: 0.86rem;
  line-height: 1.25;
  text-transform: uppercase;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
  line-height: 1.2;
}

p {
  line-height: 1.6;
}

.intro-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ochre);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.intro-note strong {
  color: var(--ink);
}

.atlas-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(310px, 380px);
  gap: 18px;
  align-items: start;
  max-width: 1480px;
  margin: 0 auto;
}

.panel,
.map-stage,
.product-detail,
.drive-detail,
.atlas-chapter,
.market-map-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.filter-panel,
.profile-panel {
  position: sticky;
  top: 84px;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.search-box input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
}

.filter-group {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.chip-grid,
.layer-grid,
.stat-strip,
.meta-grid,
.season-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 10px;
  font-size: 0.82rem;
  text-align: left;
}

.chip.dense,
.chip-grid.dense .chip {
  padding: 6px 9px;
  font-size: 0.78rem;
}

.layer-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.78rem;
}

.layer-toggle input {
  accent-color: var(--moss);
}

.query-panel {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

#planner-results {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.planner-stop {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.map-column {
  min-width: 0;
}

.stat-strip {
  margin-bottom: 12px;
}

.stat {
  min-width: 124px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.stat strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.76rem;
}

.map-stage {
  position: relative;
  overflow: hidden;
  min-height: 650px;
  background:
    linear-gradient(120deg, rgba(62, 114, 140, 0.08), transparent 36%),
    radial-gradient(circle at 18% 18%, rgba(189, 139, 47, 0.13), transparent 26%),
    #e8eee2;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.map-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.9);
}

#farm-map {
  display: block;
  width: 100%;
  height: 650px;
}

.county-fill,
.town-fill {
  fill: #f7f8f2;
  stroke: #9fac9a;
  stroke-width: 1.1;
}

.town-layer .town-fill {
  vector-effect: non-scaling-stroke;
}

.town-fill:hover {
  fill: #fffdf7;
  stroke: var(--moss);
}

.water-line {
  fill: none;
  stroke: var(--river);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  opacity: 0.66;
}

.open-space-area {
  fill: rgba(52, 95, 69, 0.15);
  stroke: rgba(52, 95, 69, 0.34);
  stroke-width: 0.8;
}

.trail-line {
  fill: none;
  stroke: var(--moss-2);
  stroke-dasharray: 2 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  opacity: 0.74;
}

.habitat-area {
  fill: rgba(189, 139, 47, 0.12);
  stroke: rgba(157, 77, 61, 0.2);
  stroke-width: 0.7;
}

.route-line {
  fill: none;
  stroke: #bd8b2f;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  opacity: 0.55;
}

.market-marker {
  fill: #6d597a;
  stroke: #fff;
  stroke-width: 1.4;
}

.label {
  fill: rgba(28, 33, 29, 0.56);
  font-size: 11px;
  font-weight: 700;
}

.farm-marker {
  cursor: pointer;
}

.farm-marker circle {
  fill: var(--white);
  stroke: var(--moss);
  stroke-width: 3;
  transition: transform 160ms ease, fill 160ms ease, stroke 160ms ease;
}

.farm-marker.filtered-out {
  opacity: 0.16;
}

.farm-marker.active circle,
.farm-marker:hover circle {
  fill: var(--clay);
  stroke: var(--ink);
  transform: scale(1.25);
}

.farm-marker text {
  pointer-events: none;
  fill: var(--ink);
  font-size: 10px;
  font-weight: 760;
}

.farm-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.farm-result,
.product-card,
.route-card,
.market-card,
.source-card,
.atlas-story,
.season-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.farm-result,
.product-card,
.route-card,
.season-card {
  color: inherit;
  text-align: left;
}

.farm-result {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.farm-result.active {
  border-color: var(--moss);
  box-shadow: inset 0 0 0 1px var(--moss);
}

.result-town,
.tag-row,
.detail-muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf4;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.profile-panel {
  overflow: hidden;
  padding: 0;
}

.entity-photo,
.profile-photo,
.route-photo,
.market-photo {
  display: grid;
  gap: 0;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f4f6ef;
}

.profile-photo {
  border-radius: 0;
}

.entity-photo img,
.profile-photo img,
.route-photo img,
.market-photo img,
.card-photo,
.image-inventory-card img {
  display: block;
  width: 100%;
  object-fit: cover;
}

.profile-photo img {
  aspect-ratio: 16 / 9;
}

.route-photo img,
.market-photo img {
  aspect-ratio: 4 / 3;
}

.entity-photo figcaption,
.profile-photo figcaption,
.route-photo figcaption,
.market-photo figcaption {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.entity-photo figcaption strong,
.profile-photo figcaption strong,
.route-photo figcaption strong,
.market-photo figcaption strong {
  color: var(--ink);
}

.entity-photo figcaption a,
.profile-photo figcaption a,
.route-photo figcaption a,
.market-photo figcaption a,
.image-inventory-card a {
  color: var(--moss);
  text-decoration-color: rgba(52, 95, 69, 0.32);
  text-underline-offset: 3px;
}

.profile-body {
  padding: 18px;
}

.profile-body h2 {
  margin-bottom: 4px;
  color: var(--clay);
}

.profile-body h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 520;
}

.meta-grid {
  margin: 14px 0;
}

.meta {
  flex: 1 1 120px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf3;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.profile-section {
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
}

.profile-list,
.compact-list,
.source-list {
  padding-left: 18px;
  margin: 0;
}

.profile-list li,
.compact-list li,
.source-list li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.text-link,
.source-list a,
.source-card a {
  color: var(--moss);
  font-weight: 760;
  text-decoration-color: rgba(52, 95, 69, 0.32);
  text-underline-offset: 3px;
}

.product-layout,
.drive-layout,
.market-layout,
.season-layout,
.atlas-content {
  display: grid;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.product-layout,
.drive-layout {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: start;
}

.product-picker,
.drive-layout > .panel {
  position: sticky;
  top: 84px;
}

.taxonomy-group {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.taxonomy-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-button,
.season-button,
.route-button {
  padding: 8px 12px;
  text-align: left;
}

.product-detail,
.drive-detail,
.market-map-panel,
.atlas-chapter {
  padding: 22px;
}

.product-hero,
.route-hero,
.market-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 22px;
  align-items: start;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin: 12px 0 20px;
}

.month-cell {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f4f6ef;
  color: var(--muted);
  font-size: 0.66rem;
  text-align: center;
  line-height: 28px;
}

.month-cell.active {
  color: var(--white);
  border-color: var(--moss);
  background: var(--moss);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.product-card,
.route-card,
.market-card,
.source-card,
.atlas-story,
.season-card {
  padding: 15px;
}

.card-title {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 760;
  line-height: 1.2;
}

.product-card > span,
.route-card > span {
  display: block;
}

.card-photo {
  aspect-ratio: 16 / 9;
  margin: -15px -15px 12px;
  width: calc(100% + 30px);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.product-card > span + span,
.route-card > span + span {
  margin-top: 8px;
}

.image-note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.route-list {
  display: grid;
  gap: 8px;
}

.route-button {
  width: 100%;
  border-radius: var(--radius);
}

.mini-map {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3e9;
}

.season-tabs {
  max-width: 1480px;
  margin: 0 auto 16px;
}

.season-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: start;
}

.season-produce {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.season-card strong {
  display: block;
  margin-bottom: 8px;
}

.market-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
}

.market-map {
  min-height: 480px;
  width: 100%;
}

.market-list {
  display: grid;
  gap: 12px;
}

.atlas-content {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: start;
}

.atlas-chapter {
  display: grid;
  gap: 14px;
}

.atlas-chapter.full-width {
  grid-column: 1 / -1;
}

.atlas-story {
  border-left: 4px solid var(--moss);
}

.source-grid {
  display: grid;
  gap: 12px;
}

.source-card {
  display: grid;
  gap: 7px;
}

.source-card small {
  color: var(--muted);
  line-height: 1.45;
}

.gis-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.gis-layer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.gis-layer-card {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--river);
  border-radius: var(--radius);
  background: var(--white);
}

.gis-layer-card span,
.gis-layer-card small,
.gis-layer-card code {
  color: var(--muted);
  line-height: 1.4;
}

.gis-layer-card span,
.gis-layer-card small {
  font-size: 0.8rem;
}

.gis-layer-card code {
  overflow-wrap: anywhere;
  padding: 6px 7px;
  border-radius: 6px;
  background: #f4f6ef;
  font-size: 0.72rem;
}

.image-inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.image-inventory-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.image-inventory-card img {
  aspect-ratio: 1;
  border-radius: 6px;
}

.image-inventory-card strong,
.image-inventory-card span,
.image-inventory-card small {
  display: block;
}

.image-inventory-card span,
.image-inventory-card small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.status-pill {
  justify-self: start;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf6f2;
  color: var(--moss);
  font-size: 0.72rem;
  font-weight: 800;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

@media (max-width: 1180px) {
  .atlas-shell {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .profile-panel {
    position: static;
    grid-column: 1 / -1;
  }

  .profile-panel .profile-photo img {
    max-height: 320px;
  }
}

@media (max-width: 860px) {
  .app-header,
  .section-intro,
  .product-layout,
  .drive-layout,
  .market-layout,
  .season-layout,
  .atlas-content,
  .product-hero,
  .route-hero,
  .market-hero,
  .atlas-shell {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: start;
  }

  .primary-nav {
    justify-content: start;
  }

  .filter-panel,
  .product-picker,
  .drive-layout > .panel {
    position: static;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.4rem);
  }

  .map-stage {
    min-height: 560px;
  }

  #farm-map {
    height: 560px;
  }
}

@media (max-width: 560px) {
  main,
  .app-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .stat {
    flex: 1 1 46%;
  }

  .map-toolbar {
    left: 12px;
    right: auto;
  }

  .timeline {
    grid-template-columns: repeat(6, 1fr);
  }
}
