/* ============================================
   WEEKEND HOMESTEADING — DESIGN TOKENS
   Palette: wheat field at golden hour, pine, brick-rust, bark
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Karla:wght@400;500;600;700&display=swap');

:root {
  /* Color */
  --wheat-cream:   #F3EBD8;
  --paper:         #FBF6EC;
  --pine:          #3C4A34;
  --pine-deep:     #262F20;
  --rust:          #A8502E;
  --rust-deep:     #7E3A21;
  --bark:          #573C28;
  --gold:          #C9992F;
  --ink:           #2B2620;
  --ink-soft:      #5A5044;
  --line:          rgba(43, 38, 32, 0.14);

  /* Type */
  --font-display: "Fraunces", serif;
  --font-body: "Karla", sans-serif;

  /* Scale */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --radius: 6px;
  --max-w: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--wheat-cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* Fraunces is a variable font with an optical-size (opsz) axis; the
   @import above leaves that axis open (9..144) instead of pinning it, so
   the browser's default font-optical-sizing:auto interpolates opsz from
   each element's rendered font-size. At small sizes that lands near the
   axis's low/default end and looks like a normal serif, but at the h1's
   large size it lands near the high end, where Fraunces swaps in its most
   ornate display shapes (a curled, hook-like "J" and "f") — the reported
   rendering "glitch". Pinning opsz explicitly removes that per-size
   variance everywhere the display font is used. */
h1, h2, h3, h4, .brand, .step-num {
  font-optical-sizing: none;
  font-variation-settings: "opsz" 30;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--pine-deep);
  margin: 0 0 var(--space-2);
  line-height: 1.15;
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 var(--space-2); color: var(--ink-soft); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: var(--space-2);
}
.eyebrow::before {
  content: "";
  width: 1.6em;
  height: 2px;
  background: var(--rust);
  display: inline-block;
}

/* ============ HEADER / NAV ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 235, 216, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  max-width: var(--max-w);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--pine-deep);
  text-decoration: none;
  line-height: 1.2;
}
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.brand-text { white-space: nowrap; }
.brand-tagline {
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0; padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--ink);
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover, .nav-links a.active { color: var(--rust); }

.nav-cta {
  background: var(--pine);
  color: var(--paper) !important;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--pine-deep); }

.nav-cta.nav-login {
  background: var(--paper);
  color: var(--ink) !important;
  border: 1px solid var(--line);
  margin-left: 0.5rem;
}
.nav-cta.nav-login:hover { background: var(--wheat-cream); }

.nav-toggle { display: none; }

/* ============ BACK BUTTON ============ */
.back-button-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-2) var(--space-3) 0;
}
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0;
}
.back-button:hover { color: var(--rust); }

/* Dropdown nav group ("Hay Stack") — a native <details>/<summary>, so it's
   click/tap-toggleable on both desktop and mobile with no extra JS. Styled
   as a distinct wheat/gold pill (not plain text like the other nav links)
   so it visibly reads as "opens a menu" rather than "navigates directly". */
.nav-dropdown { position: relative; }
.nav-dropdown summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--bark);
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  background: var(--wheat-cream);
  border: 1.5px solid rgba(201, 153, 47, 0.5);
  border-radius: 100px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after {
  content: "\25BE";
  font-size: 0.7em;
  color: var(--gold);
  transition: transform 0.15s ease;
}
.nav-dropdown summary:hover,
.nav-dropdown summary.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--paper);
}
.nav-dropdown summary:hover::after,
.nav-dropdown summary.active::after { color: var(--paper); }
.nav-dropdown details[open] > summary::after { transform: rotate(180deg); }
.nav-dropdown-menu {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  position: absolute;
  top: 100%;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(43, 38, 32, 0.14);
  min-width: 180px;
  z-index: 60;
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.92rem;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active { background: var(--wheat-cream); color: var(--rust); }

@media (max-width: 1300px) {
  /* Nav wraps into tidy rows below the brand well before the 7 top-level
     items (6 links + Hay Stack) + brand + CTA button would overflow their
     single-row container — covers small laptops and split-screen/tiled
     windows, not just phones. No JS needed. */
  .nav-inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding: 0.75rem var(--space-2);
  }
  .nav-links {
    display: flex;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
    gap: 0.5rem 1.15rem;
    padding: 0.15rem 0 0.2rem;
    font-size: 0.92rem;
  }
  .nav-links li { border: none; }
  .nav-links a { display: inline-block; padding: 0.2rem 0; }
  .nav-toggle { display: none; }
  .nav-cta { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
  /* Dropdown becomes an inline expand-in-place list instead of a floating
     panel — it's already sitting in the wrapped nav flow at this width. */
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: none;
    padding: 0.3rem 0 0.2rem 1rem;
    min-width: 0;
    margin-top: 0.3rem;
  }
  .brand { font-size: 1rem; }
  .brand svg { width: 26px; height: 26px; }
  .brand-tagline { font-size: 0.58rem; }
}

