/* Dinos.info - species page modules (backlog B14), from the approved species page board
   (design/species-page/, source/species.css). Covers the blocks the plugin ships: units switch,
   timeline, size comparison, map and classification. The page layout around them (hero, quick facts
   grid, sections, chips, sources) is Avada's in production and the preview's in build/preview.
   Colours and type come from dn-tokens.css and the design system's bundle.css. */

.sp-block, .sp-block *, .sp-block *::before, .sp-block *::after { box-sizing: border-box; }
.sp-block { font-family: var(--font-body); color: var(--text-on-dark); }
.sp-block a { color: inherit; }
.sp-block :is(a, button, [tabindex]):focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }

/* No-JavaScript summaries: visible without JavaScript; with it they stay as visually hidden text
   tied to the module by aria-describedby (NoJS board). */
.sp-summary { margin: var(--space-4) 0 0; font-size: 15px; line-height: 24px; color: var(--text-on-dark); }
.sp-summary p { margin: 0 0 var(--space-2); }
.sp-summary p:last-child { margin-bottom: 0; }
.dn-js .sp-summary { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dn-js .sp-js-hidden { display: none; }
.sp-js-only { display: none; }
.dn-js .sp-js-only { display: inline; }
.dn-js .sp-nojs-only { display: none; }

/* Shared: deep link button, switch, close button */
.sp-block .sp-deep { background: transparent; border-color: var(--border-control-dark); color: var(--text-on-dark); padding: 9px 16px; font-size: 13px; line-height: 18px; gap: 6px; }
.sp-block .sp-deep:hover { border-color: var(--action); color: var(--accent-on-dark); }
.sp-switch { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; padding: 6px 0; color: var(--text-on-dark); font-family: var(--font-body); font-size: 14px; line-height: 20px; cursor: pointer; text-align: left; }
.sp-switch .trk { flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px; border: 1.5px solid var(--border-control-dark); background: var(--surface-dark); }
.sp-switch .trk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--fossil-stone); }
.sp-switch[aria-checked="true"] .trk { background: var(--action); border-color: var(--action); }
.sp-switch[aria-checked="true"] .trk::after { left: 18px; background: var(--prehistoric-slate); }
.sp-x { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-on-dark); cursor: pointer; padding: 0; }
.sp-x svg { display: block; }

/* Units switch (one per page, in the Quick facts heading) */
.sp-units { display: inline-flex; }
.sp-units button { font-family: var(--font-heading); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 14px; min-height: 36px; background: var(--surface-dark); color: var(--text-on-dark); border: 1px solid var(--line-dark); cursor: pointer; }
.sp-units button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sp-units button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sp-units button[aria-pressed="true"] { background: var(--action); color: var(--on-action); border-color: var(--action); }
.sp-units button:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); position: relative; z-index: 1; }

