/* FOROST — a scientific registry, not a product site.
   Paper ground, slate ink, verdigris accent from conservation patina.
   Iron oxide is reserved for the unattributed flag and means nothing else.
   System fonts only: no CDN dependency on a site meant to outlive its stack. */

:root {
  --paper:      #fbfbf9;
  --paper-sunk: #f2f2ee;
  --ink:        #202a30;
  --ink-soft:   #55636c;
  --rule:       #d9d9d2;
  --verdigris:  #3e7c74;
  --verdigris-d:#2c5b55;
  --oxide:      #9a5b2e;

  --serif: Georgia, "Iowan Old Style", "Source Serif 4", "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono:  ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --measure: 66ch;
  --gap: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}

.shell { max-width: 68rem; margin-inline: auto; padding-inline: 1.25rem; }

/* Keyboard access ------------------------------------------------ */
.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

a { color: var(--verdigris-d); text-underline-offset: .15em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--verdigris); outline-offset: 2px; }

/* Masthead ------------------------------------------------------- */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead-inner {
  display: flex; flex-wrap: wrap; gap: var(--gap);
  align-items: baseline; padding-block: 1.1rem;
}
.wordmark { margin: 0; font-family: var(--serif); font-size: 1.35rem; letter-spacing: .06em; }
.wordmark a { color: var(--ink); text-decoration: none; }
.wordmark-sub {
  display: block; font-family: var(--sans); font-size: .8rem;
  letter-spacing: 0; color: var(--ink-soft);
}
.mainnav { margin-inline-start: auto; }
.mainnav ul { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: 0; padding: 0; list-style: none; }
.langpick { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.langpick label { color: var(--ink-soft); }

/* Type ----------------------------------------------------------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 1.8rem 0 .6rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
p  { max-width: var(--measure); }
.prose { white-space: normal; }
.muted { color: var(--ink-soft); }
.lede { font-size: 1.1rem; color: var(--ink-soft); }
main { padding-bottom: 4rem; }

/* Search bar ----------------------------------------------------- */
.searchbar { margin: 1.5rem 0 1rem; }
.searchbar label { display: block; font-weight: 600; margin-bottom: .2rem; }
.hint { font-size: .9rem; color: var(--ink-soft); margin: 0 0 .6rem; }
.searchbar-row { display: flex; flex-wrap: wrap; gap: .5rem; }
input[type="search"], select {
  font: inherit; padding: .55rem .7rem;
  border: 1px solid var(--rule); border-radius: 2px;
  background: #fff; color: var(--ink); min-width: 0;
}
input[type="search"] { flex: 1 1 22rem; }
button {
  font: inherit; padding: .55rem 1.1rem; border: 1px solid var(--verdigris-d);
  border-radius: 2px; background: var(--verdigris); color: #fff; cursor: pointer;
}
button:hover { background: var(--verdigris-d); }

/* Query interpretation — the signature element -------------------- */
.interpretation {
  border-inline-start: 3px solid var(--verdigris);
  background: var(--paper-sunk);
  padding: .9rem 1.1rem; margin: 1rem 0 1.6rem;
}
.interpretation h2 { margin: 0 0 .5rem; font-size: .8rem; font-family: var(--sans); color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: baseline; gap: .4rem;
  background: #fff; border: 1px solid var(--rule); border-radius: 2px;
  padding: .3rem .5rem; font-size: .9rem;
}
.chip-kind { color: var(--ink-soft); font-size: .78rem; }
.chip-value { font-weight: 600; }
.chip-drop { text-decoration: none; color: var(--ink-soft); padding-inline: .2rem; font-size: 1.05rem; line-height: 1; }
.chip-drop:hover { color: var(--oxide); }
.interpretation-free { margin: .6rem 0 0; font-size: .9rem; color: var(--ink-soft); }

/* Landing tallies ------------------------------------------------- */
.tally { display: flex; flex-wrap: wrap; gap: 2rem; margin: 1.5rem 0; padding: 0; }
.tally div { margin: 0; }
.tally dt { font-size: .8rem; color: var(--ink-soft); }
.tally dd { margin: .1rem 0 0; font-family: var(--serif); font-size: 1.7rem; }

.facets { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.facets a {
  display: inline-flex; gap: .45rem; align-items: baseline;
  border: 1px solid var(--rule); background: #fff;
  padding: .3rem .55rem; text-decoration: none; border-radius: 2px; font-size: .92rem;
}
.facets a:hover { border-color: var(--verdigris); }
.facet-n { color: var(--ink-soft); font-size: .82rem; font-variant-numeric: tabular-nums; }

/* Results --------------------------------------------------------- */
.results-heading { font-size: 1.05rem; color: var(--ink-soft); font-family: var(--sans); font-weight: 500; }
.results { list-style: none; margin: 0; padding: 0; }
.result { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.result h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
/* Catalogue numbers are the one place monospace earns its keep:
   they align down the column and are read character by character. */
.catno { font-family: var(--mono); font-size: .95em; }
.result-meta { margin: .15rem 0; color: var(--ink-soft); font-size: .92rem; }
.result-lesions { margin: .15rem 0; font-size: .9rem; }
.result-unattributed { border-inline-start: 3px solid var(--oxide); padding-inline-start: .8rem; }

.flag { color: var(--oxide); font-size: .88rem; margin: .35rem 0 0; }
.flag-block {
  border: 1px solid var(--oxide); background: #fdf6f0;
  padding: .7rem .9rem; max-width: var(--measure);
}

.empty { background: var(--paper-sunk); padding: 1.2rem; border: 1px solid var(--rule); }
.empty-note { font-size: .9rem; color: var(--ink-soft); }
.alert { border: 1px solid var(--oxide); background: #fdf6f0; padding: .8rem 1rem; }
.alert-detail { display: block; font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); }

.pager { display: flex; gap: 1.2rem; align-items: baseline; margin: 1.5rem 0; }
.pager-pos { color: var(--ink-soft); font-size: .9rem; }

/* Specimen page ---------------------------------------------------- */
.crumb { font-size: .9rem; margin: 1.2rem 0 0; }
.specimen-grid { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); }
@media (max-width: 48rem) { .specimen-grid { grid-template-columns: 1fr; } }

.specimen-facts dl, .lesion-facts { margin: 0; }
.specimen-facts dl > div, .lesion-facts > div {
  display: grid; grid-template-columns: 9rem 1fr; gap: .5rem;
  padding: .35rem 0; border-bottom: 1px solid var(--rule);
}
.specimen-facts dt, .lesion-facts dt { color: var(--ink-soft); font-size: .88rem; }
.specimen-facts dd, .lesion-facts dd { margin: 0; }

.lesion { border-top: 2px solid var(--ink); padding-top: .8rem; margin-bottom: 2rem; }
.agents { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.tag {
  display: inline-flex; flex-direction: column;
  border: 1px solid var(--verdigris); border-radius: 2px;
  padding: .25rem .5rem; font-size: .9rem;
}
/* Taphonomic agents are not trauma; the border says so without a legend. */
.tag-taphonomy { border-color: var(--ink-soft); border-style: dashed; }
.tag-cat { font-size: .75rem; color: var(--ink-soft); }

.pathologies { padding-inline-start: 1.1rem; }
.pathologies li { margin-bottom: .4rem; }

.gallery { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
           list-style: none; margin: 1rem 0 0; padding: 0; }
.gallery img { width: 100%; height: auto; border: 1px solid var(--rule); background: var(--paper-sunk); }
.rights { font-size: .78rem; color: var(--ink-soft); margin: .3rem 0 0; }

.cite { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.cite-block {
  font-family: var(--serif); background: var(--paper-sunk);
  padding: .8rem 1rem; border-inline-start: 3px solid var(--ink);
}

/* Footer ----------------------------------------------------------- */
.footer { border-top: 1px solid var(--rule); padding-block: 1.5rem; font-size: .88rem; color: var(--ink-soft); }
.footer-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Data tables — collections, institutions ---------------------------
   Real tables for real tabular data. The old site used tables for
   layout and none for data, which is exactly backwards. */
.datatable {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 2.5rem;
  font-size: .95rem;
}
.datatable caption {
  text-align: start;
  color: var(--ink-soft);
  font-size: .9rem;
  padding-bottom: .5rem;
}
.datatable th, .datatable td {
  text-align: start;
  vertical-align: top;
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--rule);
}
.datatable thead th {
  border-bottom: 2px solid var(--ink);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
  font-weight: 600;
}
.datatable tbody th { font-weight: 600; }
.datatable tbody tr:hover { background: var(--paper-sunk); }
.datatable .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.datatable .muted { display: block; font-weight: 400; font-size: .88rem; }
.datatable .ext { font-size: .85rem; white-space: nowrap; }

/* Tables scroll rather than forcing the page sideways on a phone. */
@media (max-width: 34rem) {
  .datatable { display: block; overflow-x: auto; }
}

/* A caveat carried by a vocabulary term itself, not by the record — e.g.
   that periostitis is a bone response rather than a cause. Quieter than the
   record's own notes, because it is true of the term everywhere. */
.term-note {
  display: block;
  font-size: .85rem;
  color: var(--ink-soft);
  border-inline-start: 2px solid var(--rule);
  padding-inline-start: .6rem;
  margin-top: .25rem;
}

/* Photographs recorded but no longer retrievable. Stated plainly rather than
   left as broken image icons: the record is still good evidence, only the
   picture is gone. */
.images-missing {
  font-size: .9rem;
  color: var(--ink-soft);
  background: var(--paper-sunk);
  border-inline-start: 3px solid var(--rule);
  padding: .7rem .9rem;
  margin: .75rem 0 0;
}
.images-missing a { color: var(--verdigris-d); }
