/* Wildlife Habitat and Corridors (src/conserve/habitat-twin.js). Cards, tables, pills, tabs, pagers and the pop-up are the shared
   .wqx-* classes in wq-twin.css; only what this page adds is here. Colour comes from tokens only. No new keyframes. */

.hab-scope { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--guide-color-border-strong); border-radius: 12px; background: var(--guide-color-bg-1); font-size: var(--guide-fs-sm); line-height: 1.5; max-width: 62em; }
.hab-scope svg, .hab-scope i { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--guide-color-lake); }
.hab-rule { margin: 10px 0 0; max-width: 62em; font-size: var(--guide-fs-sm); line-height: 1.5; color: var(--guide-color-ink-soft); }
.hab-source { margin: 8px 0 0; max-width: 62em; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-muted); }
.hab-sentences { margin: 14px 0 0; display: grid; gap: 10px; max-width: 62em; }
.hab-sentences p { margin: 0; font-size: var(--guide-fs-sm); line-height: 1.55; }
.hab-lede { margin: 0 0 12px; font-size: var(--guide-fs-sm); line-height: 1.55; color: var(--guide-color-ink-soft); max-width: 62em; }
.hab-h4 { margin: 18px 0 8px; font-size: var(--guide-fs-sm); font-weight: 600; color: var(--guide-color-ink-soft); }
.hab-linklist .wqx-link { text-align: left; }
.hab-linklist { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--guide-fs-sm); }
.hab-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hab .wqx-table tr.is-on td { background: var(--guide-color-bg-2); }
.hab .wqx-table .wqx-link { text-align: left; }
.hab-table td:first-child { white-space: nowrap; }
.hab-recordsearch { margin: 0 0 12px; max-width: 520px; }

/* four doors under the headline */
.hab-start { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.hab-startbtn { width: 100%; display: flex; align-items: flex-start; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--guide-color-border-strong); background: var(--guide-color-paper); color: var(--guide-color-ink); cursor: pointer; }
.hab-startbtn:hover, .hab-startbtn:focus-visible { background: var(--guide-color-bg-2); }
.hab-startbtn svg, .hab-startbtn i { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--guide-color-lake); }
.hab-startbtn b { display: block; font-size: var(--guide-fs-md); line-height: 1.3; font-weight: 600; }

/* controls */
.hab-pick { display: grid; gap: 4px; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-soft); }
.hab-pick select, .hab-pick input { min-height: 40px; max-width: 100%; padding: 0 10px; border-radius: 8px; border: 1px solid var(--guide-color-border-strong); background: var(--guide-color-paper); color: var(--guide-color-ink); font: inherit; }
.hab-pick input { min-width: 240px; }
.wqx-card-head .hab-pick { grid-auto-flow: column; align-items: center; gap: 8px; }
.hab-ctl { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 0 0 12px; align-items: flex-end; }

/* the map: blocks, not parcels. One hue for a layer; five groups for who holds the land; counties are outlines only. */
.hab-map { width: 100%; height: auto; display: block; max-height: 620px; }
.hap-co { fill: transparent; stroke: var(--guide-color-ink-muted); stroke-width: 0.9; cursor: pointer; vector-effect: non-scaling-stroke; }
.hap-co:hover { stroke: var(--guide-color-ink); stroke-width: 1.8; }
.hap-co.is-sel { stroke: var(--guide-color-ink); stroke-width: 2.4; }
.hap-co:focus-visible { outline: 2px solid var(--guide-color-signal); outline-offset: 1px; }
.hap-b { stroke: none; }
.hap-layer { fill: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); }
.hap-hatchline { stroke: var(--guide-color-ink-muted); stroke-width: 2.5; }
.hap-unmapped { fill-opacity: 1; }
.hap-g1 { fill: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); }
.hap-g2 { fill: color-mix(in srgb, var(--guide-color-lake) 62%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 62%, var(--guide-color-paper)); }
.hap-g3 { fill: color-mix(in srgb, var(--guide-color-clay) 70%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-clay) 70%, var(--guide-color-paper)); }
.hap-g4 { fill: color-mix(in srgb, var(--guide-color-ochre) 75%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-ochre) 75%, var(--guide-color-paper)); }
.hap-g5 { fill: var(--guide-color-bg-2); background: var(--guide-color-bg-2); }
.hap-pa1 { fill: color-mix(in srgb, var(--guide-color-lake) 22%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 22%, var(--guide-color-paper)); }
.hap-pa2 { fill: color-mix(in srgb, var(--guide-color-lake) 34%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 34%, var(--guide-color-paper)); }
.hap-pa3 { fill: color-mix(in srgb, var(--guide-color-lake) 46%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 46%, var(--guide-color-paper)); }
.hap-pa4 { fill: color-mix(in srgb, var(--guide-color-lake) 58%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 58%, var(--guide-color-paper)); }
.hap-pa5 { fill: color-mix(in srgb, var(--guide-color-lake) 70%, var(--guide-color-paper)); background: color-mix(in srgb, var(--guide-color-lake) 70%, var(--guide-color-paper)); }
.hap-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-soft); }
.hap-legend li { display: flex; align-items: center; gap: 8px; }
.hap-key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--guide-color-border-strong); flex: none; }
.hap-key--layer { background: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); }
.hap-key--hatch { background: var(--guide-color-paper); }
.hap-key--hatch .hap-hatchline { stroke-width: 1.6; fill: none; }
.hap-key--co { background: transparent; border-color: var(--guide-color-ink-muted); }

