/* ============================================================
   Зефира Бутаева — сайт-мемориал
   Минималистичный статический стиль в духе оригинала на GoDaddy:
   светлый фон, крупная типографика с разрядкой, много воздуха.
   ============================================================ */

:root {
  --bg: #fbfaf8;
  --bg-alt: #f3f1ec;
  --text: #232323;
  --text-muted: #5b5b5b;
  --line: #232323;
  --line-soft: #d9d6cd;
  --ghost-text: rgba(35, 35, 35, 0.05);
  --max-width: 880px;
  --font-heading: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  padding: 48px 24px 24px;
  text-align: center;
  position: relative;
}

.site-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 18px;
}

.site-title a { text-decoration: none; }

.site-title-underline {
  display: block;
  width: 220px;
  height: 1px;
  background: var(--line);
  margin: 0 auto 32px;
}

nav.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav.main-nav a {
  text-decoration: none;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  border-bottom-color: var(--text);
}

nav.main-nav .has-sub { position: relative; }

nav.main-nav .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--line-soft);
  padding: 14px 0;
  margin-top: 12px;
  min-width: 260px;
  z-index: 20;
  text-align: left;
}

nav.main-nav .has-sub:hover .sub-menu,
nav.main-nav .has-sub:focus-within .sub-menu {
  display: block;
}

nav.main-nav .sub-menu a {
  display: block;
  padding: 8px 22px;
  border-bottom: none;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: none;
}

nav.main-nav .sub-menu a:hover { background: var(--bg-alt); }

.nav-toggle {
  display: none;
  position: absolute;
  right: 20px;
  top: 52px;
  background: none;
  border: 1px solid var(--line-soft);
  font-size: 20px;
  padding: 6px 12px;
  cursor: pointer;
}

/* ---------- Hero (главная) ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 24px;
  text-align: center;
  background: var(--bg-alt);
}

.hero-ghost-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0 24px;
  font-family: var(--font-heading);
  font-size: 64px;
  font-weight: 700;
  color: var(--ghost-text);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  line-height: 1.6;
}

.hero-portrait {
  position: relative;
  z-index: 1;
  max-width: min(360px, 100%);
  margin: 0 auto 28px;
  border: 10px solid var(--bg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.hero-dates {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: 18px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* ---------- Page header (внутренние страницы) ---------- */

.page-title {
  text-align: center;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: clamp(24px, 4vw, 34px);
  margin: 56px 0 40px;
}

/* ---------- Content ---------- */

main { padding-bottom: 80px; }

.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.prose p { margin: 0 0 1.2em; }

.prose h2 {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 22px;
  margin: 3em 0 1em;
  scroll-margin-top: 24px;
}

.prose h2:first-child { margin-top: 0; }

.book-epigraph {
  text-align: center;
  margin: 0 auto 3em;
  max-width: 560px;
}

.book-epigraph .book-title {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 28px;
  margin-bottom: 4px;
}

.book-epigraph .book-place {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.book-epigraph .book-subtitle {
  font-weight: 700;
  font-size: 15px;
}

/* Chapters side nav (book page) */

.book-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

.chapter-nav {
  position: sticky;
  top: 24px;
  font-size: 13px;
  line-height: 1.9;
}

.chapter-nav a {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  padding-left: 10px;
}

.chapter-nav a:hover,
.chapter-nav a.active {
  color: var(--text);
  border-left-color: var(--text);
}

@media (max-width: 820px) {
  .book-layout { grid-template-columns: 1fr; }
  .chapter-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 32px;
  }
  .chapter-nav a { border-left: none; padding-left: 0; }
}

/* ---------- Photo gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.gallery figure {
  margin: 0;
  background: var(--bg-alt);
}

.gallery img { width: 100%; height: 260px; object-fit: cover; }

.gallery figcaption {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Family pages: byline avatar ---------- */

.byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 3em 0 0;
}

.byline h2 { margin: 0; }

.byline-avatar {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

@media (max-width: 560px) {
  .byline { flex-direction: column; align-items: flex-start; }
}

/* ---------- Family pages: inline photos, mini galleries, audio ---------- */

.family-page figure.inline-photo {
  margin: 2em 0;
  text-align: center;
}

.family-page figure.inline-photo img {
  max-width: 420px;
  margin: 0 auto;
  border: 8px solid var(--bg-alt);
  box-shadow: 0 2px 16px rgba(0,0,0,0.1);
}

.family-page figure.inline-photo figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.mini-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 1.5em 0 0.4em;
}

.mini-gallery img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-alt);
}

.mini-gallery-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 2em;
}

.audio-block {
  margin: 1.5em 0;
  padding: 18px 20px;
  background: var(--bg-alt);
}

.audio-block audio { width: 100%; margin-top: 8px; }

/* ---------- Genealogy pages ---------- */

.family-tree {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

.family-tree ul { list-style: none; padding-left: 22px; }
.family-tree > ul { padding-left: 0; }
.family-tree li {
  padding: 6px 0 6px 16px;
  border-left: 1px solid var(--line-soft);
}

/* ---------- Download page ---------- */

.download-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 32px;
  border: 1px solid var(--line-soft);
  text-align: center;
}

.download-card a.button,
.button {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 32px;
  border: 1px solid var(--line);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  color: var(--text);
}

.button:hover { background: var(--text); color: var(--bg); }

.archived-article .article-meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -1em;
}

.prose p.note {
  font-size: 14px;
  color: var(--text-muted);
  border-left: 2px solid var(--line-soft);
  padding-left: 14px;
}

.download-list {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 0 24px;
  display: grid;
  gap: 16px;
}

.download-item {
  border: 1px solid var(--line-soft);
  padding: 22px 26px;
}

.download-item h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.download-item p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Lightbox (полноразмерный просмотр фото по клику) ---------- */

.lightbox-trigger { cursor: zoom-in; }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 18, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay .lightbox-img {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: zoom-out;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fbfaf8;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}

body.lightbox-locked { overflow: hidden; }

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Responsive nav toggle ---------- */

@media (max-width: 680px) {
  .nav-toggle { display: block; }
  nav.main-nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
  }
  nav.main-nav.open { display: flex; }
  nav.main-nav .sub-menu {
    position: static;
    transform: none;
    display: none;
    border: none;
    margin: 0;
    padding-left: 16px;
  }
  nav.main-nav .has-sub.open .sub-menu { display: block; }
}
