/* public/biodiversity.css — Brief 08: the Biodiversity pillar.
   Scoped under #tab-biodiversity so nothing here can reach another tab.
   Ported from biodiversity-mapper-simple's habitat-panel.css, re-expressed on
   decodED's DS v0.1 tokens. No hardcoded hex/px/font — the ONE exception is
   habitat category colour, which is DATA from the taxonomy and is applied inline
   from JS, never from this file (brief §38). */

/* ---- Sub-tab shell (Brief 09): Intro · Categories · Mapper · Summary.
   Panels hide with CSS and never leave the DOM — a MapLibre instance that is
   conditionally rendered is destroyed, and the bug only shows on the SECOND visit.
   The header sits at tab level so it reads on every sub-tab; the Mapper panel keeps
   the 50/50 .pillar-shell it was built into under Brief 08. ---- */
/* Biodiversity theme accent = the decodED green. One token drives the title word,
   subtitles and the active pill — mirrors Climate's --cr-accent. */
#tab-biodiversity { --bio-accent: var(--brand); }

/* Header: the two-tone title, FLOATING over the panels and boxed to the triptych's left
   column — it claims no layout space, so the pages fill the viewport underneath it.
   Left edge matches Climate's --rail-offset exactly. */
#tab-biodiversity .bio-header {
  position: absolute;
  top: 0; left: 0;
  width: 30%;                        /* the triptych's left column, nothing wider */
  z-index: 4;
  pointer-events: none;
  margin: 0;
  padding: var(--sp-7) var(--sp-4) 0 var(--rail-offset);
}
#tab-biodiversity .bio-pillar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  opacity: 0; transform: translateX(-24px);   /* matches Climate's entrance */
}
#tab-biodiversity.bio-mounted .bio-pillar-title {
  animation: bioInLeft 0.5s cubic-bezier(.2,.7,.2,1) 0.1s forwards;
}
@keyframes bioInLeft { to { opacity: 1; transform: none; } }
@keyframes bioInUp { to { opacity: 1; transform: none; } }
@keyframes bioFadeIn { to { opacity: 1; } }

/* Entrance sequence, mirroring Climate: title → the four sections one under the next →
   the root pill and its habitats → the ghosted prompt on the right. */
#tab-biodiversity .bio-acc { opacity: 0; transform: translateY(10px); }
#tab-biodiversity.bio-mounted .bio-acc { animation: bioInUp 0.45s ease forwards; }
#tab-biodiversity.bio-mounted .bio-acc:nth-child(1) { animation-delay: 0.45s; }
#tab-biodiversity.bio-mounted .bio-acc:nth-child(2) { animation-delay: 0.56s; }
#tab-biodiversity.bio-mounted .bio-acc:nth-child(3) { animation-delay: 0.67s; }
#tab-biodiversity.bio-mounted .bio-acc:nth-child(4) { animation-delay: 0.78s; }
#tab-biodiversity .bio-tree__root { opacity: 0; }
#tab-biodiversity.bio-mounted .bio-tree__root { animation: bioFadeIn 0.5s ease 0.95s forwards; }
/* The connectors now DRAW themselves out from the root, one per branch, each just ahead of
   its habitat — so it reads as "line reaches out, habitat appears" rather than "all habitats,
   then all lines". pathLength=1 (set in JS) lets one dash length cover every curve. Scoped to
   .bio-links--reveal so it plays once on entrance, not on every select-time redraw.
   Line i starts at 1.05 + i·0.13s; habitat i lands 0.16s later (line mostly drawn). */
.bio-links { opacity: 1; }
.bio-links--reveal .bio-link {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: bioDraw 0.26s ease forwards;
  animation-delay: calc(1.05s + var(--li, 0) * 0.13s);
}
@keyframes bioDraw { to { stroke-dashoffset: 0; } }
#tab-biodiversity .bio-tree__branch { opacity: 0; }
#tab-biodiversity.bio-mounted .bio-tree__branch { animation: bioInUp 0.4s ease forwards; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(1) { animation-delay: 1.21s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(2) { animation-delay: 1.34s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(3) { animation-delay: 1.47s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(4) { animation-delay: 1.60s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(5) { animation-delay: 1.73s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(6) { animation-delay: 1.86s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(7) { animation-delay: 1.99s; }
#tab-biodiversity.bio-mounted .bio-tree__branch:nth-child(8) { animation-delay: 2.12s; }
/* The fade lives on the COLUMN, not the hint: the hint is re-created whenever you
   deselect a habitat, and it would then replay this delay and sit invisible for 1.9s. */
#tab-biodiversity .bio-tree__detail { opacity: 0; }
#tab-biodiversity.bio-mounted .bio-tree__detail { animation: bioFadeIn 0.6s ease 1.9s forwards; }
#tab-biodiversity .bio-t-decode { font-weight: 500; color: #1E1E1E; }               /* Stolzl Medium, near-black */
#tab-biodiversity .bio-t-sep { font-weight: 500; color: var(--ink-soft); }  /* ":" tight against both words */
#tab-biodiversity .bio-t-name { font-weight: var(--w-book); color: var(--bio-accent); }  /* Stolzl Book, pillar green */

/* Pill nav — floats over the page, centred. Nothing is offset from it; content is free
   to pass underneath. Soft tint of the pillar green; active segment is the solid accent. */