/* ============ MOBILE POLISH ============ */
@media (max-width: 700px) {
  body { font-size: 16px; }
  section { padding: var(--space-4) 0; }
  .section-tight { padding: var(--space-3) 0; }
  .hero { padding-top: var(--space-3); }
  .hero-lede { font-size: 1.05rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { justify-content: center; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .field { min-width: 100%; }
  .filter-bar .btn { width: 100%; justify-content: center; }
  fieldset { padding: var(--space-2); }
  .footer-bottom { flex-direction: column; text-align: center; }
  .two-col { gap: var(--space-3); }
  h2 { font-size: 1.55rem; }
  .card { padding: var(--space-2) var(--space-3); }
  form button[type="submit"], .chat-input-row .btn { width: 100%; justify-content: center; }
  .chat-input-row { flex-direction: column; }
  .msg { max-width: 88%; }
  #farm-map, #host-map { height: 300px; }
  #combined-map { height: 300px; }
  input, textarea, select { font-size: 16px; } /* prevents iOS auto-zoom on focus */
  .event-card .btn, .card .btn { width: 100%; justify-content: center; }
  h1 { font-size: 1.9rem; }
  .wrap { padding: 0 var(--space-2); }
  .grid { gap: var(--space-2); }
}


/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--rust); color: var(--paper); }
.btn-primary:hover { background: var(--rust-deep); }
.btn-outline { background: transparent; border-color: var(--pine); color: var(--pine); }
.btn-outline:hover { background: var(--pine); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--pine-deep); text-decoration: underline; padding: 0.4rem 0; }

/* ============ HERO ============ */
.hero {
  position: relative;
  padding: var(--space-5) 0 0;
  overflow: hidden;
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-3);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-4);
  align-items: start;
}
.hero-map-intro { grid-column: 1; grid-row: 1; }
.hero-map-col { grid-column: 1; grid-row: 2; }
.hero-photo-col { grid-column: 2; grid-row: 2; }
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-map-intro, .hero-map-col, .hero-photo-col { grid-column: 1; grid-row: auto; }
}
.hero h1 { margin-bottom: var(--space-2); }
.hero-lede { font-size: 1.15rem; max-width: 46ch; }
.hero-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }

.hero-quote {
  text-align: center;
  margin-bottom: var(--space-3);
}
.hero-quote-text {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 auto var(--space-1);
}
.hero-quote-attribution {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 0;
}
@media (max-width: 700px) {
  .hero-quote-text { font-size: 1.05rem; }
}

.horizon-scene {
  width: 100%;
  max-width: 500px;
  height: auto;
  border-radius: 8px;
  display: block;
}

/* horizon divider motif — used between sections */
.horizon-divider {
  width: 100%;
  height: 60px;
  display: block;
  margin: 0;
}

/* ============ SECTIONS ============ */
section { padding: var(--space-6) 0; }
.section-tight { padding: var(--space-5) 0; }
.section-alt { background: var(--paper); }
.section-dark {
  background: var(--pine-deep);
  color: var(--wheat-cream);
}
.section-dark h2, .section-dark h3 { color: var(--wheat-cream); }
.section-dark p { color: rgba(243,235,216,0.78); }

.center { text-align: center; }
.narrow { max-width: 62ch; margin-left: auto; margin-right: auto; }

