/* Angler's Almanac — light theme, a touch of riverbank colour. */
:root {
  --bg: #f6f4ef;
  --surface: #fff;
  --ink: #1a2b2b;
  --ink-soft: #4a5a5a;
  --muted: #8a9595;
  --line: #d8d6d0;
  --accent: #2d6a4f;        /* moss green */
  --accent-2: #1b4965;      /* deep water */
  --warn: #b45309;
  --danger: #b91c1c;

  --day: #fff8d6;
  --twilight: #f3b07a;
  --night: #1f2a44;
  --moon: #cbd5e1;
  --sun: #f59e0b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; color: var(--ink); background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5; }

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

/* ─────────── Topbar ─────────── */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand a { font-weight: 700; font-size: 18px; color: var(--ink); }
.primary-nav { display: flex; gap: 18px; }
.primary-nav a { color: var(--ink-soft); padding: 6px 0; font-weight: 500; }
.primary-nav a:hover { color: var(--accent); text-decoration: none; }
.spot-selector select { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); background: white; }

/* ─────────── Flashes ─────────── */
.flashes { list-style: none; padding: 0 24px; margin: 12px 0; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error   { background: #fee2e2; color: #991b1b; }

/* ─────────── Layout ─────────── */
.container { padding: 20px 24px 40px; max-width: 1300px; margin: 0 auto; }
.footer { text-align: center; padding: 24px; color: var(--muted); }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 12px; color: var(--ink); }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 16px 0 8px; color: var(--ink-soft); }

/* ─────────── Buttons ─────────── */
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; font-size: 14px; }
.btn:hover { background: #fafafa; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: #225d44; color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-ghost { background: transparent; border: 0; color: var(--ink-soft); }

/* ─────────── Forms ─────────── */
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.form-row label { color: var(--ink-soft); font-weight: 500; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: white;
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-section { background: var(--surface); padding: 16px 20px; border-radius: 8px; border: 1px solid var(--line); }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

/* ─────────── Calendar / day strip ─────────── */
.calendar-controls {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
  padding: 12px 16px; background: var(--surface); border-radius: 8px; border: 1px solid var(--line);
}
.calendar-controls .anchor { font-weight: 600; }

.day-strip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 14px; overflow: hidden;
}
.day-strip.is-anchor { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,106,79,0.15); }
.day-strip.is-today  { border-color: var(--accent-2); }