/* who holds it: one stacked bar, with every number in the rows under it */
.hap-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid var(--guide-color-border-strong); background: var(--guide-color-bg-1); margin: 4px 0 10px; }
.hap-seg { display: block; height: 100%; }
.hap-seg + .hap-seg { border-left: 1px solid var(--guide-color-paper); }
.hap-holders { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--guide-fs-sm); }
.hap-holders li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; }
.hap-holders small { color: var(--guide-color-ink-muted); min-width: 110px; text-align: right; }
.hap-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hap-hbars li { display: grid; grid-template-columns: minmax(120px, 34%) 1fr minmax(110px, auto); gap: 10px; align-items: center; font-size: var(--guide-fs-sm); }
.hap-hb-t { display: block; height: 10px; border-radius: 5px; background: var(--guide-color-bg-2); overflow: hidden; }
.hap-hb-f { display: block; height: 100%; border-radius: 5px; background: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); }

/* one record */
.hab-record { scroll-margin-top: 80px; }
.hab-verdict { margin: 10px 0 14px; font-size: var(--guide-fs-md); line-height: 1.5; }
.hab-dl { display: grid; gap: 0; margin: 0 0 14px; border-top: 1px solid var(--guide-color-border-subtle); }
.hab-dl > div { display: grid; grid-template-columns: minmax(150px, 30%) 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--guide-color-border-subtle); }
.hab-dl dt { font-size: var(--guide-fs-sm); color: var(--guide-color-ink-soft); }
.hab-dl dd { margin: 0; font-size: var(--guide-fs-sm); }
.hab-notes { margin: 12px 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--guide-fs-sm); line-height: 1.55; max-width: 62em; }

/* what you can do */
.hab-steps, .hab-caveats, .hab-sources { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: var(--guide-fs-sm); line-height: 1.55; max-width: 62em; }
.hab-caveats { margin-top: 4px; }
.hab-refs { display: inline; color: var(--guide-color-ink-muted); }
.hab-contact { margin: 18px 0 0; padding: 14px 16px; border: 1px solid var(--guide-color-border-strong); border-radius: 12px; background: var(--guide-color-bg-1); max-width: 62em; font-size: var(--guide-fs-sm); }
.hab-contact ul { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.hab-contact li { display: flex; gap: 8px; align-items: center; }
.hab-contact svg, .hab-contact i { width: 16px; height: 16px; flex: none; color: var(--guide-color-lake); }
.hab-contact small { display: block; color: var(--guide-color-ink-muted); line-height: 1.5; }
.hab .wqx-details { margin-top: 12px; font-size: var(--guide-fs-sm); }
.hab .wqx-details ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 640px) {
  .hab-table td:first-child { white-space: normal; }
  .hab-table, .hab-table tbody, .hab-table tr, .hab-table td { display: block; width: 100%; }
  .hab-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .hab-table tr { padding: 12px 0; border-bottom: 1px solid var(--guide-color-border-subtle); }
  .hab-table td { padding: 3px 0; border: 0; white-space: normal; }
  .hab-table td[data-label]::before { content: attr(data-label) ': '; color: var(--guide-color-ink-muted); font-size: var(--guide-fs-sm); }
  .hab-table td.hab-num { white-space: normal; }
  .hab-dl > div { grid-template-columns: 1fr; gap: 2px; }
  .hab-ctl { display: grid; grid-template-columns: 1fr; }
  .hab-pick select, .hab-pick input { width: 100%; min-width: 0; }
  .wqx-card-head .hab-pick { grid-auto-flow: row; }
  .hap-hbars li { grid-template-columns: 1fr; gap: 4px; }
  .hap-holders li { grid-template-columns: 14px 1fr auto; }
  .hap-holders small { grid-column: 2 / 4; text-align: left; }
}

@media print {
  .hab-start, .hab .wqx-pager, .hab .wqx-tabs, .hab-ctl, .hab-pick, .hab-finder { display: none !important; }
  .hab-steps li, .hab-contact li { break-inside: avoid; }
  .hab-map { max-height: 420px; }
}

/* wildlife on the road and bear conflicts: thin columns (HTML, so labels keep the 12 px floor on a phone), a note that sits above the chart */
.hab-note { margin: 10px 0 14px; padding: 10px 14px; border: 1px solid var(--guide-color-border-strong); border-radius: 12px; background: var(--guide-color-bg-1); max-width: 62em; font-size: var(--guide-fs-sm); line-height: 1.55; }
.hap-cols { list-style: none; margin: 8px 0 0; padding: 0; display: flex; align-items: flex-end; gap: 6px; height: 150px; border-bottom: 1px solid var(--guide-color-ink-muted); }
.hap-cols li { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.hap-col-bar { display: block; width: min(60%, 22px); min-height: 1px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--guide-color-moss) 72%, var(--guide-color-paper)); }
.hap-cols li:hover .hap-col-bar { background: color-mix(in srgb, var(--guide-color-moss) 90%, var(--guide-color-ink)); }
.hap-col-l { position: absolute; top: 100%; margin-top: 4px; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-muted); white-space: nowrap; }
.hap-cols + .hap-col-note { margin: 30px 0 4px; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-muted); }
.hab-cap { caption-side: top; text-align: left; font-size: var(--guide-fs-sm); color: var(--guide-color-ink-muted); padding: 4px 0; }
.hab-ntable td:first-child { white-space: nowrap; }
@media (max-width: 640px) {
  .hap-cols { gap: 3px; }
  .hap-cols[data-n="10"] li:nth-child(even) .hap-col-l { visibility: hidden; }
  .hap-cols[data-n="12"] li:not(:nth-child(3n + 1)) .hap-col-l { visibility: hidden; }
}