/* ============ VALUES GRID ============ */
.grid {
  display: grid;
  gap: var(--space-3);
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 780px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.card-icon { width: 42px; height: 42px; margin-bottom: var(--space-2); color: var(--rust); }

.value-item {
  padding-left: var(--space-3);
  border-left: 3px solid var(--gold);
}
.value-item h3 { margin-bottom: 0.3em; }

/* ============ TIMELINE / HOW IT WORKS ============ */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--space-2);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: none; }
.step-num {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold);
  font-weight: 700;
}
.step h3 { font-size: 1.05rem; margin-bottom: 0.2em; }
.step p { font-size: 0.92rem; margin-bottom: 0; }

/* ============ EVENT CARDS ============ */
.event-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.event-card-body { padding: var(--space-3); flex: 1; display: flex; flex-direction: column; }
.event-date {
  font-weight: 700;
  color: var(--rust);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.event-loc { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: var(--space-2); }
.event-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: var(--space-2); }
.tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: rgba(60,74,52,0.1);
  color: var(--pine);
}
.see-more-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin: -0.2rem 0 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pine);
  cursor: pointer;
  text-decoration: underline;
}
.see-more-toggle:hover { color: var(--pine-deep); }

/* ============ COMBINED MAP (HOMEPAGE) ============ */
.combined-map-wrap {
  position: relative;
}
#combined-map {
  height: 380px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 1;
  transition: opacity 0.2s, filter 0.2s;
}
.combined-map-wrap.map-gated #combined-map,
.combined-map-wrap.map-gated .map-legend {
  opacity: 0.45;
  filter: grayscale(30%);
}
.map-legend {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  z-index: 500;
  background: rgba(251,246,236,0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  transition: opacity 0.2s, filter 0.2s;
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(43,38,32,0.25);
}
.combined-map-pin span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(43,38,32,0.45);
}
.leaflet-popup-content {
  font-family: var(--font-body);
  margin: 0.9rem 1rem;
  min-width: 200px;
}
.leaflet-popup-content h3 { margin-top: 0; }
.leaflet-popup-content .btn { margin-top: 0.3rem; }
.leaflet-popup-content a.btn-primary { color: var(--paper); }
.map-gate-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 600;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.map-gate-overlay.active { display: flex; }
.map-gate-prompt {
  display: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  text-align: center;
  box-shadow: 0 8px 24px rgba(43,38,32,0.25);
  max-width: 280px;
}
.map-gate-overlay.show-prompt .map-gate-prompt { display: block; }
.map-gate-prompt p { margin: 0 0 var(--space-2); color: var(--ink); font-weight: 700; }

/* ============ FORMS ============ */
form { max-width: 640px; }
.field { margin-bottom: var(--space-3); }
label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
  color: var(--pine-deep);
}
.hint { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.3rem; }
input, textarea, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(168, 80, 46, 0.35);
  border-color: var(--rust);
}
textarea { resize: vertical; min-height: 110px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
legend { font-weight: 700; padding: 0 0.5rem; color: var(--pine-deep); }
.check-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.6rem; }
.check-row input { width: auto; margin-top: 0.3rem; }
.check-row label { font-weight: 500; margin-bottom: 0; }

/* ============ FOOTER ============ */
.site-footer {
  background: var(--pine-deep);
  color: rgba(243,235,216,0.85);
  padding: var(--space-4) 0 var(--space-2);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(243,235,216,0.15);
}
@media (max-width: 780px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-3); }
}
.site-footer h4 { color: var(--wheat-cream); font-size: 1rem; margin-bottom: 0.6rem; }
.site-footer a { color: rgba(243,235,216,0.75); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  font-size: 0.85rem;
  color: rgba(243,235,216,0.55);
}

/* ============ MISC ============ */
.pill-note {
  display: inline-block;
  background: rgba(201,153,47,0.16);
  color: var(--bark);
  border: 1px solid rgba(201,153,47,0.4);
  border-radius: 100px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.callout {
  background: rgba(60,74,52,0.08);
  border-left: 4px solid var(--pine);
  padding: var(--space-3);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