#tab-biodiversity .bio-subtabs {
  position: absolute;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 5px;
  background: color-mix(in srgb, var(--bio-accent) 9%, #FFFFFF);
  border: 1px solid color-mix(in srgb, var(--bio-accent) 20%, #FFFFFF);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
#tab-biodiversity .bio-subtab {
  appearance: none;
  background: none;
  border: 0;
  border-radius: 999px;
  margin: 0;
  padding: 8px 22px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;                       /* Stolzl Medium */
  line-height: 1.2;
  color: var(--ink-soft);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
#tab-biodiversity .bio-subtab:hover { color: var(--ink); }
#tab-biodiversity .bio-subtab.active {
  background: var(--bio-accent);
  color: #FFFFFF;
  box-shadow: 0 2px 9px rgba(0,0,0,0.18);
}

/* ============================================================
   Merged Intro + Categories page (Brief 13-consistency).
   Locked left/right split like Climate: left = collapsible explainer accordions
   that scroll internally; right = the school map with the 8 habitat categories as
   icons along the bottom, tap one to slide its explanation out over the map.
   ============================================================ */
/* The tab lets the Intro lock to the viewport; the floating title/pill self-pad.
   Fully white — no cream band behind the title (matches Climate's .cr-root). */
#tab-biodiversity { position: relative; padding: 0; background: #FFFFFF; }
#tab-biodiversity #bio-panel-intro.active { overflow: hidden; }

/* Triptych, matching Climate: text left · tree centred on the page · detail right.
   White lives HERE so the connector curves can be painted over it, under the nodes. */
.bio-explore {
  position: relative; display: grid; grid-template-columns: 30% 40% 30%;
  height: 100%; min-height: 0; background: #FFFFFF;
  zoom: var(--app-zoom);   /* big-screen scale-up — DISPLAY-SCALING RULES (wide triptych: fills width). Panel is height-locked + overflow:hidden, this is height:100% of it. */
}
.bio-explore__left { min-height: 0; display: flex; }
.bio-explore__mid {
  position: relative; z-index: 2; min-height: 0; display: flex; overflow: visible;
  padding: var(--sp-4) var(--sp-3);
}

/* the curve layer — spans the whole triptych so a branch can flow into the detail */
.bio-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.bio-link { fill: none; stroke: var(--line); stroke-width: 1; opacity: 0.5; }
.bio-link--on { stroke-width: 1.6; opacity: 0.9; }
.bio-explore__scroll {
  width: 100%; overflow-y: auto; scrollbar-gutter: stable; min-height: 0;
  /* Clears the floating title, AND lands the first section at exactly the same height as
     Climate's, so the two pillars' text sits on one line. Climate's is its .cr-left-inner
     padding-top (64) + the 48px title (~52 at 1.08) + .cr-title's --sp-6 margin = 164. */
  padding: 164px var(--sp-5) var(--sp-6) var(--rail-offset);
}

/* ---- collapsible accordions (flat, left-aligned — the shared left-column pattern) ---- */
#tab-biodiversity .bio-acc { border-bottom: 1px solid var(--line); }
#tab-biodiversity .bio-acc:first-child { border-top: 1px solid var(--line); }
#tab-biodiversity .bio-acc__head {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: var(--sp-4) 0; background: none; border: 0; cursor: pointer; text-align: left;
}
#tab-biodiversity .bio-acc__title {
  flex: 1 1 auto; font-family: var(--font-display); font-weight: var(--w-book);
  font-size: 22px; line-height: 28px; color: var(--bio-accent);   /* subtitle in the pillar green */
}
#tab-biodiversity .bio-acc__chevron { flex: 0 0 auto; display: flex; color: var(--ink-soft); transition: transform 0.22s ease; }
#tab-biodiversity .bio-acc__chevron .bio-picker__icon { width: 20px; height: 20px; }
#tab-biodiversity .bio-acc--open .bio-acc__chevron { transform: rotate(180deg); }
/* smooth open/close: 0fr → 1fr animates the real content height */
#tab-biodiversity .bio-acc__body {
  display: grid; grid-template-rows: 0fr; opacity: 0; max-width: 60ch;
  transition: grid-template-rows 0.45s cubic-bezier(.22,.61,.36,1), opacity 0.35s ease;
}
#tab-biodiversity .bio-acc--open .bio-acc__body { grid-template-rows: 1fr; opacity: 1; }
#tab-biodiversity .bio-acc__inner { overflow: hidden; }
/* same line's space before the divider as Climate — the two read identically */
#tab-biodiversity .bio-acc__inner > *:last-child { margin-bottom: var(--sp-5); }
/* Body copy is Inter 12 — the same ramp as Climate's left column, so the two pillars'
   text reads continuously at the same size/colour. */
#tab-biodiversity .bio-acc__body .bio-intro__para,
#tab-biodiversity .bio-acc__body .bio-intro__list,
#tab-biodiversity .bio-acc__body .bio-intro__steps {
  font-family: var(--font-detail); font-weight: var(--w-book);
  font-size: var(--size-small); line-height: var(--lh-small);
  color: var(--ink);
}

/* ---- right column: the habitat-category tree (a left→right nature hierarchy) ----
   Root "Biodiversity" on the left, a spine, then the 8 category branches. Click a branch
   to expand it in place: its what/why plus the types it includes pop in one at a time.
   Replaces the old map + full-width slide-over panel. */

/* Root → the 8 habitat branches, spread over the full height. Selecting one opens it OUT
   TO THE RIGHT into the triptych's third column, never downward. */
.bio-tree {
  display: flex; align-items: stretch; gap: 0; width: 100%; height: 100%; min-height: 0;
}

