:root {
  --bg: #f1e9de;
  --paper: #faf6f0;
  --sand: #e4d6c4;
  --beige: #c8b199;
  --taupe: #8a7564;
  --ink: #171412;
  --ink-soft: #4a403a;
  --line: rgba(23, 20, 18, .14);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --side: 280px;
}

* { box-sizing: border-box; }

/* Холст под страницей тёмный: если окно показывает что-то ниже подвала, это выглядит продолжением подвала. */
html { -webkit-text-size-adjust: 100%; background: var(--ink); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ───── каркас: боковое меню и содержимое ───── */

.topbar { display: none; }
.scrim { display: none; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side);
  padding: 44px 32px 28px;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.tagline { margin-top: 10px; font-size: 13px; color: var(--taupe); }

.menu { margin-top: 38px; }
.menu button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%;
  background: none; border: 0; padding: 0;
  text-align: left;
}
.menu button:focus-visible, .card:focus-visible, .post-close:focus-visible, .post-arrow:focus-visible, .menu-toggle:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 3px;
}
.menu-count { font-family: var(--sans); font-size: 12px; font-style: normal; font-weight: 500; color: var(--taupe); letter-spacing: 0; }

.menu-group { padding: 16px 0 14px; border-top: 1px solid var(--line); }
.menu-group:first-child { border-top: 0; padding-top: 0; }
.menu-section { font-family: var(--serif); font-size: 29px; line-height: 1.1; }
.menu-section[aria-current="true"] > span:first-child { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.menu-sub { display: none; margin-top: 10px; }
.menu-group.open .menu-sub { display: block; }
.menu-sub button {
  padding: 5px 0 5px 14px;
  border-left: 1px solid transparent;
  font-size: 14px; color: var(--ink-soft);
}
.menu-sub button:hover { color: var(--ink); }
.menu-sub button[aria-current="true"] { border-left-color: var(--ink); color: var(--ink); font-weight: 700; }
.menu-sub button.is-empty { color: var(--beige); }

/* метки: второстепенный фильтр под разделами */
.tags { margin-top: 14px; padding: 12px 0 0 14px; border-top: 1px solid var(--line); }
.menu-group:not(.open) .tags { display: none; }
.tags-title {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0;
  background: none; border: 0;
  font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--taupe);
}
.tags-title::after { content: '+'; font-size: 15px; font-weight: 400; letter-spacing: 0; line-height: 1; }
.tags-title[aria-expanded="true"]::after { content: '−'; }
.tags-title:hover { color: var(--ink); }
.tags-title:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.tags .tags-list { margin-top: 12px; }
.tags-list[hidden] { display: none; }
.tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  padding: 4px 9px;
  background: none;
  border: 1px solid var(--sand);
  font-size: 12px; line-height: 1.4; color: var(--ink-soft);
}
.tag-chip:hover { border-color: var(--ink); color: var(--ink); }
.tag-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tag-count { margin-left: 6px; font-size: 10px; opacity: .6; }

.sidebar-note { margin-top: auto; padding-top: 30px; font-size: 11px; line-height: 1.5; letter-spacing: .08em; text-transform: uppercase; color: var(--taupe); }

/* фоновые рисунки раздела */
.backdrop { position: fixed; inset: 0 0 0 var(--side); z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop svg {
  position: absolute;
  fill: none; stroke: #dccdb9; stroke-width: 1.4px; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transition: opacity .7s ease;
}
.backdrop svg * { vector-effect: non-scaling-stroke; }
.backdrop.on svg { opacity: 1; }
.sidebar { z-index: 2; }

.content { position: relative; z-index: 1; margin-left: var(--side); padding: 52px 48px 80px; max-width: calc(var(--side) + 1180px); }

/* ───── заголовок раздела и поиск ───── */

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--ink); }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--taupe); min-height: 17px; }
.title { font-family: var(--serif); font-weight: 500; font-size: 60px; line-height: 1; margin-top: 8px; letter-spacing: -.01em; }
.title small { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--taupe); margin-left: 12px; letter-spacing: .02em; vertical-align: super; }

.search input {
  width: 240px; max-width: 100%;
  background: transparent;
  border: 0; border-bottom: 1px solid var(--beige);
  padding: 8px 2px;
  font-size: 14px;
  border-radius: 0;
  outline: none;
}
.search input::placeholder { color: var(--taupe); }
.search input:focus { border-bottom-color: var(--ink); }

