/*
 * Codex Naturalis Khassidia — shared styles.
 * Archival catalogue aesthetic: typography, thin rules, restrained spacing.
 * No cards, no tiles, no colored filter chips.
 * Relies on the site's existing CSS custom properties (--ink, --muted,
 * --paper, --panel, --blue, --archive, --gold, --gold-soft, --russet,
 * --line, --shadow, --max) already defined per-page.
 */

.codex-quote {
  max-width: 70ch;
  margin: 1.6rem 0 0;
  padding: 0 0 0 1.25rem;
  border-left: 3px solid var(--gold);
  color: var(--archive);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.55;
}
.codex-quote cite {
  display: block;
  margin-top: .6rem;
  font-style: normal;
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--russet);
}

/* ---- Volume Index (main Codex landing page) ---- */
.volume-index { margin-top: 2rem; }
.volume-entry {
  display: grid;
  grid-template-columns: 84px minmax(0,1fr);
  gap: 1.4rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
}
.volume-index .volume-entry:last-child { border-bottom: 1px solid var(--line); }
.volume-numeral {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--gold);
  font-weight: 400;
}
.volume-body h3 { margin: 0 0 .15rem; }
.volume-title-link { color: var(--blue); font-size: 1.35rem; font-weight: 800; }
.volume-title-link:hover, .volume-title-link:focus { color: var(--russet); }
.volume-desc { margin: .5rem 0 .75rem; max-width: 68ch; color: var(--muted); }
.volume-explore { display: inline-flex; align-items: center; gap: .35rem; color: var(--russet); font-weight: 800; font-size: .88rem; text-transform: uppercase; letter-spacing: .02em; }
.volume-explore::after { content: "\2192"; }
.volume-count { margin-left: .6rem; color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* ---- Search / filter panel ---- */
.codex-search-band { margin: 2.4rem 0 1.6rem; padding: 1.6rem 0; border-top: 1px solid var(--gold-soft); border-bottom: 1px solid var(--gold-soft); }
.codex-search-band .kicker { display: block; margin-bottom: .5rem; }
.filter-toggle {
  display: none;
  width: 100%;
  text-align: left;
  padding: .75rem 1rem;
  margin-bottom: .8rem;
  background: var(--panel);
  border: 1px solid var(--gold-soft);
  color: var(--blue);
  font-weight: 800;
  font-size: .92rem;
  cursor: pointer;
}
.filter-toggle::after { content: "+"; float: right; }
.filter-toggle[aria-expanded="true"]::after { content: "\2212"; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 1rem 1.4rem;
}
.filter-field { display: flex; flex-direction: column; gap: .35rem; position: relative; }

/* Multi-select widget (Terrain, Region, Encounter Role): a toggle button,
   a checkbox panel, and a list of removable tags. Deliberately plain —
   monochrome text and thin borders, no colored chips. */
.multiselect { position: relative; }
.multiselect-toggle {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: .55rem .6rem;
  font-size: .92rem;
  font-family: inherit;
  cursor: pointer;
}
.multiselect-toggle::after { content: "\25be"; float: right; color: var(--muted); }
.multiselect-toggle:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.multiselect-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--gold-soft);
  box-shadow: var(--shadow);
  padding: .4rem 0;
}
.multiselect-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .7rem;
  font-size: .88rem;
  color: var(--ink);
  cursor: pointer;
}
.multiselect-option:hover { background: rgba(215,182,75,.12); }
.multiselect-option input { margin: 0; }
.multiselect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .4rem;
}
.multiselect-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--archive);
  font-size: .78rem;
  font-weight: 700;
  padding: .18rem .4rem .18rem .55rem;
}
.multiselect-remove {
  border: 0;
  background: none;
  color: var(--russet);
  font-weight: 900;
  cursor: pointer;
  padding: 0 .1rem;
  font-size: .95rem;
  line-height: 1;
}
.multiselect-remove:hover { color: var(--ink); }

.filter-field label {
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--archive);
}

/* Concordance definition tooltips: small "?" buttons next to the Primary
   Concordance Type / Origin Designation / Disposition Classification
   labels. Expands a short definition + link to the full Taxonomical
   Concordance guide in normal document flow (no absolute positioning --
   simpler and doesn't need viewport-edge collision handling). */