/* the root node — the curves to each habitat are drawn in the SVG layer */
.bio-tree__root { flex: 0 0 auto; position: relative; display: flex; align-items: center; }
.bio-tree__root-node {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: color-mix(in srgb, var(--bio-accent) 10%, #FFFFFF);
  border: 1px solid color-mix(in srgb, var(--bio-accent) 30%, #FFFFFF);
  border-radius: 999px; white-space: nowrap;
  font-family: var(--font-display); font-weight: var(--w-medium); font-size: 15px;
  color: var(--bio-accent);
}
.bio-tree__root-node .bio-picker__icon { width: 18px; height: 18px; }

/* habitats stretch over the full height, and sit in ~2/3 of the column so the root pill
   and the detail both get breathing space for the curves to flow through */
/* Sat hard right (margin-left:auto) before, which starved the long curves running on to
   the detail. Fixed gap after the root instead, so the slack falls on the RIGHT — the
   root and the detail column both stay exactly where they were. */
.bio-tree__branches {
  flex: 0 0 41%; min-width: 0; margin-left: calc(var(--sp-7) + 10px); margin-right: auto; position: relative;
  /* Packed together with a fixed gap and centred, rather than justified to fill the full
     height — the eight habitats were too stretched out (Chris). This leaves breathing room
     above and below. Nudged ~10px right of where they were, too. */
  display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 0;
  /* Top inset keeps the first habitat out from under the floating pill. */
  padding: 56px 0 16px;
}
.bio-tree__branch { position: relative; }

.bio-tree__node {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: var(--sp-2) var(--sp-3); background: none;
  border: 1px solid transparent; border-radius: var(--radius-card);
  cursor: pointer; text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.2s cubic-bezier(.2,.7,.2,1);
}
/* the live branch steps out toward its detail; the curve onward is drawn in the SVG layer */
.bio-tree__branch--open .bio-tree__node { transform: translateX(4px); }
.bio-tree__node:hover {
  background: color-mix(in srgb, var(--cat-colour) 7%, transparent);
  border-color: color-mix(in srgb, var(--cat-colour) 30%, transparent);
}
.bio-tree__node-icon {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--cat-colour) 12%, #FFFFFF);
  border: 1px solid color-mix(in srgb, var(--cat-colour) 32%, #FFFFFF);
}
.bio-tree__node-icon .bio-picker__icon { width: 18px; height: 18px; }
.bio-tree__node-label { flex: 1 1 auto; font-family: var(--font-display); font-weight: var(--w-book); font-size: 15px; color: var(--ink); }
/* chevron points RIGHT — the branch opens out to the side, not down */
.bio-tree__node-chevron { flex: 0 0 auto; display: flex; color: var(--text-tertiary); transform: rotate(-90deg); transition: color 0.2s ease; }
.bio-tree__node-chevron .bio-picker__icon { width: 16px; height: 16px; }
.bio-tree__branch--open .bio-tree__node { background: color-mix(in srgb, var(--cat-colour) 9%, transparent); border-color: color-mix(in srgb, var(--cat-colour) 34%, transparent); }
.bio-tree__branch--open .bio-tree__node-chevron { color: var(--cat-colour); }
.bio-tree__branch--open .bio-tree__node-label { color: var(--cat-colour); font-weight: var(--w-medium); }
/* When one branch is live, the rest recede. Dimmed via filter, NOT opacity: the entrance
   animation below owns opacity and its `forwards` fill would outrank this for good. */
.bio-tree--focused .bio-tree__branch:not(.bio-tree__branch--open) { filter: opacity(0.45); }
.bio-tree__branch { transition: filter 0.3s ease; }
.bio-tree__node-label { transition: color 0.2s ease; }

/* ---- the detail panel: the triptych's third column ----
   Top-aligned on purpose: the heading must land at the SAME height every time, so the
   curve from the live habitat always meets a fixed point. */
.bio-tree__detail {
  position: relative; z-index: 2;
  min-width: 0; display: flex; align-items: flex-start; overflow-y: auto; scrollbar-gutter: stable;
  /* left inset gives the curve from the live habitat room to flow in */
  padding: 132px var(--sp-5) var(--sp-4) var(--sp-6);
}
/* Ghosted prompt, centred in the column (matches Climate exactly): title-scale, with a
   ring that breathes to say "there's something to click". Ghosted via the colour's alpha,
   not opacity — the entrance animation owns opacity. */
/* dead centre of the column, both axes — matches Climate exactly */
.bio-tree__detail--empty { align-items: center; justify-content: center; padding: var(--sp-4); }
/* The prompt is now the SAME object in all three pillars — Chris wanted continuity, and the
   three had drifted: this was a 24px-radius rect with 44px type at 34% alpha, while Climate
   was a 190px circle with 17px type at 46%. Climate's is the one they now share (Carbon's
   .cb-hint-ring matches it too); only the accent token differs per pillar. */
.bio-hint-ring {
  position: relative; flex: none;
  width: 190px; height: 190px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  border: 1px solid color-mix(in srgb, var(--bio-accent) 22%, transparent);
}
.bio-tree__hint {
  margin: 0;
  font-family: var(--font-display); font-weight: 500;   /* Stolzl Medium */
  font-size: 17px; line-height: 1.35; text-align: center;
  color: color-mix(in srgb, var(--bio-accent) 46%, transparent);
}
.bio-hint-ring::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit;
  box-shadow: 0 0 0 0 var(--bio-accent); opacity: 0; pointer-events: none;
  animation: bioHintPulse 2.8s ease-out infinite;
  animation-delay: 2.2s;   /* after the entrance sequence has landed — same as the others */
}
@keyframes bioHintPulse {
  0%   { box-shadow: 0 0 0 0 var(--bio-accent); opacity: 0.5; }
  70%  { box-shadow: 0 0 0 16px var(--bio-accent); opacity: 0; }
  100% { box-shadow: 0 0 0 16px var(--bio-accent); opacity: 0; }
}
.bio-tree__card {
  width: 100%; opacity: 0; transform: translateX(-10px);
  animation: bioDetailIn 0.42s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes bioDetailIn { to { opacity: 1; transform: none; } }
.bio-tree__card-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.bio-tree__card-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: color-mix(in srgb, var(--cat-colour) 12%, #FFFFFF);
  border: 1px solid color-mix(in srgb, var(--cat-colour) 32%, #FFFFFF);
}
.bio-tree__card-icon .bio-picker__icon { width: 22px; height: 22px; }
.bio-tree__card-title { margin: 0; font-family: var(--font-display); font-weight: var(--w-book); font-size: 24px; line-height: 1.15; color: var(--cat-colour); }
/* one size, one colour, one family throughout the habitat detail — Inter 12 */
.bio-tree__what,
.bio-tree__why {
  margin: 0 0 var(--sp-3); font-family: var(--font-detail); font-weight: var(--w-book);
  font-size: var(--size-small); line-height: var(--lh-small); color: var(--ink);
}
.bio-tree__why { margin-bottom: var(--sp-4); }
/* reads as an invitation, not a taxonomy tag — so no uppercase/tracking */
.bio-tree__types-label {
  display: block; margin-bottom: var(--sp-2);
  font-family: var(--font-detail); font-size: var(--size-small); font-weight: var(--w-medium);
  color: var(--bio-accent);
}
.bio-tree__types { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: 0; list-style: none; }
.bio-tree__type {
  display: flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2); background: #FFFFFF;
  border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--font-detail); font-size: var(--size-small); color: var(--ink);
  /* the types pop off one at a time (the card is rebuilt per selection, so this replays) */
  opacity: 0;
  animation: bioChipIn 0.34s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(var(--i, 0) * 55ms + 120ms);
}
.bio-tree__type .bio-picker__icon { width: 14px; height: 14px; color: var(--cat-colour); }
@keyframes bioChipIn { from { opacity: 0; transform: translateX(-10px) scale(0.94); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  /* not enough width for the triptych — detail drops under the tree */
  .bio-explore { grid-template-columns: 34% 66%; }
  .bio-tree__detail { grid-column: 2; padding: 0 var(--sp-5) var(--sp-4) var(--sp-4); }
  .bio-tree__branch--open .bio-tree__node::after { display: none; }
}
@media (max-width: 900px) {
  #tab-biodiversity #bio-panel-intro.active { overflow: visible; height: auto !important; }
  .bio-explore { grid-template-columns: 1fr; height: auto; }
  .bio-explore__mid { height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  #tab-biodiversity .bio-pillar-title,
  #tab-biodiversity .bio-acc,
  #tab-biodiversity .bio-tree__root,
  #tab-biodiversity .bio-tree__branch,
  #tab-biodiversity .bio-tree__detail,
  .bio-links { opacity: 1 !important; transform: none !important; animation: none !important; }
  /* without this the connectors stay dashed-away (offset:1) and vanish under reduced motion */
  .bio-links--reveal .bio-link { stroke-dashoffset: 0 !important; animation: none !important; }
  .bio-hint-ring::after, .cr-hint-ring::after { animation: none; }
  #tab-biodiversity .bio-acc__body { transition: none; }
  .bio-tree__card, .bio-tree__type { animation: none; opacity: 1; transform: none; }
  .bio-tree__branch--open .bio-tree__node { transform: none; }
}

#tab-biodiversity .bio-panel { display: none; }
#tab-biodiversity .bio-panel.active { display: block; }
/* The Mapper's shell carries its own padding; the content panels get the rail offset. */
#tab-biodiversity .bio-panel__todo {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--section-gap) var(--rail-offset);
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  color: var(--ink-soft);
}

/* ---- Intro (Brief 09 Part D): four collapsible sections + the site figures.
   Laid out to the pillar template's visual language — the same max-width, rail offset
   and section rhythm as .pillar-shell, and the canvas's card treatment (surface, line,
   radius) on each accordion card. It is a single reading column rather than a forced
   50/50: the content is prose, and a half-width column of body copy is not what the
   template's two columns are for. ---- */
#tab-biodiversity .bio-intro {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--section-gap) var(--rail-offset);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
#tab-biodiversity .bio-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
#tab-biodiversity .bio-card__heading { margin: 0; }
#tab-biodiversity .bio-card__toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-4);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-card__icon { display: flex; color: var(--bio-accent); flex: none; }
#tab-biodiversity .bio-card__label { flex: 1; color: var(--bio-accent); }  /* subtitles in the pillar colour */
#tab-biodiversity .bio-card__chevron {
  width: 18px; height: 18px;
  flex: none;
  color: var(--ink-soft);
  transition: transform 0.15s ease;
}
#tab-biodiversity .bio-card__chevron--open { transform: rotate(180deg); }
#tab-biodiversity .bio-card--open { border-color: var(--brand); }
#tab-biodiversity .bio-card__content {
  padding: 0 var(--sp-4) var(--sp-4);
  max-width: 78ch;
}
#tab-biodiversity .bio-intro__para,
#tab-biodiversity .bio-intro__list,
#tab-biodiversity .bio-intro__steps {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-intro__list,
#tab-biodiversity .bio-intro__steps { padding-left: var(--sp-4); }
#tab-biodiversity .bio-intro__list li,
#tab-biodiversity .bio-intro__steps li { margin-bottom: var(--sp-2); }
#tab-biodiversity .bio-intro__lead { font-weight: var(--w-medium); color: var(--ink); }
#tab-biodiversity .bio-intro__note {
  margin: 0;
  padding: var(--sp-3);
  background: var(--warn-bg);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--warn-ink);
}

