/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { min-height: 100vh; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
input { font-family: inherit; color: inherit; background: none; border: none; }
input:focus { outline: none; }
details summary { cursor: pointer; }
details summary::-webkit-details-marker { display: none; }

/* ── Custom Properties — Apothecary's Bog: deep-forest-swamp + biotech alchemy ── */
:root {
  /* Drowned grove — almost-black water, deeper than peat */
  --bg:        #03080a;
  --bg-tint:   #03080a;
  --bg-card:   #08110d;          /* barely lifted, like wet bark in shadow */
  --bg-grid:   rgba(120, 220, 160, 0.018);

  --fg:        #d4e8d2;          /* dim moonlight on lichen */
  --fg-dim:    rgba(212, 232, 210, 0.45);
  --fg-mute:   rgba(212, 232, 210, 0.24);

  /* Witchlight — bioluminescent spore green, brighter to compensate for darker bg */
  --accent:        #7af0a8;
  --accent-soft:   rgba(122, 240, 168, 0.10);
  --accent-bright: #a8f8c5;
  --accent-deep:   #2fa168;
  --accent-glow:   rgba(122, 240, 168, 0.45);

  /* Goblin amber — alchemist's brew, deep ember in dark glass */
  --rune:        #e0aa50;
  --rune-soft:   rgba(224, 170, 80, 0.12);
  --rune-deep:   #8c6420;
  --rune-glow:   rgba(224, 170, 80, 0.4);

  /* Tier indicators */
  --tier-a:    #7af0a8;          /* spore-glow */
  --tier-b:    #e0aa50;           /* ember */
  --tier-c:    #92e0b3;           /* pale moss */

  /* Toadstool red */
  --warn:      #e8584a;
  --warn-soft: rgba(232, 88, 74, 0.1);

  --border:        rgba(160, 200, 170, 0.06);
  --border-strong: rgba(160, 200, 170, 0.14);
  --border-accent: rgba(122, 240, 168, 0.22);

  --font-display: 'Newsreader', 'Iowan Old Style', 'Source Serif Pro', Georgia, serif;
  --font-mono:    'Space Mono', 'JetBrains Mono', 'Courier New', monospace;
  --font-body:    'Space Mono', 'JetBrains Mono', monospace;
  --font-sans:    'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-prose:   'Newsreader', 'Iowan Old Style', 'Source Serif Pro', Georgia, serif;

  --nav-h:     58px;
  --pad-x:     clamp(1.25rem, 5vw, 4rem);
  --max-w:     1320px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;

  /* Drifting bioluminescent fog: large soft spore-glows + ember-pools, faint grid below */
  background-image:
    radial-gradient(ellipse 1400px 700px at 15% 5%,   rgba(122, 240, 168, 0.07), transparent 55%),
    radial-gradient(ellipse 900px 500px  at 88% 78%,  rgba(224, 170, 80,  0.05), transparent 55%),
    radial-gradient(ellipse 700px 400px  at 42% 55%,  rgba(47, 161, 104,  0.04), transparent 65%),
    radial-gradient(ellipse 500px 300px  at 70% 25%,  rgba(122, 240, 168, 0.025), transparent 70%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 96px 96px, 96px 96px;
  background-attachment: fixed, fixed, fixed, fixed, scroll, scroll;
  position: relative;
}

/* Faint fireflies — pinpoint glows that breathe and drift very slowly. Lightweight. */
body::before {
  content: '';
  position: fixed;
  inset: -10vh -10vw;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 1.5px at 14% 18%, rgba(122, 240, 168, 0.7), transparent 60%),
    radial-gradient(circle 1px   at 86% 28%, rgba(224, 170, 80,  0.55), transparent 60%),
    radial-gradient(circle 1.5px at 28% 72%, rgba(122, 240, 168, 0.55), transparent 60%),
    radial-gradient(circle 1px   at 72% 64%, rgba(122, 240, 168, 0.6),  transparent 60%),
    radial-gradient(circle 1px   at 54% 38%, rgba(224, 170, 80,  0.5),  transparent 60%),
    radial-gradient(circle 1.5px at 22% 52%, rgba(122, 240, 168, 0.55), transparent 60%),
    radial-gradient(circle 1px   at 62% 86%, rgba(122, 240, 168, 0.5),  transparent 60%),
    radial-gradient(circle 1px   at 92% 76%, rgba(224, 170, 80,  0.5),  transparent 60%),
    radial-gradient(circle 1px   at 8% 84%,  rgba(122, 240, 168, 0.55), transparent 60%),
    radial-gradient(circle 1px   at 48% 12%, rgba(122, 240, 168, 0.5),  transparent 60%);
  filter: blur(0.5px);
  animation: firefly-drift 90s linear infinite, firefly-breathe 6s ease-in-out infinite;
}
@keyframes firefly-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(3vw, -2vh, 0); }
}
@keyframes firefly-breathe {
  0%, 100% { opacity: 0.8; }
  50%      { opacity: 0.45; }
}

/* Soft vignette darkening edges — feel of being deep in a grove */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 100% at 50% 50%,
    transparent 30%,
    rgba(0, 0, 0, 0.35) 90%,
    rgba(0, 0, 0, 0.6) 100%);
}

/* ── Typography — engraved serif titles, typewriter mono body ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: 0;
  font-style: normal;
}
body {
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; transition: color 200ms ease; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

/* ── Scrollbar — lab-thin ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent-deep); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utilities ── */
.u-upper { text-transform: uppercase; }
.u-mono  { font-family: var(--font-mono); }
.u-dim   { color: var(--fg-dim); }
.u-accent { color: var(--accent); }
.u-warn  { color: var(--warn); }
.u-good  { color: var(--tier-c); }

/* Crosshair / corner brackets — used for "framed" elements */
.u-bracketed {
  position: relative;
}
.u-bracketed::before,
.u-bracketed::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border: 1px solid var(--accent);
}
.u-bracketed::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.u-bracketed::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ── Status dots ── */
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.5em;
}
.dot--cyan  { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot--green { background: var(--tier-c); box-shadow: 0 0 6px var(--tier-c); }
.dot--gray  { background: var(--fg-dim); }
.dot--red   { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

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

/* ── Print ── */
@media print {
  body { background: white; color: black; background-image: none; }
  .site-nav, .filter-bar, .nav-actions { display: none !important; }
  .card, .finding-block { break-inside: avoid; }
}
