/* ============================================================================
   Seedelli Theme — Shared across all pages
   Source of truth for light/dark tokens, toggle component, accessibility.
   Loaded via <link rel="stylesheet" href="/assets/theme.css"> BEFORE page <style>.
   ============================================================================ */

/* --- Light tokens (defaults) --- */
:root {
  --cream: #FAF6F0;
  --cream-dark: #F0EBE3;
  --green-deep: #2D5016;
  --green-mid: #3D6B22;
  --green-light: #5A8F35;
  --green-pale: #E8F0E0;
  --earth: #8B6914;
  --earth-light: #C49B2A;
  --brown-dark: #1E1708;
  --text-primary: #1A1A1A;
  --text-secondary: #5A5A5A;
  --text-muted: #6B6B5A;
  --red-accent: #A63D2F;
  --red-muted: #8B3425;
  --white: #FFFFFF;
  --nav-bg-scrolled: rgba(250, 246, 240, 0.92);
  --shadow-card: 0 2px 20px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 12px 30px rgba(0,0,0,0.1);
  --border-subtle: rgba(0,0,0,0.08);
  /* Aliases for compat across all page variants */
  --vert1: #2D5016;
  --vert2: #4a7c2e;
  --terre1: #8B6914;
  --bg: #FDF8F0;
  --fg: #333;
  --text: #333;
  --text-light: #666;
  --text-dark: #1A1A1A;
  --border: #e8dcc8;
  --light: #FAF6F0;
  --dark: #1A1A1A;
  --light-gray: #f5f5f5;
  --muted: #8A8A7A;
  --radius: 0.75rem;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --sm: 0.5rem;
  --bg-white: #FFFFFF;
  --accent: #E07A2F;
  /* Calendar */
  --blue-indoor: #4A7FB5;
  --blue-indoor-bg: #E8F0FA;
  --green-outdoor: #3D6B22;
  --green-outdoor-bg: #E8F0E0;
  --orange-harvest: #C47B20;
  --orange-harvest-bg: #FFF3E0;
  /* Climate zones */
  --zone-ocean: #4A7FB5;
  --zone-continental: #C49B2A;
  --zone-med: #C47B20;
  --zone-mountain: #5A8F35;
  /* Producers */
  --kok: #2D5016;
  --ger: #8B6914;
  --sem: #6B4D0A;
}

/* --- Dark tokens --- */
:root[data-theme="dark"] {
  --cream: #0F1410;
  --cream-dark: #141A15;
  --white: #1A211C;
  --green-deep: #8BC46A;
  --green-mid: #6BA84D;
  --green-light: #9BD87A;
  --green-pale: #1F2A1A;
  --text-primary: #E8EAE0;
  --text-secondary: #A8B0A2;
  --text-muted: #7A8278;
  --earth-light: #D4B24A;
  --red-accent: #E85D4A;
  --nav-bg-scrolled: rgba(15, 20, 16, 0.92);
  --shadow-card: 0 2px 20px rgba(0,0,0,0.5);
  --shadow-card-hover: 0 12px 30px rgba(0,0,0,0.6);
  --border-subtle: rgba(232, 234, 224, 0.1);
  /* Aliases */
  --vert1: #8BC46A;
  --vert2: #6BA84D;
  --terre1: #D4B24A;
  --bg: #0F1410;
  --fg: #E8EAE0;
  --text: #E8EAE0;
  --text-light: #A8B0A2;
  --text-dark: #E8EAE0;
  --border: rgba(232, 234, 224, 0.15);
  --light: #1A211C;
  --dark: #E8EAE0;
  --light-gray: #1A211C;
  --muted: #7A8278;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --bg-white: #1A211C;
  --accent: #E07A2F;
  /* Calendar (keep same hues, slightly muted) */
  --blue-indoor: #6A9FD5;
  --blue-indoor-bg: rgba(74, 127, 181, 0.15);
  --green-outdoor: #6BA84D;
  --green-outdoor-bg: rgba(61, 107, 34, 0.15);
  --orange-harvest: #D4952A;
  --orange-harvest-bg: rgba(196, 123, 32, 0.15);
  /* Climate zones */
  --zone-ocean: #6A9FD5;
  --zone-continental: #D4B24A;
  --zone-med: #D4952A;
  --zone-mountain: #8BC46A;
  /* Producers */
  --kok: #8BC46A;
  --ger: #D4B24A;
  --sem: #C49B2A;
}