/* Site figures — the MV2 boundary + OSM land cover. */
#tab-biodiversity .bio-site {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  max-width: 78ch;
}
#tab-biodiversity .bio-site__heading,
#tab-biodiversity .bio-site__sub {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-site__sub { margin-top: var(--sp-4); }
#tab-biodiversity .bio-site__submit,
#tab-biodiversity .bio-site__to-mapper {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  cursor: pointer;
}
#tab-biodiversity .bio-site__submit {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: var(--surface);
  font-weight: var(--w-medium);
}
#tab-biodiversity .bio-site__submit[disabled] { opacity: 0.6; cursor: default; }
#tab-biodiversity .bio-site__to-mapper {
  display: inline-block;
  margin-top: var(--sp-4);
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-site__to-mapper:hover { border-color: var(--brand); color: var(--brand); }
#tab-biodiversity .bio-site__status {
  margin: var(--sp-3) 0 0;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-site__summary {
  margin: var(--sp-3) 0 0;
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  color: var(--ink);
}
#tab-biodiversity .bio-site__note,
#tab-biodiversity .bio-site__caption {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink-soft);
}

/* Land-cover bar. These four are DATA categories but carry no palette from the
   taxonomy, so they take DS tokens rather than invented hex. "Built" deliberately
   reuses --text-tertiary: that is exactly what the Mapper paints buildings with, so
   the Intro's bar and the map agree on what a building looks like. */
