/* «Говорящий архив», дизайн v3 «Эпоха»: русская книжная печать 1880–1900-х. Одна гарнитура — Old Standard TT
   («обыкновенная» гарнитура изданий конца XIX века, файлы в app/fonts), выделения разрядкой и курсивом, а не жирным;
   бумага верже (тонкие горизонтальные линии и редкие вертикальные понтюзо), чернила железо-галловые, сургуч — единственный цвет;
   линейки толстая-тонкая у шапки и подвала, звёздочки ⁂ вместо разделителей, портрет как кабинетная карточка.
   Разворот академического издания сохранён: набор посередине, аппарат (источники) в правом поле, пометы в левом.
   Тёмная тема («при лампе») только по выбору посетителя (data-theme="dark" на <html>). */

:root {
  --paper: #f1e9d8;
  --paper-2: #e5dbc4;
  --ink: #27211a;
  --ink-2: #5a4d3f;
  --ink-3: #665a4c; /* контраст на бумаге 5.5:1, на --paper-2 4.9:1 (было 4.97 / 4.36) */
  --accent: #8e2a1c;
  --accent-ink: #f6efe0;
  --rule: rgba(39, 33, 26, 0.22);
  --rule-2: rgba(39, 33, 26, 0.5);
  --hatch: rgba(39, 33, 26, 0.36);
  --dim: rgba(39, 33, 26, 0.45);
  --lamp: none;
  /* бумага верже: линии через 4px и понтюзо через 28px, едва заметные */
  --laid: repeating-linear-gradient(0deg, rgba(39, 33, 26, 0.045) 0 1px, transparent 1px 4px),
          repeating-linear-gradient(90deg, rgba(39, 33, 26, 0.03) 0 1px, transparent 1px 28px);
  /* карандаш редактора: рисованная линия цветом сургуча */
  --pencil: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'><path d='M0 3.2C10 1.4 20 4.6 30 3S50 1.6 60 3.2 80 4.8 90 3.2 110 1.4 120 3' fill='none' stroke='%238e2a1c' stroke-width='1.9' stroke-linecap='round' opacity='.9'/></svg>");
  --pencil-dash: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'><path d='M0 3.2C10 1.4 20 4.6 30 3S50 1.6 60 3.2 80 4.8 90 3.2 110 1.4 120 3' fill='none' stroke='%238e2a1c' stroke-width='1.9' stroke-linecap='round' stroke-dasharray='7 5' opacity='.9'/></svg>");
  --serif: "Old Standard TT", "Times New Roman", Georgia, "Liberation Serif", serif;
  --sans: "Old Standard TT", "Times New Roman", Georgia, "Liberation Serif", serif; /* вся служебная типографика тоже антиквой: гротеск в книгах того времени не встречался */
  --mono: ui-monospace, Consolas, Menlo, "Liberation Mono", monospace;
  --page: 1320px;
  --gutter: 32px;
  --col-margin: 200px;
  --col-addr: 240px; /* v4: колонка адресата на главной */
  --col-notes: 320px;
  --gap: 48px;
  --measure: 680px;
  --density-h: 56px;
  --dur: 240ms;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #1d1813;
  --paper-2: #2b2419;
  --ink: #eadcc3;
  --ink-2: #c3b29a;
  --ink-3: #b09f87; /* контраст на тёмной бумаге 6.8:1 (было 6.3) */
  --accent: #e0896d;
  --accent-ink: #1d1813;
  --rule: rgba(234, 220, 195, 0.24);
  --rule-2: rgba(234, 220, 195, 0.45);
  --hatch: rgba(234, 220, 195, 0.34);
  --dim: rgba(0, 0, 0, 0.55);
  --laid: repeating-linear-gradient(0deg, rgba(234, 220, 195, 0.035) 0 1px, transparent 1px 4px),
          repeating-linear-gradient(90deg, rgba(234, 220, 195, 0.02) 0 1px, transparent 1px 28px);
  --pencil: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'><path d='M0 3.2C10 1.4 20 4.6 30 3S50 1.6 60 3.2 80 4.8 90 3.2 110 1.4 120 3' fill='none' stroke='%23e38d74' stroke-width='1.9' stroke-linecap='round' opacity='.9'/></svg>");
  --pencil-dash: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'><path d='M0 3.2C10 1.4 20 4.6 30 3S50 1.6 60 3.2 80 4.8 90 3.2 110 1.4 120 3' fill='none' stroke='%23e38d74' stroke-width='1.9' stroke-linecap='round' stroke-dasharray='7 5' opacity='.9'/></svg>");
  --lamp: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 196, 120, 0.07), transparent 100%);
  color-scheme: dark;
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image: var(--lamp), var(--laid);
  background-attachment: fixed, scroll;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  font-kerning: normal;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 36px; font-weight: 400; line-height: 1.15; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 10px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.cap { font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.textbtn { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; min-height: 40px; display: inline-flex; align-items: center; color: var(--ink-2); }
.textbtn:hover { color: var(--ink); text-decoration-color: var(--accent); }
.btn { background: var(--accent); color: var(--accent-ink); border-radius: 0; padding: 12px 24px; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; min-height: 44px; display: inline-flex; align-items: center; outline: 1px solid var(--accent); outline-offset: 2px; }
.btn:hover { filter: brightness(0.9); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.btn[disabled] { opacity: 0.5; cursor: default; filter: none; }
.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- Шапка и подвал ---------- */
.top { border-bottom: 1px solid var(--rule-2); box-shadow: 0 3px 0 0 var(--paper), 0 5px 0 0 var(--rule-2); position: relative; z-index: 1; }
/* шапка как титул журнала 1890-х: название разрядкой по центру, под ним подзаголовок курсивом и строка разделов через точки */
.top .wrap { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; padding-top: 22px; padding-bottom: 10px; }
.brand { text-decoration: none; display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1.15; min-height: 40px; }
.brand b { font-family: var(--serif); font-weight: 700; font-size: 24px; letter-spacing: 0.24em; text-transform: uppercase; margin-right: -0.24em; }
.brand span { font-size: 15px; font-style: italic; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.02em; }
.nav { display: flex; gap: 0; margin: 10px 0 0; justify-content: center; flex-wrap: wrap; }
.nav a { position: relative; text-decoration: none; padding: 6px 16px; color: var(--ink-2); min-height: 36px; display: inline-flex; align-items: center; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }
.nav a + a::before { content: "·"; position: absolute; left: -3px; top: 50%; transform: translateY(-50%); color: var(--ink-3); letter-spacing: 0; }
.nav a > span { border-bottom: 1px solid transparent; padding-bottom: 1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] > span { border-bottom-color: var(--accent); }
/* переключатель собеседника — визитка в правом поле шапки: медальон, имя, годы жизни, сургучная стрелка;
   список — лист той же бумаги с двойной рамкой. Есть, только если видимых героев в authors.json больше одного. */
.top .wrap { position: relative; }
.top.picking { z-index: 20; }
.author-switch { position: absolute; right: var(--gutter); top: 18px; text-align: left; }
.author-switch[hidden] { display: none; }
.as-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 10px 5px 6px; border: 1px solid transparent; color: var(--ink); text-align: left; }
.as-btn:hover { border-color: var(--rule); }
.as-btn[aria-expanded="true"] { border-color: var(--rule-2); background: var(--paper-2); }
.as-btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }
.as-thumb, .as-list img { flex: none; object-fit: cover; object-position: 50% 30%; border-radius: 50%; border: 1px solid var(--rule-2); outline: 1px solid var(--rule); outline-offset: 2px; background: var(--paper-2); }
.as-thumb { width: 36px; height: 45px; }
.as-text { display: flex; flex-direction: column; line-height: 1.2; }
.as-cap { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.as-name { font-size: 16px; margin-top: 1px; }
.as-years { font-size: 13px; font-style: italic; color: var(--ink-3); }
.as-caret { width: 0; height: 0; margin-left: 4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--accent); transition: transform var(--dur); }
.as-btn[aria-expanded="true"] .as-caret { transform: rotate(180deg); }
.as-list { position: absolute; z-index: 5; right: 0; top: calc(100% + 8px); width: 330px; margin: 0; padding: 4px 0; list-style: none; text-align: left; background-color: var(--paper); background-image: var(--laid); border: 1px solid var(--rule-2); outline: 1px solid var(--rule); outline-offset: 3px; }
.as-list[hidden] { display: none; }
.as-list li { position: relative; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 16px 8px 18px; cursor: pointer; }
.as-list li + li { border-top: 1px dotted var(--rule); }
.as-list li:hover, .as-list li:focus { background: var(--paper-2); outline: none; }
.as-list li:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.as-list li[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; border-left: 2px solid var(--accent); }
.as-list img { width: 40px; height: 50px; }
.as-list b { display: block; font-weight: 400; font-size: 17px; line-height: 1.25; }
.as-list i { display: block; font-size: 14px; color: var(--ink-3); }
/* узкий планшет: от визитки остаются медальон и стрелка (имя — в подписи кнопки), чтобы не наехать на название сайта */
@media (min-width: 760px) and (max-width: 859px) {
  .as-text { display: none; }
}