/* ───── сетка карточек ───── */

main { padding-top: 34px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 40px 26px; align-items: start; }

.card { display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; }
.card-cover { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--sand); }
.card-cover img, .card-cover .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-cover img, .card:hover .card-cover .ph { transform: scale(1.04); }

.ph {
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 92px; color: rgba(23, 20, 18, .22);
}
.ph.t0 { background: linear-gradient(150deg, #e9dccb, #cdb69e); }
.ph.t1 { background: linear-gradient(150deg, #d9c7b2, #a89079); }
.ph.t2 { background: linear-gradient(150deg, #2a2420, #5a4a3e); color: rgba(228, 214, 196, .3); }

.card-demo {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 9px;
  background: var(--paper); color: var(--ink);
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}

.card-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 14px; }
.card-kind { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--taupe); }
.card-score { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1; white-space: nowrap; }
.card-score small { font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--taupe); }
.card-name { display: block; font-family: var(--serif); font-size: 25px; line-height: 1.1; margin-top: 6px; }
.card:hover .card-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.card-brand { display: block; margin-top: 5px; font-size: 13px; color: var(--ink-soft); }
.card-verdict { display: block; margin-top: 9px; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.25; color: var(--ink-soft); }

.empty {
  padding: 70px 20px; text-align: center;
  font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--taupe);
}

/* ───── подвал: тонкая полоса на всю ширину портала, поверх бокового меню ───── */

body { display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1; }
.footer {
  position: relative; z-index: 3;
  padding: 11px 32px;
  background: var(--ink); color: var(--beige);
  display: flex; align-items: center; justify-content: space-between; gap: 6px 28px; flex-wrap: wrap;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
}
.footer-mark { font-family: var(--serif); font-size: 18px; letter-spacing: 0; text-transform: none; color: var(--paper); line-height: 1; }

/* ───── реестр книг ───── */

.library-places { margin-bottom: 14px; }
.library-places .tag-chip { padding: 6px 12px; font-size: 13px; }
.library-places .read-chip { margin-left: 10px; }
.library-note { font-size: 13px; color: var(--taupe); margin-bottom: 8px; }
.library-place { margin-left: 8px; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--taupe); white-space: nowrap; }
.library-list { columns: 3 250px; column-gap: 36px; }
.library-letter {
  column-span: all;
  margin: 26px 0 14px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif); font-weight: 500; font-size: 38px; line-height: 1;
}
.library-author { break-inside: avoid; padding-bottom: 18px; }
.library-author h3 { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.15; }
.library-author ul { margin-top: 5px; }
.library-author li { font-size: 14px; line-height: 1.4; color: var(--ink-soft); padding: 2px 0; }
.library-author li.in-series { padding-left: 12px; border-left: 1px solid var(--beige); }
.library-author li.library-series {
  margin-top: 6px; padding-bottom: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--taupe);
}
.library-book { background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
.library-book:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.library-book:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.library-book.has-opinion { color: var(--ink); font-weight: 700; }
.library-book.has-opinion::after {
  content: '✓';
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; margin-left: 7px;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 10px; font-weight: 700; line-height: 1;
  vertical-align: 1px;
}
.library-mark { margin-left: 8px; font-size: 12px; color: var(--taupe); white-space: nowrap; }

/* ───── окно отзыва ───── */

.post {
  width: min(1000px, calc(100vw - 32px));
  max-width: none;
  height: min(680px, calc(100dvh - 32px));
  max-height: none;
  padding: 0; border: 0;
  background: var(--paper); color: var(--ink);
  overflow: hidden;
}
.post[open] { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.post::backdrop { background: rgba(23, 20, 18, .72); }

.post-close {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: var(--paper);
  font-size: 26px; line-height: 1;
}

.post-media { position: relative; background: #fff; min-height: 0; }
.post-photo { position: absolute; inset: 0; }
.post-photo img, .post-photo .ph { width: 100%; height: 100%; object-fit: contain; }
.post-photo .ph { font-size: 150px; }

.post-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(250, 246, 240, .88);
  box-shadow: 0 0 0 1px var(--line);
  font-size: 22px; line-height: 1; padding-bottom: 3px;
}
.post-arrow.prev { left: 12px; }
.post-arrow.next { right: 12px; }
.photo-note { position: absolute; left: 12px; top: 12px; padding: 5px 10px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.post-dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 6px; }
.post-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(23, 20, 18, .25); }
.post-dots i.on { background: var(--ink); }

.post-body { overflow-y: auto; padding: 38px 40px 34px; }

.post-category { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--taupe); }
.post-brand { margin-top: 16px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.post-name { font-family: var(--serif); font-weight: 500; font-size: 38px; line-height: 1.05; margin-top: 4px; }
.post-meta { margin-top: 8px; font-size: 13px; color: var(--taupe); }

.post-score { display: flex; align-items: baseline; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.score-num { font-family: var(--serif); font-size: 54px; font-weight: 600; line-height: .9; }
.score-of { font-size: 13px; color: var(--taupe); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.badges:not(:has(> :not([hidden]))) { display: none; }
.repurchase {
  padding: 6px 12px;
  border: 1px solid var(--ink);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.repurchase.testing { border-style: dashed; }
.card-testing { border: 1px dashed var(--ink); }
.repurchase.yes { background: var(--ink); color: var(--paper); }

.post-verdict { margin-top: 18px; font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.25; }

.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 24px; padding: 18px 20px; background: var(--bg); }
.proscons:has(> [hidden]) { grid-template-columns: 1fr; }
.proscons h3 { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 8px; }
.proscons li { position: relative; padding-left: 18px; font-size: 14px; margin-top: 5px; }
.proscons li::before { position: absolute; left: 0; font-weight: 700; }
.pros li::before { content: '+'; }
.cons li::before { content: '−'; color: var(--taupe); }

.post-article { margin-top: 24px; }
.post-article p { margin-top: 12px; color: var(--ink-soft); }
.post-article p:first-child::first-letter {
  float: left;
  font-family: var(--serif); font-size: 58px; line-height: .82;
  padding: 5px 9px 0 0; color: var(--ink);
}

.post-with { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-soft); }
.with-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.post-tags { margin-top: 22px; }
.post-article h3 { margin-top: 26px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }
.post-article h3:first-child { margin-top: 0; }
.post-article p.is-empty { font-style: italic; color: var(--taupe); }
.opinion-date { font-size: 12px; color: var(--taupe); }
.post-tags { gap: 8px 18px; }
.book-link { font-size: 13px; font-weight: 600; color: var(--ink); text-underline-offset: 4px; }

/* ───── узкий экран ───── */

@media (max-width: 860px) {
  .topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }
  .menu-toggle {
    padding: 8px 14px;
    background: var(--ink); color: var(--paper);
    border: 0;
    font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  }
  .topbar-mark { font-family: var(--serif); font-size: 28px; line-height: 1; }

  .sidebar {
    z-index: 20;
    width: min(300px, 86vw);
    padding: 30px 24px 24px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    visibility: hidden;
  }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(23, 20, 18, .6); }
  .wordmark { font-size: 40px; }
  .menu { margin-top: 28px; }

  .content { margin-left: 0; padding: 26px 16px 56px; }
  .footer { padding: 10px 16px; font-size: 9px; }
  .backdrop { inset: 0; }
  .backdrop svg { scale: .6; }
  .backdrop svg:nth-child(n+9) { display: none; }
  .head { flex-direction: column; align-items: stretch; gap: 14px; padding-bottom: 16px; }
  .title { font-size: 42px; }
  .search input { width: 100%; font-size: 16px; }

  main { padding-top: 22px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 26px 12px; }
  .card-name { font-size: 20px; }
  .card-verdict { font-size: 15px; }
  .card-score { font-size: 20px; }
  .card-demo { top: 8px; left: 8px; font-size: 9px; padding: 3px 6px; }
  .ph { font-size: 60px; }

  .post { width: 100vw; height: 100dvh; }
  .post[open] { display: block; overflow-y: auto; }
  .post-media { aspect-ratio: 4 / 5; }
  .post-body { overflow: visible; padding: 24px 18px 40px; }
  .post-name { font-size: 31px; }
  .proscons { grid-template-columns: 1fr; gap: 16px; }
  .post-close { position: fixed; }
}

.post-score[hidden] { display: none; }
.proscons[hidden] { display: none; }