#tab-biodiversity .bio-cover-bar {
  display: flex;
  height: var(--sp-4);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--line);
}
#tab-biodiversity .bio-cover-bar__seg { min-width: 2px; }
#tab-biodiversity .bio-cover-bar__seg--built { background: var(--text-tertiary); }
#tab-biodiversity .bio-cover-bar__seg--green { background: var(--brand); }
#tab-biodiversity .bio-cover-bar__seg--water { background: var(--blue); }
#tab-biodiversity .bio-cover-bar__seg--unclassified { background: var(--line); }
#tab-biodiversity .bio-cover-legend {
  margin: var(--sp-3) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
#tab-biodiversity .bio-cover-legend__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
}
#tab-biodiversity .bio-cover-legend__swatch {
  width: 10px; height: 10px;
  flex: none;
  border-radius: 2px;
}
#tab-biodiversity .bio-cover-legend__label { flex: 1; }
#tab-biodiversity .bio-cover-legend__pct { font-weight: var(--w-medium); }
#tab-biodiversity .bio-cover-legend__area { color: var(--ink-soft); min-width: 7ch; text-align: right; }

/* ---- Categories (Brief 09 Part E): the eight habitat groups explained. Same
   template language as the Intro — pillar max-width, rail offset, card treatment.
   --cat-colour is set inline from the taxonomy: habitat category colour is DATA, and
   is the one value this file never owns. ---- */
#tab-biodiversity .bio-cats {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--section-gap) var(--rail-offset);
}
#tab-biodiversity .bio-cats__title {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-title);
  line-height: var(--lh-title);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
#tab-biodiversity .bio-cats__intro {
  margin: 0 0 var(--sp-5);
  max-width: 78ch;
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-lede);
  line-height: var(--lh-lede);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
}
#tab-biodiversity .bio-cat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--w-medium);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#tab-biodiversity .bio-cat-tile:hover { border-color: var(--cat-colour); }
#tab-biodiversity .bio-cat-tile--selected {
  border-color: var(--cat-colour);
  box-shadow: inset 0 0 0 1px var(--cat-colour);
}
#tab-biodiversity .bio-cat-tile__icon { display: flex; }
#tab-biodiversity .bio-cat-tile__icon .bio-picker__icon { width: 26px; height: 26px; }
#tab-biodiversity .bio-cats__prompt {
  margin: var(--sp-4) 0 0;
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-cat-detail {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  max-width: 78ch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-colour);
  border-radius: var(--radius-card);
}
#tab-biodiversity .bio-cat-detail__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
#tab-biodiversity .bio-cat-detail__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-cat-detail__what,
#tab-biodiversity .bio-cat-detail__why {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-cat-detail__what { color: var(--ink); }
#tab-biodiversity .bio-cat-detail__types-label {
  display: block;
  margin-bottom: var(--sp-2);
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
#tab-biodiversity .bio-cat-detail__type-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
  padding: 0;
  list-style: none;
}
#tab-biodiversity .bio-cat-detail__type {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  background: var(--bg-primary);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
}
#tab-biodiversity .bio-cat-detail__type .bio-picker__icon { width: 14px; height: 14px; }
#tab-biodiversity .bio-cat-detail__cta {
  padding: var(--sp-2) var(--sp-4);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  font-weight: var(--w-medium);
  color: var(--surface);
  cursor: pointer;
}

/* ---- Guidance (Brief 09): one line over the map saying what to do next. Never
   intercepts a click — it sits above the canvas but is pointer-transparent. ---- */
/* bottom-centre: the sub-tab pill owns the top-centre now */
#tab-biodiversity .bio-helper {
  position: absolute;
  bottom: var(--sp-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  max-width: min(90%, 460px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-4);
  text-align: center;
  pointer-events: none;
  background: var(--popover-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--popover-shadow);
  backdrop-filter: blur(8px);
}
#tab-biodiversity .bio-helper--active { border-color: var(--brand); }
#tab-biodiversity .bio-helper__title {
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
#tab-biodiversity .bio-helper__text {
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink);
}

/* ---- Habitats list: what's been drawn, with delete. Bottom-left, clear of the HUD
   (top-left) and MapLibre's scale control. ---- */
/* stacks under the donut inside the right dock */
#tab-biodiversity .bio-habitats-list {
  position: static;
  width: 100%;
  max-height: 34vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: var(--sp-2);
  background: var(--popover-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--popover-shadow);
  backdrop-filter: blur(8px);
}
#tab-biodiversity .bio-habitats-list__title {
  margin: 0 0 var(--sp-1);
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
#tab-biodiversity .bio-habitats-list__items { margin: 0; padding: 0; list-style: none; }
#tab-biodiversity .bio-habitats-list__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 2px 0;
}
#tab-biodiversity .bio-habitats-list__swatch {
  width: 10px; height: 10px;
  flex: none;
  border-radius: 2px;
}
#tab-biodiversity .bio-habitats-list__label {
  flex: 1;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-biodiversity .bio-habitats-list__delete {
  flex: none;
  padding: 0 var(--sp-1);
  background: none;
  border: 0;
  font-size: var(--size-detail);
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
#tab-biodiversity .bio-habitats-list__delete:hover { color: var(--coral); }

/* ============================================================
   Mapper: the map IS the page. It fills the panel edge to edge; the title, the
   sub-tab pill and the dock all float on top of it. The old 50/50 rail + drag
   handle are gone — a floating dock has no column to resize.
   ============================================================ */
#tab-biodiversity #bio-panel-mapper.active { position: relative; overflow: hidden; }
#tab-biodiversity #bio-panel-mapper .pillar-shell {
  position: relative; display: block;
  width: 100%; height: 100%; max-width: none;
  margin: 0; padding: 0; gap: 0; grid-template-columns: none;
}
#tab-biodiversity #bio-panel-mapper .pillar-canvas {
  position: absolute; inset: 0;
  padding: 0; margin: 0; border: 0; border-radius: 0; background: none;
}

