/* Навигатор по Перечню ВАК — оформление.
   Палитра: холодная бумага + кармин (цвет типографской краски официальных
   изданий), шрифты: Golos Text (интерфейс), PT Serif (названия изданий),
   Roboto Mono (коды специальностей, ISSN, даты). */

:root {
  --ground: #eceef2;
  --panel: #ffffff;
  --panel-2: #f4f6f9;
  --ink: #14171c;
  --muted: #656d7b;
  --line: #d9dde4;
  --line-soft: #e8ebf0;
  --accent: #96182b;
  --accent-ink: #96182b;
  --accent-soft: #f7e8ea;
  --ok: #1f6b4e;
  --ok-soft: #e4f1ea;
  --gone: #8a5a12;
  --gone-soft: #f6eddc;
  --focus: #96182b;
  --radius: 5px;
  --shadow: 0 1px 1px rgba(20, 23, 28, .04);
  --ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #101318;
    --panel: #171b21;
    --panel-2: #1d222a;
    --ink: #e6e9ee;
    --muted: #98a1af;
    --line: #2a303a;
    --line-soft: #232830;
    --accent: #ef8394;
    --accent-ink: #ef8394;
    --accent-soft: #2c1a1e;
    --ok: #5cc294;
    --ok-soft: #14271f;
    --gone: #d6a45c;
    --gone-soft: #2a2114;
    --focus: #ef8394;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --ground: #101318;
  --panel: #171b21;
  --panel-2: #1d222a;
  --ink: #e6e9ee;
  --muted: #98a1af;
  --line: #2a303a;
  --line-soft: #232830;
  --accent: #ef8394;
  --accent-ink: #ef8394;
  --accent-soft: #2c1a1e;
  --ok: #5cc294;
  --ok-soft: #14271f;
  --gone: #d6a45c;
  --gone-soft: #2a2114;
  --focus: #ef8394;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------- шапка */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  color: var(--accent-ink);
  font: 600 14px/1 var(--ui);
  letter-spacing: .12em;
}
.topbar h1 {
  font-family: var(--serif);
  font-size: 18px; line-height: 1.15; font-weight: 700;
  text-wrap: balance;
}
.sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.sub b { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; gap: 8px; flex: none; }

button, select, input { font: inherit; color: inherit; }

.ghost {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.ghost.icon { padding: 7px 10px; }
.ghost.wide { width: 100%; }

/* ---------------------------------------------------------- макет */

.layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
  max-width: 1480px;
  margin: 0 auto;
}
.filters {
  position: sticky; top: 82px;
  display: flex; flex-direction: column; gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  max-height: calc(100vh - 102px);
  overflow: auto;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600;
}

input[type="search"], select {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
input[type="search"]:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }
.search-wrap { position: relative; }
.search-wrap kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 11px/1.4 var(--mono); color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px;
  background: var(--panel);
}
.search-wrap input:focus + kbd { display: none; }

.segmented {
  display: flex; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.segmented button {
  flex: 1; padding: 7px 4px; border: 0; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--muted);
}
.segmented button:hover { color: var(--accent-ink); }
.segmented button.on { background: var(--accent); color: #fff; font-weight: 500; }
:root[data-theme="dark"] .segmented button.on { color: #1a0d10; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented button.on { color: #1a0d10; }
}

.combo { position: relative; }
.options {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 300px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(15, 18, 24, .18);
}
.options div {
  padding: 7px 10px; cursor: pointer; font-size: 13.5px;
  border-bottom: 1px solid var(--line-soft);
}
.options div:last-child { border-bottom: 0; }
.options div:hover, .options div.hl { background: var(--accent-soft); }
.options .code {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--accent-ink); margin-right: 7px;
}
.options .cnt { float: right; font: 12px var(--mono); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 3px; padding: 3px 4px 3px 8px;
  font: 500 12.5px var(--mono);
}
.chip button {
  border: 0; background: none; cursor: pointer; color: inherit;
  font-size: 14px; line-height: 1; padding: 0 3px;
}

.branch-list { max-height: 232px; overflow: auto; padding-right: 4px; }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.check .n { margin-left: auto; font: 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.check.tiny { font-size: 12.5px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 0; border-top: 1px solid var(--line-soft); padding-top: 12px; }

/* ---------------------------------------------------------- результаты */

.results-bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.count { font-size: 13.5px; color: var(--muted); }
.count b { color: var(--ink); font-size: 19px; font-family: var(--mono); font-weight: 500; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sort select { width: auto; }

.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}
.card.dropped { border-left-color: var(--gone); }
.card-head { display: flex; gap: 12px; align-items: baseline; }
.num {
  flex: none; min-width: 46px;
  font: 12.5px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums;
}
.title {
  font-family: var(--serif); font-size: 16.5px; font-weight: 700; line-height: 1.25;
  cursor: pointer; text-wrap: pretty;
}
.title:hover { color: var(--accent-ink); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 9px 0 0 58px; }
.tag {
  font-size: 12px; padding: 2px 8px; border-radius: 3px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-soft);
}
.tag.issn { font-family: var(--mono); font-size: 11.5px; letter-spacing: -.01em; }
.tag.branch { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-weight: 500; }
.tag.old { background: var(--gone-soft); color: var(--gone); border-color: transparent; font-weight: 500; }
.tag.hit { box-shadow: 0 0 0 1px var(--accent); }