/* Timeline block */
.sp-tl { background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-lg); padding: var(--space-5); }
.sp-tl-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.sp-tl-top p { margin: 0; font-size: 14px; line-height: 20px; }
.sp-basis { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-weight: 700; font-size: 12px; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-on-dark); border: 1px dashed var(--border-control-dark); border-radius: var(--radius-sm); padding: 6px 10px; }
.sp-tl-chart { position: relative; padding-top: 40px; }
.sp-tl-row { position: relative; height: 26px; margin-bottom: 3px; }
.sp-tl-row .dn-band { position: absolute; top: 0; height: 26px; padding: 5px 6px; }
.sp-tl-row .sp-tl-txt { position: relative; z-index: 2; font-style: normal; white-space: nowrap; pointer-events: none; }
.sp-tl-row.st { height: 18px; }
.sp-tl-row.st .dn-band { height: 18px; padding: 0; }
.sp-tl-row .dn-band:focus-visible { outline: 2px solid transparent; z-index: 3; box-shadow: 0 0 0 2px var(--bone-white), 0 0 0 4px var(--prehistoric-slate); }
.sp-tl-span { position: absolute; top: 34px; bottom: 0; border: 2px solid var(--bone-white); border-radius: 3px; box-shadow: 0 0 0 1px var(--prehistoric-slate), inset 0 0 0 1px var(--prehistoric-slate); pointer-events: none; z-index: 4; min-width: 4px; }
.sp-tl-span.fuzzy { border-style: dashed; }
.sp-tl-span-label { position: absolute; top: 0; transform: translateX(-100%); white-space: nowrap; font-family: var(--font-heading); font-weight: 700; font-size: 12px; line-height: 16px; color: var(--text-on-dark); background: var(--prehistoric-slate); border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); padding: 4px 8px; }
.sp-tl-span-label.at-start { transform: none; }
.sp-tl-axis { position: relative; height: 22px; border-top: 1px solid var(--line-dark); margin-top: 6px; }
.sp-tl-axis span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 12px; line-height: 14px; color: var(--text-muted-on-dark); }
.sp-tl-axis-note { margin: 2px 0 0; font-size: 12px; line-height: 18px; }
.sp-tl-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line-dark); }
.sp-tl-shared { margin: 0 auto 0 0; font-size: 15px; line-height: 22px; color: var(--text-on-dark); }
.sp-tl-shared b { font-family: var(--font-heading); font-size: 14px; }
.sp-tl-rels { position: relative; margin: 10px 0 0; padding-top: 6px; border-top: 1px dashed var(--line-dark); }
.sp-tl-rel { position: relative; height: 20px; }
.sp-tl-rel .bar { position: absolute; top: 7px; height: 6px; border-radius: 3px; background: var(--fossil-stone); min-width: 3px; }
.sp-tl-rel .bar.me { background: var(--bone-white); }
.sp-tl-rel .lbl { position: absolute; top: 0; transform: translateX(-100%); padding-right: 8px; font-size: 12px; line-height: 20px; color: var(--text-muted-on-dark); white-space: nowrap; font-style: italic; }
.sp-tl-rel .lbl.after { transform: none; padding: 0 0 0 8px; }
.sp-tl-tip { position: absolute; top: 122px; z-index: 6; padding: 8px 12px; background: var(--prehistoric-slate); border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); box-shadow: var(--shadow-float); font-size: 13px; line-height: 18px; color: var(--text-muted-on-dark); white-space: nowrap; pointer-events: none; }
.sp-tl-tip b { display: block; font-family: var(--font-heading); font-size: 14px; line-height: 20px; color: var(--text-on-dark); }
.sp-tl-tip::before { content: ""; position: absolute; top: -6px; left: var(--tip-x, 50%); width: 10px; height: 10px; background: var(--prehistoric-slate); border-left: 1px solid var(--border-control-dark); border-top: 1px solid var(--border-control-dark); transform: translateX(-50%) rotate(45deg); }
.sp-tl-row .dn-band.sp-hov { z-index: 3; box-shadow: 0 0 0 2px var(--bone-white), 0 0 0 4px var(--prehistoric-slate); }

