/* ==========================================================================
   Perennial Flowers — global stylesheet
   Plain CSS3, mobile-first, no build step, no framework.
   ========================================================================== */

:root {
  --color-bg: #fdfbf6;
  --color-surface: #ffffff;
  --color-text: #2b2f26;
  --color-text-muted: #5c6355;
  --color-border: #e3ddcd;
  --color-primary: #3f6b3f;
  --color-primary-dark: #2c4d2c;
  --color-primary-light: #eef4ea;
  --color-accent: #b5563c;
  --color-accent-light: #f6e6e0;
  --color-sun: #d99a2b;
  --color-shade: #4a6fa5;
  --color-header-bg: #2c4d2c;
  --color-header-text: #f6f4ec;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 10px rgba(43, 61, 43, 0.08);
  --shadow-lg: 0 8px 28px rgba(43, 61, 43, 0.14);
  --max-width: 1160px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  font-size: 17px;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--color-primary-dark);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2.2em; }
h3 { font-size: 1.25rem; margin-top: 1.6em; }

p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }
li { margin-bottom: 0.4em; }

a { color: var(--color-primary); text-decoration: underline; text-decoration-color: rgba(63,107,63,0.35); text-underline-offset: 2px; }
a:hover { color: var(--color-primary-dark); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.75em 1.2em;
  z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: #fff; opacity: 0.9; }
.logo-mark { font-size: 1.4rem; }

.nav-toggle {
  display: inline-flex;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  border-radius: 8px;
  padding: 0.4em 0.6em;
  font-size: 1rem;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255,255,255,0.1); }

.main-nav {
  display: none;
  width: 100%;
}
.main-nav.is-open { display: block; }
/* Direct-child combinator only — a plain ".main-nav ul" would also match the
   nested .dropdown <ul> submenus and force them permanently visible, which
   was the actual cause of the overlapping-menu bug. */
.main-nav > ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.main-nav a {
  display: block;
  color: var(--color-header-text);
  text-decoration: none;
  padding: 0.6em 0.2em;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.98rem;
}
.main-nav li:first-child a { border-top: none; }
.main-nav a:hover { color: #fff; text-decoration: underline; }
.main-nav a[aria-current="page"] { color: var(--color-sun); font-weight: 600; }

.has-dropdown { position: relative; }
.dropdown {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.9rem;
  display: none;
}
.has-dropdown.is-open .dropdown { display: block; }
.dropdown li { break-inside: avoid; }
.dropdown a { font-size: 0.92rem; opacity: 0.9; }

/* Below 1200px, the four dropdown menus (24 links total) can't fit cleanly
   in a single horizontal bar without crowding or overflowing the viewport,
   so tablets and small laptops get the safe, non-overlapping mobile menu. */
@media (min-width: 1200px) {
  .nav-toggle { display: none; }
  .main-nav { display: block; width: auto; }
  .main-nav > ul {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1.1rem;
  }
  .main-nav a {
    border-top: none;
    padding: 0.4em 0.1em;
    white-space: nowrap;
    line-height: 1.4;
  }
  .has-dropdown:hover .dropdown,
  .has-dropdown:focus-within .dropdown { display: block; }
  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-primary-dark);
    padding: 0.85rem;
    border-radius: 10px;
    min-width: 210px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
  }
  /* Flower Types (10 links) and Growing Guides (8 links) become a
     two-column mega-menu instead of one long overflowing list. */
  .main-nav > ul > li:nth-child(3) .dropdown,
  .main-nav > ul > li:nth-child(4) .dropdown {
    columns: 2;
    column-gap: 1.5rem;
    width: max-content;
    min-width: 380px;
    max-width: 440px;
  }
  /* By Season and Pollinators sit toward the right edge of the header,
     so their menus anchor to the right of the trigger, not the left,
     to avoid spilling past the viewport edge. */
  .main-nav > ul > li:nth-child(5) .dropdown,
  .main-nav > ul > li:nth-child(6) .dropdown {
    left: auto;
    right: 0;
  }
  .dropdown a {
    display: block;
    padding: 0.5em 0.7em;
    border-radius: 6px;
    line-height: 1.4;
  }
  .dropdown a:hover { background: rgba(255,255,255,0.1); opacity: 1; }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.9rem 0;
}
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35em; }
.breadcrumbs li:not(:last-child)::after { content: "\203A"; margin-left: 0.35em; color: var(--color-border); }
.breadcrumbs a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--color-primary-light), var(--color-bg));
  padding: 2.4rem 0 3rem;
}
.hero-grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 860px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; }
}
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.6em;
}
.hero p.lede { font-size: 1.1rem; color: var(--color-text-muted); }
.hero-photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-photo img { width: 100%; object-fit: cover; aspect-ratio: 4/3; }
.hero-photo figcaption { font-size: 0.78rem; color: var(--color-text-muted); padding: 0.5em 0.2em 0; }

.btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 0.7em 1.3em;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 0.98rem;
}
.btn:hover { background: var(--color-primary-dark); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--color-primary-dark);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ---------- Sections ---------- */
main section { padding: 2.4rem 0; }
main section.tight { padding: 1.2rem 0; }
.section-head { max-width: 720px; margin-bottom: 1.6rem; }
.section-head p { color: var(--color-text-muted); }

/* ---------- Cards / grids ---------- */
.card-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--color-text); }
.card img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.card-body { padding: 1rem 1.1rem 1.2rem; }
.card-body h3 { margin-top: 0; font-size: 1.08rem; }
.card-body .meta { font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 0.4em; }
.card-body p { margin-bottom: 0; font-size: 0.92rem; color: var(--color-text-muted); }
.card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: 0.2em 0.6em;
  border-radius: 999px;
  margin-bottom: 0.5em;
}

/* Link-list style category cards (browse by sun/season/purpose) */
.link-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.link-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--color-text);
  display: block;
  box-shadow: var(--shadow);
}
.link-card:hover { border-color: var(--color-primary); color: var(--color-text); }
.link-card .icon { font-size: 1.5rem; margin-bottom: 0.3em; display: block; }
.link-card h3 { margin: 0 0 0.2em; font-size: 1.05rem; }
.link-card p { margin: 0; font-size: 0.87rem; color: var(--color-text-muted); }

/* ---------- Flower Finder ---------- */
.finder {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.finder-controls {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 1.2rem;
}
.finder-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.3em;
}
.finder-field select {
  width: 100%;
  padding: 0.55em 0.6em;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 0.95rem;
  color: var(--color-text);
}
.finder-actions { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.finder-count { font-size: 0.85rem; color: var(--color-text-muted); }
.finder-results {
  margin-top: 1.4rem;
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.finder-empty {
  padding: 1.4rem;
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  display: none;
}

/* ---------- Quick facts table ---------- */
.quick-facts {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.94rem;
  margin: 1.2em 0 1.8em;
}
.quick-facts caption { text-align: left; font-weight: 700; padding: 0.7em 1em; background: var(--color-primary-light); color: var(--color-primary-dark); }
.quick-facts th, .quick-facts td { text-align: left; padding: 0.55em 1em; border-top: 1px solid var(--color-border); }
.quick-facts th { width: 40%; color: var(--color-text-muted); font-weight: 600; }

/* ---------- Pros/cons, callouts ---------- */
.two-col {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
  margin: 1.4em 0;
}
@media (min-width: 700px) { .two-col { grid-template-columns: 1fr 1fr; } }
.callout {
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--color-border);
}
.callout.good { background: var(--color-primary-light); border-color: #cfe0c8; }
.callout.watch { background: var(--color-accent-light); border-color: #e3c3b6; }
.callout h3 { margin-top: 0; font-size: 1rem; }
.callout ul { margin-bottom: 0; padding-left: 1.2em; }

.note {
  border-left: 4px solid var(--color-sun);
  background: #fbf3e2;
  padding: 0.9rem 1.1rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.94rem;
  margin: 1.4em 0;
}

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid var(--color-border);
}
.faq-item:first-child { border-top: 1px solid var(--color-border); }
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.9em 0.2em;
  color: var(--color-primary-dark);
  list-style: none;
  position: relative;
  padding-right: 1.6em;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0.2em;
  top: 0.85em;
  font-size: 1.2em;
  color: var(--color-primary);
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { padding-bottom: 0.9em; color: var(--color-text-muted); }

/* ---------- Tags / pill filters on listing pages ---------- */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1em 0 1.6em; }
.pill {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: 0.35em 0.9em;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.pill:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

/* ---------- Zone map / table ---------- */
.zone-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 1.2em 0; }
.zone-table th, .zone-table td { padding: 0.5em 0.7em; border: 1px solid var(--color-border); text-align: left; }
.zone-table th { background: var(--color-primary-light); }

/* ---------- Forms (contact) ---------- */
.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; font-weight: 700; margin-bottom: 0.35em; font-size: 0.92rem; }
.form-field input, .form-field textarea {
  width: 100%;
  padding: 0.65em 0.8em;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.98rem;
  background: #fff;
  color: var(--color-text);
}
.form-field textarea { min-height: 140px; resize: vertical; }
.form-note { font-size: 0.85rem; color: var(--color-text-muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-header-bg);
  color: rgba(255,255,255,0.85);
  margin-top: 3rem;
  padding: 2.6rem 0 1.6rem;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  gap: 1.8rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.8rem;
}
@media (min-width: 700px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
.footer-grid h4 { color: #fff; font-size: 0.92rem; font-family: var(--font-body); margin-bottom: 0.7em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.5em; }
.footer-grid a { color: rgba(255,255,255,0.78); text-decoration: none; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.4rem;
  justify-content: space-between;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}
.footer-bottom a { color: rgba(255,255,255,0.6); }

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 4rem 0; }
.error-page .code { font-family: var(--font-head); font-size: 5rem; color: var(--color-primary-light); font-weight: 700; margin: 0; }
