/* Family site stylesheet. Lifted from reports/web_report_template.html
   (2026-10-09) so the essay keeps its look; the site-only rules (nav,
   roster) are at the end. The old template keeps its own copy until the
   Artifact page is retired. */
:root {
  --paper: #e9e3d2;
  --paper-raised: #f5f1e6;
  --ink: #211d17;
  --ink-soft: #5b5647;
  --line: #cfc6ac;
  --accent: #33475c;
  --accent-soft: #5c7286;
  --accent-2: #8a6e3b;
  --accent-2-soft: #a6864f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1912;
    --paper-raised: #242118;
    --ink: #e8e1cd;
    --ink-soft: #a79e86;
    --line: #3a3527;
    --accent: #8fb2cc;
    --accent-soft: #6c8ca3;
    --accent-2: #c9a968;
    --accent-2-soft: #a3874e;
  }
}
:root[data-theme="dark"] {
  --paper: #1b1912;
  --paper-raised: #242118;
  --ink: #e8e1cd;
  --ink-soft: #a79e86;
  --line: #3a3527;
  --accent: #8fb2cc;
  --accent-soft: #6c8ca3;
  --accent-2: #c9a968;
  --accent-2-soft: #a3874e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PT Serif", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  padding-inline: clamp(16px, 5vw, 32px);
  padding-block: clamp(28px, 6vw, 64px);
}

.page {
  max-width: 700px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 4vw, 32px);
}

.eyebrow {
  font-family: "PT Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

header.masthead {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: clamp(18px, 4vw, 28px);
  border-bottom: 3px double var(--line);
}

h1 {
  font-size: clamp(2.1rem, 4.6vw + 0.6rem, 3.1rem);
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
  font-weight: 700;
}

.lede {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
}
.lede em { font-style: italic; }

details.toc {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.9rem 1.1rem;
}
details.toc summary {
  font-family: "PT Sans", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
details.toc summary::-webkit-details-marker { display: none; }
details.toc summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}
details.toc[open] summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  details.toc summary::before { transition: none; }
}