/* Most viewed species per period standing on the period bar (board round 7) */
.sp-tl-chart.has-crowd { padding-top: 78px; }
.sp-tl-chart.has-crowd > .sp-tl-span { top: 72px; }
.sp-tl-chart.has-crowd ~ .sp-tl-tip, .has-crowd .sp-tl-tip { top: 160px; }
.sp-tl-chart .sp-tl-span-label { z-index: 70; }
.sp-tl-stage { position: relative; }
.sp-crowd { position: absolute; left: 0; right: 0; top: 0; height: 78px; margin: 0; padding: 0; list-style: none; pointer-events: none; z-index: 5; }
.sp-cr { position: absolute; bottom: 0; transform: translateX(-50%); pointer-events: auto; }
.sp-cr.bk { bottom: 5px; }
.sp-cr > a { position: relative; display: block; width: 100%; height: 100%; border-radius: 4px; color: var(--bone-white); }
.sp-cr-fig { display: block; width: 100%; height: 100%; }
.sp-cr-fig img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.sp-cr-fig svg { display: block; width: 100%; height: 100%; fill: var(--fossil-stone); }
.sp-cr.fr { opacity: .6; filter: grayscale(1); }
.sp-cr.bk { opacity: .4; filter: grayscale(1) brightness(.85); }
.sp-cr:hover, .sp-cr:focus-within { opacity: 1; filter: none; z-index: 400 !important; }
.sp-cr > a:focus-visible { outline: 2px solid transparent; box-shadow: 0 0 0 2px #202123, 0 0 0 4px var(--action); }
.sp-cr.me { opacity: 1; filter: drop-shadow(0 0 1px #f58a1f) drop-shadow(0 0 1px #f58a1f) drop-shadow(0 0 7px #f58a1fb3); }
.sp-cr.me .sp-cr-fig svg { fill: var(--bone-white); }
.sp-cr-tag { display: none; position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--bone-white); background: var(--prehistoric-slate); border: 1px solid var(--fossil-stone); border-radius: 4px; padding: 2px 8px; pointer-events: none; }
.sp-cr:hover .sp-cr-tag, .sp-cr:focus-within .sp-cr-tag, .sp-cr.out .sp-cr-tag { display: block; }
.sp-cr.me .sp-cr-tag { border-color: var(--action); }
.sp-cr.tag-r .sp-cr-tag { left: auto; right: 0; transform: none; }
.sp-cr.tag-l .sp-cr-tag { left: 0; transform: none; }
/* This species outside its period's crowd: the name and rank sit beside the figure, low down, clear of the span label */
.sp-cr.out .sp-cr-tag { bottom: 8px; left: calc(100% + 4px); right: auto; transform: none; }
.sp-cr.out.tag-r .sp-cr-tag { left: auto; right: calc(100% + 4px); }
.sp-cr-src { margin: 2px 0 0; max-width: 72ch; font-size: 12px; line-height: 18px; }   /* core 0.20.8: its measure */
.sp-cr-src a { color: var(--text-on-dark); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  /* Mobile: Ben picks between scrolling and zooming the timeline (board options A and B); until then the crowd is left out. */
  .sp-crowd, .sp-cr-src { display: none; }
  .sp-tl-chart.has-crowd { padding-top: 40px; }
  .sp-tl-chart.has-crowd > .sp-tl-span { top: 34px; }
  .has-crowd .sp-tl-tip { top: 122px; }
}

/* Size comparison block */
.sp-size { background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-lg); padding: var(--space-5); }
.sp-size > p { margin: 0; font-size: 14px; line-height: 20px; }
.sp-size-stage { position: relative; margin-top: var(--space-4); border-bottom: 2px solid var(--fossil-stone); background-image: linear-gradient(var(--line-dark) 1px, transparent 1px); background-size: 100% 60px; background-position: 0 -1px; }
.sp-size-svg { display: block; width: 100%; height: 300px; }
.sp-size-person { fill: var(--fossil-stone); }
.sp-size-max { fill: none; stroke-width: 2; }
.sp-size-legend { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-top: var(--space-4); }
.sp-size-legend p { margin: 0; }
.sp-size-legend .dn-fact-value { margin-top: 2px; }
.sp-key { display: inline-flex; align-items: center; gap: 8px; }
.sp-key i { width: 14px; height: 14px; display: inline-block; flex: none; }
.sp-size-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line-dark); }
.sp-size-foot > span { font-size: 13px; line-height: 20px; }
.sp-cite { font-family: var(--font-heading); font-weight: 700; font-size: 11px; vertical-align: super; line-height: 0; color: var(--accent-on-dark); text-decoration: none; margin-left: 1px; }

