:root {
  --paper: #f1f4ef;
  --sheet: #fbfcf8;
  --ink: #17212b;
  --ink-2: #44505c;
  --muted: #66717d;
  --rule: #c8d0c6;
  --rule-strong: #8f9a8e;
  --accent: #2b4a99;
  --accent-ink: #ffffff;
  --accent-soft: #dfe5f4;
  --warn-bg: #fbe9d6;
  --warn-ink: #7a3a05;
  --bar: #2b4a99;
  --bar-muted: #9aa8c9;
  --focus: #c2410c;
  --font-display: "Alegreya", Georgia, serif;
  --font-body: "Alegreya Sans", "Helvetica Neue", Arial, sans-serif;
  --font-label: "Courier Prime", "Courier New", monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 4.2vw, 3.1rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10151a;
    --sheet: #171e25;
    --ink: #e5eae3;
    --ink-2: #b8c1ba;
    --muted: #8f9a94;
    --rule: #2c3640;
    --rule-strong: #4f5c66;
    --accent: #93abf2;
    --accent-ink: #0d1424;
    --accent-soft: #1f2a44;
    --warn-bg: #3a2512;
    --warn-ink: #f6c89a;
    --bar: #93abf2;
    --bar-muted: #4b5a80;
    --focus: #fb923c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10151a; --sheet: #171e25; --ink: #e5eae3; --ink-2: #b8c1ba; --muted: #8f9a94;
  --rule: #2c3640; --rule-strong: #4f5c66; --accent: #93abf2; --accent-ink: #0d1424;
  --accent-soft: #1f2a44; --warn-bg: #3a2512; --warn-ink: #f6c89a; --bar: #93abf2;
  --bar-muted: #4b5a80; --focus: #fb923c; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code { font-family: var(--font-label); font-size: 0.92em; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.12; margin: 0; }
h2 { font-size: var(--step-2); }
p { margin: 0 0 0.8em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; }
.skip:focus { left: 8px; z-index: 10; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--font-label); font-size: var(--step--1); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 0.6em; }

/* masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.masthead-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 12px; }
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); }
.brand-sub { font-family: var(--font-label); font-size: 0.8rem; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--accent); text-decoration: underline; }

.banner { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 16px; text-align: center; font-weight: 500; }

/* identify */
.identify { display: grid; gap: 32px; padding-top: 48px; padding-bottom: 56px; }
@media (min-width: 960px) { .identify { grid-template-columns: 1.05fr 1fr; align-items: start; gap: 56px; padding-top: 72px; } }
.identify h1 { font-size: var(--step-3); margin-bottom: 0.45em; letter-spacing: -0.01em; }
.lede { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); max-width: 34em; }
.identify-form { display: flex; align-items: stretch; margin-top: 24px; border: 2px solid var(--ink); background: var(--sheet); border-radius: 4px; max-width: 560px; }
.input-prefix { font-family: var(--font-label); color: var(--muted); padding: 0 0 0 12px; display: flex; align-items: center; white-space: nowrap; }
@media (max-width: 420px) { .input-prefix { display: none; } }
.identify-form input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 400 1.05rem var(--font-label); padding: 14px 8px; }
.identify-form input:focus { outline: none; }
.identify-form:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.identify-form button { border: 0; background: var(--ink); color: var(--paper); font: 700 1rem var(--font-body); padding: 0 22px; cursor: pointer; letter-spacing: 0.02em; }
.identify-form button:disabled { opacity: 0.6; cursor: progress; }
.examples { margin-top: 12px; color: var(--muted); font-size: var(--step--1); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-family: var(--font-label); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }

