/* Dinos.info - Discovery Map (approved design, backlog B13).
   Page and block styles from the approved Claude Design board (design/discovery-map/source/dm.css,
   version 1791675092-9e0d), adapted only where Leaflet's DOM differs from the board's static map.
   The FilterBar, options, swatches, tabs and data marks come from the design system's bundle.css
   (dn- classes). The dm- classes here move to the design system later. */

.dn-dmap { color: var(--text-on-dark); font-family: var(--font-body); }
.dn-dmap, .dn-dmap * { box-sizing: border-box; }
.dn-dmap [hidden] { display: none !important; }

/* Under the page's header band ([dn_discovery_map], includes/modules.php): the map on the site width */
.dm-page-body { padding-block: var(--space-5) var(--space-8); }

/* Page head (the module's own, when a page asks for it) */
.dm-head { padding: var(--space-6) 0 var(--space-5); display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4) var(--space-6); flex-wrap: wrap; }
.dm-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 60px; line-height: 58px; text-transform: uppercase; letter-spacing: .01em; color: var(--text-on-dark); }
.dm-intro { margin: 8px 0 0; max-width: 620px; font-size: 16px; line-height: 26px; color: var(--text-muted-on-dark); }
.dm-stats { display: flex; gap: var(--space-5); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.dm-stats li { display: flex; flex-direction: column; }
.dm-stats b { font-family: var(--font-display); font-weight: 900; font-size: 32px; line-height: 34px; color: var(--accent-on-dark); }
.dm-stats span { font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }

/* FilterBar: padding as on the board; the long country list scrolls */
.dm-filterbar { position: relative; z-index: 20; padding: var(--space-4); }
.dn-dmap .dn-listbox ul { max-height: 320px; overflow-y: auto; }
.dn-dmap .dm-opt-none { cursor: default; color: var(--text-muted-on-dark); }
.dn-dmap .dn-dropdown .mk-slot { display: contents; }

/* Results bar */
.dm-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin: var(--space-4) 0 var(--space-3); }
.dm-bar-left { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.dm-bar .dn-tabs { display: inline-flex; }
.dm-count { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-muted-on-dark); }
.dm-count b { color: var(--text-on-dark); font-family: var(--font-heading); }
.dm-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dm-fchip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 10px; background: var(--surface-dark-raised); border: 1px solid var(--bone-white); border-radius: var(--radius-sm); font-size: 13px; line-height: 18px; color: var(--text-on-dark); }
.dm-fchip b { font-family: var(--font-heading); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted-on-dark); }
.dm-x { flex: none; width: 28px; height: 28px; margin-right: -4px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--text-on-dark); cursor: pointer; }
.dm-x svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* Map stage: map plus side panel */
.dm-stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-4); align-items: start; }
/* The map is its own stacking context: Leaflet's panes and controls (z-index 400 to 1000) stay inside
   it, so the filter dropdowns (dn-listbox, z-index 30) open above the map, not under its markers. */
.dm-map { isolation: isolate; position: relative; height: 620px; border: 1px solid var(--line-dark); border-radius: var(--radius-lg); overflow: hidden; background: #0e0f10; }
.dm-fit { position: absolute; z-index: 850; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; background: #121417f2; border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); font-family: var(--font-heading); font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-on-dark); pointer-events: none; }
.dm-fit svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.dm-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-top: var(--space-3); padding: 10px 14px; background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-md); }
.dm-legend > span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 20px; }
.dm-legend .ttl { font-family: var(--font-heading); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }
.dm-cl-sample { position: relative; flex: none; width: 44px; height: 30px; display: inline-flex !important; align-items: center; justify-content: center; }
.dm-source { margin: var(--space-3) 0 0; font-size: 13px; line-height: 20px; }

/* Markers: shared/dn-fossil-map.css (row 19 group silhouettes, labels, 44 px hit area, selected state).
   Clusters (Ben's evening review 2026-10-13, item 9b, replacing the board's numbered circle so the dinosaurs show at
   world zoom): the silhouette of the cluster's commonest group, filled, with the number of fossils on a pill at its
   shoulder (Montserrat Bold 11 px, slate on Bone White, about 15:1). The opening globe draws the same. */
