/* Biodiversity Dashboard (BTX-484), lane L4: sections 01 Site snapshot, 02 Diversity indices,
   03 Species abundance curves, 07 Native against invasive. Additive to biodiversity_dashboard.css
   (the theme and every token live there); everything here is scoped under .bd and uses only
   tokens already defined in all four theme blocks. Sizes stay on the §1.1 rem scale. */

.bd .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}

/* ---------------- charts: hover hit area, chart hover card ---------------- */
.bd .hit{fill:transparent;cursor:crosshair;touch-action:pan-y;}
.bd svg .bar{shape-rendering:crispEdges;}
/* The card is display:none until shown, so a hidden card never takes part in layout. */
.bd .tooltip.bd-tt{display:none;opacity:1;white-space:normal;width:max-content;}
.bd .tooltip.bd-tt.show{display:block;}
.bd .tooltip .tt-year{font-weight:700;margin-bottom:.3rem;color:#fff;}
.bd .tooltip .tt-row{display:flex;align-items:center;gap:.4rem;}
.bd .tooltip .tt-sw{width:9px;height:2px;flex:none;}
.bd .tooltip .tt-val{margin-left:auto;font-weight:700;padding-left:.6rem;white-space:nowrap;}
.bd .tooltip .tt-species{margin:0 0 .35rem 1.3rem;}
.bd .tt-sp{display:flex;align-items:baseline;gap:.3rem;flex-wrap:wrap;line-height:1.35;}
.bd .tt-star{color:var(--ht-amber);font-size:0.68rem;}
.bd .tt-name{font-weight:600;}
.bd .tt-st{font-size:0.68rem;opacity:.9;}
.bd .tt-sci{font-style:italic;opacity:.72;font-size:0.68rem;}
.bd .tt-iucn{font-size:0.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;border-radius:3px;padding:.05rem .28rem;}
.bd .tt-tag{font-size:0.62rem;opacity:.72;text-transform:uppercase;letter-spacing:.05em;}

/* ---------------- 01 Site snapshot ---------------- */
.bd #sec-sites .sourcenote{margin-top:1rem;}

/* ---------------- 03 Abundance ---------------- */
.bd .abundlegend{margin-top:.6rem;gap:.4rem 1.2rem;font-size:0.76rem;}
.bd .abundsite .cardyears{margin:.2rem 0 .3rem;}
.bd .abundsite .sourcenote{margin-top:.6rem;}

/* ---------------- 07 Native against invasive ---------------- */
.bd .natgrid .natstats{grid-template-columns:repeat(2,minmax(0,1fr));}
.bd .natstat .s.down{color:var(--loss);font-weight:600;}
.bd .projbar{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;margin:0 0 1.1rem;}
.bd .projtoggle{display:inline-flex;align-items:center;gap:.5rem;background:none;border:none;padding:0;cursor:pointer;}
.bd .projtoggle .track{width:30px;height:17px;border-radius:999px;background:var(--rule-strong);position:relative;flex:none;transition:background .15s;}
.bd .projtoggle .knob{position:absolute;top:2px;left:2px;width:13px;height:13px;border-radius:50%;background:var(--surface);
  box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .15s;}
.bd .projtoggle .lbl{font-family:var(--label);font-weight:500;font-size:0.76rem;color:var(--ink-2);}
.bd .projtoggle.on .track{background:var(--teal);}
.bd .projtoggle.on .knob{transform:translateX(13px);}
.bd .projtoggle.on .lbl{color:var(--ink);}
.bd .projtoggle:focus-visible{outline:2px solid var(--amber);outline-offset:3px;border-radius:999px;}
.bd .projnote{font-size:0.76rem;font-weight:600;color:var(--ink-2);background:color-mix(in srgb, var(--ht-amber) 18%, var(--surface));
  border:1px solid color-mix(in srgb, var(--ht-amber) 55%, var(--rule));border-radius:999px;padding:.22rem .55rem;}

/* ---------------- 02 Diversity indices ---------------- */
.bd .divtable th{text-align:center;padding:.4rem .7rem .55rem;}
.bd .divtable th.sitehead,.bd .divtable th.txhead{text-align:left;}
.bd .divtable .siteheadin{display:flex;align-items:center;gap:.55rem;}
.bd .divtable tr td:first-child{border-radius:6px 0 0 6px;}
.bd .divtable tr td:last-child{border-radius:0 6px 6px 0;}
.bd .divtable .sn{font-weight:700;color:var(--ink);vertical-align:middle;}
.bd .divtable .sn::before{content:"";display:inline-block;width:.55rem;height:.55rem;border-radius:50%;background:var(--tc,transparent);
  margin-right:.45rem;vertical-align:.05em;}
.bd .divtable .snrow{display:none;}
.bd .divtable .tx{font-family:var(--label);font-size:0.68rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;}
.bd .divtable .tx.flora{color:var(--flora);}
.bd .divtable .tx.poll{color:var(--amber-ink);}
.bd .divtable .n{text-align:center;font-variant-numeric:tabular-nums;font-weight:700;color:var(--ink);border-radius:5px;}
.bd .divtable .n.gap{font-weight:400;color:var(--ink-3);}
.bd .taxicons{display:inline-flex;gap:.25rem;}
.bd .taxicon{width:24px;height:24px;padding:0;display:inline-flex;align-items:center;justify-content:center;border:none;
  border-radius:8px;background:var(--seg);cursor:pointer;color:var(--ink-3);}
.bd .taxicon svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round;}
.bd .taxicon:hover{color:var(--ink-2);}
.bd .taxicon.on{background:var(--teal);color:var(--on-teal);}
.bd .taxicon:focus-visible,.bd .sortbtn:focus-visible{outline:2px solid var(--amber);outline-offset:2px;}
.bd .sortbtn{font-family:var(--sans);font-size:0.68rem;font-weight:500;color:inherit;letter-spacing:0;text-transform:none;background:none;border:none;padding:0;cursor:pointer;
  display:inline-flex;align-items:center;gap:.3rem;white-space:nowrap;}
.bd .sortbtn .arw{font-size:0.82rem;color:var(--ink-3);line-height:1;}
.bd .sortbtn:hover .arw{color:var(--ink-2);}
.bd .sortbtn.on{color:var(--ink);}
.bd .sortbtn.on .arw{color:var(--teal-2);}
/* A phone: the site name moves to its own row above its taxa, so the table is four columns wide
   and fits without a horizontal scroll; column heads wrap. */
@media (max-width:640px){
  .bd .divtable .snrow{display:table-row;}
  .bd .divtable .snrow .sn{background:transparent;padding:.7rem .4rem .15rem;border-radius:0;}
  .bd .divtable .sncell,.bd .divtable th.txhead{display:none;}
  .bd .divtable th,.bd .divtable td{padding-left:.35rem;padding-right:.35rem;}
  .bd .divtable th{white-space:normal;vertical-align:bottom;}
  .bd .sortbtn{white-space:normal;text-align:center;}
  .bd .divtable .siteheadin span:first-child{display:none;}
}