/* The dock — deliberately NOT a panel: no card, no border, no scrim. Each habitat is its
   own chip floating on the map, so the left reads as a set of choices rather than a box
   sitting on top of the site. */
#tab-biodiversity #bio-panel-mapper .pillar-rail {
  position: absolute; z-index: 3;
  top: 136px;                        /* clears the floating title above it */
  left: var(--rail-offset);
  bottom: var(--sp-5);
  width: 292px;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: 0 var(--sp-2) 0 0;
  background: none; border: 0; box-shadow: none;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* "Add a habitat" — a green cue on the map, breathing to pull the eye left */
#tab-biodiversity #bio-panel-mapper .bio-picker { margin-top: 0; gap: var(--sp-2); }
#tab-biodiversity #bio-panel-mapper .bio-picker__heading {
  position: relative; align-self: flex-start;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bio-accent);
  border-radius: 999px;
  font-family: var(--font-display); font-size: var(--size-detail); font-weight: var(--w-medium);
  line-height: 1.3; color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}
#tab-biodiversity #bio-panel-mapper .bio-picker__heading::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 var(--bio-accent); opacity: 0; pointer-events: none;
  animation: bioHintPulse 2.6s ease-out infinite;
}
#tab-biodiversity #bio-panel-mapper .bio-picker__hint {
  padding: var(--sp-1) var(--sp-2);
  background: rgba(255,255,255,0.82); backdrop-filter: blur(6px);
  border-radius: var(--radius-card); align-self: flex-start;
}
/* the chips themselves carry the contrast, since the dock no longer does */
#tab-biodiversity #bio-panel-mapper .bio-picker__btn,
#tab-biodiversity #bio-panel-mapper .bio-picker__armed,
#tab-biodiversity #bio-panel-mapper .bio-picker__back-row {
  background: rgba(255,255,255,0.94); backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}
#tab-biodiversity #bio-panel-mapper .bio-picker__back-row {
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-card);
}

/* the title floats over the tiles here, so it needs a pill to stay legible */
#tab-biodiversity.bio-on-mapper .bio-header { width: auto; padding-top: var(--sp-5); }
#tab-biodiversity.bio-on-mapper .bio-pillar-title {
  display: inline-block;
  padding: var(--sp-2) var(--sp-5);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--popover-shadow);
  font-size: 32px;                    /* a pill this size doesn't need the full 48 */
}

/* ---- Surveys (Brief 09 Part C): the dated layer a teacher is mapping into. Sits at
   the top of the rail, above the picker — you choose the survey, then the habitat. ---- */
#tab-biodiversity .bio-surveys {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
#tab-biodiversity .bio-surveys__heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-surveys__select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink);
  cursor: pointer;
}
#tab-biodiversity .bio-surveys__new {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink-soft);
  cursor: pointer;
}
#tab-biodiversity .bio-surveys__new:hover { border-color: var(--brand); color: var(--brand); }

/* New-survey dialog — over the map, as the source puts it (storey-prompt-backdrop). */
#tab-biodiversity .bio-survey-dialog {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Scrim derived from a token, not a literal: this file forbids hardcoded colour, and
     the DS carries no scrim token (adding one is Chris's DS call, not this brief's). */
  background: color-mix(in srgb, var(--ink) 35%, transparent);
  backdrop-filter: blur(2px);
}
#tab-biodiversity .bio-survey-dialog__box {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 300px;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--popover-shadow);
}
#tab-biodiversity .bio-survey-dialog__heading {
  margin: 0 0 var(--sp-1);
  font-family: var(--font-display);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-survey-dialog__label {
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-survey-dialog__input {
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink);
}
#tab-biodiversity .bio-survey-dialog__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
#tab-biodiversity .bio-survey-dialog__btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink-soft);
  cursor: pointer;
}
#tab-biodiversity .bio-survey-dialog__btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--surface);
  font-weight: var(--w-medium);
}

/* The edit panel's survey select — matches its sibling controls. */
#tab-biodiversity .bio-edit__survey {
  padding: var(--sp-1) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
  cursor: pointer;
}

/* ---- Canvas: the Brief 07 shell centres its placeholder with flex and pads it by
   --card-pad. The map needs the whole box, so neutralise that for THIS tab only,
   via a class the module adds. The shell's 50/50 grid is untouched. ---- */
#tab-biodiversity .pillar-canvas.bio-canvas--map {
  display: block;
  padding: 0;
  position: relative;
  overflow: hidden;
}
#tab-biodiversity .bio-map { position: absolute; inset: 0; }
#tab-biodiversity .bio-map .maplibregl-ctrl-attrib {
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  line-height: var(--lh-micro);
}

/* ---- Live readout: floats on the map, top-left, clear of MapLibre's own controls
   (nav top-right, scale bottom-left). The headline figure uses the DS stat ramp. ---- */
/* Right dock: the readout and the habitats list STACK here. They were two absolutely
   positioned boxes before and overlapped as soon as either grew. */
#tab-biodiversity .bio-dock-right {
  position: absolute; z-index: 2;
  top: 136px; right: var(--sp-4); bottom: var(--sp-5);
  width: 340px;                    /* wider — the donut is now the hero, so its box grew too */
  display: flex; flex-direction: column; gap: var(--sp-3);
  overflow-y: auto;
  scrollbar-gutter: stable; pointer-events: none;
}
#tab-biodiversity .bio-dock-right > * { pointer-events: auto; flex: none; }

/* the donut: the whole site in one picture — mapped by habitat, built, and untouched */
#tab-biodiversity .bio-hud {
  position: static;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-4);
  background: var(--popover-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--popover-shadow);
  backdrop-filter: blur(8px);
}
/* the donut is the hero — full box width, and max-width:100% so it can never be clipped by
   the box however narrow the dock gets (that's what was cutting it off) */