.dm-cl-icon { background: none; border: 0; }
.dm-cl { flex: none; position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--text-on-dark); font-family: var(--font-heading); font-weight: 700; font-size: 12px; }
.dm-cl-sil .dn-fm-mk { width: 34px; height: 22px; margin-top: 8px; }
.dm-cl-n { position: absolute; left: 50%; top: 1px; min-width: 20px; height: 18px; padding: 0 5px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; background: var(--bone-white); color: var(--prehistoric-slate); border: 1px solid var(--prehistoric-slate); border-radius: 9px; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 1; white-space: nowrap; box-shadow: 0 0 0 2px #12141766; }
.dm-cl-sample .dm-cl { width: 44px; height: 30px; }
.dm-cl-sample .dn-fm-mk { margin-top: 10px; width: 28px; height: 18px; }
.dm-cl-sample .dm-cl-n { top: -2px; height: 16px; min-width: 16px; font-size: 10px; }
.dm-cl-icon:hover .dn-fm-mk { transform: scale(1.12); }
.dm-cl-icon:focus-visible { outline: 2px solid transparent; }
.dm-cl-icon:focus-visible .dm-cl { box-shadow: var(--focus-ring-dark); }

/* Leaflet chrome on the dark ground (contrast figures in DECISIONS, 2026-10-10) */
.dn-dmap .leaflet-container { font-family: var(--font-body); background-color: #0e0f10; }
.dn-dmap .leaflet-bar { border: 1px solid var(--border-control-dark); box-shadow: var(--shadow-float); }
.dn-dmap .leaflet-bar a { background-color: var(--surface-dark-raised); color: var(--text-on-dark); border-bottom-color: var(--border-control-dark); }
.dn-dmap .leaflet-bar a:hover { background-color: var(--prehistoric-slate); color: var(--accent-on-dark); }
.dn-dmap .leaflet-bar a.leaflet-disabled { background-color: var(--surface-dark-raised); color: var(--text-muted-on-dark); }
.dn-dmap .leaflet-bar a:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }
/* Attribution: required by CARTO and OSM to stay visible; it sits above our popup card (z-index 1000 > 900). */
.dn-dmap .leaflet-control-attribution { background-color: var(--surface-dark-raised); color: var(--text-on-dark); border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm) 0 0 0; padding: 2px var(--space-2); font-size: 12px; line-height: 16px; }
.dn-dmap .leaflet-control-attribution a { color: var(--accent-on-dark); text-decoration: underline; text-underline-offset: 2px; }
.dn-dmap .leaflet-control-attribution a:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }
.dn-dmap .leaflet-bottom.leaflet-right { z-index: 1000; }

/* Side panel */
.dm-side { background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); max-height: 680px; overflow: auto; }
.dm-side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dm-side-head.dm-side-head h2 { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: 16px; line-height: 22px; letter-spacing: .04em; text-transform: uppercase; }
.dm-side-head small { font-size: 12px; color: var(--text-muted-on-dark); }
.dm-res { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dm-res-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line-dark); border-radius: var(--radius-sm); background: none; color: var(--text-on-dark); font: inherit; text-align: left; cursor: pointer; }
.dm-res-row:hover { background: #1a1c1f; }
.dm-res-row.on { background: var(--surface-dark); box-shadow: inset 0 0 0 1px var(--action); border-bottom-color: transparent; }
.dm-res-row:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }
.dm-thumb { flex: none; width: 56px; height: 36px; display: flex; align-items: flex-end; justify-content: center; background: var(--surface-dark); border-radius: var(--radius-sm); padding: 3px 4px; }
.dm-thumb svg { width: 100%; height: 100%; }
.dm-res .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-res .tx i { font-family: var(--font-name, "Barlow Semi Condensed", "Barlow Condensed", "Arial Narrow", sans-serif); font-weight: 700; font-size: 17px; line-height: 20px; overflow-wrap: break-word; }
.dm-res .tx small { font-size: 12px; line-height: 17px; color: var(--text-muted-on-dark); }
.dm-res .mk { flex: none; }
.dm-side-foot { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-muted-on-dark); }