/* Map block */
.sp-map-wrap { position: relative; }
.sp-map { position: relative; isolation: isolate; height: 420px; border: 1px solid var(--line-dark); border-radius: var(--radius-lg); overflow: hidden; background: #0e0f10; }
.sp-map[hidden] { display: none; }
.dn-js .sp-mapblock:not(.is-loaded) .sp-summary { position: static !important; width: auto; height: auto; margin: 0; overflow: auto; clip: auto; white-space: normal; min-height: 420px; padding: var(--space-5); background: var(--surface-dark-raised); border: 1px solid var(--line-dark); border-radius: var(--radius-lg); }
.sp-map-summary ul { margin: 0 0 var(--space-2); padding-left: 20px; font-size: 14px; line-height: 22px; }
.sp-map .leaflet-container, .sp-map.leaflet-container { font-family: var(--font-body); background-color: #0e0f10; }
.sp-map .leaflet-bar { border: 1px solid var(--border-control-dark); box-shadow: var(--shadow-float); }
.sp-map .leaflet-bar a { background-color: var(--surface-dark-raised); color: var(--text-on-dark); border-bottom-color: var(--border-control-dark); }
.sp-map .leaflet-bar a:hover { background-color: var(--prehistoric-slate); color: var(--accent-on-dark); }
.sp-map .leaflet-bar a.leaflet-disabled { background-color: var(--surface-dark-raised); color: var(--text-muted-on-dark); }
.sp-map .leaflet-bar a:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }
.sp-map .leaflet-control-attribution { background-color: #121417f2; color: var(--text-on-dark); border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); margin: 0 8px 8px 0 !important; padding: 3px 8px; font-size: 12px; line-height: 16px; }
.sp-map .leaflet-control-attribution a { color: var(--text-on-dark); text-decoration: underline; text-underline-offset: 2px; }
.sp-map .leaflet-control-attribution a:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring-dark); }
.sp-map .leaflet-bottom.leaflet-right { z-index: 1000; }
/* Markers, group labels and the fossil card: shared/dn-fossil-map.css (approval sheet row 19). */
.sp-map-cluster-icon { background: none; border: 0; }
.sp-map-cluster { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--pin, var(--data-theropoda)); border: 2px solid var(--prehistoric-slate); color: var(--on-data); font-family: var(--font-heading); font-weight: 700; font-size: 12px; }
.sp-map-cluster.g-unplaced { background: var(--prehistoric-slate); border: 3px solid var(--data-unplaced); color: var(--text-on-dark); }
.leaflet-marker-icon:focus-visible .sp-map-cluster { box-shadow: var(--focus-ring-dark); }
.sp-map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 800; display: flex; flex-direction: column; gap: 4px; background: #121417f2; border: 1px solid var(--border-control-dark); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; line-height: 18px; color: var(--text-on-dark); }
.sp-map-legend > span { display: flex; align-items: center; gap: 8px; }
.sp-map-foot { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; align-items: center; margin-top: var(--space-3); }
.sp-map-foot > span { font-size: 14px; line-height: 20px; }
.sp-map-actions { display: flex; gap: 12px 20px; align-items: center; flex-wrap: wrap; }

