/* ============================================================
   Tick Field Dashboard · Somerset County, PA
   Aesthetic: naturalist field journal — forest green, ochre,
   warm cream, deep ink. Display serif (Fraunces) + Inter body.
   ============================================================ */

:root {
  /* Palette — earthy, naturalist */
  --cream: #f4eee2;
  --cream-2: #ece4d2;
  --paper: #faf6ec;
  --ink: #1f2417;
  --ink-2: #2e3624;
  --ink-muted: #5a604f;
  --ink-faint: #cdc8b8;
  --line: #d8d1bf;
  --line-soft: #e6dfca;

  --accent: #6b8e3d;        /* moss / sage */
  --accent-deep: #4a6628;
  --accent-soft: #c8d5a9;

  --ochre: #b8772b;         /* warning / alarm */
  --ochre-soft: #e8c997;
  --rust: #a84522;          /* peak risk */
  --rust-soft: #e6b1a0;

  /* Risk ramp (for calendar & legend) */
  --risk-low: #a8b988;
  --risk-mod: #d8a85a;
  --risk-high: #c46f2a;
  --risk-peak: #a84522;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}

/* Subtle paper grain via gradient noise (no images needed) */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 10% 0%, rgba(107,142,61,.06), transparent 60%),
    radial-gradient(ellipse 600px 500px at 90% 10%, rgba(184,119,43,.05), transparent 60%);
  z-index: 0;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid currentColor; }
a:hover { color: var(--ink); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--sp-3);
  line-height: 1.15;
}
h1 { font-size: clamp(36px, 5vw, 60px); font-weight: 500; letter-spacing: -0.025em; }
h2 { font-size: clamp(28px, 3.5vw, 42px); letter-spacing: -0.02em; }
h3 { font-size: 20px; }
h4 { font-size: 16px; font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }

p { margin: 0 0 var(--sp-4); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--sp-3);
}

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,246,236,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 1280px; margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-5);
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--ink); border-bottom: none;
}
.brand-mark { width: 32px; height: 32px; color: var(--accent-deep); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.brand-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-muted); text-transform: uppercase; }

.topnav { display: flex; gap: var(--sp-5); margin-left: auto; }
.topnav a {
  color: var(--ink-muted); border-bottom: none;
  font-size: 14px; font-weight: 500;
  padding: 6px 0;
  position: relative;
}
.topnav a:hover { color: var(--ink); }
.topnav a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 0; height: 1.5px; background: var(--accent-deep);
  transition: width 250ms ease;
}
.topnav a:hover::after { width: 100%; }

.now-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--cream); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px;
  font-size: 12px; color: var(--ink-muted);
}
.now-pill strong { color: var(--ink); font-weight: 600; }
.now-divider { opacity: 0.4; }
.now-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(107,142,61,0.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: 1280px; margin: 0 auto;
  padding: var(--sp-8) var(--sp-5) var(--sp-7);
  position: relative; z-index: 1;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--sp-7);
  align-items: start;
}
.hero-text h1 {
  margin-bottom: var(--sp-4);
}
.lede {
  font-size: 18px;
  color: var(--ink-muted);
  max-width: 60ch;
  margin-bottom: var(--sp-6);
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--line);
  padding-top: var(--sp-5);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-unit { font-size: 22px; color: var(--ink-muted); margin-left: 2px; }
.stat-label {
  font-size: 13px; color: var(--ink-muted); line-height: 1.4;
}
.stat-label span { display: block; font-size: 11px; opacity: 0.75; }

/* Risk card */
.hero-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--sp-4);
}
.card-kicker {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink-muted);
}
.card-date { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.risk-gauge { display: flex; justify-content: center; margin: var(--sp-3) 0 var(--sp-4); }
.gauge-svg { width: 100%; max-width: 280px; height: auto; }
.gauge-num { font-family: var(--font-display); font-size: 42px; font-weight: 500; fill: var(--ink); }
.gauge-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.18em; fill: var(--ink-muted); }