html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* --- CTAs that use green-deep as BACKGROUND must stay deep green in dark --- */
:root[data-theme="dark"] .nav-cta,
:root[data-theme="dark"] .sticky-cta a,
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .seasonal-banner .sb-cta {
  background: #2D5016;
  color: #FAF6F0;
}
:root[data-theme="dark"] .nav-cta:hover,
:root[data-theme="dark"] .sticky-cta a:hover,
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .seasonal-banner .sb-cta:hover {
  background: #3D6B22;
  color: #FAF6F0;
}

/* --- Common dark overrides --- */
:root[data-theme="dark"] .hamburger span { background: #8BC46A; }
:root[data-theme="dark"] .mobile-menu {
  background: #1A211C;
  box-shadow: -4px 0 30px rgba(0,0,0,0.6);
}
:root[data-theme="dark"] .mobile-menu a {
  border-bottom-color: rgba(232, 234, 224, 0.08);
}

/* --- Theme toggle component --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  padding: 0;
  font-family: inherit;
}
.theme-toggle:hover {
  color: var(--green-deep);
  border-color: var(--green-deep);
  transform: rotate(15deg);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-label { display: none; }
.theme-toggle-mobile {
  width: auto;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  gap: 0.6rem;
  justify-content: flex-start;
  margin-top: 1.5rem;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.theme-toggle-mobile .theme-toggle-label {
  display: inline;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
}
.theme-toggle-mobile:hover { transform: none; }

/* --- Standard nav layout --- */
nav {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 110;
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--nav-bg-scrolled);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}
.nav-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-deep);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-logo img { width: 28px; height: 28px; object-fit: contain; }
.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}
.nav-links a, .nav-links li a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.3s;
  padding: 0.75rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover { color: var(--green-deep); text-decoration: none; }
.nav-cta {
  background: var(--green-deep);
  color: var(--cream) !important;
  padding: 0.5rem 1.2rem;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.3s;
  text-decoration: none !important;
}
.nav-cta:hover { background: var(--green-mid); }

/* Mobile nav */
.nav-right-mobile { display: none; align-items: center; gap: 0.75rem; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; z-index: 110; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--green-deep); border-radius: 2px; transition: all 0.3s; margin: 5px 0; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
.mobile-basket { position: relative; display: flex; align-items: center; color: var(--green-deep); text-decoration: none; }
.basket-count-mobile { position: absolute; top: -6px; right: -8px; background: #E07A2F; color: #fff; font-size: 0.6rem; font-weight: 700; border-radius: 50%; width: 16px; height: 16px; display: none; align-items: center; justify-content: center; }
.mobile-menu-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 95; background: rgba(0,0,0,0.3); }
.mobile-menu-overlay.open { display: block; }
.mobile-menu { display: none; position: fixed; top: 0; right: 0; width: 280px; max-width: 80vw; height: 100vh; background: var(--cream); z-index: 105; padding: 5rem 2rem 2rem; box-shadow: -4px 0 30px rgba(0,0,0,0.1); transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.23,1,0.32,1); flex-direction: column; gap: 0; }
.mobile-menu.open { transform: translateX(0); }
.mobile-menu a { display: block; text-decoration: none; color: var(--text-primary); font-size: 1.05rem; font-weight: 500; padding: 1rem 0; border-bottom: 1px solid var(--cream-dark); transition: color 0.2s; }
.mobile-menu a:hover { color: var(--green-deep); }
.mobile-menu a.nav-cta { display: inline-block; margin-top: 1rem; border-bottom: none; text-align: center; }

@media (max-width: 768px) {
  .nav-links { display: none !important; }
  .nav-right-mobile { display: flex; }
  .mobile-menu { display: flex; }
}

/* --- Focus-visible accessibility --- */
.theme-toggle:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--green-deep);
  outline-offset: 2px;
  border-radius: 4px;
}