.main { flex: 1; width: 100%; max-width: var(--page); margin: 0 auto; padding: 40px var(--gutter) 80px; }
.foot { border-top: 2px solid var(--rule-2); box-shadow: 0 -3px 0 0 var(--paper), 0 -4px 0 0 var(--rule-2); margin-top: 8px; }
/* подвал как колофон в конце тома: концовка ⁂, текст по центру петитом */
.foot .wrap { padding-top: 22px; padding-bottom: 36px; color: var(--ink-3); font-size: 14px; text-align: center; }
.foot .wrap::before { content: "⁂"; display: block; font-size: 20px; line-height: 1; color: var(--ink-3); margin-bottom: 16px; }
.foot p { max-width: 640px; margin: 0 auto; }
.foot .switches { margin-top: 10px; }
.foot .switches button { color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; min-height: 40px; }
.foot .switches button:hover { color: var(--ink); text-decoration-color: var(--accent); }

/* ---------- Загрузка ---------- */
.loading { position: fixed; inset: 0; background: var(--paper); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.loading[hidden] { display: none; }
.loading p { font-family: var(--serif); font-size: 21px; text-align: center; }
.loading b { display: block; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; font-size: 20px; }
.loading span { display: block; margin-top: 6px; font-family: var(--sans); font-size: 15px; }

/* ---------- Сцена даты ---------- */
/* v4: сверху шкала жизни (выбор даты), ниже «стол»: адресат | письмо и переписка | источники */
.home { display: block; }
.stage { margin-bottom: 28px; }
.stage-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 24px; margin-bottom: 4px; }
.stage-head .cap { margin: 0; }
.desk { display: grid; grid-template-columns: var(--col-addr) minmax(0, 1fr) var(--col-notes); column-gap: var(--gap); align-items: start; padding-top: 32px; border-top: 1px solid var(--rule-2); box-shadow: 0 -3px 0 0 var(--paper), 0 -4px 0 0 var(--rule); }
.addressee { position: sticky; top: 20px; min-width: 0; }
.addressee > .cap { text-align: center; margin-bottom: 12px; }
.portrait { margin: 0; width: 100%; }
.portrait .plate { position: relative; width: 100%; padding: 7px; border: 1px solid var(--rule-2); outline: 1px solid var(--rule); outline-offset: 3px; background: var(--paper-2); }
.portrait .plate[hidden] { display: none; }
.portrait .plate img { display: block; width: 100%; height: auto; }
.portrait figcaption { margin-top: 10px; font-size: 14px; font-style: italic; text-align: center; color: var(--ink-2); line-height: 1.4; }
.portrait figcaption .muted { display: block; margin-top: 2px; font-size: 13px; font-style: normal; }
.portrait .fade { animation: fade var(--dur) ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.when { margin-top: 18px; text-align: center; }
.who-name { font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.now-date { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.12; letter-spacing: 0; margin-top: 6px; text-wrap: balance; }
.now-place { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ink-2); margin-top: 4px; }
.now-place b { font-style: normal; font-weight: 400; color: var(--ink); }
.knows { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.45; color: var(--ink-3); }
.knows b { font-weight: 400; color: var(--ink); }
.date-field { position: relative; display: inline-flex; align-items: baseline; gap: 10px; font-size: 15px; color: var(--ink-3); }
.date-field input { border: 0; border-bottom: 1px solid var(--rule-2); border-radius: 0; background: transparent; padding: 6px 0; font-size: 15px; color: var(--ink); min-height: 40px; width: 7.5em; font-variant-numeric: tabular-nums; }
.date-field input:focus { border-bottom-color: var(--accent); outline: none; }
.date-field input[aria-invalid="true"] { border-bottom: 2px solid var(--accent); padding-bottom: 5px; }
.date-hint { position: absolute; right: 0; top: 100%; margin-top: 2px; z-index: 3; padding: 2px 6px; background: var(--paper); border: 1px solid var(--rule); font-size: 15px; color: var(--accent); white-space: nowrap; }
.date-hint[hidden] { display: none; }

.timeline { position: relative; user-select: none; touch-action: none; }
.density { position: relative; height: var(--density-h); }
/* гистограмма писем — как гравированный профиль: сплошная штриховка горизонтальными линиями и обводка по верху, без просветов между годами */
.density .yr { position: absolute; bottom: 0; box-sizing: border-box; border-top: 1px solid var(--rule-2); background: repeating-linear-gradient(to top, var(--hatch) 0 1px, transparent 1px 3px); }
.axis { position: relative; height: 22px; border-top: 1px solid var(--rule-2); }
.axis .tick { position: absolute; top: -1px; width: 1px; height: 5px; background: var(--rule-2); }
.axis .tick.big { height: 9px; }
.axis .yl { position: absolute; top: 6px; transform: translateX(-50%); font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.axis .yl.end { transform: translateX(-100%); }
.lrow { position: relative; height: 18px; z-index: 2; }
.lrow.under + .lrow.under { z-index: 1; }
.lrow .lbl { position: absolute; bottom: 0; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; line-height: 1; padding: 0 3px; background: var(--paper); }
.lrow .lbl.c { transform: translateX(-50%); }
.lrow .lbl.r { transform: translateX(-100%); margin-left: 3px; }
.lrow .lbl.l { margin-left: -3px; }
.lrow.under .lbl { top: 2px; bottom: auto; }
.lrow.under .lbl::before { content: ""; position: absolute; left: 50%; bottom: 100%; height: 4px; border-left: 1px solid var(--rule-2); }
.lrow.under .lbl.l::before { left: 3px; }
.lrow.under .lbl.r::before { left: auto; right: 3px; }
.lrow.under + .lrow.under .lbl::before { height: 18px; }
.lane { position: relative; height: 28px; }
.lane.lived { margin-top: 2px; }
.lane .seg { position: absolute; top: 2px; bottom: 2px; border: 1px solid var(--rule-2); min-width: 2px; }
.lane .seg span { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); white-space: nowrap; max-width: calc(100% - 12px); overflow: hidden; font-size: 15px; color: var(--ink-2); line-height: 1; }
.lane .seg.cur { background: var(--paper-2); }
.lane .seg.cur span { color: var(--ink); }
.lane .seg.bio { border-style: dashed; }
/* поездки — штрихованная полоса между двумя волосяными линиями, как закраска на карте; без рамки-«ящика» */
.lane.trips .seg { border-width: 1px 0; border-color: var(--rule); background: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 5px); }
.lane.trips .seg.dotted { border-style: dotted; border-width: 1px; background: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 8px); }
.lane.trips .seg span { background: var(--paper); padding: 2px 4px; left: 5px; }
.lane.trips .seg.cur span { background: var(--paper-2); }
/* месяцы с письмами из другого места — тонкие вертикальные штрихи, а не чёрные бруски: на полном корпусе их сотни, и бруски сливались в штрихкод */
.lane .seg.mark { top: 7px; bottom: 7px; border: 0; background: repeating-linear-gradient(90deg, var(--hatch) 0 1px, transparent 1px 3px); }
.lane .seg.mark.cur { background: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 3px); }
.marker { position: absolute; top: 0; bottom: 36px; width: 0; border-left: 1px solid var(--accent); pointer-events: none; transition: left 160ms ease-out; }
.marker .knob { position: absolute; top: calc(var(--density-h) - 20px); left: -20px; width: 40px; height: 40px; pointer-events: auto; cursor: grab; }
.marker .knob::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px; background: var(--accent); border-radius: 50%; }
.legend { margin-top: 10px; font-size: 15px; color: var(--ink-3); line-height: 1.5; }
.presets { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; font-size: 15px; }
.presets .cap { margin-right: 4px; }
.presets button { color: var(--ink-2); padding: 9px 0; min-height: 40px; min-width: 40px; text-align: left; border-bottom: 2px solid transparent; }
.presets button:hover { color: var(--ink); }
.presets button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Переписка ---------- */
.letters { display: flex; flex-direction: column; min-width: 0; }
.letters.fresh .compose { order: -1; } /* пока переписки нет, лист письма первым; потом — под перепиской, как следующее письмо */
.thread { min-width: 0; }
.letters.fresh .thread { margin-top: 44px; }
.letters.fresh .thread::before { content: "⁂"; display: block; text-align: center; font-size: 22px; line-height: 1; color: var(--ink-3); margin-bottom: 28px; max-width: var(--measure); }
.compose { min-width: 0; }
.sources { position: sticky; top: 20px; min-width: 0; }
.desk .sheet .tag { position: static; width: auto; margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.desk .sheet .tag b { display: inline; margin: 0; }
.desk .sheet .tag i { display: inline; }
.thread > .lead { max-width: var(--measure); font-size: 15px; color: var(--ink-2); margin-bottom: 28px; }
.sheet { position: relative; max-width: var(--measure); margin: 0 0 56px; }
.sheet .tag { position: absolute; left: calc(-1 * (var(--col-margin) + var(--gap))); width: var(--col-margin); top: 0.35em; font-family: var(--sans); font-size: 15px; color: var(--ink-3); line-height: 1.45; }
.sheet .tag b { display: block; color: var(--ink-2); font-weight: 400; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12.5px; margin-bottom: 2px; }
.sheet .tag i { display: block; font-style: normal; }
.sheet.his { font-family: var(--serif); font-size: 21px; line-height: 1.5; }
.sheet.his .meta { font-family: var(--sans); font-size: 15px; color: var(--ink-3); margin-bottom: 8px; }
.sheet.his .dateline { text-align: right; font-style: italic; color: var(--ink-2); margin-bottom: 20px; font-size: 0.86em; }
.sheet.his .salute { margin-bottom: 0.5em; }
/* набор как в книге — но флаговый: выключка по формату без словаря переносов (headless Chromium, часть браузеров) даёт «реки»;
   переносы включены там, где словарь есть (lang="ru"), и text-wrap: pretty против коротких висячих строк */
.sheet.his .body p { margin: 0; text-indent: 1.5em; hanging-punctuation: first; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; }
.sheet.his .body p:first-child { text-indent: 0; }
.sheet.his .sign { text-align: right; margin-top: 0.9em; font-style: italic; }
/* мелкая строка под подписью: снимок письма без шапки и пометы не выдаст ответ модели за подлинное письмо */
.sheet.his .made { text-align: right; margin-top: 0.35em; font-family: var(--sans); font-size: 13.5px; font-style: italic; line-height: 1.4; color: var(--ink-3); }
.sheet.his .more { font-family: var(--sans); font-size: 15px; margin-top: 16px; }
.sheet .colophon { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 15px; color: var(--ink-3); }
.sheet.mine { font-family: var(--serif); font-size: 18px; line-height: 1.5; max-width: 560px; color: var(--ink-2); padding-bottom: 32px; }
.sheet.mine .body p { margin: 0; text-indent: 1.5em; }
.sheet.mine .body p:first-child { text-indent: 0; }
.sheet.mine .meta { font-family: var(--sans); font-size: 15px; color: var(--ink-3); margin-bottom: 10px; }
.sheet.mine + .sheet.his::before { content: "⁂"; display: block; text-align: center; font-size: 22px; line-height: 1; color: var(--ink-3); margin: 0 0 36px; }
.sheet.note { font-family: var(--serif); font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 560px; }
.sheet.note p + p { margin-top: 0.6em; }
.status { font-family: var(--serif); font-size: 18px; line-height: 1.6; max-width: 560px; margin-bottom: 56px; }
.status li { list-style: none; color: var(--ink-3); }
.status li.live { color: var(--ink); font-style: italic; }
.status ol { margin: 0; padding: 0; }
.status .lead { font-family: var(--sans); font-size: 15px; color: var(--ink-3); margin-bottom: 8px; }
.sheet.appear { animation: appear var(--dur) ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* знаки ссылок: дословно — подчёркивание только у активной; почти — пунктир всегда; не найдено — перечёркнут */
.cite { position: relative; font-family: var(--serif); font-weight: 700; font-size: 0.66em; vertical-align: super; line-height: 0; color: var(--accent); text-decoration: none; margin: 0 -18px; padding: 14px 18px; }
.cite::after { content: ""; position: absolute; left: 17px; right: 17px; bottom: 11px; border-bottom: 1.5px solid transparent; }
.cite:hover::after, .cite.active::after { border-bottom-color: currentColor; }
.cite.near::after { border-bottom-style: dashed; border-bottom-color: currentColor; }
.cite.short::after { border-bottom-style: dotted; border-bottom-color: currentColor; } /* короткая цитата: дословно, но подтверждение слабое */
.cite.bad { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 2px; }
.cite.active::after { border-bottom-width: 2px; border-bottom-style: solid; }

/* ---------- Аппарат: на что он опирался ---------- */
/* аппарат: как примечания в конце тома — рубрика разрядкой, номера-«звёздочки» сургучом, имя адресата, библиография петитом */
.sources h2 { font-size: 13px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--rule-2); }
.sources .lead { font-size: 15px; color: var(--ink-3); margin-bottom: 18px; }
.sources .cap { margin: 24px 0 2px; color: var(--ink-2); }
.src-list { list-style: none; margin: 0; padding: 0; }
.src { position: relative; padding: 14px 0 14px 26px; border-top: 1px solid var(--rule); }
.src:last-child { border-bottom: 1px solid var(--rule); }
.src .n { position: absolute; left: 0; top: 13px; font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1; color: var(--accent); }
.src.bad .n { color: var(--ink-3); text-decoration: line-through; }
.src.active::before { content: ""; position: absolute; left: 0; top: -1px; bottom: -1px; border-left: 2px solid var(--accent); }
.src.active .n { left: 8px; }
.src .who { font-size: 16px; font-weight: 400; color: var(--ink); }
.src .meta { font-size: 14px; color: var(--ink-3); margin-top: 1px; }
.src .ctx { font-family: var(--serif); font-size: 16px; line-height: 1.55; margin: 8px 0 6px; color: var(--ink-2); text-indent: 1.2em; }
.src .verdict { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 16px; font-style: italic; }
.src .verdict a { font-style: normal; }
.src .verdict a { color: var(--ink-3); }
.src .verdict .pair { color: var(--ink-3); }
.src .verdict .short-note { color: var(--ink-3); }
.quote { color: var(--ink); background-image: var(--pencil); background-repeat: repeat-x; background-position: 0 100%; background-size: 120px 6px; padding-bottom: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.quote.near { background-image: var(--pencil-dash); }
.quote.bad { background: none; text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--ink-3); color: var(--ink-2); }
.quote .diff { outline: 1px dashed var(--accent); outline-offset: 1px; white-space: nowrap; }
.quote .ref { font-family: var(--serif); font-weight: 700; font-size: 0.62em; vertical-align: super; line-height: 0; color: var(--accent); margin-left: 2px; }
.sources details { margin-top: 20px; font-size: 15px; }
.sources summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 40px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary:hover { color: var(--ink); text-decoration-color: var(--accent); }
.sources details[open] summary { color: var(--ink); }
/* ход поиска — как ведомость: антиква, глаголы разрядкой в поле слева, без моноширинного шрифта терминала */
.trace ol { margin: 8px 0 0; padding: 0; font-family: var(--serif); font-size: 15px; line-height: 1.5; color: var(--ink-2); list-style: none; counter-reset: step; }
.trace li { position: relative; padding: 4px 0 4px 1.6em; border-top: 1px dotted var(--rule); }
.trace li::before { counter-increment: step; content: counter(step) "."; position: absolute; left: 0; top: 4px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.trace li:last-child { border-bottom: 1px dotted var(--rule); }
.trace .k { color: var(--ink-3); font-style: italic; }
.trace .q { color: var(--ink); font-style: normal; }
.trace li.live { font-style: italic; color: var(--ink); }
.trace .note { margin-top: 8px; font-size: 14px; color: var(--ink-3); font-style: italic; }
.read-list .src { padding-left: 0; }
.read-list .src .ctx { color: var(--ink-2); }

/* ---------- Форма письма ---------- */
.compose { max-width: var(--measure); padding: 22px 28px 20px; margin-top: 8px; border: 1px solid var(--rule-2); outline: 1px solid var(--rule); outline-offset: 3px; background: var(--paper); background-image: var(--laid); }
.letters:not(.fresh) .compose { margin-top: 0; }
/* форма — лист почтовой бумаги: рубрика, строка адресата, текст на линованной бумаге, подпись справа внизу */
.compose .head { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; align-items: baseline; margin-bottom: 16px; }
.compose .head h2 { font-size: 13px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.compose .head .to { font-size: 16px; color: var(--ink-2); }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 15px; font-style: italic; color: var(--ink-3); margin-bottom: 4px; }
.field input, .field textarea { display: block; width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rule-2); border-radius: 0; padding: 8px 0; color: var(--ink); min-height: 40px; }
.field input { max-width: 320px; }
.field input[type="search"] { -webkit-appearance: none; appearance: none; }
.field input[type="search"]::-webkit-search-cancel-button, .field input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.field textarea { font-family: var(--serif); font-size: 18px; line-height: 28px; min-height: 176px; padding: 4px 0 8px; border-bottom: 0; resize: none; field-sizing: content; max-height: 60vh; background-image: repeating-linear-gradient(to bottom, transparent 0 27px, var(--rule) 27px 28px); background-attachment: local; background-position: 0 4px; }
.field textarea:focus { border-bottom: 0; padding-bottom: 8px; background-image: repeating-linear-gradient(to bottom, transparent 0 27px, var(--rule-2) 27px 28px); }
.field.sign { margin: 0 0 16px auto; width: 320px; max-width: 100%; text-align: right; }
.field.sign input { text-align: right; margin-left: auto; }
.field input:focus, .field textarea:focus { outline: none; border-bottom: 2px solid var(--accent); padding-bottom: 7px; }
.field textarea:focus { border-bottom: 0; padding-bottom: 8px; }
.field textarea:focus-visible { outline: 1px dashed var(--accent); outline-offset: 6px; } /* видимый фокус с клавиатуры, без второй красной черты */ /* у линованного листа фокус — потемневшие линейки, без второй красной черты */
.field ::placeholder { color: var(--ink-3); opacity: 1; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.starters { margin: 14px 0 0; padding-top: 6px; border-top: 1px dotted var(--rule); font-size: 15px; }
.starters summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 40px; color: var(--ink-2); font-style: italic; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.starters summary::-webkit-details-marker { display: none; }
.starters summary:hover { color: var(--ink); text-decoration-color: var(--accent); }
.starters ul { list-style: none; margin: 4px 0 0; padding: 0; columns: 2; column-gap: 32px; }
.starters li { break-inside: avoid; }
/* подсказки — реплики с тире, как в книге: «— Как Ваше здоровье?» */
.starters button { text-align: left; color: var(--ink-2); padding: 8px 0 8px 1.1em; min-height: 40px; display: block; line-height: 1.35; position: relative; }
.starters button::before { content: "—"; position: absolute; left: 0; top: 8px; color: var(--accent); }
.starters button:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.actions .hint { font-size: 14px; font-style: italic; color: var(--ink-3); max-width: 420px; }
.notice { font-size: 15px; color: var(--ink-2); padding: 10px 0 10px 16px; border-left: 2px solid var(--accent); margin: 0 0 20px; max-width: 520px; line-height: 1.5; }
.notice[hidden] { display: none; }
.notice b { font-weight: 400; color: var(--ink); }

/* ---------- Шторка с письмом ---------- */
.drawer { position: fixed; inset: 0; z-index: 30; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--dim); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100%); background: var(--paper); background-image: var(--laid); border-left: 1px solid var(--rule-2); box-shadow: -3px 0 0 0 var(--paper), -5px 0 0 0 var(--rule-2); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px 48px 12px; border-bottom: 1px solid var(--rule-2); }
.drawer-head .cap { margin: 0; }
.drawer-head button { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; min-height: 40px; }
.drawer-head button:hover { color: var(--ink); text-decoration-color: var(--accent); }
.drawer-body { padding: 32px 48px 56px; overflow: auto; }
.letter { font-family: var(--serif); font-size: 18px; line-height: 1.55; max-width: 600px; }
.letter h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 8px; }
.letter .meta { font-family: var(--sans); font-size: 15px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 22px; }
.letter .meta a { color: var(--ink-2); }
.letter .dateline { text-align: right; font-style: italic; color: var(--ink-2); margin-bottom: 16px; }
.letter .body p { margin: 0; text-indent: 1.5em; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; }
.letter .body p:first-of-type { text-indent: 0; }
.letter .apparatus { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 15px; color: var(--ink-2); }
.letter .apparatus p + p { margin-top: 6px; }
.letter .apparatus .n { font-family: var(--serif); font-weight: 700; color: var(--accent); margin-right: 6px; }