.risk-breakdown {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--ink-muted);
  border-top: 1px dashed var(--line); padding-top: var(--sp-4);
}
.risk-breakdown div { display: flex; align-items: center; gap: var(--sp-2); }
.risk-breakdown strong { color: var(--ink); margin-left: auto; font-weight: 600; }
.weight { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin: 0 6px; }
.weight-explainer { font-size: 11px; color: var(--ink-muted); font-style: italic; margin: 8px 0 12px; line-height: 1.4; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-blacklegged { background: var(--rust); }
.dot-dog { background: var(--ochre); }
.dot-lonestar { background: var(--accent); }

.card-note {
  margin-top: var(--sp-4);
  font-size: 13px; color: var(--ink-muted); line-height: 1.5;
  border-top: 1px dashed var(--line); padding-top: var(--sp-3);
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  max-width: 1280px; margin: 0 auto;
  padding: var(--sp-9) var(--sp-5) var(--sp-8);
  position: relative; z-index: 1;
}
.section-alt {
  background: linear-gradient(180deg, transparent, var(--cream) 8%, var(--cream) 92%, transparent);
  max-width: none;
  padding-left: 0; padding-right: 0;
}
.section-alt > * { max-width: 1280px; margin-left: auto; margin-right: auto; padding-left: var(--sp-5); padding-right: var(--sp-5); }

.section-head { max-width: 800px; margin-bottom: var(--sp-7); }
.section-head h2 { margin-bottom: var(--sp-3); }
.section-sub { font-size: 16px; color: var(--ink-muted); }

/* ============================================================
   RISK CALENDAR
   ============================================================ */
.risk-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--sp-5);
}
.chart-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.section-alt .chart-card { background: var(--paper); }
.chart-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.chart-head h3 { margin: 0; }
.chart-sub { font-size: 12px; color: var(--ink-muted); margin: 4px 0 0; }
.chart-wrap { position: relative; height: 280px; }
.chart-lg .chart-wrap { height: 320px; }
.chart-foot { font-size: 12px; color: var(--ink-muted); margin: var(--sp-4) 0 0; font-style: italic; }

.legend { display: flex; gap: var(--sp-4); font-size: 11px; color: var(--ink-muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); letter-spacing: 0.05em; }
.sw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.sw-low { background: var(--risk-low); }
.sw-mod { background: var(--risk-mod); }
.sw-high { background: var(--risk-high); }
.sw-peak { background: var(--risk-peak); }

.month-detail {
  margin-top: var(--sp-5);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  display: none;
  animation: slideDown 0.3s ease;
}
.month-detail.open { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.month-detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); }
.month-detail h3 { color: var(--cream); margin: 0; }
.close-btn {
  background: transparent; border: 1px solid rgba(244,238,226,0.3);
  color: var(--cream); width: 32px; height: 32px; border-radius: 50%;
  font-size: 20px; cursor: pointer; line-height: 1;
}
.close-btn:hover { background: rgba(244,238,226,0.1); }
.month-detail-body { font-size: 14px; color: rgba(244,238,226,0.85); line-height: 1.6; }
.month-detail-body strong { color: var(--cream); }
.md-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.md-block h4 { color: var(--accent-soft); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: var(--sp-2); }

/* ============================================================
   SPECIES GRID
   ============================================================ */
.species-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5);
}
.species-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.species-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}
.species-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--c, var(--accent));
}
.species-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.species-name { display: flex; flex-direction: column; gap: 4px; }
.species-common { font-family: var(--font-display); font-size: 24px; color: var(--ink); }
.species-latin { font-style: italic; font-size: 13px; color: var(--ink-muted); }
.species-rank {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  background: var(--cream); padding: 4px 10px; border-radius: 999px;
  color: var(--ink-muted); text-transform: uppercase;
  text-align: right; line-height: 1.4;
  max-width: 50%;
}
.species-illust {
  width: 100%; max-width: 200px; margin: 0 auto var(--sp-4);
  aspect-ratio: 200/130;
  display: flex; align-items: center; justify-content: center;
}
.species-illust svg { width: 100%; height: 100%; }
.species-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--sp-3); font-size: 13px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: var(--sp-4) 0;
  margin-bottom: var(--sp-4);
}
.species-meta dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 2px; }
.species-meta dd { margin: 0 0 var(--sp-3); color: var(--ink); }
.species-meta dd:last-child { margin-bottom: 0; }
.species-disease { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  font-family: var(--font-mono); letter-spacing: 0.03em;
  background: var(--cream-2); color: var(--ink);
  padding: 4px 10px; border-radius: 4px;
}
.tag-warn { background: var(--ochre-soft); color: var(--ink-2); }
.tag-danger { background: var(--rust-soft); color: var(--ink-2); }

/* ============================================================
   DISEASES
   ============================================================ */
.disease-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.disease-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--c, var(--accent));
  border-radius: var(--r-md);
  padding: var(--sp-5);
}
.disease-name { font-family: var(--font-display); font-size: 20px; margin-bottom: 4px; }
.disease-cause { font-size: 12px; font-style: italic; color: var(--ink-muted); margin-bottom: var(--sp-4); }
.disease-onset {
  display: inline-block;
  background: var(--cream); padding: 4px 10px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  color: var(--ink-2); margin-bottom: var(--sp-3);
}
.disease-symptoms { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: var(--sp-3); }
.disease-severity { font-size: 12px; color: var(--ink-muted); border-top: 1px dashed var(--line-soft); padding-top: var(--sp-3); }
.disease-severity strong { color: var(--ink); }