#tab-biodiversity .bio-hud__chart { position: relative; display: flex; justify-content: center; width: 100%; }
#tab-biodiversity .bio-donut { display: block; width: 100%; max-width: 248px; height: auto; }
#tab-biodiversity .bio-hud__centre {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
#tab-biodiversity .bio-hud__stat {
  font-family: var(--font-display); font-weight: var(--w-book);
  font-size: 40px; line-height: 1.05; letter-spacing: -0.02em;   /* scaled up with the donut */
  color: var(--bio-accent);
}
#tab-biodiversity .bio-hud__label {
  font-family: var(--font-detail); font-weight: var(--w-medium);
  font-size: var(--size-micro); line-height: var(--lh-micro);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
}
#tab-biodiversity .bio-hud__legend {
  list-style: none; margin: 0; padding: 0; width: 100%;
  display: flex; flex-direction: column; gap: var(--sp-1);
}
#tab-biodiversity .bio-hud__row {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-detail); font-size: var(--size-small);
  line-height: var(--lh-small); color: var(--ink);
}
#tab-biodiversity .bio-hud__row--muted { color: var(--text-tertiary); }
#tab-biodiversity .bio-hud__swatch { width: 10px; height: 10px; flex: none; border-radius: 3px; }
#tab-biodiversity .bio-hud__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tab-biodiversity .bio-hud__pct { font-weight: var(--w-medium); }
#tab-biodiversity .bio-hud__meta {
  width: 100%; margin: 0; padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
  font-family: var(--font-detail); font-size: var(--size-micro);
  line-height: var(--lh-small); color: var(--ink-soft);
}

/* ---- Picker: lives in the rail, under the lede (rail = controls + text,
   canvas = the interactive map — the shell's own division of labour). ---- */
.bio-picker {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.bio-picker__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-h2);
  line-height: var(--lh-h2);
  color: var(--ink-soft);
}

.bio-picker__hint {
  margin: 0;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--text-secondary);
}

.bio-picker__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Category + type rows share a shape; only the icon colour source differs. */
.bio-picker__btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.bio-picker__btn:hover { border-color: var(--brand); background: var(--card-hover); }
.bio-picker__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.bio-picker__btn--armed {
  border-color: var(--brand);
  background: var(--accent-bg);
  font-weight: var(--w-medium);
}

.bio-picker__icon { flex-shrink: 0; width: var(--sp-4); height: var(--sp-4); }
.bio-picker__label { flex: 1; }

/* Draw kind (area / line / point) — a quiet meta chip on each type row. */
.bio-picker__kind {
  flex-shrink: 0;
  font-family: var(--font-detail);
  font-weight: var(--w-medium);
  font-size: var(--size-micro);
  line-height: var(--lh-micro);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--badge-bg);
  border-radius: var(--radius-card);
  padding: var(--sp-1) var(--sp-2);
}

/* Back row when drilled into a category. */
.bio-picker__back-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.bio-picker__back {
  margin-right: auto;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease;
}
.bio-picker__back:hover { color: var(--brand); }
.bio-picker__back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.bio-picker__cat-label {
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  color: var(--ink);
}

/* Armed banner — what you're about to draw, and how to stop. */
.bio-picker__armed {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--accent-bg);
  border: 1px solid var(--brand);
  border-radius: var(--radius-card);
}
.bio-picker__armed-text {
  flex: 1;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink);
}
.bio-picker__disarm {
  flex-shrink: 0;
  padding: var(--sp-1) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  color: var(--ink-soft);
  cursor: pointer;
}
.bio-picker__disarm:hover { border-color: var(--brand); color: var(--brand); }

/* ---- Summary (source HomePage.jsx). Brief 09 Part F re-homed this from the Mapper's
   rail into its own sub-tab, so it is now a full-width dashboard on the pillar
   template's geometry rather than a narrow rail section. ---- */
.bio-summary {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--section-gap) var(--rail-offset);
  zoom: var(--app-zoom);   /* big-screen scale-up — DISPLAY-SCALING RULES (card/text page: already width-capped + centred) */
}
.bio-summary__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.bio-summary__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-title);
  line-height: var(--lh-title);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
#tab-biodiversity .bio-summary__asof { display: flex; align-items: center; gap: var(--sp-2); }
#tab-biodiversity .bio-summary__asof-label {
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-summary__asof-select {
  padding: var(--sp-1) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink);
  cursor: pointer;
}
.bio-summary__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-h2);
  line-height: var(--lh-h2);
  color: var(--ink-soft);
}
.bio-summary__sub {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-detail);
  font-weight: var(--w-medium);
  font-size: var(--size-micro);
  line-height: var(--lh-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
/* Composition and area sit side by side once there's room (the source's two-column
   dashboard body); they stack on narrow viewports. */
#tab-biodiversity .bio-summary__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4);
}
#tab-biodiversity .bio-summary__section {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
#tab-biodiversity .bio-summary__no-data {
  margin: 0;
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  color: var(--ink-soft);
}

/* Empty state — the source's, restored (Brief 08 never ported it). */
#tab-biodiversity .bio-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
}
#tab-biodiversity .bio-empty__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-title);
  line-height: var(--lh-title);
  color: var(--text-primary);
}
#tab-biodiversity .bio-empty__subtext {
  margin: 0;
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-lede);
  line-height: var(--lh-lede);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-empty__btn {
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-detail);
  font-weight: var(--w-medium);
  color: var(--surface);
  cursor: pointer;
}

/* Climate risks — a DEMONSTRATION placeholder. The badge is locked on in JS
   (isPlaceholder); this styling must keep it unmissable, never decorative. */