/* the specimen label: the page's one signature */
.label {
  background: var(--sheet); border: 1px solid var(--ink); border-radius: 2px;
  box-shadow: 0 1px 0 var(--rule), 6px 6px 0 -1px var(--paper), 6px 6px 0 0 var(--rule-strong);
  font-family: var(--font-label); padding: 0; max-width: 600px;
}
.label-head { display: flex; justify-content: space-between; border-bottom: 1px solid var(--ink); padding: 8px 14px; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; }
.label-no { color: var(--muted); letter-spacing: 0; text-transform: none; }
.label-taxon { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.9rem; margin: 14px 14px 2px; line-height: 1.15; }
.label-taxon.none { color: var(--ink-2); }
.label-repo { margin: 0 14px 12px; color: var(--ink-2); font-size: 0.9rem; word-break: break-all; }
.label-fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; padding: 12px 14px; border-top: 1px dashed var(--rule-strong); font-size: 0.88rem; }
.label-fields dt { color: var(--muted); }
.label-fields dd { margin: 0; overflow-wrap: anywhere; }
.label-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--ink); font-size: 0.8rem; color: var(--muted); }
.label-sample { opacity: 0.78; }
.label + .label { margin-top: 18px; }
.determinations { list-style: none; margin: 0; padding: 0 14px 6px; }
.determinations li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-top: 1px dotted var(--rule-strong); font-size: 0.9rem; }
.determinations li:first-child { border-top: 0; }
.det-name { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; }
.det-conf { align-self: center; font-size: 0.8rem; border: 1px solid currentColor; padding: 1px 6px; border-radius: 2px; }
.det-conf.high { color: var(--accent); }
.det-conf.medium { color: var(--ink-2); border-style: dashed; }
.det-conf.low { color: var(--muted); border-style: dotted; }
.det-why { grid-column: 1 / -1; color: var(--ink-2); font-family: var(--font-body); font-size: 0.95rem; }
.evidence { grid-column: 1 / -1; margin: 4px 0 0; padding-left: 0; list-style: none; font-size: 0.82rem; }
.evidence li { border: 0; padding: 2px 0; display: block; }
.evidence q { font-family: var(--font-body); quotes: "“" "”"; }
.unverified { color: var(--warn-ink); background: var(--warn-bg); padding: 0 4px; }
.status-line { font-family: var(--font-label); font-size: 0.9rem; color: var(--ink-2); }
.error-label { border-color: var(--warn-ink); }
.error-label .label-head { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.neighbors { margin: 0; padding: 0 14px 12px; list-style: none; font-size: 0.85rem; }
.neighbors li { padding: 2px 0; }
.warn-list { margin: 0; padding: 8px 14px 10px 30px; font-size: 0.82rem; color: var(--warn-ink); background: var(--warn-bg); border-top: 1px solid var(--ink); }

/* bands & sections */
section { scroll-margin-top: 90px; }
.band { padding-top: 40px; padding-bottom: 48px; border-top: 1px solid var(--rule); }
.band-head, .section-head { max-width: 760px; margin-bottom: 20px; }
.band-head h2, .section-head h2 { margin-bottom: 0.4em; }
.band-head p, .section-head p { color: var(--ink-2); }
#registry, #regularities, #map, #paper { padding-top: 40px; padding-bottom: 48px; border-top: 1px solid var(--rule); }

.validation table, table.registry { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.validation th, .validation td, .registry th, .registry td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.validation th, .registry th { font-family: var(--font-label); font-weight: 400; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.validation td.num, .registry td.num { font-variant-numeric: tabular-nums; text-align: right; }
.validation .note { color: var(--muted); font-size: var(--step--1); margin-top: 10px; max-width: 760px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--rule); }
.registry td:first-child a { font-family: var(--font-label); font-size: 0.88rem; word-break: break-all; }
.registry .lin { font-family: var(--font-display); font-style: italic; }
.registry .dim { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 3px; font-family: var(--font-label); }
.filters select, .filters input { font: 400 0.95rem var(--font-body); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 7px 8px; min-width: 0; }
.filter-search { flex: 1 1 220px; }
.filter-search input { width: 100%; }
.count { margin-left: auto; font-family: var(--font-label); font-size: 0.85rem; color: var(--muted); align-self: center; }

/* regularity cards with status stamps */
.reg-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.reg-card { background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.reg-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.reg-code { font-family: var(--font-label); color: var(--muted); font-size: 0.85rem; }
.reg-card h3 { font-size: 1.3rem; }
.stamp { font-family: var(--font-label); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 7px; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-2deg); white-space: nowrap; }
.stamp.support { color: var(--accent); }
.stamp.conditional { color: var(--accent); border-style: dashed; }
.stamp.revised { color: var(--ink-2); border-style: double; border-width: 3px; }
.stamp.exploratory { color: var(--muted); border-style: dotted; }
.reg-card .claim { color: var(--ink); }
.reg-card dl { margin: 0; display: grid; gap: 4px; font-size: 0.92rem; }
.reg-card dt { font-family: var(--font-label); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.reg-card dd { margin: 0; color: var(--ink-2); }

/* paper map */
.map-layout { display: grid; gap: 24px; }
@media (min-width: 960px) { .map-layout { grid-template-columns: 1.4fr 1fr; } }
.map-figure { margin: 0; }
.map-figure figcaption { color: var(--muted); font-size: var(--step--1); margin-top: 8px; }
.map-chart { position: relative; }
.bar-row { display: grid; grid-template-columns: minmax(0, 13em) 1fr 2.4em; align-items: center; gap: 10px; padding: 3px 4px; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 3px; }
.bar-row:hover, .bar-row[aria-pressed="true"] { background: var(--accent-soft); }
.bar-name { font-family: var(--font-label); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar-muted); border-radius: 0 4px 4px 0; }
.bar-row.top .bar-fill { background: var(--bar); }
.bar-val { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--ink-2); text-align: right; }
.map-legend { display: flex; gap: 18px; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
.map-detail { background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 14px 16px; align-self: start; }
.map-detail h3 { font-family: var(--font-label); font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; word-break: break-all; }
.map-detail ol { margin: 0; padding-left: 1.3em; font-size: 0.92rem; }
.map-detail li { margin-bottom: 4px; }

/* paper */
.paper-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; max-width: 40em; }
.paper-links { display: flex; gap: 18px; flex-wrap: wrap; }
.bibtex { background: var(--sheet); border: 1px solid var(--rule-strong); padding: 12px 14px; font: 400 0.82rem/1.5 var(--font-label); overflow-x: auto; max-width: 760px; }
.footer { border-top: 1px solid var(--rule); padding-top: 18px; padding-bottom: 40px; color: var(--muted); font-size: var(--step--1); }
.footer code { word-break: break-all; }
.validation th.sep, .validation td.sep { border-left: 1px solid var(--rule); }
.validation thead tr:first-child th { text-transform: none; letter-spacing: 0; font-size: 0.78rem; border-bottom: 0; }
.page-claim { display: block; font-family: var(--font-label); font-style: normal; font-size: 0.75rem; color: var(--muted); }
