/* «Our Inheritance in the Great Pyramid» — сайт для чтения. Шрифты: Source Serif 4, Golos Text (OFL, site/fonts).
   Палитра: известняк облицовки и лазурит; ночью — гранит Царской камеры. */
@font-face { font-family: 'GP Serif'; font-weight: 400; font-display: swap; src: url(fonts/serif-400-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0100-024F, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'GP Serif'; font-weight: 400; font-display: swap; src: url(fonts/serif-400-cyr.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'GP Serif'; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/serif-400i-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0100-024F, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'GP Serif'; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/serif-400i-cyr.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'GP Serif'; font-weight: 600; font-display: swap; src: url(fonts/serif-600-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0100-024F, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'GP Serif'; font-weight: 600; font-display: swap; src: url(fonts/serif-600-cyr.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'GP Sans'; font-weight: 400; font-display: swap; src: url(fonts/golos-400-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'GP Sans'; font-weight: 400; font-display: swap; src: url(fonts/golos-400-cyr.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'GP Sans'; font-weight: 600; font-display: swap; src: url(fonts/golos-600-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'GP Sans'; font-weight: 600; font-display: swap; src: url(fonts/golos-600-cyr.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --bg: #F1F0EC; --paper: #FAFAF7; --ink: #22252A; --muted: #6A6F76; --line: #DDDCD5;
  --accent: #1F4F7A; --accent-ink: #FAFAF7; --mark: #E4ECF3;
  --serif: 'GP Serif', 'Iowan Old Style', 'PT Serif', Georgia, serif;
  --sans: 'GP Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs: clamp(17px, 0.95rem + 0.4vw, 20px);
  --measure: 36em;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #131518; --paper: #1A1D21; --ink: #E3E2DD; --muted: #9A9FA6; --line: #30343A;
    --accent: #8DB5DB; --accent-ink: #131518; --mark: #22303D;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #131518; --paper: #1A1D21; --ink: #E3E2DD; --muted: #9A9FA6; --line: #30343A;
  --accent: #8DB5DB; --accent-ink: #131518; --mark: #22303D;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 var(--fs)/1.62 var(--serif); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: .15em; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, .zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

/* шапка */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px 16px; flex-wrap: wrap; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  font: 400 14px/1.3 var(--sans); background: var(--paper); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.top .brand { color: var(--ink); text-decoration: none; font: 600 15px/1.3 var(--serif); letter-spacing: .01em; }
.nav { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.langs a { padding: 3px 9px; font: 600 12px/1.4 var(--sans); letter-spacing: .04em; color: var(--muted); }
.langs a.on { background: var(--ink); color: var(--paper); }
.theme { display: grid; place-items: center; background: none; border: 1px solid var(--line); border-radius: 999px; width: 30px; height: 30px; padding: 0; cursor: pointer; color: var(--ink); }
.theme svg { width: 16px; height: 16px; }

/* общее для страниц */
main { padding: 32px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
.eyebrow { font: 400 13px/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { color: var(--muted); max-width: 40em; }
h1, h2, h3 { text-wrap: balance; }

/* главная */
.home { max-width: 68rem; margin: 0 auto; display: grid; gap: 56px; }
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: center; }
.frontis img { display: block; border: 1px solid var(--line); background: var(--paper); }
.titles h1 { font: 400 clamp(34px, 3.2vw + 14px, 56px)/1.08 var(--serif); margin: 10px 0 14px; letter-spacing: -.005em; }
.author { font-size: 1.05em; margin: 0 0 18px; }
.author span { color: var(--muted); font-style: italic; }
.cta { display: inline-block; font: 600 15px/1 var(--sans); padding: 12px 18px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.toc h2, .plates-strip h2 { font: 600 13px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.plates-strip h2 a { color: inherit; text-decoration: none; }
.toc { columns: 2 22rem; column-gap: 48px; }
.toc h2 { column-span: all; }
.group { break-inside: avoid; margin: 0 0 26px; }
.group h3 { font: 400 1.05em/1.35 var(--serif); font-style: italic; margin: 0 0 6px; }
.group h3 a { color: var(--ink); text-decoration: none; }
.group ol { list-style: none; margin: 0; padding: 0; }
.group li a { display: grid; grid-template-columns: 2.6em minmax(0, 1fr) auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; }
.group li a:hover .t { color: var(--accent); }
.group .n { font: 400 13px/1.9 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.group .p { font: 400 13px/1.9 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }

/* иллюстрации */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 18px; }
.grid a { display: grid; gap: 6px; color: var(--ink); text-decoration: none; }
.grid img { display: block; border: 1px solid var(--line); background: var(--paper); aspect-ratio: 400 / 676; object-fit: cover; width: 100%; }
.grid .pn { font: 600 12px/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grid .pt { font-size: 14px; line-height: 1.35; }
.grid a:hover .pt { color: var(--accent); }
.plates { max-width: 68rem; margin: 0 auto; }
.plates h1, .plate h1, .about h1 { font: 400 clamp(28px, 2vw + 16px, 40px)/1.15 var(--serif); margin: 6px 0 10px; }
.plate { max-width: 68rem; margin: 0 auto; display: grid; gap: 14px; }
.plate .ptitle { margin: 0; font-style: italic; max-width: 40em; }
.zoom { overflow: auto; max-height: 82vh; background: var(--paper); border: 1px solid var(--line); cursor: zoom-in; text-align: center; overscroll-behavior: contain; }
.zoom img { display: block; margin: 0 auto; max-height: 80vh; width: auto; }
.zoom.on { cursor: grab; text-align: left; }
.zoom.on img { max-height: none; max-width: none; width: auto; }
.hint { font: 400 13px/1.4 var(--sans); color: var(--muted); margin: 0; }

/* чтение */
.reader { max-width: calc(var(--measure) + 8rem); margin: 0 auto; }
.where { font: 400 13px/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); max-width: var(--measure); margin: 0 auto 8px; }
.text { max-width: var(--measure); margin: 0 auto; }
.text p { margin: 0; text-indent: 1.5em; hyphens: auto; -webkit-hyphens: auto; }
.text h1 + p, .text h2 + p, .text h3 + p, .text h4 + p, .text h5 + p, .text .pgb + p, .text .tbl + p, .text .dmath + p { text-indent: 0; }
.text h1, .text h2, .text h3, .text h4, .text h5 { font-weight: 400; text-align: center; margin: 1.6em 0 .6em; line-height: 1.3; }
.text h1 { font-size: 1.5em; letter-spacing: .06em; }
.text h2 { font-size: 1.05em; letter-spacing: .14em; margin-top: 2em; }
.text h3 { font-size: 1.2em; letter-spacing: .04em; margin: .3em 0; }
.text h2 + h3 { margin-top: .4em; }
.text h4 { font-size: 1em; margin-top: 1.8em; }
.text h5 { font: 600 13px/1.4 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.text em { font-style: italic; }
.text .tbl { overflow-x: auto; margin: .8em 0 1em; }
.text table { border-collapse: collapse; font-size: .9em; font-variant-numeric: tabular-nums; margin: 0 auto; }
.text td, .text th { padding: 3px 14px 3px 0; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); }
.text th { font-weight: 600; }
.text .dmath { overflow-x: auto; overflow-y: hidden; margin: .6em 0 .8em; }
.katex { font-size: 1.04em; }
.text .katex-display { margin: .4em 0; }
/* метка страницы оригинала: на полях на широком экране, в строке — на узком */
.pg { font: 400 11px/1 var(--sans); color: var(--muted); text-indent: 0; font-variant-numeric: tabular-nums; }
.pg a { color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 3px; padding: 1px 4px; background: var(--paper); }
.pg a:hover { color: var(--accent); border-color: var(--accent); }
.pg.static { border: 1px solid var(--line); border-radius: 3px; padding: 1px 4px; }
.text .pgb { height: 0; }
.pg, .notes li, sup.fnref, h1, h2, h3, h4 { scroll-margin-top: 72px; }
@media (min-width: 60rem) {
  .text { position: relative; }
  .text .pg { position: absolute; left: -4.5rem; width: 3.6rem; text-align: right; margin-top: .45em; }
}
@media (max-width: 59.99rem) {
  .text .pg { margin: 0 .3em; vertical-align: .15em; }
  .text .pgb { height: auto; text-align: right; }
}
sup.fnref { font: 600 .66em/0 var(--sans); padding: 0 .1em; }
sup.fnref a { text-decoration: none; }
.notes { max-width: var(--measure); margin: 2.5em auto 0; border-top: 1px solid var(--line); padding-top: 1em; font-size: .88em; }
.notes h2 { font: 600 13px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .6em; }
.notes ol { padding-left: 1.6em; margin: 0; }
.notes li { margin: 0 0 .5em; }
.notes li:target, sup.fnref:target { background: var(--mark); }
.notes .back { text-decoration: none; margin-left: .2em; }
.plateref { text-decoration-style: dotted; }
.pager { max-width: var(--measure); margin: 3em auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; grid-column: 2; }
.pager .dir { font: 400 12px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pager .t { font-size: .95em; line-height: 1.35; }

/* рисунок внутри страницы */
.text .fig { margin: 1em auto; text-align: center; }
.text .fig img { max-width: min(100%, 320px); mix-blend-mode: multiply; }
:root[data-theme=dark] .text .fig img { filter: invert(.88); mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .text .fig img { filter: invert(.88); mix-blend-mode: screen; } }

/* указатель */
.text.index p { text-indent: -1.2em; padding-left: 1.2em; font-size: .92em; line-height: 1.5; }
.text.index p.sub { padding-left: 2.4em; }
.text.index a { text-decoration: none; }

/* об издании */
.prose { max-width: var(--measure); margin: 0 auto; }
.prose h2 { font: 600 13px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 2em 0 .4em; }
.prose li { margin-bottom: .4em; }

/* скан страницы поверх текста */
.scanview { border: 0; padding: 0; background: transparent; max-width: min(96vw, 760px); max-height: 96vh; overflow: visible; }
.scanview::backdrop { background: rgba(10, 12, 14, .72); }
.scanview figure { margin: 0; display: grid; gap: 6px; }
.scanview img { display: block; max-height: 88vh; width: auto; margin: 0 auto; border-radius: 3px; background: #fff; }
.scanview figcaption { font: 400 13px/1.3 var(--sans); color: #e6e6e6; text-align: center; }
.scanview .close { position: absolute; top: -6px; right: -6px; width: 34px; height: 34px; border-radius: 999px; border: 0; background: var(--paper); color: var(--ink); font-size: 20px; cursor: pointer; }

@media (max-width: 520px) {
  .top { flex-wrap: nowrap; }
  .top .brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .nav .about-link { display: none; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .frontis { max-width: 320px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .top, .pager, .theme { display: none; } body { background: #fff; } }