.concordance-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin-left: .4rem;
  border-radius: 50%;
  border: 1px solid var(--russet);
  background: var(--panel);
  color: var(--russet);
  font-size: .66rem;
  font-weight: 900;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
}
.concordance-tip:hover,
.concordance-tip:focus {
  background: rgba(154, 90, 61, .1);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.concordance-tip-popover {
  grid-column: 1 / -1;
  margin: -.2rem 0 .3rem;
  background: var(--paper);
  border-left: 3px solid var(--gold);
  padding: .65rem .8rem;
  font-size: .85rem;
  color: #323b42;
}
.concordance-tip-popover p { margin: 0 0 .4rem; }
.concordance-tip-popover a {
  color: var(--russet);
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.filter-field input,
.filter-field select {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: .55rem .6rem;
  font-size: .92rem;
  font-family: inherit;
}
.filter-field input:focus,
.filter-field select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .3rem;
  flex-wrap: wrap;
}
.filter-count { color: var(--muted); font-size: .88rem; }
.filter-reset {
  background: none;
  border: 1px solid var(--russet);
  color: var(--russet);
  font-weight: 800;
  font-size: .82rem;
  text-transform: uppercase;
  padding: .45rem .9rem;
  cursor: pointer;
}
.filter-reset:hover { background: rgba(154,90,61,.08); }

.sort-row { display: flex; align-items: center; gap: .6rem; margin: 1rem 0 0; font-size: .88rem; color: var(--muted); }
.sort-row select { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: .4rem .55rem; font-family: inherit; }

/* ---- Catalogue entries (creature listing) ---- */
.catalogue-list { margin-top: 1.6rem; }
.catalogue-entry {
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: .3rem;
}
.catalogue-list .catalogue-entry:last-child { border-bottom: 1px solid var(--line); }
.catalogue-name { color: var(--blue); font-size: 1.25rem; font-weight: 800; }
.catalogue-name a { color: inherit; }
.catalogue-name a:hover { color: var(--russet); }
.catalogue-taxon { color: var(--archive); font-size: .84rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.catalogue-meta { color: var(--muted); font-size: .86rem; }
.catalogue-desc { margin: .35rem 0 .2rem; color: #323b42; max-width: 74ch; }
.catalogue-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--russet); font-weight: 800; font-size: .84rem; text-transform: uppercase; letter-spacing: .02em; margin-top: .2rem; }
.catalogue-link::after { content: "\2192"; }
.catalogue-empty { padding: 2.4rem 0; color: var(--muted); font-style: italic; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---- Catalogue pagination ---- */
.catalogue-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}
.pagination-link {
  background: none;
  border: 1px solid var(--gold-soft);
  color: var(--blue);
  font-weight: 800;
  font-size: .84rem;
  padding: .5rem 1rem;
  cursor: pointer;
}
.pagination-link:hover:not(:disabled) { border-color: var(--gold); background: rgba(215,182,75,.08); }
.pagination-link:disabled { color: var(--muted); border-color: var(--line); cursor: default; opacity: .55; }
.pagination-status { color: var(--muted); font-size: .84rem; }

/* ---- Taxonomical Concordance (creature dossier top block) ---- */
.concordance-band { background: var(--panel); border: 1px solid var(--gold-soft); border-top: 4px solid var(--gold); box-shadow: var(--shadow); margin: 2.4rem 0; }
.concordance-band h2 { padding: 1.15rem 1.3rem; color: var(--blue); background: #f7efd9; border-bottom: 1px solid var(--line); font-size: 1.3rem; }
.concordance-note { margin: 0; padding: .7rem 1.3rem 0; color: var(--muted); font-size: .82rem; font-style: italic; }

@media (max-width: 980px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .volume-entry { grid-template-columns: 1fr; gap: .3rem; }
  .volume-numeral { font-size: 1.6rem; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-toggle { display: block; }
  .codex-search-band .filter-grid { display: none; }
  .codex-search-band.is-open .filter-grid { display: grid; }
}