/* Classification tree and clade panel */
.sp-tree { list-style: none; margin: 0; padding: 0; }
.sp-tree ul { list-style: none; margin: 0; padding: 0; }
.sp-tree li { position: relative; padding: 0 0 0 26px; }
.sp-tree li::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; border-left: 2px solid var(--line-dark); }
.sp-tree li:last-child::before { bottom: auto; height: 20px; }
.sp-tree li > .sp-node { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 4px 0; padding: 5px 10px; border-radius: var(--radius-sm); background: var(--surface-dark-raised); border: 1px solid var(--line-dark); font-family: var(--font-heading); font-weight: 700; font-size: 13px; line-height: 18px; color: var(--text-on-dark); text-decoration: none; }
.sp-tree li > .sp-node::before { content: ""; position: absolute; left: -19px; top: 50%; width: 17px; border-top: 2px solid var(--line-dark); }
.sp-tree li > .sp-node small { font-family: var(--font-body); font-weight: 400; font-size: 12px; color: var(--text-muted-on-dark); }
.sp-tree li.sp-tree-root { padding-left: 0; }
.sp-tree li.sp-tree-root::before, .sp-tree li.sp-tree-root > .sp-node::before { display: none; }
.sp-tree li.sp-tree-here > .sp-node { background: var(--action); border-color: var(--action); color: var(--on-action); font-style: italic; }
.sp-tree li.sp-tree-here > .sp-node small { color: var(--on-action); font-style: normal; }
.sp-tree a.sp-node { cursor: pointer; }
.sp-tree .sp-node .chev { fill: none; stroke: var(--text-muted-on-dark); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sp-tree .sp-node[aria-expanded="true"] { border-color: var(--action); }
.sp-tree .sp-node[aria-expanded="true"] .chev { transform: rotate(180deg); stroke: var(--accent-on-dark); }
.sp-tree li.sp-tree-sib > .sp-node { background: transparent; border-style: dashed; color: var(--text-muted-on-dark); font-style: italic; text-decoration: underline; text-underline-offset: 2px; }
.sp-clade-panel { position: relative; margin: 4px 0 10px; max-width: 460px; background: var(--prehistoric-slate); border: 1px solid var(--border-control-dark); border-radius: var(--radius-md); box-shadow: var(--shadow-float); padding: 12px 14px 14px; }
.sp-clade-panel .hd { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sp-clade-panel .hd p { margin: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 20px; color: var(--text-muted-on-dark); }
.sp-clade-panel .hd b { font-family: var(--font-heading); font-size: 15px; line-height: 22px; color: var(--text-on-dark); }
.sp-clade-panel .sp-x { flex: none; margin: -4px -6px 0 0; }
.sp-tree .sp-clade-list { list-style: none; margin: 8px 0 10px; padding: 0; }
.sp-tree .sp-clade-panel li { padding: 0; }
.sp-tree .sp-clade-panel li::before { display: none; }
.sp-clade-list a { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-dark); text-decoration: none; font-size: 14px; line-height: 20px; }
.sp-clade-list a svg { flex: none; }
.sp-clade-list i { font-family: var(--font-name, "Barlow Semi Condensed", "Barlow Condensed", "Arial Narrow", sans-serif); font-weight: 700; font-size: 17px; overflow-wrap: break-word; }
.sp-clade-list small { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--text-muted-on-dark); white-space: nowrap; }
.sp-clade-wait { margin: 8px 0 0; font-size: 13px; color: var(--text-muted-on-dark); }
.sp-note { font-size: 13px; line-height: 20px; color: var(--text-muted-on-dark); margin: var(--space-3) 0 0; }

@media (max-width: 760px) {
  .sp-tl { padding: var(--space-4); }
  .sp-tl-row.ep .dn-band { font-size: 0; }
  .sp-tl-row:not(.ep):not(.st) .dn-band { font-size: 11px; padding: 6px 4px; letter-spacing: 0; }
  .sp-tl-tip { white-space: normal; max-width: 220px; }
  .sp-tl-shared { flex-basis: 100%; }
  .sp-tl-axis span.minor { display: none; }
  .sp-block .sp-deep { width: 100%; justify-content: space-between; text-align: left; }
  .sp-size-svg { height: 200px; }
  .sp-size-stage { background-size: 100% 40px; }
  .sp-map { height: 300px; }
  .dn-js .sp-mapblock:not(.is-loaded) .sp-summary { min-height: 300px; }
  .sp-map-legend { position: static; margin-top: 8px; flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
  /* Deep trees: a narrower indent so the genus still fits a 400px screen (not on the board). */
  .sp-tree li { padding-left: 14px; }
  .sp-tree li::before { left: 3px; }
  .sp-tree li > .sp-node::before { left: -11px; width: 9px; }
}
