:root {
  --bg: #fbfbfc;
  --side: #f3f4f6;
  --seg: #f0f1f3;
  --hover: #e8eaee;
  --card: #ffffff;
  --ink: #15171b;
  --ink-2: #3b3f46;
  --ink-3: #4a4f57;
  --muted: #5f646d;
  --muted-2: #6b7079;
  --faint: #8a8f98;
  --faint-2: #a3a8b0;
  --line: #e4e6ea;
  --line-2: #dadde2;
  --dark-line: #3a3e46;
  --accent: oklch(0.55 0.13 35);
  --accent-dark: oklch(0.45 0.13 35);
  --accent-soft: oklch(0.95 0.03 35);
  --accent-light: oklch(0.75 0.11 35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 50; padding: 8px 14px; background: var(--ink); color: #fff; border-radius: 8px; }

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

/* Боковая панель */
.side {
  flex: 0 0 290px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side); border-right: 1px solid var(--line);
  padding: 28px 20px 28px 24px; display: flex; flex-direction: column; gap: 32px;
}
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px;
}
.brand-text { font-size: 15px; line-height: 1.3; font-weight: 600; }
.brand-text span { font-weight: 400; color: var(--muted-2); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav > a { padding: 9px 12px; border-radius: 8px; font-size: 15px; color: var(--ink-3); }
.side-nav > a:hover { background: var(--hover); color: var(--ink); }
.side-nav > a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; }
.side-toc { display: flex; flex-direction: column; margin: 4px 0 10px 12px; padding-left: 12px; border-left: 1px solid var(--line-2); }
.side-toc a {
  display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 6px;
  font-size: 14px; line-height: 1.35; color: var(--muted);
}
.side-toc a:hover { color: var(--ink); }
.side-toc a.active { color: var(--accent); background: var(--accent-soft); }
.side-toc a span:last-child, .toc-chips a span:last-child { color: var(--faint-2); font-variant-numeric: tabular-nums; }

.side-channels { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.channel { display: block; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); transition: border-color .15s; }
.channel:hover { border-color: var(--accent); color: var(--ink); }
.channel .label { color: var(--muted-2); line-height: 1.35; }
.channel .handle { margin-top: 3px; color: var(--accent); font-weight: 500; }

/* Основная колонка */
.content { flex: 1 1 600px; min-width: 0; }
.content main, .site-footer { max-width: 1040px; padding-left: 56px; padding-right: 56px; }