.rash-callout {
  display: flex; align-items: center; gap: var(--sp-6);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.rash-icon { width: 100px; flex: none; }
.rash-callout h3 { margin-bottom: var(--sp-2); }
.rash-callout p { margin: 0; color: var(--ink-muted); font-size: 14px; }

/* ============================================================
   PREVENTION CHECKLISTS
   ============================================================ */
.checklist-tabs {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.tab {
  background: transparent; border: none;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--ink-muted); cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent-deep); }

.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-5);
}
.check-group {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-5);
}
.check-group h4 {
  font-family: var(--font-display); font-size: 18px; font-weight: 500;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line-soft);
}
.check-list { list-style: none; padding: 0; margin: 0; }
.check-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 10px 0;
  font-size: 14px; line-height: 1.45;
  border-bottom: 1px dashed var(--line-soft);
  cursor: pointer;
  transition: opacity 0.2s;
}
.check-item:last-child { border-bottom: none; }
.check-item input { display: none; }
.check-mark {
  width: 18px; height: 18px;
  border: 1.5px solid var(--accent-deep);
  border-radius: 4px;
  flex: none;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.check-mark::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: rotate(-45deg) translate(1px,-1px);
  opacity: 0;
  transition: opacity 0.2s;
}
.check-item input:checked + .check-mark { background: var(--accent-deep); }
.check-item input:checked + .check-mark::after { opacity: 1; }
.check-item input:checked ~ .check-text { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.check-text { flex: 1; }

.repellent-card {
  margin-top: var(--sp-6);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.repellent-card h3 { color: var(--cream); margin-bottom: var(--sp-5); }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-5); }
.rep-name { font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }
.rep-use { font-size: 13px; color: var(--accent-soft); margin-bottom: 6px; font-weight: 500; }
.rep-stat { font-size: 12px; color: rgba(244,238,226,0.6); line-height: 1.4; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { list-style: none; padding: 0; margin: 0; max-width: 800px; }
.timeline li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--sp-5);
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.timeline li:last-child { border-bottom: none; }
.tl-time {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-deep);
  padding-top: 4px;
}
.tl-body h4 { font-family: var(--font-display); font-size: 19px; font-weight: 500; margin-bottom: var(--sp-2); }
.tl-body p { font-size: 14px; color: var(--ink-muted); margin: 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--ink);
  color: rgba(244,238,226,0.75);
  margin-top: var(--sp-9);
  padding: var(--sp-8) var(--sp-5);
}
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1.2fr;
  gap: var(--sp-7);
}
.footer h4 { color: var(--cream); font-family: var(--font-display); font-size: 18px; margin-bottom: var(--sp-4); }
.src-list { list-style: none; padding: 0; margin: 0; }
.src-list li { padding: 6px 0; font-size: 13px; }
.src-list a { color: var(--accent-soft); border-bottom-color: rgba(200,213,169,0.3); }
.src-list a:hover { color: var(--cream); border-bottom-color: var(--cream); }
.footer-meta p { font-size: 13px; line-height: 1.6; margin-bottom: var(--sp-3); }
.footer-tiny { font-size: 11px; opacity: 0.6; font-style: italic; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .risk-grid { grid-template-columns: 1fr; }
  .species-grid { grid-template-columns: 1fr; }
  .md-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .now-pill { margin-left: auto; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
  .stat-value { font-size: 30px; }
  .rash-callout { flex-direction: column; text-align: left; align-items: flex-start; }
  .timeline li { grid-template-columns: 1fr; gap: var(--sp-2); }
  .tl-time { padding-top: 0; }
  .section { padding-top: var(--sp-7); padding-bottom: var(--sp-6); }
}
@media (max-width: 560px) {
  .masthead-inner { padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); }
  .brand-text { display: none; }
  .hero { padding: var(--sp-6) var(--sp-4) var(--sp-5); }
  .hero-stats { grid-template-columns: 1fr; }
  .section-alt > * { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .section { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .chart-wrap { height: 220px; }
  .species-card { padding: var(--sp-5); }
  .species-head { flex-direction: column; align-items: flex-start; }
  .species-rank { max-width: 100%; align-self: flex-start; }
  .species-meta { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .now-pill { font-size: 11px; padding: 5px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
