/* Сайт памяти Михаила Леонидовича Беркенгейма — gynecolog.net */

/* ---------- Шрифты (SIL Open Font License, хранятся локально) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */
:root {
  --paper: #F5F3EE;
  --paper-2: #ECE8E0;
  --card: #FFFFFF;
  --ink: #1E2320;
  --ink-2: #2A302C;
  --text: #3D433F;
  --muted: #5B615C;
  --muted-2: #4A504C;
  --line: #DEDAD1;
  --line-2: #CFCAC0;
  --field-line: #C9C3B8;
  --accent: #2F5A45;
  --accent-ink: #1E3D2E;
  --dark: #1F2622;
  --on-dark: #EDEAE3;
  --on-dark-muted: #B9C2BC;
  --fern-on-dark: #9FB8A8;

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(20px, 4vw, 48px);
  --section-y: clamp(72px, 9vw, 128px);
  --photo-tone: grayscale(1) sepia(0.22) contrast(1.04);
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, p, figure, blockquote, ol, ul { margin: 0; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 6px; text-decoration: none;
}
.skip-link:focus { top: 16px; color: var(--paper); }

.container { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.band-sand { background: var(--paper-2); }
.band-dark { background: var(--dark); color: var(--on-dark); }
.rule-top { border-top: 1px solid var(--line); }
.rule-bottom { border-bottom: 1px solid var(--line); }

.fern { flex: none; }
.photo-tone { filter: var(--photo-tone); }

/* ---------- Типографика ---------- */
.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}
.h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(46px, 6.4vw, 92px); line-height: 0.98; letter-spacing: -0.01em;
}
.h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(36px, 4.4vw, 56px); line-height: 1.05;
}
.lead { font-size: clamp(18px, 1.6vw, 20px); line-height: 1.6; color: var(--ink-2); }
.body-text { color: var(--text); }
.small-muted { font-size: 14px; color: var(--muted); }
.serif-quote {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(23px, 2.2vw, 26px); line-height: 1.35; color: var(--ink);
}
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, color .15s, border-color .15s;
}
.btn--dark { background: var(--ink); color: var(--paper); }
.btn--dark:hover { background: #000; color: var(--paper); }
.btn--outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--ink); color: var(--paper); }
.btn--accent { background: var(--accent); color: #FFFFFF; }
.btn--accent:hover { background: var(--accent-ink); color: #FFFFFF; }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Шапка ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px; padding-block: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand__name { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: 0.01em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 26px; font-size: 15px; font-weight: 500; }
.nav a { color: var(--ink); text-decoration: none; padding: 10px 0; }
.nav a:hover { color: var(--accent); }
.nav a.nav__pill {
  color: #FFFFFF; background: var(--accent); padding: 10px 20px; border-radius: 999px;
}
.nav a.nav__pill:hover { background: var(--accent-ink); color: #FFFFFF; }
@media (max-width: 640px) {
  .nav { gap: 0 18px; font-size: 14px; }
  .nav a.nav__pill { margin-top: 4px; }
}

/* ---------- Первый экран ---------- */
.hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 56px 80px;
  padding-block: clamp(56px, 8vw, 112px) clamp(64px, 8vw, 120px);
}
.hero__text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.hero__dates {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px;
  font-family: var(--serif); font-size: 30px; color: var(--text);
}
.hero__role { font-family: var(--sans); font-size: 16px; color: var(--muted); }
.hero__lead { max-width: 600px; }
.hero__photo { flex: 1 1 340px; max-width: 440px; display: flex; flex-direction: column; gap: 12px; }
.hero__photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 30%; border-radius: 4px; }
.hero__photo figcaption { font-size: 13px; color: var(--muted); }

/* ---------- Цитата ---------- */
.quote-band__inner {
  max-width: 1000px; margin: 0 auto; padding: clamp(64px, 9vw, 120px) var(--gutter);
  display: flex; flex-direction: column; gap: 28px; align-items: flex-start;
}
.quote-band blockquote {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(32px, 4.4vw, 56px); line-height: 1.15;
}
.quote-band__source { font-size: 15px; color: var(--on-dark-muted); }

/* ---------- Цифры ---------- */
.facts { display: flex; flex-wrap: wrap; gap: 40px 48px; padding-block: 64px; }
.fact { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }
.fact__num { font-family: var(--serif); font-size: 52px; line-height: 1; color: var(--accent); }
.fact__text { font-size: 15px; color: var(--muted-2); }

/* ---------- Две колонки ---------- */
.split { display: flex; flex-wrap: wrap; gap: 48px 96px; }
.split--center { align-items: center; }
.split__main { flex: 1 1 360px; min-width: 0; }
.split__side { flex: 1.3 1 480px; min-width: 0; }

/* ---------- Его дети ---------- */
.kids { display: flex; flex-wrap: wrap; align-items: center; gap: 56px 96px; }
.kids__text { flex: 1 1 420px; min-width: 0; }
.kids__pair { flex: 1 1 440px; min-width: 0; position: relative; padding-bottom: 72px; }
.kids__front { width: 88%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }
.kids__back {
  position: absolute; right: 0; bottom: 0; width: 54%; aspect-ratio: 3 / 2; object-fit: contain; background: #FFFFFF;
  border-radius: 3px; box-shadow: 0 12px 32px rgba(30, 35, 32, 0.18);
}
.kids__quote { font-size: clamp(26px, 2.6vw, 32px); line-height: 1.3; }
.kids__note { margin-top: 48px; font-size: 15px; color: var(--muted); }
.kids__note a { font-weight: 600; }

/* ---------- Хронология ---------- */
.timeline { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: flex; gap: 32px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.timeline__year { flex: 0 0 96px; font-family: var(--serif); font-size: 28px; line-height: 1.2; color: var(--accent); }
.timeline__text { flex: 1 1 0; min-width: 0; }
@media (max-width: 520px) {
  .timeline li { gap: 16px; }
  .timeline__year { flex-basis: 80px; font-size: 24px; }
}

/* ---------- Каким он был ---------- */
.quotes { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 48px; }
.quote-card { flex: 1 1 320px; padding: 32px; background: var(--paper); border-radius: 6px; }
.quote-card blockquote { font-family: var(--serif); font-size: 26px; line-height: 1.3; }

/* ---------- Изобретение ---------- */
.device__fern { flex: 0 1 340px; display: flex; justify-content: center; margin: 0 auto; }
.device__fern svg { max-width: 100%; height: auto; }
@media (max-width: 640px) { .device__fern svg { width: 150px; } }
.device__text { flex: 1 1 520px; min-width: 0; }
.medals { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
.medal {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px;
  border: 1px solid var(--line-2); border-radius: 999px; font-size: 14px; color: var(--ink-2);
}

/* ---------- Альбом ---------- */
.album__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 48px; margin-bottom: 40px; }
.album__head p { max-width: 420px; font-size: 15px; color: var(--muted); }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 32px 24px; }
.album figure { display: flex; flex-direction: column; gap: 10px; }
.album img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.album figcaption { font-size: 14px; color: var(--muted); }
.album__open { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 4px; cursor: zoom-in; }
.album__open img { transition: opacity .2s ease; }
.album__open:hover img { opacity: .88; }

/* ---------- Просмотр фото на весь экран (assets/js/album.js) ---------- */
html.lightbox-open { overflow: hidden; }
.lightbox {
  --pad-x: clamp(12px, 3vw, 40px);
  --pad-y: clamp(56px, 7vh, 72px);
  --cap: 64px;
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: var(--pad-y) var(--pad-x); border: 0;
  background: #131715; color: var(--on-dark);
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; animation: lightbox-in .2s ease; }
.lightbox::backdrop { background: transparent; }
.lightbox__figure { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lightbox__img {
  width: min(calc(100vw - 2 * var(--pad-x)), calc((100vh - 2 * var(--pad-y) - var(--cap)) * var(--ratio, 1.5)));
  width: min(calc(100vw - 2 * var(--pad-x)), calc((100dvh - 2 * var(--pad-y) - var(--cap)) * var(--ratio, 1.5)));
  max-width: none; height: auto; aspect-ratio: var(--ratio, 1.5); object-fit: contain; border-radius: 2px;
}
.lightbox__caption { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; max-width: 640px; font-size: 15px; line-height: 1.5; text-align: center; color: var(--on-dark); }
.lightbox__count { color: var(--on-dark-muted); font-variant-numeric: tabular-nums; }
.lightbox__btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .4); color: var(--on-dark); cursor: pointer;
  transition: background .2s ease;
}
.lightbox__btn:hover { background: rgba(0, 0, 0, .7); }
.lightbox__btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: 12px; }
.lightbox__next { right: 12px; }
.lightbox :focus-visible { outline-color: var(--on-dark); }
@keyframes lightbox-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .lightbox[open] { animation: none; }
  .album__open img, .lightbox__btn { transition: none; }
}