#tab-biodiversity .bio-climate {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
#tab-biodiversity .bio-climate__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
#tab-biodiversity .bio-climate__header .bio-summary__sub { margin-bottom: 0; }
#tab-biodiversity .bio-climate__badge {
  padding: 2px var(--sp-2);
  background: var(--warn-bg);
  border: 1px solid var(--warn-ink);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn-ink);
}
#tab-biodiversity .bio-climate__note {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-3);
  background: var(--warn-bg);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--warn-ink);
}
#tab-biodiversity .bio-climate__intro {
  margin: var(--sp-3) 0 var(--sp-4);
  max-width: 78ch;
  font-family: var(--font-light);
  font-weight: var(--w-light);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-climate-cards,
#tab-biodiversity .bio-action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
}
#tab-biodiversity .bio-climate-card,
#tab-biodiversity .bio-action-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--bg-primary);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
#tab-biodiversity .bio-climate-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
#tab-biodiversity .bio-climate-card__title,
#tab-biodiversity .bio-action-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  font-weight: var(--w-medium);
  color: var(--ink);
}
#tab-biodiversity .bio-climate-card__level {
  padding: 1px var(--sp-2);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--badge-bg);
  color: var(--ink-soft);
}
#tab-biodiversity .bio-climate-card__level--high { background: var(--warn-bg); color: var(--coral); }
#tab-biodiversity .bio-climate-card__level--moderate { background: var(--warn-bg); color: var(--warn-ink); }
#tab-biodiversity .bio-climate-card__level--low { background: var(--badge-bg); color: var(--brand); }
#tab-biodiversity .bio-climate-card__summary,
#tab-biodiversity .bio-action-card__desc {
  margin: 0;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--text-secondary);
}
#tab-biodiversity .bio-climate-card__measures-label {
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  font-weight: var(--w-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
#tab-biodiversity .bio-climate-card__measures { margin: 0; padding: 0; list-style: none; }
#tab-biodiversity .bio-climate-card__measure {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 2px 0;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
}
#tab-biodiversity .bio-climate-card__measure .bio-picker__icon { width: 14px; height: 14px; flex: none; }

/* Costed actions — the source's five cards. */
#tab-biodiversity .bio-actions {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
#tab-biodiversity .bio-action-card .bio-picker__icon { width: 24px; height: 24px; color: var(--brand); }
#tab-biodiversity .bio-action-card__cost {
  margin-top: auto;
  font-family: var(--font-detail);
  font-size: var(--size-small);
  font-weight: var(--w-medium);
  color: var(--brand);
}

.bio-stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-2); }
.bio-stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.bio-stat-card__value {
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-h2);
  line-height: var(--lh-h2);
  color: var(--ink);
}
.bio-stat-card__label {
  font-family: var(--font-detail);
  font-size: var(--size-micro);
  line-height: var(--lh-micro);
  color: var(--text-secondary);
}

/* Segment widths are flex ratios — the source's approach. Colours are taxonomy DATA,
   applied inline from JS, never from this file. */
.bio-comp-bar {
  display: flex;
  height: var(--sp-4);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--badge-bg);
}
.bio-comp-bar__seg { min-width: 2px; }
.bio-comp-bar__seg--building { background: var(--text-tertiary); }

.bio-comp-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.bio-comp-legend__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink);
}
.bio-comp-legend__item .bio-picker__icon { width: var(--sp-3); height: var(--sp-3); }
.bio-comp-legend__swatch {
  width: var(--sp-3); height: var(--sp-3); flex-shrink: 0;
  border-radius: var(--sp-1);
  background: var(--text-tertiary);
}
.bio-comp-legend__label { flex: 1; }
.bio-comp-legend__pct { font-weight: var(--w-medium); color: var(--ink-soft); }
.bio-comp-legend__area { color: var(--text-secondary); min-width: 7ch; text-align: right; }

.bio-area-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.bio-area-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink);
}
.bio-area-bar__label { display: flex; align-items: center; gap: var(--sp-2); width: 14ch; flex-shrink: 0; color: var(--ink-soft); }
.bio-area-bar__label .bio-picker__icon { width: var(--sp-3); height: var(--sp-3); }
.bio-area-bar__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bio-area-bar__track { flex: 1; height: var(--sp-2); background: var(--badge-bg); border-radius: var(--sp-1); overflow: hidden; }
.bio-area-bar__fill { display: block; height: 100%; border-radius: var(--sp-1); }
.bio-area-bar__value { min-width: 8ch; text-align: right; color: var(--text-secondary); }

/* ---- Feature edit panel: floats bottom-right on the canvas ---- */
#tab-biodiversity .bio-edit {
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-6);
  z-index: 3;
  width: 260px;
  max-height: 60%;
  overflow-y: auto;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--popover-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--popover-shadow);
  backdrop-filter: blur(8px);
}
.bio-edit__row { display: flex; align-items: center; gap: var(--sp-2); }
.bio-edit__swatch { width: var(--sp-3); height: var(--sp-3); border-radius: var(--sp-1); flex-shrink: 0; }
.bio-edit__type {
  flex: 1;
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--size-detail);
  line-height: var(--lh-detail);
  color: var(--ink);
}
.bio-edit__label {
  font-family: var(--font-detail);
  font-weight: var(--w-medium);
  font-size: var(--size-micro);
  line-height: var(--lh-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.bio-edit__note {
  width: 100%;
  box-sizing: border-box;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  line-height: var(--lh-small);
  color: var(--ink);
  resize: vertical;
}
.bio-edit__note:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.bio-edit__actions { display: flex; gap: var(--sp-2); justify-content: space-between; }
.bio-edit__btn {
  padding: var(--sp-1) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink-soft);
  cursor: pointer;
}
.bio-edit__btn:hover { border-color: var(--brand); color: var(--brand); }
.bio-edit__btn--danger:hover { border-color: var(--coral); color: var(--coral); }
.bio-edit__picker {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  max-height: 180px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: var(--sp-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.bio-edit__type-opt {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  background: none;
  border: none;
  border-radius: var(--radius-card);
  font-family: var(--font-detail);
  font-size: var(--size-small);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.bio-edit__type-opt:hover { background: var(--card-hover); }
.bio-edit__type-opt .bio-picker__icon { width: var(--sp-3); height: var(--sp-3); }