/* Главная */
.home { padding: 96px 0 64px; }
.home h1 { margin: 0; max-width: 820px; font-size: clamp(36px, 5vw, 60px); line-height: 1.08; font-weight: 600; letter-spacing: -0.035em; text-wrap: balance; }
.home .lead { margin: 28px 0 0; max-width: 620px; font-size: 17px; line-height: 1.65; color: var(--muted); text-wrap: pretty; }
.cards { margin-top: 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 20px; padding: 32px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { color: var(--ink); border-color: var(--accent); box-shadow: 0 8px 30px rgba(21, 23, 27, 0.06); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.pill { font-size: 13px; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; }
.card-top .arrow { font-size: 22px; color: var(--accent); transition: transform .15s; }
.card:hover .arrow { transform: translateX(4px); }
.card-title { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: 13px; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }

.home-photos { margin-top: 96px; }
.home-photos h2, .photos h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.home-photos .sub, .photos .sub { margin: 8px 0 0; font-size: 16px; color: var(--muted); }
.thumbs { margin-top: 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.thumbs img, .photo-grid img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: var(--line); }
.more { display: inline-block; margin-top: 20px; font-size: 15px; }

/* Списки книг */
.list-page { padding: 72px 0 48px; }
.crumbs { font-size: 14px; color: var(--muted-2); display: flex; gap: 8px; }
.crumbs a { color: var(--muted-2); }
.crumbs a:hover { color: var(--ink); }
.crumbs span:last-child { color: var(--ink); }
.list-page h1 { margin: 18px 0 0; font-size: clamp(32px, 4.5vw, 52px); line-height: 1.1; font-weight: 600; letter-spacing: -0.035em; }
.list-meta { margin-top: 14px; font-size: 15px; color: var(--muted-2); }
.toc-chips { display: none; }
.sections { margin-top: 56px; }
.sections section { scroll-margin-top: 32px; padding-bottom: 56px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-head .num { font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.section-head h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.section-head .rule { flex: 1; height: 1px; background: var(--line); }
.section-head .count { font-size: 13px; color: var(--faint); white-space: nowrap; }
.books { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.book { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.book .t { font-size: 17px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; text-wrap: pretty; }
.book .a { font-size: 14px; line-height: 1.45; color: var(--muted); }
.book .isbn { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--faint); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.photos { scroll-margin-top: 32px; margin-top: 24px; padding: 48px; background: var(--side); border-radius: 20px; }
.photo-grid { margin-top: 36px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 20px; }
.photo-grid figure { margin: 0; }
.photo-grid figcaption { margin-top: 14px; }
.photo-grid .t { font-size: 16px; font-weight: 600; line-height: 1.35; }
.photo-grid .a { margin-top: 3px; font-size: 14px; color: var(--muted); }
.photo-grid .credit { margin-top: 8px; font-size: 12px; color: var(--faint); }

/* Документы */
.legal-page { padding: 72px 0 64px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--seg); border-radius: 10px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 7px; font-size: 14px; color: var(--muted-2); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(21, 23, 27, 0.06); }
.legal-page article { max-width: 700px; margin-top: 48px; }
.legal-page h1 { margin: 0 0 40px; font-size: clamp(28px, 3.5vw, 42px); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; }
.legal-page .block { margin-bottom: 36px; }
.legal-page h2 { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
.legal-page p { margin: 0 0 10px; font-size: 16px; line-height: 1.7; color: var(--ink-2); text-wrap: pretty; }

/* 404 */
.notfound { padding: 96px 0 72px; }
.notfound h1 { margin: 0; font-size: clamp(36px, 5vw, 60px); line-height: 1.08; font-weight: 600; letter-spacing: -0.035em; }
.notfound p { margin: 24px 0 32px; font-size: 17px; line-height: 1.65; color: var(--muted); max-width: 620px; }
.btn { display: inline-flex; padding: 10px 18px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; border: 0; font-family: inherit; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--accent); color: #fff; }

/* Подвал */
.site-footer { padding-bottom: 40px; }
.cta {
  padding: 40px; border-radius: 20px; background: var(--ink); color: #fff;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; align-items: center;
}
.cta-title { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; }
.cta-title span { color: var(--accent-light); }
.contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.contacts a { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--dark-line); color: #fff; font-size: 14px; transition: background .15s, border-color .15s; }
.contacts a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.footer-channels { display: none; }
.footer-links { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; }
.footer-links a { color: var(--faint); }
.footer-links a:hover { color: var(--ink); }

/* Cookie */
.cookie {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  width: min(720px, calc(100% - 40px)); background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 12px 40px rgba(21, 23, 27, 0.1);
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.cookie[hidden] { display: none; }
.cookie p { flex: 1 1 320px; margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-3); }

/* Планшеты и телефоны: панель превращается в верхнюю шапку */
@media (max-width: 900px) {
  .shell { display: block; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
    padding: 12px 20px; border-right: 0; border-bottom: 1px solid var(--line);
    background: rgba(243, 244, 246, 0.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .side-nav > a { padding: 7px 10px; font-size: 14px; }
  .side-toc, .side-channels { display: none; }
  .content main, .site-footer { padding-left: 20px; padding-right: 20px; }
  .sections section, .photos { scroll-margin-top: 120px; }
  .toc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
  .toc-chips a { display: inline-flex; gap: 6px; font-size: 13px; color: var(--muted); padding: 5px 10px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
  .toc-chips a.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .footer-channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-bottom: 16px; font-size: 13px; }
}
@media (max-width: 640px) {
  .side { padding: 10px 20px 6px; gap: 6px; }
  .brand { gap: 10px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
  .brand-text { font-size: 14px; }
  .brand-text br { display: none; }
  .brand-text span::before { content: ' '; }
  .side-nav { width: calc(100% + 40px); margin: 0 -20px; padding: 0 12px 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav > a { flex: none; padding: 6px 8px; font-size: 13px; }
  .sections section, .photos { scroll-margin-top: 100px; }
  .home { padding: 56px 0 48px; }
  .cards { margin-top: 40px; grid-template-columns: 1fr; }
  .card { padding: 24px; }
  .home-photos { margin-top: 64px; }
  .thumbs { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .list-page, .legal-page { padding-top: 40px; }
  .books { grid-template-columns: 1fr; }
  .photos { padding: 28px 20px; margin-left: -8px; margin-right: -8px; }
  .photo-grid { grid-template-columns: 1fr; }
  .cta { padding: 28px 24px; }
  .cta-title { font-size: 22px; }
  .notfound { padding-top: 56px; }
}
