/* shared.css — common styles for all FarMapa pages.
   Pages override sizing via --nav-h / --nav-pad-x and add page-specific rules. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Colour tokens ────────────────────────────────────────────────── */
  --cream:        #f7f3eb;
  --cream-warm:   #f0ebe0;
  --cream-dark:   #e0d9cc;
  --sage-light:   #a7c584;
  --sage:         #a7c584;
  --sage-dark:    #7bb669;
  --forest:       #619b5f;          /* brand colour — text on cream, logo */
  --forest-deep:  #7bb669;          /* slightly lighter — used as hover */
  --forest-bg:    #3a6b39;          /* dark variant for green backgrounds; AA on cream/white */
  --forest-bg-hover: #2d5a2c;
  --text:         #2c2722;
  --text-mid:     #5a5148;
  --text-muted:   #9a9088;
  --white:        #ffffff;

  /* ── Layout tokens ────────────────────────────────────────────────── */
  --nav-h:        64px;
  --nav-pad-x:    48px;

  /* ── Z-index scale ────────────────────────────────────────────────── */
  /* map tiles are drawn at 0 by Leaflet; markers ~600 and popups 700 are
     Leaflet defaults left untouched. */
  --z-grain:           1;
  --z-error-overlay:   600;
  --z-leaflet-popup:   700;
  --z-sidebar:         800;
  --z-search-input:    850;
  --z-search-dropdown: 900;
  --z-nav:             1000;
  --z-mobile-overlay:  9998;
  --z-mobile-panel:    9999;
}

html, body { height: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
}

/* Subtle grain — sits behind everything; pointer-events:none so it never blocks input. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: var(--z-grain);
}

/* ── Navigation ─────────────────────────────────────────────────────── */
nav {
  height: var(--nav-h);
  padding: 0 var(--nav-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--cream-dark);
  background: rgba(247, 243, 235, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}

.nav-logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--forest);
  text-decoration: none;
}
.nav-logo em { font-style: italic; font-weight: 300; }

.nav-right {
  position: fixed;
  top: 0;
  right: var(--nav-pad-x);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  z-index: var(--z-nav);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}
.nav-links a {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a:focus-visible { color: var(--forest); }
.nav-links a.active { color: var(--forest); }

/* ── Language switcher ─────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid var(--cream-dark);
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 5px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover,
.lang-btn:focus-visible { background: var(--cream-warm); color: var(--text); }
.lang-btn.active { color: var(--forest); font-weight: 500; }

/* Visible focus ring for keyboard users */
:focus-visible { outline: 2px solid var(--forest-bg); outline-offset: 2px; }

/* ── Hamburger ─────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 6px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
nav.menu-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.menu-open .hamburger span:nth-child(2) { opacity: 0; }
nav.menu-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav overlay (sits below the panel, above the page) ──── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: var(--z-mobile-overlay);
}
.mobile-nav-overlay.visible { display: block; }

/* ── Footer ────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--cream-dark);
  padding: 24px var(--nav-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
footer p { font-size: 14px; color: var(--text-muted); }
footer a { color: var(--sage-dark); text-decoration: none; }
footer a:hover,
footer a:focus-visible { text-decoration: underline; }

/* ── Contact bar ──────────────────────────────────────────────────── */
/* Uses --forest-bg (darker) so cream text passes WCAG AA 4.5:1 contrast. */
.contact-bar {
  background: var(--forest-bg);
  padding: 18px var(--nav-pad-x);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.contact-bar p {
  font-size: 14px;
  color: var(--cream);
  text-align: center;
}
.contact-bar a {
  font-size: 14px;
  color: var(--cream);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(247,243,235,0.55);
  transition: border-color 0.2s;
}
.contact-bar a:hover,
.contact-bar a:focus-visible { border-color: var(--cream); }

/* ── Mobile (≤768px): nav becomes a slide-in panel ──────────────── */
@media (max-width: 768px) {
  nav { padding: 0 16px; }
  .nav-logo img { max-height: 40px; width: auto; }
  .hamburger { display: flex; }

  .nav-right {
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    padding: 80px 24px 40px;
    flex-direction: column;
    align-items: flex-start;
    background: var(--cream);
    border-left: 1px solid var(--cream-dark);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: var(--z-mobile-panel);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    gap: 0;
    visibility: hidden;
  }
  .nav-right.menu-open {
    transform: translateX(0);
    visibility: visible;
  }
  .nav-links { flex-direction: column; gap: 0; width: 100%; margin-bottom: 24px; }
  .nav-links a {
    padding: 14px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 16px;
    border-bottom: 1px solid var(--cream-dark);
    width: 100%;
  }
  .lang-switcher {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 20px;
    gap: 8px;
  }
  .lang-btn { min-height: 44px; padding: 8px 12px; font-size: 14px; }

  footer {
    padding: 16px 20px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .contact-bar { padding: 14px 20px; }
}