ol.toc-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: chapter;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
ol.toc-list > li > a {
  font-family: "PT Sans", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
ul.toc-sub {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-left: 1px solid var(--line);
}
ul.toc-sub li a {
  font-family: "PT Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.toc-list a, .toc-sub a { text-decoration: none; }
.toc-list a:hover, .toc-sub a:hover { color: var(--accent); text-decoration: underline; }

article {
  display: flex;
  flex-direction: column;
}
article > * + * { margin-top: 1.15em; }

h2 {
  font-size: clamp(1.4rem, 2.6vw + 0.5rem, 1.85rem);
  line-height: 1.2;
  margin-top: 2.4em;
  text-wrap: balance;
  scroll-margin-top: 1.2rem;
}
h3 {
  font-size: 1.22rem;
  color: var(--accent);
  margin-top: 1.8em;
  scroll-margin-top: 1.2rem;
}
h2:first-of-type { margin-top: 0; }

p { text-wrap: pretty; }
strong { font-weight: 700; }
a { color: var(--accent); }
a:hover { color: var(--accent-soft); }

blockquote {
  margin: 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 2px solid var(--accent-2);
  color: var(--ink-soft);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.2em 0;
}

ul, ol {
  padding-left: 1.4rem;
}
li + li { margin-top: 0.35em; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--paper-raised);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.88em;
}
pre {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  max-width: 100%;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.table-wrap { overflow-x: auto; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
th {
  font-family: "PT Sans", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

sup a.footnote-ref {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
sup a.footnote-ref:hover { text-decoration: underline; }

section.footnotes {
  margin-top: 1.4em;
  padding-top: 1.6em;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--ink-soft);
}
section.footnotes::before {
  content: "Источники и примечания";
  display: block;
  font-family: "PT Sans", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1em;
}
section.footnotes ol {
  padding-left: 1.5rem;
}
section.footnotes li {
  margin-bottom: 0.7em;
}
section.footnotes li::marker {
  font-family: "PT Sans", sans-serif;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
}
.footnote-back {
  color: var(--accent-2);
  text-decoration: none;
  margin-left: 0.3em;
}
span.src-tag {
  display: inline-block;
  font-family: "PT Sans", sans-serif;
  font-weight: 700;
  font-size: 0.78em;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  border-radius: 2px;
  padding: 0.05em 0.4em;
  margin-right: 0.15em;
}

footer.colophon {
  margin-top: 1rem;
  padding-top: 1.4rem;
  border-top: 3px double var(--line);
  font-family: "PT Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
footer.colophon a { color: var(--accent); }

.top-link {
  position: fixed;
  right: clamp(10px, 3vw, 22px);
  bottom: clamp(10px, 3vw, 22px);
  font-family: "PT Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  text-decoration: none;
  padding: 0.5em 0.85em;
  border-radius: 3px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 25%, transparent);
}
.top-link:hover { background: var(--accent-soft); }

a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- site-only: navigation ---------------------------------------- */
nav.site-nav {
  max-width: 700px;
  margin: 0 auto clamp(20px, 4vw, 32px);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.2rem;
  font-family: "PT Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}
nav.site-nav .brand {
  font-family: "PT Serif", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}
nav.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.1rem;
}
nav.site-nav li + li { margin-top: 0; }
nav.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
nav.site-nav a:hover { color: var(--accent); }
nav.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--accent-2);
}

/* ---- site-only: roster (people/index.html) ------------------------- */
.intro { color: var(--ink-soft); }
.intro p { margin: 0 0 0.6em; }
section.generation > h2 { margin-top: 1.6em; }
section.generation:first-of-type > h2 { margin-top: 0.4em; }
.family {
  margin-top: 1.2em;
}
.family-head {
  font-family: "PT Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4em;
}
ul.people {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
ul.people > li {
  margin: 0;
  padding: 0.65rem 0 0.7rem;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 1.2rem;
}
.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}
.person-name { font-weight: 700; }
.person-name.center { color: var(--accent-2); }
.years {
  font-family: "PT Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.relation {
  font-family: "PT Sans", sans-serif;
  font-size: 0.8rem;
  color: var(--accent-2);
}
.aka {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
}
ul.spouses {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--line);
}
ul.spouses li + li { margin-top: 0.3em; }
ul.spouses .person-name { font-weight: 400; }
.draft-banner {
  max-width: 700px;
  margin: 0 auto 1rem;
  font-family: "PT Sans", sans-serif;
  font-size: 0.78rem;
  color: var(--accent-2);
  border: 1px dashed var(--accent-2-soft);
  border-radius: 3px;
  padding: 0.4rem 0.7rem;
}

/* ---- site-only: profile pages (people/<id>.html) ------------------- */
.life-years {
  margin: 0;
  font-family: "PT Sans", sans-serif;
  font-size: 1.05rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
header.masthead .aka { margin: 0; }
dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 1.1rem;
  margin: 0;
  padding: 0.9rem 1.1rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.95rem;
  line-height: 1.5;
}
dl.facts dt {
  font-family: "PT Sans", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.2em;
}
dl.facts dd { margin: 0; }
.muted { color: var(--ink-soft); font-size: 0.9em; }
@media (max-width: 520px) {
  dl.facts { grid-template-columns: 1fr; gap: 0.1rem; }
  dl.facts dd { margin-bottom: 0.5rem; }
}
article.bio > * + * { margin-top: 1.15em; }
article.bio section.bio-part > * + * { margin-top: 1em; }
article.bio h3 { margin-top: 1.6em; }
article.bio .lede { font-size: 1.08rem; }
section.timeline ul {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--accent-2-soft);
}
section.timeline li {
  position: relative;
  padding: 0.15rem 0 0.15rem 1.1rem;
}
section.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.75em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
}
section.timeline li strong {
  font-family: "PT Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
section.gallery figure {
  margin: 1.4rem 0 0;
}
section.gallery img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
}
section.gallery figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-style: italic;
}
details.sources-note {
  margin-top: 2rem;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
details.sources-note summary {
  cursor: pointer;
  font-family: "PT Sans", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
section.kin { border-top: 3px double var(--line); padding-top: 1.2rem; }
section.kin h2 { margin-top: 0; }
.kin-block { margin-top: 1.4rem; }
.kin-label {
  margin: 0 0 0.5rem;
  font-family: "PT Sans", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.couple {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-raised);
  line-height: 1.6;
}
.couple .ring {
  font-family: "PT Sans", sans-serif;
  font-size: 0.8rem;
  color: var(--accent-2);
  margin: 0 0.35rem;
  white-space: nowrap;
}
.kin-name { font-weight: 700; }
a.kin-name { text-decoration: none; border-bottom: 1px solid var(--line); }
a.kin-name:hover { border-bottom-color: var(--accent); }
.kin-self { color: var(--accent-2); }
.kin-self::after {
  content: " — это он";
  font-weight: 400;
  font-family: "PT Sans", sans-serif;
  font-size: 0.8rem;
}
ul.tree, ul.tree ul { list-style: none; margin: 0; padding: 0; }
ul.tree { margin-left: 1.2rem; }
ul.tree ul { margin-left: 0.4rem; }
ul.tree li {
  position: relative;
  margin: 0;
  padding: 0.3rem 0 0.3rem 1.4rem;
  line-height: 1.45;
}
ul.tree li::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--accent-soft);
}
ul.tree li:last-child::before { bottom: auto; height: 1.05rem; }
ul.tree li::after {
  content: "";
  position: absolute;
  left: 0; top: 1.05rem;
  width: 1rem;
  border-top: 1px solid var(--accent-soft);
}
.kin-note { font-size: 0.9rem; color: var(--ink-soft); margin: 0.6rem 0 0 1.2rem; }
aside.in-essay ul { padding-left: 1.2rem; margin: 0; }
p.back { font-family: "PT Sans", sans-serif; font-size: 0.85rem; margin: 0; }
header.masthead.with-portrait { display: grid; grid-template-columns: 1fr; }
figure.portrait { margin: 0 0 0.6rem; max-width: 260px; }
figure.portrait img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  filter: sepia(0.15);
}
figure.portrait figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-soft);
}
@media (min-width: 640px) {
  header.masthead.with-portrait {
    grid-template-columns: 1fr 220px;
    grid-template-areas: "eyebrow portrait" "title portrait" "years portrait" "aka portrait";
    grid-template-rows: auto auto auto 1fr;
    row-gap: 0.6rem;
    column-gap: 1.6rem;
    align-items: start;
  }
  header.masthead.with-portrait figure.portrait { grid-area: portrait; margin: 0; }
  header.masthead.with-portrait .eyebrow { grid-area: eyebrow; }
  header.masthead.with-portrait h1 { grid-area: title; }
  header.masthead.with-portrait .life-years { grid-area: years; }
  header.masthead.with-portrait .aka { grid-area: aka; }
}
/* two notes side by side: "1,2", not "12" */
a.footnote-ref + a.footnote-ref sup::before { content: ","; }
article.bio a.footnote-ref { text-decoration: none; font-weight: 700; }
.enh-note { display: block; font-size: 0.85em; opacity: 0.8; }

