/*
  Island Lab tool theme, tokens. Rules: /design/DESIGN.md.
  Adopt with one tag, absolute path:
    <link rel="stylesheet" href="/design/tokens/islandlab.css">
  Colour values are the house tokens already inline in hub.html and the
  landing page (scripts/build_landing.py); the two agree, so this file
  carries them unchanged. The GDR drafting-sheet layer
  (design/islandlab-brand_v0_2.css, --ds-*) is a separate client layer.
  Line language: Sean's geo marks setting of 2026-10-08,
  tol=0.25 water=2 fill=none stroke=2.0 motion=off.
*/

:root {
  /* Grounds, darkest to lightest: page, band, panel, raised card. */
  --abyss: #06151A;
  --mid: #091F24;
  --deep: #0C2A30;
  --surface: #11363E;
  --panel: #04181C;

  /* Roles: signal is the one bold line, model is computed or secondary, life is living things. */
  --signal: #5EE6C8;
  --model: #8AA9C2;
  --life: #E6B567;

  /* Ink, strongest to quietest. */
  --text: #E8F0EE;
  --muted: #86A09F;
  --faint: #5C7676;
  --ink-strong: #FFFFFF;

  /* Rules and borders. */
  --line: rgba(133, 170, 168, 0.16);
  --line-strong: rgba(133, 170, 168, 0.30);

  /* Line language: one signal stroke, quieter secondary strokes in the model colour, no fill. */
  --stroke-signal: 2px;
  --stroke-secondary: 1.2px;
  --stroke-secondary-opacity: 0.7;
  --stroke-secondary-color: var(--model);
  --mark-fill: none;
  --mark-tol: 0.25;

  /* Type families, each ending in a fallback that ships with the OS. */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale in px; body 15 matches the landing page. */
  --fs-micro: 11px;
  --fs-small: 13px;
  --fs-body: 15px;
  --fs-lead: 18px;
  --fs-h3: 22px;
  --fs-h2: 30px;
  --fs-h1: 44px;
  --lh-body: 1.5;
  --lh-head: 1.12;
  --ls-kicker: 0.12em;
  --ls-label: 0.08em;

  /* Spacing on a 4 px step, and the page measure. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --maxw: 1120px;

  /* Radii: panel corners, small controls, pills. */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Cards: headline at least 18 px and at least 1.35x the support line (18 / 13 = 1.38). */
  --card-head-size: 18px;
  --card-head-family: var(--serif);
  --card-support-size: 13px;
  --card-support-color: var(--muted);
  --card-pad: var(--sp-4);
  --card-bg: var(--surface);
  --card-border: 1px solid var(--line);

  /* Chips: mono pill, provenance tints for the synthetic and pending states. */
  --chip-size: var(--fs-micro);
  --chip-ls: 0.04em;
  --chip-pad: 2px 8px;
  --chip-border: 1px solid var(--line-strong);
  --chip-color: var(--muted);
  --chip-synthetic: var(--life);
  --chip-local: var(--signal);
  --chip-derived: var(--model);

  /* Map basemap: OSM tiles tinted by a filter on .leaflet-tile-pane, night by default. */
  --tile-filter: invert(1) hue-rotate(190deg) saturate(0.35) brightness(0.72) contrast(0.9);

  /* Motion is opt-in: a page sets this to 1 to allow its marks to move. */
  --motion: 0;
}

/* Day theme; "light" is an alias because some pages use that name. */
:root[data-theme="day"],
:root[data-theme="light"] {
  --abyss: #E6EBEA;
  --mid: #DDE4E2;
  --deep: #D4DCDB;
  --surface: #F4F7F6;
  --panel: #E1E8E6;
  --signal: #0E9E83;
  --model: #436680;
  --life: #B07E1E;
  --text: #0E2227;
  --muted: #43615F;
  --faint: #7A918F;
  --ink-strong: #082027;
  --line: rgba(20, 60, 58, 0.14);
  --line-strong: rgba(20, 60, 58, 0.26);
  --tile-filter: saturate(0.4) brightness(1.02);
}

/* The one rule a map page needs from this file. */
.leaflet-tile-pane {
  filter: var(--tile-filter);
}

/* Card and chip shapes, opt-in by class. */
.il-card {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: var(--r-md);
  padding: var(--card-pad);
}
.il-card-head {
  font-family: var(--card-head-family);
  font-size: var(--card-head-size);
  font-weight: 500;
  line-height: var(--lh-head);
  color: var(--text);
  margin: 0;
}
.il-card-support {
  font-family: var(--sans);
  font-size: var(--card-support-size);
  line-height: var(--lh-body);
  color: var(--card-support-color);
  margin: var(--sp-1) 0 0;
}
.il-kicker {
  font-family: var(--mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--faint);
}
.il-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--chip-size);
  letter-spacing: var(--chip-ls);
  padding: var(--chip-pad);
  border: var(--chip-border);
  border-radius: var(--r-pill);
  color: var(--chip-color);
}
.il-chip.synthetic { color: var(--chip-synthetic); border-color: var(--chip-synthetic); }
.il-chip.local { color: var(--chip-local); border-color: var(--chip-local); }
.il-chip.derived { color: var(--chip-derived); border-color: var(--chip-derived); }

/* Marks: real geometry, signal line bold, secondary lines quiet, nothing filled. */
.il-mark { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.il-mark .sig { fill: none; stroke: var(--signal); stroke-width: var(--stroke-signal); }
.il-mark .sec {
  fill: none;
  stroke: var(--stroke-secondary-color);
  stroke-width: var(--stroke-secondary);
  opacity: var(--stroke-secondary-opacity);
}

/* Reduced motion always wins over a page's opt-in. */
@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0; }
  .il-mark * { animation: none !important; }
}
