/* Moth Field Guide — standalone styles */
:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-2: #faf6ef;
  --ink: #2a2118;
  --ink-soft: #5c4f3d;
  --ink-muted: #8a7b66;
  --line: #e4dccb;
  --accent: #4a7c59;
  --accent-soft: #e6efe8;
  --warn: #b8860b;
  --pest: #a8433a;
  --benefit: #2e7d4f;
  --neutral: #7a6a52;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(42, 33, 24, 0.06), 0 1px 2px rgba(42, 33, 24, 0.04);
  --shadow-lg: 0 8px 32px rgba(42, 33, 24, 0.12);
  --maxw: 1200px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark { flex-shrink: 0; }
.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9375rem;
}
.site-nav a { color: var(--ink-soft); font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* Hero */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--ink);
}
.hero-sub {
  font-size: 1.125rem;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  max-width: 480px;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #3d6a4a; border-color: #3d6a4a; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-muted); }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.875rem; }

/* Sections */
.section-head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}
.section-head h2 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}
.section-head p {
  color: var(--ink-soft);
  margin: 0;
  max-width: 600px;
}

/* Guide layout */
.guide-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}
.guide-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

/* Filters */
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 80px;
}
.filter-group { margin-bottom: 1.25rem; }
.filter-group h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.chip {
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Results */
.results-area { min-width: 0; }
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.result-count {
  font-weight: 600;
  color: var(--ink-soft);
}
.results-actions { display: flex; gap: 0.5rem; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* Species card */
.species-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.species-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.species-thumb {
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.species-thumb svg { width: 80%; height: 80%; }
.species-info {
  padding: 0.875rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.species-name {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  color: var(--ink);
}
.species-sci {
  font-style: italic;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin: 0;
}
.species-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}
.badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-beneficial { background: #e6f4ea; color: var(--benefit); }
.badge-neutral { background: #f0ece4; color: var(--neutral); }
.badge-pest { background: #fbeae8; color: var(--pest); }
.card-save {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--ink-muted);
  transition: color 0.15s;
}
.card-save:hover { color: var(--accent); }
.card-save.saved { color: var(--accent); }

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
}
.empty-state p { margin: 0.25rem 0; }

/* Saved section */
.saved-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* About section */
.about-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.about-card h3 {
  font-size: 1.0625rem;
  margin: 0.75rem 0 0.5rem;
}
.about-card p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 0.9375rem;
}
.content-block {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.content-block h3 {
  font-size: 1.0625rem;
  margin: 1.25rem 0 0.5rem;
}
.content-block h3:first-child { margin-top: 0; }
.content-block p {
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 15, 10, 0.55);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink-muted);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-species-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.modal-species-thumb svg { width: 60%; height: 80%; }
.modal-title {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}
.modal-sci {
  font-style: italic;
  color: var(--ink-muted);
  margin: 0 0 1rem;
}
.modal-section { margin-bottom: 1.25rem; }
.modal-section h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.375rem;
}
.modal-section p { margin: 0; color: var(--ink-soft); }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Season bar */
.season-bar {
  display: flex;
  gap: 2px;
  margin-top: 0.5rem;
}
.season-month {
  flex: 1;
  height: 24px;
  border-radius: 3px;
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.season-month.active { background: var(--accent); color: #fff; }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 2rem 1.5rem;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}
.footer-brand { font-weight: 700; margin: 0 0 0.25rem; }
.footer-note { color: var(--ink-muted); font-size: 0.875rem; margin: 0; }
.footer-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
}
.footer-col a {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  padding: 0.125rem 0;
}
.footer-col a:hover { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 1.5rem 1.5rem; }
  .hero-art { order: -1; max-width: 320px; margin: 0 auto; }
  .guide-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .site-nav { gap: 1rem; font-size: 0.875rem; }
}
@media (max-width: 480px) {
  .header-inner { padding: 0.75rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .results-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .modal-card { padding: 1.25rem; }
  .site-nav a:nth-child(3) { display: none; }
}

@media print {
  .site-header, .filters, .hero-actions, .results-actions, .site-footer, .saved-section, .about-section, .modal { display: none !important; }
  .results-grid { display: block; }
  .species-card { break-inside: avoid; margin-bottom: 1rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