/* ---- site-only: tree (tree.html) ----------------------------------- */
.tree-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  font-family: "PT Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.tree-legend li + li { margin-top: 0; }
.tree-legend .key {
  display: inline-block;
  width: 1.6em;
  height: 0.95em;
  margin-right: 0.45em;
  vertical-align: -0.12em;
  border: 1.5px solid var(--ink-soft);
  border-radius: 3px;
  background: var(--paper-raised);
}
.tree-legend .key-center { border-color: var(--accent-2); border-width: 2.5px; }
.tree-legend .key-page { border-color: var(--accent); }
.tree-legend .key-married { border-style: dotted; background: transparent; }
.tree-legend .key-weak { border: 0; border-top: 2px dashed var(--ink-soft); border-radius: 0; height: 0; background: none; }
.tree-legend .key-stack { border-width: 0 0 0 2px; border-radius: 0; background: none; }
.tree-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tree-tools[hidden] { display: none; }
.tree-tools button {
  font: 700 0.8rem "PT Sans", sans-serif;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.8rem;
  min-width: 2.4rem;
  cursor: pointer;
}
.tree-tools button:hover { border-color: var(--accent); color: var(--accent); }
.tree-box {
  /* break out of the 700px reading column to the full window */
  width: calc(100vw - 2 * clamp(16px, 5vw, 32px));
  margin-inline: calc(50% - 50vw + clamp(16px, 5vw, 32px));
  height: min(78vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-raised);
  cursor: grab;
  overscroll-behavior: contain;
}
.tree-box.dragging { cursor: grabbing; user-select: none; }
svg.tree { display: block; }
svg.tree .link { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
svg.tree .link.weak { stroke-dasharray: 5 4; }
svg.tree .card rect { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
svg.tree .card.has-page rect { stroke: var(--accent); }
svg.tree .card.married-in rect { fill: var(--paper-raised); stroke-dasharray: 2 3; }
svg.tree .card.center rect { stroke: var(--accent-2); stroke-width: 3; }
svg.tree a:hover .card rect, svg.tree a:focus .card rect { stroke: var(--accent); stroke-width: 2.5; }
svg.tree text { font-family: "PT Sans", ui-sans-serif, system-ui, sans-serif; fill: var(--ink); }
svg.tree .nm { font-size: 13.5px; font-weight: 700; }
svg.tree .sub { font-size: 11.5px; fill: var(--ink-soft); font-style: italic; }
svg.tree .yr { font-size: 12px; fill: var(--ink-soft); }
svg.tree .pg { font-size: 11px; fill: var(--accent); font-weight: 700; }
.tree-note { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
@media print {
  .tree-tools, nav.site-nav, .top-link, .draft-banner { display: none !important; }
  .tree-box { width: auto; height: auto; margin: 0; overflow: visible; border: 0; }
  svg.tree { width: 100% !important; height: auto !important; }
}