/* Mini timeline (.dm-mtl): shared/dn-fossil-map.css, which the fossil card shares. */

/* Fossil card: shared/dn-fossil-map.css (FossilCard, row 19). Chips the species panel and list view still use: */
.dm-grp { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }
.dm-chiprow { display: flex; gap: 6px; flex-wrap: wrap; }
.dm-pchip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .04em; }
.dm-unc { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; white-space: nowrap; padding: 0 8px; border: 1px dashed var(--bone-white); border-radius: 3px; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .04em; color: var(--text-on-dark); }
.dm-unc svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
/* The card on the map sits below the attribution control (z-index 1000 > 900). */

/* Summary panels: country, species */
.dm-sum { display: flex; flex-direction: column; gap: var(--space-4); }
.dm-sum-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dm-kicker { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-dark); }
.dm-sum-title { margin: 2px 0 0; font-family: var(--font-display); font-weight: 900; font-size: 34px; line-height: 34px; text-transform: uppercase; }
.dm-sum-title.it { font-style: italic; text-transform: none; }
.dm-mini-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; background: transparent; border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); color: var(--text-on-dark); font-family: var(--font-heading); font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.dm-mini-btn svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.dm-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.dm-nums div { background: var(--surface-dark); border: 1px solid var(--line-dark); border-radius: var(--radius-sm); padding: 10px 12px; }
.dm-nums dt { font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }
.dm-nums dd { margin: 2px 0 0; font-family: var(--font-display); font-weight: 900; font-size: 30px; line-height: 32px; color: var(--accent-on-dark); }
.dm-sub { margin: 0 0 8px; font-family: var(--font-heading); font-weight: 700; font-size: 12px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }
.dm-stack { display: flex; height: 14px; border-radius: 3px; overflow: hidden; gap: 2px; background: var(--prehistoric-slate); }
.dm-stack span { display: block; height: 100%; }
.dm-brk { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.dm-brk li { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 20px; }
.dm-brk li .ct { margin-left: auto; color: var(--text-muted-on-dark); font-size: 12px; }
.dm-pers { display: flex; gap: 6px; flex-wrap: wrap; }
.dm-top { list-style: none; margin: 0; padding: 0; }
.dm-top li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-dark); font-size: 13px; }
.dm-top li i { font-family: var(--font-name, "Barlow Semi Condensed", "Barlow Condensed", "Arial Narrow", sans-serif); font-weight: 700; font-size: 16px; flex: 1; min-width: 0; overflow-wrap: break-word; }
.dm-top li .ct { color: var(--text-muted-on-dark); font-size: 12px; }
.dm-top .thumb { flex: none; width: 40px; height: 24px; }
.dm-spfig { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 14px 16px 8px; background: var(--surface-dark); border: 1px solid var(--line-dark); border-radius: var(--radius-sm); }
.dm-spfig svg { width: 100%; max-width: 240px; height: 110px; }
.dm-spfig small { font-size: 11px; line-height: 16px; color: var(--text-muted-on-dark); }
.dm-deep { justify-content: space-between; }

