@font-face { font-family: "Marcellus"; src: url("fonts/marcellus.woff2") format("woff2"); font-display: swap; }

:root {
  --ink: #231f20;
  --ink-2: #4a4546;
  --muted: #7a7374;
  --gold: #b48338;
  --gold-soft: #f5ecdf;
  --gold-line: #e3cfae;
  --paper: #fbfaf8;
  --card: #ffffff;
  --rule: #e7e3df;
  --red: #9b3b2a;
  --red-soft: #f8e9e5;
  --green: #2f6b45;
  --green-soft: #e6f1ea;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "TeX Gyre Pagella", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Marcellus", var(--serif);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.band { height: 4px; background: var(--ink); border-bottom: 2px solid var(--gold); }

.masthead { background: #fff; border-bottom: 1px solid var(--rule); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand-mark { width: 58px; height: auto; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--display); font-size: 23px; letter-spacing: .06em; line-height: 1.1; }
.brand-tag { font-family: var(--display); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-top: 4px; }
.masthead-title { text-align: right; display: flex; flex-direction: column; }
.db-title { font-family: var(--display); font-size: 21px; letter-spacing: .04em; }
.db-meta { font-size: 12.5px; color: var(--muted); }

.searchbar { background: var(--ink); padding: 22px 0 14px; }
.search-field { position: relative; display: flex; align-items: center; background: #fff; border-radius: 6px; border: 1px solid var(--ink); }
.search-field svg { position: absolute; left: 14px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search-field input { flex: 1; border: 0; background: transparent; padding: 14px 44px 14px 46px; font-size: 16.5px; border-radius: 6px; min-width: 0; }
.search-field input:focus { outline: none; }
.search-field:focus-within { box-shadow: 0 0 0 3px rgba(180,131,56,.55); }
.clear-q { position: absolute; right: 8px; border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; padding: 2px 8px; }
.search-hint { color: #bdb6b3; font-size: 12.5px; margin: 8px 2px 0; }

.layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding-top: 24px; padding-bottom: 40px; align-items: start; }

.sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding-right: 4px; }
.filters-toggle { display: none; }
.fgroup { margin-bottom: 20px; }
.fhead { font-family: var(--display); font-weight: 400; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--gold-line); }
.subjects { list-style: none; margin: 0; padding: 0; }
.subjects button { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; border-radius: 4px; padding: 5px 8px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.subjects button:hover { background: var(--gold-soft); }
.subjects button.on { background: var(--ink); color: #fff; }
.subjects .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.subjects button.on .n { color: var(--gold-line); }
select { width: 100%; padding: 7px 8px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; font-size: 14px; }
.years { display: flex; align-items: center; gap: 8px; }
.years span { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--rule); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.reset { background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 7px 12px; cursor: pointer; width: 100%; color: var(--ink-2); }
.reset:hover { border-color: var(--gold); }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); margin-bottom: 14px; min-height: 28px; }
.status strong { color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; }
.pill button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 5px; color: var(--muted); }

.cite-panel { background: #fff; border: 1px solid var(--gold-line); border-left: 4px solid var(--gold); border-radius: 6px; padding: 14px 16px; margin-bottom: 16px; }
.cite-panel h2 { font-family: var(--display); font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.cite-panel p { margin: 0; color: var(--ink-2); font-size: 14px; }

.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px 12px; }
.card:target { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180,131,56,.25); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cites { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.35; }
.cites .c { cursor: pointer; border-bottom: 1px dotted var(--gold); }
.cites .c:hover { color: var(--gold); }
.cites .sep { color: var(--muted); font-weight: 400; padding: 0 4px; }
.cites .nocite { color: var(--muted); font-weight: 400; font-style: italic; font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.badge { font-size: 11.5px; letter-spacing: .03em; border-radius: 4px; padding: 2px 8px; white-space: nowrap; border: 1px solid transparent; }
.b-acc { background: var(--ink); color: #fff; }
.b-com { background: #fff; color: var(--gold); border-color: var(--gold); }
.b-out { background: #f1efed; color: var(--ink-2); }
.b-ok { background: var(--green-soft); color: var(--green); }
.b-rev { background: #fff5e0; color: #8a5a00; border-color: #f0d9a8; }
.meta { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.meta .title { font-style: italic; }
.crumb { font-size: 12px; color: var(--gold); letter-spacing: .03em; margin-top: 6px; }
.crumb button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: inherit; }
.crumb button:hover { text-decoration: underline; }
.body { font-family: var(--serif); font-size: 15.5px; line-height: 1.6; margin-top: 8px; white-space: pre-line; color: #2c2829; }
.body.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.body mark, .meta mark, .cites mark { background: #fbe7b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.expand { border: 0; background: none; color: var(--gold); cursor: pointer; padding: 4px 0 0; font-size: 13px; }
.refs { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.refs:empty { display: none; }
.refrow { display: flex; flex-wrap: wrap; gap: 5px; align-items: baseline; font-size: 12.5px; }
.refrow .lbl { color: var(--muted); margin-right: 2px; min-width: 82px; }
.ref { border: 1px solid var(--rule); background: #fff; border-radius: 4px; padding: 1px 7px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.ref:hover { border-color: var(--gold); color: var(--ink); }
.ref.contra { border-color: #e6c1b8; color: var(--red); background: var(--red-soft); }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #f0edea; font-size: 12.5px; }
.act { border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 0; text-decoration: none; }
.act:hover { color: var(--gold); }
.id { margin-left: auto; color: #aaa3a3; font-variant-numeric: tabular-nums; }
.more { text-align: center; margin-top: 18px; }
.more button { border: 1px solid var(--ink); background: #fff; border-radius: 4px; padding: 9px 22px; cursor: pointer; }
.more button:hover { background: var(--ink); color: #fff; }
.empty { background: #fff; border: 1px dashed var(--rule); border-radius: 8px; padding: 28px; text-align: center; color: var(--ink-2); }

.foot { background: var(--ink); color: #d9d3d1; font-size: 13px; padding: 22px 0 26px; border-top: 3px solid var(--gold); }
.foot p { margin: 0 0 8px; max-width: 900px; }
.foot strong { color: #fff; }
.copy { color: #a39c9a; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 9; }

@media (max-width: 860px) {
  .wrap { padding: 0 14px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .masthead-title { text-align: left; }
  .brand-name { font-size: 19px; }
  .layout { grid-template-columns: 1fr; gap: 12px; padding-top: 14px; }
  .sidebar { position: static; max-height: none; overflow: visible; }
  .filters-toggle { display: block; width: 100%; padding: 10px; border: 1px solid var(--ink); background: #fff; border-radius: 4px; font-family: var(--display); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
  .filter-panel { display: none; padding-top: 14px; }
  .filter-panel.open { display: block; }
  .card-top { flex-direction: column; }
  .badges { justify-content: flex-start; }
}

@media print {
  .band, .searchbar, .sidebar, .actions, .expand, .more, .search-hint { display: none !important; }
  .layout { display: block; }
  .card { break-inside: avoid; border-color: #ccc; }
  .body.clamp { -webkit-line-clamp: unset; display: block; }
  .foot { background: none; color: #333; border: 0; }
}
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.act, a.act { color: var(--ink-2); font-size: 12.5px; }