.specs-preview { margin: 9px 0 0 58px; color: var(--muted); font-size: 13px; }
.specs-preview .code {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); font-weight: 500;
}
.specs-preview .code.hit { background: var(--accent-soft); border-radius: 3px; padding: 1px 3px; }
.specs-preview a { text-decoration: none; border-bottom: 1px solid currentColor; }

.details { margin: 12px 0 0 58px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.group { margin-bottom: 14px; }
.group h4 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 500;
}
table.specs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.specs td { padding: 4px 10px 4px 0; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
table.specs tr:last-child td { border-bottom: 0; }
table.specs td.c {
  width: 1%; white-space: nowrap; font-family: var(--mono); font-size: 12.5px;
  color: var(--accent-ink); font-weight: 500; font-variant-numeric: tabular-nums;
}
table.specs td.b { width: 1%; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
table.specs tr.hit td { background: var(--accent-soft); }
.notes { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.links { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; margin-top: 12px; font-size: 13px; }
.links a { text-decoration: none; border-bottom: 1px solid var(--line); }
.links a:hover { border-bottom-color: currentColor; }
.links .page { font: 12px var(--mono); color: var(--muted); }
mark { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 2px; }

.more-wrap { margin: 16px 0 48px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.error {
  background: var(--gone-soft); color: var(--gone);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; line-height: 1.6;
}
.error code { font-family: var(--mono); font-size: 12.5px; background: var(--panel); padding: 1px 5px; border-radius: 3px; }

/* ---------------------------------------------------------- статистика */

dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
  max-width: 660px; width: calc(100% - 32px); padding: 22px;
}
dialog h2 { font-family: var(--serif); font-size: 20px; margin-bottom: 14px; }
dialog h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
dialog::backdrop { background: rgba(10, 12, 16, .55); }
dialog .close {
  position: absolute; right: 14px; top: 12px;
  border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px;
}
.stat-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.stat-row span:last-child { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 4px; border-radius: 2px; background: var(--accent); opacity: .75; }

/* ---------------------------------------------------------- категории */

.cat-list { display: flex; flex-direction: column; gap: 2px; }
.tag.cat {
  font: 600 11.5px var(--mono); letter-spacing: .02em;
  padding: 2px 7px; border-radius: 3px; border-color: transparent;
}
.tag.cat.c1 { background: var(--accent); color: #fff; }
.tag.cat.c2 { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px currentColor; }
.tag.cat.c3 { background: var(--panel-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag.cat.c0 { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
:root[data-theme="dark"] .tag.cat.c1 { color: #1a0d10; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.cat.c1 { color: #1a0d10; }
}
.tag.site {
  font-family: var(--mono); font-size: 11.5px; text-decoration: none;
  color: var(--accent-ink); background: var(--panel-2); border-color: var(--line);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag.site:hover { border-color: var(--accent); }
.tag.site::before { content: "↗ "; opacity: .6; }
.tag.site.pub { color: var(--muted); }
.tag.site.pub::before { content: "↗ "; opacity: .4; }

.cat-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 0 12px; font-size: 13px; color: var(--muted);
}
.warn-note { color: var(--gone); background: var(--gone-soft); border-radius: 3px; padding: 1px 7px; font-size: 12px; }

/* ---------------------------------------------------------- правовые документы */

.doc {
  max-width: 74ch;
  margin: 0 auto;
  padding: 28px 20px 56px;
  font-size: 14.5px;
  line-height: 1.65;
}
.doc h1 { font-family: var(--serif); font-size: 24px; line-height: 1.2; margin-bottom: 6px; text-wrap: balance; }
.doc-back { margin: 0 0 22px; font-size: 13px; }
.doc-back a, .doc a { color: var(--accent-ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.doc a:hover { border-bottom-color: currentColor; }
.doc-date { margin: 0 0 22px; color: var(--muted); font-size: 12.5px; }
.doc ol { padding-left: 22px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.doc li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.doc b { font-weight: 600; }
.doc-owner { margin: 22px 0 0; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------- подвал */

.site-footer {
  max-width: 1480px;
  margin: 8px auto 0;
  padding: 18px 20px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.site-footer p { margin: 0 0 8px; max-width: 78ch; }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer b { color: var(--ink); font-weight: 600; }
.site-footer a { color: var(--accent-ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.site-footer a:hover { border-bottom-color: currentColor; }
.site-footer .versions { font-size: 12px; }
.site-footer .legal { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .filters { position: static; max-height: none; }
  .meta, .specs-preview, .details { margin-left: 0; }
  .topbar { flex-wrap: wrap; }
  .topbar h1 { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.options .none { color: var(--muted); font-size: 12.5px; cursor: default; }
.options .none:hover { background: transparent; }