/* ---------- Архив ---------- */
.archive { display: grid; grid-template-columns: 300px minmax(0, 1fr); column-gap: var(--gap); align-items: start; }
.filters h1 { font-size: 28px; margin-bottom: 20px; }
.filters .field { margin-bottom: 22px; }
.filters select { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rule-2); padding: 8px 0; color: var(--ink); min-height: 40px; border-radius: 0; }
.filters .only-phone { display: none; }
.filters .years { display: flex; align-items: flex-end; height: 56px; margin-top: 8px; }
.filters .years button { flex: 1 1 0; margin: 0; padding: 0; border-top: 1px solid var(--rule-2); background: repeating-linear-gradient(to top, var(--hatch) 0 1px, transparent 1px 3px); min-width: 0; min-height: 4px; }
.filters .years button:hover { background: var(--rule-2); }
.filters .years button[aria-pressed="true"] { background: var(--accent); border-top-color: var(--accent); }
.filters .ylabels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--rule-2); padding-top: 4px; margin-bottom: 4px; }
.filters .yhint { font-size: 15px; color: var(--ink-2); margin: 2px 0 22px; min-height: 40px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filters .yhint b { font-weight: 400; }
.results .stats { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; color: var(--ink-3); padding-bottom: 10px; border-bottom: 1px solid var(--rule-2); margin-bottom: 4px; }
.results .stats b { color: var(--ink); font-weight: 400; }
.results .empty { font-family: var(--serif); font-size: 18px; color: var(--ink-2); padding: 24px 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.row .date { font-family: var(--serif); font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1.5; }
.row .date small { display: block; font-family: var(--sans); font-size: 12.5px; color: var(--ink-3); }
.row .who { font-size: 15px; font-weight: 400; }
.row .who small { font-weight: 400; color: var(--ink-3); margin-left: 10px; font-size: 15px; }
.row .who a { text-decoration: none; }
.row .who a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.row .snip { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink-2); margin-top: 4px; max-width: 720px; }
.row .snip mark { background: none; color: var(--ink); font-weight: 700; }
.pager { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 28px 0 0; font-size: 15px; color: var(--ink-3); }
.pager button { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; min-height: 40px; }
.pager button:hover { color: var(--ink); text-decoration-color: var(--accent); }
.pager button[disabled] { color: var(--ink-3); text-decoration: none; cursor: default; }

/* ---------- О проекте ---------- */
.about { display: grid; grid-template-columns: var(--col-margin) minmax(0, var(--measure)); column-gap: var(--gap); }
.about > * { grid-column: 2; }
.about h1 { margin-bottom: 20px; }
.about .intro { font-family: var(--serif); font-size: 21px; line-height: 1.5; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; }
.about .intro p + p { margin-top: 0.7em; }
.about h2 { margin: 56px 0 16px; }
.about .text { font-family: var(--serif); font-size: 18px; line-height: 1.55; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; }
.about .text p + p, .about .text li + li { margin-top: 0.6em; }
.about .text ol { padding-left: 1.3em; margin: 0; }
.about .rules { list-style: none; margin: 0; padding: 0; }
.about .rule { position: relative; font-family: var(--serif); font-size: 18px; line-height: 1.55; padding: 18px 0; border-top: 1px solid var(--rule); hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; }
.about .rule:last-child { border-bottom: 1px solid var(--rule); }
.about .rule .num { position: absolute; left: calc(-1 * (var(--col-margin) + var(--gap))); width: var(--col-margin); top: 10px; font-family: var(--serif); font-weight: 400; font-size: 48px; line-height: 1; color: var(--accent); }
.about .rule b { font-weight: 400; }
.about .mono { font-family: var(--mono); font-size: 15px; line-height: 1.6; color: var(--ink-2); border-left: 1px solid var(--rule-2); padding: 4px 0 4px 16px; margin: 16px 0; white-space: pre; overflow-x: auto; }
.about .mono.inline { display: inline; border: 0; padding: 0; margin: 0; white-space: normal; }
.about .side { grid-column: 1; font-size: 15px; color: var(--ink-3); line-height: 1.45; align-self: end; padding-bottom: 18px; }
.about .side b { display: block; color: var(--ink-2); font-weight: 400; }
.about .bounds { color: var(--ink-2); }

/* ---------- Ответ пером ---------- */
.writing .w { opacity: 0; }
.writing .w.inked { opacity: 1; animation: ink 600ms ease-out; }
@keyframes ink { from { opacity: 0; filter: blur(1.4px); } 40% { opacity: 0.9; } to { opacity: 1; filter: none; } }
.nib { display: inline-block; width: 0.9em; height: 3px; margin-left: 2px; background: var(--accent); vertical-align: baseline; animation: nib 900ms ease-in-out infinite; }
@keyframes nib { 50% { opacity: 0.25; } }
.sheet .colophon, .sheet .made { transition: opacity 400ms ease-out; }
.writing .colophon, .writing .made { opacity: 0; }
.sources .src-list { transition: opacity 400ms ease-out; }
.desk:has(.writing) .sources .src-list { opacity: 0.25; }
.penskip { font-size: 14px; font-style: italic; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; min-height: 32px; text-transform: none; letter-spacing: 0; }
.penskip:hover { color: var(--ink); text-decoration-color: var(--accent); }

/* ---------- Обучение при первом заходе ---------- */
.tour-dim { position: fixed; inset: 0; z-index: 44; background: var(--dim); }
.tour-target { z-index: 45; outline: 2px solid var(--accent); outline-offset: 10px; background-color: var(--paper); background-image: var(--laid); }
.compose.tour-target, .timeline.tour-target { position: relative; }
.timeline.tour-target { padding: 0 12px; margin: 0 -12px; }
.addressee.tour-target { outline-offset: 4px; }
.tour { position: fixed; z-index: 47; background-color: var(--paper); background-image: var(--laid); border: 1px solid var(--rule-2); outline: 1px solid var(--rule); outline-offset: 3px; padding: 16px 22px 12px; }
.tour .cap { margin: 0; }
.tour h2 { font-size: 23px; margin: 6px 0 8px; }
.tour p:not(.cap) { font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.tour-actions span { display: flex; align-items: center; gap: 18px; }
.tour .btn { padding: 10px 18px; font-size: 14px; }
.foot .switches { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 24px; }

/* ---------- Движение ---------- */
@media (prefers-reduced-motion: reduce) {
  .marker { transition: none; }
  .portrait .fade, .sheet.appear { animation: none; }
  .writing .w, .writing .w.inked { opacity: 1; animation: none; }
  .nib { display: none; }
}

/* ---------- Ширины ---------- */
@media (max-width: 1279px) {
  .lrow { display: none; }
  .marker { bottom: 0; }
}
@media (min-width: 1280px) {
  .legend { display: none; }
}
@media (max-height: 860px) and (min-width: 760px) {
  :root { --density-h: 40px; }
  .main { padding-top: 22px; }
  .lane { height: 24px; }
  .stage { margin-bottom: 14px; }
  .presets { margin-top: 4px; }
  .desk { padding-top: 18px; }
  .compose { padding-top: 16px; }
  .compose .head { margin-bottom: 8px; }
  .field textarea { min-height: 120px; }
  .portrait .plate img { max-height: 210px; width: auto; margin: 0 auto; }
  .portrait .plate { width: fit-content; margin: 0 auto; }
}
@media (max-width: 1499px) and (min-width: 1100px) {
  .who-name { font-size: 13px; letter-spacing: 0.08em; }
  .now-date { font-size: 28px; }
}
@media (min-width: 1500px) {
  :root { --page: 1440px; --col-addr: 260px; --col-notes: 340px; }
}
@media (max-width: 1279px) and (min-width: 1100px) {
  :root { --col-addr: 210px; --col-notes: 290px; --gap: 36px; }
}
@media (max-width: 1099px) {
  :root { --col-margin: 160px; --gap: 32px; }
  /* адресат — полоса над письмом, закреплённая сверху: портрет-миниатюра, дата, место */
  .desk { grid-template-columns: minmax(0, 1fr) 280px; }
  .addressee { grid-column: 1 / -1; position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 16px; align-items: center; margin: 0 calc(-1 * var(--gutter)) 20px; padding: 8px var(--gutter); background-color: var(--paper); background-image: var(--laid); border-bottom: 1px solid var(--rule-2); }
  .addressee > .cap { display: none; }
  .addressee:not(:has(.portrait)) { grid-template-columns: minmax(0, 1fr); } /* портретов у героя нет */
  .addressee .portrait .plate { padding: 3px; outline-offset: 2px; }
  .addressee figcaption { display: none; }
  .addressee .when { margin: 0; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
  .addressee .who-name { width: 100%; font-size: 12.5px; }
  .addressee .now-date { font-size: 24px; margin: 0; }
  .addressee .now-place { font-size: 17px; margin: 0; }
  .addressee .knows { display: none; }
  .letters { grid-column: 1; }
  .sources { grid-column: 2; top: 120px; }
  .sheet, .status, .compose, .src { scroll-margin-top: 120px; }
  .compose .head .to { display: none; }
  .sheet .tag { position: static; width: auto; margin-bottom: 8px; }
  .sheet .tag b, .sheet .tag i { display: inline; }
  .sheet .tag i::before { content: " · "; }
  .about { grid-template-columns: minmax(0, var(--measure)); }
  .about > *, .about .side { grid-column: 1; }
  .about .rule { padding-left: 56px; }
  .about .rule .num { left: 0; width: auto; font-size: 36px; top: 16px; }
}
@media (max-width: 759px) {
  :root { --gutter: 16px; --density-h: 44px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .top .wrap { padding-top: 16px; padding-bottom: 8px; }
  .brand span { display: none; }
  .brand b { font-size: 19px; letter-spacing: 0.2em; margin-right: -0.2em; }
  .nav { width: 100%; margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 2px; }
  .nav a { font-size: 12.5px; padding: 6px 12px; }
  /* на телефоне переключатель — строка на месте скрытого подзаголовка: медальон, имя и годы в одну строку */
  .author-switch { position: static; margin-top: 4px; }
  .as-btn { gap: 8px; padding: 2px 8px 2px 4px; }
  .as-thumb { width: 28px; height: 34px; }
  .as-text { flex-direction: row; align-items: baseline; gap: 8px; }
  .as-cap { display: none; }
  .as-name { font-size: 15px; margin: 0; }
  .as-list { left: var(--gutter); right: var(--gutter); top: auto; width: auto; margin-top: 6px; }
  .main { padding-top: 24px; padding-bottom: 48px; }
  .home, .desk { display: block; }
  .stage { margin-bottom: 20px; }
  .stage-head { flex-direction: column; gap: 0; }
  .timeline { width: 100%; }
  .addressee { grid-template-columns: 52px minmax(0, 1fr); column-gap: 12px; padding: 6px var(--gutter); margin-bottom: 16px; }
  .addressee .who-name { font-size: 11.5px; }
  .addressee .now-date { font-size: 20px; }
  .addressee .now-place { font-size: 15px; }
  .date-field { width: 100%; }
  .date-hint { right: auto; left: 0; }
  .legend, .lane.trips { display: none; }
  .sheet.day .body p:nth-child(n+2) { display: none; } /* на телефоне письмо дня — один абзац */
  /* быстрые даты — одна строка с горизонтальной прокруткой внутри, чтобы лист письма был ближе */
  .presets { flex-wrap: nowrap; overflow-x: auto; gap: 0 18px; margin: 4px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); scrollbar-width: none; }
  .presets::-webkit-scrollbar { display: none; }
  .presets .cap { display: none; }
  .presets { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 48px; }
  .writing .w:not(.inked) { display: none; } /* на телефоне лист растёт по мере письма, а не стоит пустым */
  .nav a { min-height: 44px; }
  .presets button { flex: none; white-space: nowrap; }
  .compose { padding: 16px 14px 14px; outline-offset: 2px; }
  .letters.fresh .thread { margin-top: 32px; }
  .axis .yl { font-size: 11px; }
  .axis .yl.near-end { display: none; }
  .lane .seg span { font-size: 11px; left: 3px; max-width: calc(100% - 4px); }
  .lane .seg.cur span { display: block; left: 5px; max-width: none; overflow: visible; z-index: 1; background: var(--paper-2); padding: 2px 4px; }
  .thread, .compose, .sources { position: static; }
  .sources { margin-bottom: 48px; padding-top: 24px; border-top: 1px solid var(--rule-2); }
  .sheet { margin-bottom: 40px; }
  .sheet.his { font-size: 18px; }
  .sheet.mine { font-size: 17px; }
  .sheet .tag { position: static; width: auto; margin-bottom: 8px; }
  .sheet .tag b, .sheet .tag i { display: inline; }
  .sheet .tag i::before { content: " · "; }
  .sheet.mine + .sheet.his::before { margin-bottom: 28px; }
  .starters ul { columns: 1; }
  .starters button { min-height: 44px; }
  .btn { min-height: 44px; width: 100%; justify-content: center; }
  .actions { flex-direction: column; align-items: stretch; }
  .drawer-panel { width: 100%; border-left: 0; }
  .drawer-head { padding: 14px 16px 10px; }
  .drawer-body { padding: 20px 16px 40px; }
  .letter { font-size: 17px; }
  .letter h1 { font-size: 17px; }
  .archive { grid-template-columns: 1fr; }
  .filters { margin-bottom: 32px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-2); }
  .filters h1 { font-size: 26px; }
  .filters .only-phone { display: block; }
  .filters .years button { pointer-events: none; }
  .filters .yhint { display: none; }
  .src .verdict a, .letter .meta a, .row .who a, .about .text a, .trace a, .sheet.his .more a, .portrait figcaption a { display: inline-block; padding: 11px 0; margin: -11px 0; }
  .row { grid-template-columns: 1fr; row-gap: 2px; padding: 14px 0; }
  .row .date { font-size: 15px; }
  .row .date small { display: inline; margin-left: 8px; }
  .row .snip { font-size: 16px; }
  .pager { gap: 18px; flex-wrap: wrap; }
  .about .intro { font-size: 19px; }
  .about h2 { margin-top: 40px; }
  .about .rule { padding-left: 44px; }
  .about .rule .num { font-size: 30px; top: 18px; }
}

/* ---------- Печать: переписка как страница книги ---------- */
@media print {
  :root, :root[data-theme="dark"] { --paper: #fff; --paper-2: #f2f2f2; --ink: #000; --ink-2: #222; --ink-3: #444; --accent: #000; --accent-ink: #fff; --rule: #999; --rule-2: #000; --hatch: #777; --dim: transparent; --laid: none; --lamp: none; }
  body { background: #fff !important; background-image: none !important; font-size: 12pt; color: #000; }
  .top .nav, .author-switch, .timeline, .legend, .presets, .date-field, .compose, .foot .switches, .skip, .loading, .drawer-backdrop, .sheet.his .more, .trace, details.more, .sources .lead, .notice { display: none !important; }
  .top { box-shadow: none; border-bottom: 2px solid #000; }
  .top .wrap { padding-top: 0; }
  .main { padding: 18pt 0 24pt; }
  .home, .desk { display: block; }
  .stage, .tour, .tour-dim, .penskip, .nib, .addressee > .cap, .knows { display: none !important; }
  .desk { border: 0; box-shadow: none; padding: 0; }
  .addressee { position: static; overflow: hidden; margin-bottom: 18pt; }
  .portrait { width: 140px; float: left; margin: 0 18pt 8pt 0; }
  .when { display: block; text-align: left; margin-bottom: 8pt; }
  .now-date { font-size: 24pt; }
  .writing .w { opacity: 1 !important; animation: none !important; }
  .sources:not(:has(.src-list)) { display: none !important; } /* до первого ответа источников нет — пустую рубрику не печатаем */
  .sheet, .src { break-inside: avoid; }
  .sheet { max-width: none; margin-bottom: 18pt; }
  .sheet .tag { position: static; width: auto; margin-bottom: 4pt; }
  .sheet .tag b, .sheet .tag i { display: inline; }
  .sheet .tag i::before { content: " · "; }
  .sheet.his { font-size: 12pt; }
  .sources { position: static; clear: both; margin-top: 18pt; border-top: 1px solid #000; padding-top: 8pt; }
  a { text-decoration: none; color: inherit; }
  .cite, .quote .ref, .src .n { color: #000; }
  .quote { background: none; border-bottom: 1px solid #000; }
  .foot { box-shadow: none; border-top: 1px solid #000; }
  .foot .wrap::before { display: none; }
  /* открытая шторка печатается как отдельная страница письма, остальное скрыто */
  .drawer { position: static; }
  .drawer-panel { position: static; width: auto; border: 0; box-shadow: none; background-image: none; }
  .drawer-body { overflow: visible; padding: 0; }
  .drawer-head { padding: 0 0 8pt; }
  .drawer-head button { display: none; }
  body:has(.drawer:not([hidden])) .top, body:has(.drawer:not([hidden])) .main, body:has(.drawer:not([hidden])) .foot { display: none; }
}