/* ---------- Записки (список глав) ---------- */
.chapters { list-style: none; padding: 0; border-top: 1px solid var(--line-2); }
.chapters li { border-bottom: 1px solid var(--line-2); }
.chapters a { display: flex; align-items: baseline; gap: 20px; padding: 16px 0; color: var(--ink); text-decoration: none; }
.chapters a:hover .chapters__title { color: var(--accent); }
.chapters__num { flex: 0 0 32px; font-family: var(--serif); font-size: 22px; color: var(--accent); }
.chapters__title { flex: 1 1 0; font-size: 17px; }
.chapters__arrow { color: var(--muted); }
.chapters [aria-current="page"] .chapters__title { font-weight: 600; color: var(--accent); }

/* ---------- Призыв ---------- */
.cta { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; padding-block: clamp(80px, 10vw, 140px); }
.cta .h2 { max-width: 820px; font-size: clamp(36px, 4.8vw, 62px); line-height: 1.08; }
.cta p { max-width: 640px; font-size: 19px; color: var(--text); }
.cta .btn-row { justify-content: center; padding-top: 8px; }

/* ---------- Подвал ---------- */
.site-footer { background: var(--dark); color: var(--on-dark-muted); font-size: 14px; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px 48px; padding-block: 48px; }
.site-footer__name { font-family: var(--serif); font-size: 24px; color: var(--on-dark); }
.site-footer__col { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.site-footer a { color: var(--on-dark); }

/* ---------- Книга памяти ---------- */
.page-head { display: flex; flex-direction: column; gap: 20px; padding-block: clamp(56px, 7vw, 96px) 48px; }
.page-head .h1 { max-width: 860px; font-size: clamp(44px, 5.6vw, 76px); line-height: 1.02; }
.page-head .lead { max-width: 680px; color: var(--text); }
.memory { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 48px 64px; padding-block: 24px clamp(80px, 10vw, 128px); }
.memory__entries { flex: 1.3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.entry {
  background: var(--card); border: 1px solid #E4E0D7; border-radius: 8px; padding: 32px;
  display: flex; flex-wrap: wrap; gap: 28px;
}
.entry__photo { flex: 0 0 200px; width: 200px; aspect-ratio: 3 / 2; object-fit: contain; background: #FFFFFF; border-radius: 3px; border: 1px solid #E4E0D7; }
.entry__body { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.entry__text { font-family: var(--serif); font-style: italic; font-size: 26px; line-height: 1.3; }
.entry__meta { font-size: 14px; color: var(--muted); }
.entry--empty {
  background: transparent; border: 1.5px dashed var(--line-2);
  flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 48px 32px;
}
.entry--empty .entry__title { font-family: var(--serif); font-size: 26px; line-height: 1.2; }
.entry--empty p:last-child { max-width: 420px; font-size: 15px; color: var(--muted); }

.form-card { flex: 1 1 380px; min-width: 0; background: var(--paper-2); border-radius: 8px; padding: clamp(24px, 3vw, 36px); }
.form-card h2 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; }
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--field-line); border-radius: 6px; background: #FFFFFF;
  font: inherit; font-size: 16px; color: var(--ink);
}
.field input { min-height: 48px; padding: 0 14px; }
.field textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 160px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 20px; height: 20px; margin: 3px 0 0; flex: 0 0 20px; accent-color: var(--accent); }
.check label { font-size: 14px; color: var(--text); }
.form__note { font-size: 13px; color: var(--muted); }
.form__error { font-size: 14px; color: #8A2E1F; }
.form-done { display: flex; flex-direction: column; gap: 16px; padding-block: 24px; }
.form-done[hidden], .form[hidden], .form__error[hidden] { display: none; }

/* ---------- Глава «Записок» ---------- */
.chapter-head { display: flex; flex-direction: column; gap: 18px; padding-block: clamp(56px, 7vw, 96px) 40px; max-width: 860px; }
.chapter-head .h1 { font-size: clamp(42px, 5.4vw, 72px); line-height: 1.02; }
.chapter-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 56px 96px; padding-bottom: clamp(72px, 9vw, 120px); }
.chapter { flex: 1 1 560px; min-width: 0; max-width: 700px; }
.chapter p { margin: 0 0 1.1em; font-size: 18px; line-height: 1.75; color: var(--ink-2); text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.chapter h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.2; margin: 1.6em 0 0.6em; }
.chapter figure { margin: 2em 0; }
.chapter figure img { border-radius: 4px; }
.chapter figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
.chapter__signature { margin-top: 2em; font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--ink); }
.chapter-aside { flex: 0 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.chapter-aside .eyebrow { margin-bottom: 4px; }
.chapter-aside .chapters a { padding: 12px 0; }
.chapter-aside .chapters__title { font-size: 15px; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); max-width: 48%; }
.pager a:hover .pager__title { color: var(--accent); }
.pager__label { font-size: 13px; color: var(--muted); }
.pager__title { font-family: var(--serif); font-size: 24px; line-height: 1.2; }
.pager__next { margin-left: auto; text-align: right; align-items: flex-end; }
@media (max-width: 520px) { .pager a { max-width: 100%; } }

/* ---------- 404 ---------- */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; padding-block: clamp(80px, 12vw, 160px); max-width: 760px; }