.day-header {
  display: grid; grid-template-columns: 200px 1fr 320px; align-items: center;
  padding: 12px 16px; background: #fbfaf6;
}
.day-header .date {
  font-weight: 600;
}
.day-header .date .weekday { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.day-header .phase-block {
  display: flex; align-items: center; gap: 12px;
}
.phase-emoji { font-size: 24px; }
.phase-name { font-size: 13px; color: var(--ink-soft); }
.phase-illum { font-size: 12px; color: var(--muted); }
.strength-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.strength-pill.strong { background: #fde68a; color: #92400e; }
.strength-pill.peak   { background: #fca5a5; color: #7f1d1d; }
.strength-pill.weak   { background: #e0e7ff; color: #3730a3; }
.strength-pill.avg    { background: #e2e8f0; color: #334155; }

.day-header .weather { font-size: 13px; color: var(--ink-soft); text-align: right; }
.day-header .weather .temp-range { font-weight: 600; color: var(--ink); }
.day-header .weather .weather-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.day-header .weather .weather-icon {
  font-size: 22px; line-height: 1; display: inline-block;
}
.day-header .weather .wind-row {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 8px;
  margin-top: 4px;
}
.day-header .weather .wind-dir {
  font-weight: 700; color: var(--ink); background: #eef2f7;
  padding: 1px 7px; border-radius: 10px; font-size: 12px;
  min-width: 36px; text-align: center;
}
.day-header .weather .wind-mph { font-weight: 500; color: var(--ink); }

/* Wind strength bar — scale 0–120 mph */
.day-header .weather .wind-bar {
  position: relative; height: 6px; width: 220px; margin: 4px 0 0 auto;
  background: #eef2f7; border-radius: 3px; overflow: visible;
}
.day-header .weather .wind-bar-fill {
  height: 100%; border-radius: 3px; transition: width 0.3s;
}
.wind-bar-fill.b-green  { background: #16a34a; }
.wind-bar-fill.b-yellow { background: #eab308; }
.wind-bar-fill.b-orange { background: #ea580c; }
.wind-bar-fill.b-red    { background: #b91c1c; }

.day-header .weather .wind-bar-gust {
  position: absolute; top: -3px; width: 2px; height: 12px;
  background: #1a2b2b; transform: translateX(-1px);
  border-radius: 1px;
}

.day-canvas-wrap { padding: 8px 16px 12px; }
.day-canvas { width: 100%; height: 110px; display: block; }
.day-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); padding: 0 16px 12px; }
.day-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.swatch.sun { background: var(--sun); }
.swatch.moon { background: var(--moon); border: 1px solid var(--ink-soft); }
.swatch.capture { background: var(--accent); }

.captures-row { padding: 0 16px 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.capture-tag {
  display: inline-flex; gap: 6px; align-items: center;
  background: #f0f9ff; color: var(--accent-2); padding: 4px 10px; border-radius: 12px; font-size: 12px;
}

/* ─────────── Tables ─────────── */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
.data-table th { background: #fbfaf6; color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { font-weight: 500; }

/* ─────────── Cards ─────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.card .stat-value { font-size: 24px; font-weight: 700; color: var(--ink); }
.card .stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

/* ─────────── Pressure / 3-day trend ─────────── */
.pressure-row { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }

.trend-arrow {
  font-weight: 700; font-size: 14px;
}
.trend-arrow.trend-rising  { color: #16a34a; }  /* green */
.trend-arrow.trend-falling { color: var(--danger); }  /* red */
.trend-arrow.trend-steady  { color: var(--muted); }   /* grey */

.trend-badge {
  font-size: 11px; padding: 1px 5px; border-radius: 4px;
  background: #f0f4f0;
}
.trend-badge.trend-rising  { background: #dcfce7; color: #15803d; }
.trend-badge.trend-falling { background: #fee2e2; color: #b91c1c; }
.trend-badge.trend-steady  { background: #f1f5f9; color: var(--muted); }

/* ─────────── Tide row ─────────── */
.tide-row {
  color: var(--accent-2);   /* #1b4965 deep water */
  margin-top: 4px;
  text-align: right;
  letter-spacing: 0.01em;
}
.tide-row sup { font-size: 9px; vertical-align: super; }

/* ─────────── Misc ─────────── */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.warning-banner { padding: 10px 14px; background: #fef3c7; color: #92400e; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }

/* Photo */
.photo-thumb { max-width: 100%; height: auto; border-radius: 6px; }

/* ─────────── Phenology ─────────── */
.phen-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.phen-header h1 { margin: 0; flex: 1; }
.phen-header-actions { display: flex; gap: 8px; }

.phen-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 20px;
}
.phen-filters-label { font-weight: 600; color: var(--ink-soft); }
.phen-cat-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  background: white; font-size: 13px;
}
.phen-cat-toggle input { margin: 0; }
.phen-cat-glyph { font-size: 14px; }
.phen-filters-item { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.phen-filters-item select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.phen-filters-pill { padding: 4px 10px; background: var(--bg); border-radius: 999px; font-size: 13px; }

.phen-empty { padding: 40px; text-align: center; color: var(--muted); }

.phen-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 20px; margin-bottom: 16px; }
.phen-section h2 { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.phen-section-count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* Year strip */
.phen-strip { position: relative; }
.phen-strip-axis {
  position: relative; height: 18px; margin-left: 200px; border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.phen-strip-month-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.phen-strip-month-label { position: absolute; top: 0; font-size: 10px; color: var(--muted); transform: translateX(2px); }
.phen-strip-today {
  position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--warn);
  z-index: 2; box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.2);
}

.phen-strip-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 10px; padding: 3px 0; }
.phen-strip-name {
  font-size: 13px; color: var(--ink); text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}
.phen-strip-name:hover { color: var(--accent); }
.phen-strip-track { position: relative; height: 22px; background: rgba(0,0,0,0.02); border-radius: 4px; }

.phen-band {
  position: absolute; top: 2px; bottom: 2px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: white; padding: 0 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none;
  transition: filter 0.15s;
}
.phen-band:hover { filter: brightness(0.93); text-decoration: none; }
.phen-band--positive { background: var(--accent); }
.phen-band--negative { background: #b45309; }
.phen-band--upcoming { opacity: 0.75; }
.phen-band--past { opacity: 0.45; }
.phen-band--fading { background: linear-gradient(90deg, var(--accent) 0%, #a16207 100%); }
.phen-band-label { pointer-events: none; }

.phen-chain-dot { color: var(--accent-2); font-weight: 700; margin-left: 4px; }

.phen-legend {
  margin-top: 20px; font-size: 12px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.phen-legend-swatch { display: inline-block; width: 22px; height: 12px; border-radius: 3px; vertical-align: middle; }
.phen-legend-line { display: inline-block; width: 2px; height: 14px; background: var(--warn); vertical-align: middle; }

/* Event detail */
.phen-event-header { margin-bottom: 16px; }
.phen-breadcrumb { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.phen-scientific { margin: 0 0 6px; color: var(--ink-soft); }
.phen-tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.phen-tag--negative { background: #fef3c7; color: #92400e; }

.phen-callout {
  background: linear-gradient(180deg, #ecfdf5, #d1fae5);
  border: 1px solid #6ee7b7; border-radius: 8px;
  padding: 16px 20px; margin-bottom: 20px;
}
.phen-callout h2 { margin-top: 0; color: #064e3b; }
.phen-callout-list { margin: 0; padding-left: 18px; }
.phen-callout-list li { margin-bottom: 6px; }
.phen-callout-range { color: var(--ink-soft); font-size: 13px; }
.phen-callout-via { color: var(--muted); font-size: 12px; }
.phen-callout-note { color: var(--ink-soft); font-size: 12px; margin: 10px 0 0; font-style: italic; }

.phen-event-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.phen-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; }
.phen-card--span { grid-column: 1 / -1; }
.phen-card h2 { margin-top: 0; }
.phen-card h3 { margin-top: 14px; }

.phen-window-line { margin: 4px 0; }
.phen-window-line--calibrated { color: var(--accent); }
.phen-window-line--note { color: var(--ink-soft); font-style: italic; font-size: 13px; }

.phen-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin: 12px 0; }
.phen-meta dt { color: var(--ink-soft); }
.phen-meta dd { margin: 0; }

.phen-notes { color: var(--ink-soft); font-style: italic; }
.phen-muted { color: var(--muted); }

.phen-chain-list { margin: 4px 0; padding-left: 18px; }
.phen-chain-list li { margin-bottom: 4px; }
.phen-chain-lag { color: var(--ink-soft); font-size: 12px; }

.phen-obs-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.phen-obs-table th, .phen-obs-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.phen-obs-table th { color: var(--ink-soft); font-weight: 600; }
.phen-obs-table tbody tr:hover { background: rgba(45, 106, 79, 0.04); }

.form-grid-inline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid-inline label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.form-grid-inline input, .form-grid-inline select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 14px;
}
.form-grid-wide { grid-column: span 3; }

.phen-lede { color: var(--ink-soft); margin-bottom: 20px; max-width: 750px; }

/* ─────────── Geocode result cards (polish #1) ─────────── */
.geo-result-card {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 6px; background: var(--surface);
}
.geo-result-actions {
  margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap;
}

/* ─────────── Hotspots (3g) ─────────── */
.hotspot-swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.25); vertical-align: middle;
}
.mono, .plus-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.plus-code {
  padding: 2px 6px; background: var(--bg); border-radius: 4px;
  font-size: 13px; letter-spacing: 0.05em;
}

.wind-checks {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.wind-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 11px; cursor: pointer;
  font-family: ui-monospace, monospace; letter-spacing: 0.03em;
}
.wind-pill:has(input:checked) {
  background: var(--accent); color: white; border-color: var(--accent);
}
.wind-pill--avoided:has(input:checked) {
  background: #b91c1c; color: white; border-color: #b91c1c;
}
.wind-pill--inline {
  padding: 2px 8px; cursor: default; pointer-events: none;
  background: var(--accent); color: white; border-color: var(--accent);
}
.wind-pill--inline.wind-pill--avoided {
  background: #b91c1c; border-color: #b91c1c;
}
.wind-pill input { display: none; }

.phen-status-pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  margin-left: 6px;
}
.phen-status-pill--active   { background: #d1fae5; color: #065f46; }
.phen-status-pill--fading   { background: #fed7aa; color: #7c2d12; }
.phen-status-pill--upcoming { background: #dbeafe; color: #1e3a8a; }
.phen-status-pill--past     { background: #e5e7eb; color: #374151; }
.phen-status-pill--unknown  { background: #fee2e2; color: #991b1b; }

.hotspot-photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.hotspot-photo { width: 100%; height: 140px; object-fit: cover; border-radius: 6px; }

/* Hotspot map icon — built in JS via L.divIcon. Class handle for future tweaks. */
.hotspot-icon { /* no-op placeholder so the SVG container is selectable */ }

/* ─────────── Lunar overlay (3f) ─────────── */
.lunar-bearings { color: var(--accent-2) !important; font-weight: 500; }
.supermoon-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #78350f; font-size: 11px; font-weight: 600;
  border: 1px solid #fbbf24;
}
.lunar-rose-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

/* ─────────── Biodiversity register (3d) ─────────── */
.biodiv-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.biodiv-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; color: var(--ink);
}
.biodiv-tab:hover { background: #fafafa; text-decoration: none; color: var(--accent); }
.biodiv-tab-glyph { font-size: 16px; }
.biodiv-tab-count {
  display: inline-block; min-width: 22px; padding: 0 8px;
  background: var(--bg); border-radius: 999px;
  font-size: 11px; color: var(--ink-soft); text-align: center;
}

.biodiv-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px 20px; margin-bottom: 16px;
  scroll-margin-top: 80px;
}
.biodiv-section h2 { margin-top: 0; }

.biodiv-abundance {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.biodiv-abundance--rare       { background: #fee2e2; color: #991b1b; }
.biodiv-abundance--occasional { background: #fef3c7; color: #92400e; }
.biodiv-abundance--common     { background: #d1fae5; color: #065f46; }
.biodiv-abundance--abundant   { background: #dbeafe; color: #1e3a8a; }

.biodiv-phen-link { margin-left: 4px; }
.biodiv-edit-form, .biodiv-add-form {
  margin-top: 10px; padding: 10px; background: var(--bg); border-radius: 6px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.biodiv-edit-form input, .biodiv-edit-form select,
.biodiv-add-form input, .biodiv-add-form select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 13px;
}
.biodiv-add-details summary { list-style: none; cursor: pointer; }
.biodiv-add-details summary::-webkit-details-marker { display: none; }

/* Calendar inline indicator (also used on day strips) */
.phen-day-indicator {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; padding: 4px 10px; background: rgba(45, 106, 79, 0.06);
  border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0; margin-top: 4px;
}
.phen-day-indicator-leader { color: var(--accent); font-weight: 600; }
.phen-day-indicator a { color: var(--ink); }
.phen-day-indicator a:hover { color: var(--accent); }
.phen-day-indicator-item--fading { color: var(--ink-soft); }
.phen-day-indicator-item--negative { color: #92400e; }