/* List view */
.dm-tablewrap { background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-lg); overflow: hidden; }
.dm-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.dm-table th { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-dark); background: var(--surface-dark); }
.dm-th { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); cursor: pointer; }
.dm-th svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dm-th-static { cursor: default; }
th[aria-sort] .dm-th { color: var(--text-on-dark); }
.dm-table td { padding: 10px 16px; border-bottom: 1px solid var(--line-dark); vertical-align: middle; }
.dm-table tbody tr:hover td { background: #1a1c1f; }
.dm-sp { display: flex; align-items: center; gap: 12px; }
.dm-sp a { text-decoration: none; color: var(--text-on-dark); }
.dm-sp a:hover i { color: var(--accent-on-dark); }
.dm-sp-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.dm-sp i { display: block; font-family: var(--font-name, "Barlow Semi Condensed", "Barlow Condensed", "Arial Narrow", sans-serif); font-weight: 700; font-size: 18px; line-height: 20px; overflow-wrap: break-word; }
.dm-dated { display: flex; flex-direction: column; gap: 4px; width: 150px; }
.dm-dated small { font-size: 12px; line-height: 16px; color: var(--text-muted-on-dark); }
.dm-ctry-cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.dm-ctry-cell small { font-size: 12px; line-height: 16px; color: var(--text-muted-on-dark); }
.dm-ctry { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; color: var(--text-on-dark); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dm-ctry svg { fill: none; stroke: var(--accent-on-dark); stroke-width: 2; flex: none; }
.dm-grpcell { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; }
.dm-ref { font-size: 13px; color: var(--text-on-dark); }
.dm-list-empty { text-align: center; color: var(--text-muted-on-dark); }
.dm-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; font-size: 13px; color: var(--text-muted-on-dark); }
.dm-pager .pg { display: flex; gap: 6px; }
.dm-pager button { min-width: 40px; height: 40px; padding: 0 10px; background: var(--surface-dark); border: 1px solid var(--line-dark); border-radius: var(--radius-sm); color: var(--text-on-dark); font-family: var(--font-heading); font-weight: 700; font-size: 12px; cursor: pointer; }
.dm-pager button[aria-current="page"] { background: var(--action); border-color: var(--action); color: var(--on-action); }
.dm-pager button[disabled] { color: var(--text-muted-on-dark); cursor: default; }

/* Keyboard focus for every dm- control (design-system focus ring) */
.dm-x:focus-visible, .dm-th:focus-visible, .dm-ctry:focus-visible, .dm-mini-btn:focus-visible,
.dm-pager button:focus-visible, .dm-sp a:focus-visible,
.dn-dmap .dn-listbox ul:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }

@media (max-width: 760px) {
  .dm-head { padding: var(--space-5) 0 var(--space-4); }
  .dm-title { font-size: 44px; line-height: 44px; }
  .dm-intro { font-size: 15px; line-height: 24px; }
  .dm-stats { gap: var(--space-4); }
  .dm-stats b { font-size: 26px; line-height: 28px; }
  .dm-filterbar { padding: var(--space-3); }
  .dm-bar { margin: var(--space-3) 0; }
  .dm-stage { grid-template-columns: minmax(0, 1fr); }
  .dm-map { height: 460px; }
  .dm-side { max-height: none; }
  .dm-fit { bottom: 46px; }
  .dm-legend { gap: 6px 14px; }
  .dm-legend .ttl { flex-basis: 100%; }
  .dm-tablewrap { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .dm-table thead { display: none; }
  .dm-table, .dm-table tbody { display: block; }
  .dm-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; margin-bottom: 12px; padding: 14px; background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-md); }
  .dm-table td { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; }
  .dm-table td.full { grid-column: 1 / -1; }
  .dm-table td::before { content: attr(data-label); font-family: var(--font-heading); font-weight: 700; font-size: 10px; line-height: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted-on-dark); }
  .dm-table td.full::before { display: none; }
  .dm-table tbody tr:hover td { background: transparent; }
  .dm-dated { width: 100%; }
  .dm-pager { padding: 4px 0; }
  .dm-nums dd { font-size: 26px; }
}

/* Room for the map before its script draws it (the feed loads first), so the footer doesn't jump down under the reader:
   launch checks 2026-10-14, Lighthouse CLS 0.27 at 1600 px and 0.35 at 400 px. A little under the drawn height, so no
   gap is left; only when scripting is on. */
@media (scripting: enabled) {
  .dn-discovery-map { min-height: 880px; }
}
@media (scripting: enabled) and (max-width: 760px) {
  .dn-discovery-map { min-height: 1400px; }
}
