/* Абашево — the interface.
 *
 * The palette is sampled from the wordmark rather than chosen: oxblood #623830
 * on parchment #F2E1BA. Contrast measured, not assumed — ink on page is 9.16:1
 * and ink on parchment 7.64:1, both AAA.
 *
 * Parchment is the header band only. A full page of it behind dense Russian
 * prose is tiring and leaves nothing lighter to sit underneath, so the page is
 * the same hue lightened.
 *
 * Typefaces are self-hosted: this site serves an unpublished manuscript and
 * should not announce every page view to a font CDN, and the box should not
 * need outbound network access to render. Both have complete Cyrillic, which
 * eliminates most alternatives — the whole interface is Russian.
 */

/* Roboto Slab is variable, so one file per subset covers every weight. */
@font-face {
  font-family: "Roboto Slab"; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url("/static/fonts/robotoslab-var-cyrillic.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Roboto Slab"; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url("/static/fonts/robotoslab-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+2000-206F,U+2190-2193,U+2212;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ptserif-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ptserif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+2212;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/ptserif-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/ptserif-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+2212;
}
@font-face {
  font-family: "PT Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ptserif-400i-cyrillic.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "PT Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ptserif-400i-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+2212;
}

:root {
  --ink: #623830;
  --parchment: #F2E1BA;
  --page: #FBF6EC;
  --panel: #FFFDF7;
  --rule: #E4D6B8;
  --muted: #8A6A5E;          /* warm-biased, not a neutral grey */
  --flag: #B0791C;           /* needs attention */
  --ok: #4E6B3C;
  --idle: #948A7C;
  --shadow: rgba(98, 56, 48, .10);
  --slab: "Roboto Slab", Georgia, serif;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--serif); font-size: 16px; line-height: 1.55;
}

/* ── header ─────────────────────────────────────────────────────────────── */

.band { background: var(--parchment); border-bottom: 1px solid var(--rule); }
.band-in {
  max-width: 78rem; margin: 0 auto; padding: 1rem 1.5rem 0;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.25rem;
}
.mark { display: block; margin-bottom: .55rem; }
.mark img { display: block; height: 30px; width: auto; mix-blend-mode: multiply; }

nav.main { display: flex; gap: 1.35rem; flex: 1; flex-wrap: wrap; }
nav.main a {
  font-family: var(--slab); font-size: .9rem; color: var(--ink); text-decoration: none;
  padding: .35rem 0 .55rem; border-bottom: 2px solid transparent;
}
nav.main a:hover { border-bottom-color: color-mix(in srgb, var(--ink) 35%, transparent); }
nav.main a[aria-current] { border-bottom-color: var(--ink); font-weight: 600; }
.who { font-family: var(--slab); font-size: .8rem; color: var(--muted); padding-bottom: .65rem; }
.who a { color: var(--muted); }

main { max-width: 78rem; margin: 0 auto; padding: 1.75rem 1.5rem 5rem; }

h1 { font-family: var(--slab); font-size: 1.5rem; font-weight: 600; margin: 0 0 .3rem; }
h2 { font-family: var(--slab); font-size: 1.05rem; font-weight: 600; margin: 2rem 0 .5rem; }
.sub { color: var(--muted); margin: 0 0 1.5rem; font-size: .95rem; }

/* ── homepage counters ──────────────────────────────────────────────────── */

.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.counts a {
  display: block; text-decoration: none; color: inherit; text-align: center;
  border: 1px solid var(--rule); border-radius: 5px; padding: 1.4rem 1rem; background: var(--panel);
}
.counts a:hover { border-color: var(--ink); }
.counts b { display: block; font-family: var(--slab); font-size: 2.5rem; line-height: 1;
            font-weight: 600; font-variant-numeric: tabular-nums; }
.counts span { display: block; font-family: var(--slab); font-size: .88rem; margin-top: .45rem; }
.counts small { display: block; font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* ── tables ─────────────────────────────────────────────────────────────── */

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--rule);
         vertical-align: top; }
th { font-family: var(--slab); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase;
     color: var(--muted); font-weight: 600; white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--ink); }
tbody tr:hover { background: color-mix(in srgb, var(--parchment) 38%, transparent); }
td a { color: inherit; text-decoration: none; display: block; }
td a:hover { text-decoration: underline; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trunc { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { display: inline-block; font-family: var(--slab); font-size: .7rem; padding: .05rem .45rem;
        border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; }
.pill.flag { color: var(--flag); } .pill.ok { color: var(--ok); } .pill.idle { color: var(--idle); }

.tools { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.tools input[type="search"] {
  font: inherit; font-size: .9rem; padding: .35rem .6rem; border: 1px solid var(--rule);
  border-radius: 4px; background: var(--panel); color: inherit; min-width: 16rem;
}
.chip { font-family: var(--slab); font-size: .78rem; border: 1px solid var(--rule);
        border-radius: 12px; padding: .2rem .7rem; color: var(--muted); text-decoration: none; }
.chip[aria-pressed="true"] { border-color: var(--flag); color: var(--flag); }
.count { color: var(--muted); font-size: .85rem; }

/* ── record pages ───────────────────────────────────────────────────────── */

.rec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
            flex-wrap: wrap; margin-bottom: 1rem; }
.btn { font-family: var(--slab); font-size: .84rem; padding: .4rem .95rem; border-radius: 4px;
       cursor: pointer; border: 1px solid var(--ink); background: var(--ink); color: var(--page); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible { outline: 2px solid var(--flag); outline-offset: 2px; }

dl.fields { display: grid; grid-template-columns: 13rem 1fr; gap: 0 1.25rem; margin: 0; }
dl.fields dt { font-family: var(--slab); font-size: .78rem; color: var(--muted);
               padding: .5rem 0; border-bottom: 1px solid var(--rule); }
dl.fields dd { margin: 0; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.fld { display: block; width: 100%; font: inherit; font-size: .95rem; color: inherit;
       padding: .3rem .45rem; border: 1px solid var(--rule); border-radius: 3px;
       background: var(--page); }
textarea.fld { min-height: 6rem; resize: vertical; }

/* The source text. Same grey, and for the same stated reason, as the
   «Исходный текст (не изменять)» column in the workbook Olga already reviews. */
.src { background: color-mix(in srgb, var(--rule) 40%, transparent);
       border-left: 3px solid var(--rule); padding: .7rem .85rem; font-size: .88rem;
       color: var(--muted); border-radius: 0 3px 3px 0; white-space: pre-wrap; }

.note { background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--flag);
        border-radius: 0 4px 4px 0; padding: .6rem .8rem; margin: .5rem 0; font-size: .9rem; }
.empty { color: var(--muted); border: 1px dashed var(--rule); border-radius: 5px;
         padding: 1.75rem 1rem; text-align: center; font-size: .95rem; }
.flash { background: color-mix(in srgb, var(--flag) 12%, var(--panel));
         border: 1px solid var(--flag); border-radius: 4px; padding: .6rem .85rem;
         margin-bottom: 1rem; font-size: .92rem; }

/* ── correspondence, three columns ──────────────────────────────────────── */

.three { display: grid; grid-template-columns: 15rem 1fr 1fr; border: 1px solid var(--rule);
         border-radius: 6px; background: var(--panel); overflow: hidden; min-height: 26rem; }
.three > div { padding: .9rem 1rem; overflow-y: auto; max-height: 42rem; }
.three > div + div { border-left: 1px solid var(--rule); }
.mlist { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.mlist a { display: flex; gap: .5rem; align-items: baseline; padding: .3rem .35rem;
           border-radius: 3px; text-decoration: none; color: inherit; }
.mlist a:hover { background: color-mix(in srgb, var(--parchment) 40%, transparent); }
.mlist a[aria-current] { background: color-mix(in srgb, var(--parchment) 65%, transparent);
                         font-weight: 700; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; flex: none; translate: 0 -.1em; }
.msg { border-bottom: 1px solid var(--rule); padding: .6rem 0; font-size: .88rem; }
.msg header { font-family: var(--slab); font-size: .74rem; color: var(--muted);
              display: flex; justify-content: space-between; gap: .5rem; }
.msg .body { white-space: pre-wrap; margin-top: .35rem; max-height: 12rem; overflow: hidden; }
.msg.out { border-left: 3px solid var(--rule); padding-left: .6rem; }

@media (max-width: 900px) {
  .three { grid-template-columns: 1fr; }
  .three > div + div { border-left: 0; border-top: 1px solid var(--rule); }
  dl.fields { grid-template-columns: 1fr; }
  dl.fields dt { border-bottom: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
