/* ============================================================
   Кулинарная библиотека · дизайн-система «Тёплая бумага» (вариант A)
   ============================================================ */

:root {
  --paper:        #f5f1ea;
  --paper-2:      #ece6db;
  --ink:          #2b1f14;
  --ink-soft:     #6b5a48;
  --ink-mute:     #8b7355;
  --ink-faint:    #b8a48a;
  --accent:       #b8553c;
  --accent-soft:  #d4715a;
  --line:         rgba(43, 31, 20, 0.12);
  --line-2:       rgba(43, 31, 20, 0.06);
  --card:         #ffffff;
  --shadow-1:     0 1px 3px rgba(43, 31, 20, .08), 0 8px 24px -10px rgba(43, 31, 20, .14);
  --shadow-2:     0 2px 6px rgba(43, 31, 20, .12), 0 18px 40px -14px rgba(43, 31, 20, .22);
  --radius:       4px;
  --radius-lg:    10px;
  --container:    1200px;
  --t-fast:       .15s ease;
  --t:            .25s ease;
  --serif:        'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --sans:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: var(--ink); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ===== layout ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 640px) {
  .container { padding: 0 18px; }
}

main { flex: 1; padding: 0 0 80px; }

/* ===== header ===== */
.site-header {
  border-bottom: 1px solid var(--line);
  padding: 28px 0 24px;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background-color: rgba(245, 241, 234, 0.92);
}
@media (max-width: 640px) {
  .site-header {
    padding: 12px 0 10px;
    background-color: var(--paper);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.brand .sub {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 6px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .brand .sub { display: none; }
}
.nav {
  display: flex;
  gap: 28px;
  align-items: center;
  flex-wrap: nowrap; /* prevent wrapping — keep avatar always in row */
}
.nav a {
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .nav { gap: 14px; }
  .nav a { font-size: 13px; }
  /* Скрываем большую кнопку "Регистрация" — она дублирует hero CTA */
  .nav a[data-auth="signup"] { display: none; }
  /* "Вход" — заметнее */
  .nav a[data-auth="login"] {
    font-weight: 600;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 5px 14px;
    border-radius: 6px;
  }
}
.nav a.active,
.nav a[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}
.nav a:hover { color: var(--accent); }
.me {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.me-link { display: inline-flex; align-items: center; gap: 10px; }
.me-link:hover .me { background: var(--accent-soft); }

/* avatar dropdown */
.me-menu { position: relative; }
.me-trigger {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.me-trigger:hover .me { background: var(--accent-soft); }
.me-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 6px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 100;
}
.me-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.me-popover-email {
  padding: 12px 14px 10px;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 4px;
  word-break: break-all;
}
.me-popover-item {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.me-popover-item:hover { background: var(--paper-2); color: var(--accent); }
.me-popover-form { margin: 0; }
.me-popover-logout { color: #b03a2e; }
.me-popover-logout:hover { background: #fdecea; color: #b03a2e; }

/* PWA install prompt — floating bottom-right */
.pwa-install {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font: 500 13px var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(184, 85, 60, .35);
  transition: transform .15s ease, background .15s ease;
}
.pwa-install:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}
/* На узких экранах кнопка перекрывала контент — прячем (юзер ставит через
   «поделиться» в Safari, beforeinstallprompt всё равно не стреляет в iOS). */
@media (max-width: 720px) {
  .pwa-install { display: none !important; }
}

/* cookie banner */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
  /* Desktop: компактный toast в правом нижнем углу, не перекрывает центральные CTA.
     Mobile: тонкий sticky-bottom бар. z-index ниже paywall-bar (60), чтобы
     paywall оставался поверх. */
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  left: auto;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 45;
  animation: cookie-banner-in .3s ease;
}
@keyframes cookie-banner-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cookie-banner-text {
  flex: 1;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.cookie-banner .btn { padding: 8px 14px; font-size: 12px; }
@media (max-width: 560px) {
  .cookie-banner {
    left: 12px; right: 12px; max-width: none;
    padding: 10px 12px;
    flex-direction: row; align-items: center; gap: 10px;
  }
  .cookie-banner-text { font-size: 11.5px; line-height: 1.35; }
  .cookie-banner .btn { padding: 7px 12px; font-size: 11.5px; white-space: nowrap; }
}
/* На страницах с paywall-bar — приподнимаем cookie над ним. */
body.reader-page .cookie-banner { bottom: calc(220px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 880px) {
  body.reader-page .cookie-banner { bottom: calc(260px + env(safe-area-inset-bottom, 0px)); }
}

/* ===== headings ===== */
.h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.h1 em { font-style: italic; color: var(--accent); }
.lead {
  font-family: var(--serif);
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 580px;
  margin: 0 0 56px;
}

.section-title {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  margin: 56px 0 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.section-title .count {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* ===== hero — editorial: text left on cream, photo right (background-image) ===== */
.hero {
  position: relative;
  isolation: isolate;
  /* Tall enough for the photo to feel cinematic, short enough for features below */
  min-height: 62vh;
  padding: clamp(48px, 7vh, 72px) 0 clamp(40px, 6vh, 60px);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  /* Break out to full viewport width */
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  z-index: -1;
  background-color: var(--paper);
  /* Layer 1: left→right gradient (cream over text, fades to transparent)
     Layer 2: bottom gradient (fades to cream at footer)
     Layer 3: CSP.png positioned right, showing books area */
  background-image:
    linear-gradient(to right,
      var(--paper) 0%,
      var(--paper) 32%,
      rgba(245, 241, 234, 0.88) 46%,
      rgba(245, 241, 234, 0.45) 56%,
      rgba(245, 241, 234, 0) 68%
    ),
    linear-gradient(to bottom,
      rgba(245, 241, 234, 0) 55%,
      rgba(245, 241, 234, 0.55) 82%,
      var(--paper) 100%
    ),
    url("/static/img/CSP.1fcb9994620e.png");
  /* right = photo's right edge aligns to viewport right edge
     62%  = show the lower 60% of the photo (books, salt bowl, cutting board) */
  background-position: center, center, right 62%;
  background-size: cover, cover, cover;
  background-repeat: no-repeat;
}
.hero-text {
  position: relative;
  z-index: 1;
  max-width: 480px;
}
.hero-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 12px;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  /* Bigger title — matches editorial weight of the photo */
  font-size: clamp(30px, 4.2vw, 50px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: var(--ink);
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-bio {
  font-family: var(--serif);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 400px;
}
.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
  margin: 14px 0 0;
}
.hero-note a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.hero-note a:hover { color: var(--accent); }
.hero-eyebrow-sep { margin: 0 8px; opacity: 0.5; }
/* hero-trial — мелкий CTA под кнопкой */
.hero-trial {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
  margin: 10px 0 0;
}
/* hero-photo-strip — только мобилка (показывается под hero) */
.hero-photo-strip { display: none; }

/* Mobile: текст на чистом белом, фото — отдельная полоса снизу */
@media (max-width: 820px) {
  .hero {
    min-height: auto;
    padding: 32px 0 28px;
    margin: 0;
    align-items: flex-start;
  }
  /* Убираем фото из background на мобилке — только кремовый цвет */
  .hero-bg {
    background-image: none;
    background-color: var(--paper);
  }
  .hero-text { max-width: 100%; }
  .hero-title { font-size: clamp(30px, 7.5vw, 44px); }
  /* Скрываем "Войти" из hero — есть в хедере */
  .hero-links a[data-auth="login"] { display: none; }
  /* Кнопка подписки — на всю ширину */
  .hero-links { flex-direction: column; align-items: flex-start; }
  .hero-links .btn-primary { width: 100%; text-align: center; justify-content: center; }

  /* Фото-полоса скрыта на мобилке */
  .hero-photo-strip { display: none; }
}

/* ===== features v2 (4 columns, line-icons, terracotta accent)
   Перебиваем базовую .features-карточку явной специфичностью .features.features-v2 */
.features.features-v2 {
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 36px 0 8px;
  margin: 0 0 48px;
  border-top: 1px solid var(--line);
}
@media (max-width: 820px) {
  .features.features-v2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 20px;
    border-top: none;     /* убираем полосу */
    padding-top: 20px;
    margin-top: 0;
  }
}
@media (max-width: 460px) {
  .features.features-v2 { grid-template-columns: repeat(2, 1fr); gap: 20px 16px; }
}
.features-v2 .feature {
  flex-direction: column;
  gap: 8px;
  background: transparent;
}
.features-v2 .feature-icon {
  width: 28px; height: 28px;
  background: transparent;
  color: var(--accent);
  font-size: 28px;
  margin-bottom: 6px;
}
.features-v2 .feature-icon svg { width: 100%; height: 100%; display: block; }
.features-v2 .feature-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.features-v2 .feature-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.feature-badge {
  display: inline-flex; align-items: center;
  font-family: var(--sans);
  font-weight: 600; font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-deep, #8d3e16);
  background: rgba(184, 92, 43, 0.08);
  border: 1px solid rgba(184, 92, 43, 0.22);
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
}

/* ===== features (3-column value props) ===== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 8px 0 56px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; gap: 18px; padding: 22px 18px; }
}
.feature { display: flex; flex-direction: column; gap: 8px; }
.feature-icon { font-size: 24px; line-height: 1; }
.feature-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
}
.feature-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ===== subscription banner ===== */
.sub-banner {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fbe9d2 0%, #f5dcc1 100%);
  border: 1px solid #e8c89e;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 40px;
}
.sub-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 240px;
}
.sub-banner-text strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}
.sub-banner-text span {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ===== continue reading — slim top bar ===== */
.continue-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 14px 10px 10px;
  margin: 8px 0 32px;
  text-decoration: none;
  transition: box-shadow var(--t), transform var(--t-fast), border-color var(--t-fast);
}
.continue-bar:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(184, 85, 60, 0.15);
  transform: translateY(-1px);
}
.continue-bar-cover {
  width: 44px;
  height: 64px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--paper-2);
  box-shadow: 0 1px 3px rgba(43,31,20,.15);
}
.continue-bar-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.continue-bar-text { flex: 1; min-width: 0; }
.continue-bar-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.continue-bar-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.continue-bar-title span { color: var(--ink-mute); font-weight: 400; }
.continue-bar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(184, 85, 60, 0.08);
  transition: background var(--t-fast), color var(--t-fast);
}
.continue-bar:hover .continue-bar-cta {
  background: var(--accent);
  color: #fff;
}
@media (max-width: 480px) {
  .continue-bar-cta span { display: none; }
  .continue-bar-cta { padding: 8px 10px; }
  .continue-bar-title { font-size: 15px; }
}

/* ===== legacy continue (kept for compat if used elsewhere) ===== */
.continue {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 48px;
  transition: box-shadow var(--t), transform var(--t);
}
.continue:hover { box-shadow: var(--shadow-1); }
@media (max-width: 480px) {
  .continue { grid-template-columns: 72px 1fr; gap: 16px; padding: 14px; }
}
.continue-cover {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.continue-cover img { width: 100%; height: 100%; object-fit: cover; }
.continue-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.continue-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 500;
}
.continue-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  margin: 4px 0 0;
  line-height: 1.2;
  color: var(--ink);
}
.continue-author { font-size: 13px; color: var(--ink-mute); }
.continue-btn { align-self: flex-start; margin-top: 12px; padding: 10px 16px; font-size: 13px; }
@media (max-width: 480px) {
  .continue-title { font-size: 16px; }
  .continue-btn { padding: 8px 14px; font-size: 12px; }
}

/* ===== category nav (under header) ===== */
.catalog-section-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 32px 0 0;
  line-height: 1.15;
}
.catalog-section-title--gap {
  margin-top: 40px;
}
.cats {
  display: flex;
  align-items: center;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
}
.cats a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  padding-bottom: 6px;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.cats a.active {
  color: var(--accent);
  border-color: var(--accent);
}
.cats a:hover { color: var(--accent); }
.cats-sep {
  color: var(--ink-soft);
  opacity: 0.5;
  padding-bottom: 6px;
  user-select: none;
}
/* На мобиле — одна горизонтальная скроллируемая полоса вместо 3 строк */
@media (max-width: 640px) {
  .cats-wrap {
    position: relative;
    margin: 0 -18px;
  }
  .cats-wrap::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 36px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(245, 241, 234, 0) 0%, var(--paper) 100%);
  }
  .cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0 20px;
    padding: 16px 36px 6px 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cats::-webkit-scrollbar { display: none; }
}

/* ===== a11y focus ring (брендовый, не дефолтный синий хром) ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* ===== paywall block (sticky bar / overlay card) ===== */
/* Bar — sticky внизу ридера. Card — большой overlay в конце превью. */
.paywall {
  color: #fff;
  background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%);
  border-top: 3px solid var(--accent);
}
.paywall-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  box-shadow: 0 -8px 32px rgba(0,0,0,.28);
  padding: 22px 24px;
}
.paywall-card {
  position: relative;
  max-width: 720px;
  margin: 48px auto;
  padding: 40px 36px;
  border-radius: 18px;
  border-top: none;
  box-shadow: 0 24px 60px rgba(0,0,0,.24);
}
.paywall-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: var(--accent);
  border-radius: 18px 18px 0 0;
}
.paywall-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}
.paywall-card .paywall-inner {
  grid-template-columns: 1fr;
  gap: 24px;
  text-align: center;
}
.paywall-copy { min-width: 0; }
.paywall-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.paywall-head {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.paywall-card .paywall-head { font-size: 32px; }
.paywall-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}
.paywall-sub strong { color: #fff; font-weight: 600; }

.paywall-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
}
.paywall-card .paywall-cta { min-width: 0; max-width: 360px; margin: 0 auto; width: 100%; }
.pb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 22px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-align: center;
  white-space: nowrap;
}
.pb-btn-label { font-size: 15px; line-height: 1.1; }
.pb-btn-price { font-size: 12px; opacity: 0.86; margin-top: 2px; font-weight: 500; }
.pb-btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(196, 99, 56, 0.42);
}
.pb-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(196, 99, 56, 0.55);
  background: #d97149;
}
.pb-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.pb-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}
.paywall-micro {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-top: 2px;
}

@media (max-width: 880px) {
  .paywall-bar { padding: 14px 16px; }
  .paywall-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .paywall-head { font-size: 18px; }
  .paywall-card .paywall-head { font-size: 24px; }
  .paywall-cta { min-width: 0; }
  .paywall-card {
    margin: 24px 16px;
    padding: 28px 22px;
    max-width: none;
    width: auto;
  }
  /* На mobile в sticky-bar — только eyebrow + headline + CTA.
     Подробный sub-text не помещается, забирает 40% viewport. */
  .paywall-bar .paywall-sub { display: none; }
  .paywall-bar .paywall-eyebrow { margin-bottom: 4px; }
  .paywall-bar .paywall-head { margin-bottom: 8px; line-height: 1.2; }
}

/* Нейтральная сноска в конце preview — как в ЛитРес/Bookmate. */
.preview-end-note {
  margin: 32px auto 120px;
  max-width: 560px;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft, #6b6358);
  border-top: 1px solid rgba(0,0,0,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.preview-end-label { opacity: 0.85; }
.preview-end-link {
  color: var(--accent, #c46338);
  font-weight: 600;
  text-decoration: none;
}
.preview-end-link:hover { text-decoration: underline; }
/* Recipe preview cut — индикация что дальше скрыто. */
.recipe-preview-cut {
  margin-top: 24px;
  padding: 20px 24px;
  background: rgba(196, 99, 56, 0.08);
  border: 1px dashed rgba(196, 99, 56, 0.32);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  font-style: italic;
}

/* End-of-preview fade — мягкий градиент над последней страницей перед карточкой. */
.paywall-end-fade {
  height: 80px;
  margin-top: -80px;
  background: linear-gradient(180deg, rgba(245, 241, 234, 0) 0%, rgba(245, 241, 234, 0.95) 100%);
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* Чтобы контент ридера не упирался под бар. */
body.reader-page .reader-stage { padding-bottom: 200px; }
@media (max-width: 880px) {
  body.reader-page .reader-stage { padding-bottom: 240px; }
}

/* ===== welcome banner (after signup, on catalog) ===== */
.welcome-banner {
  position: relative;
  margin: 18px 0 8px;
  padding: 18px 44px 18px 22px;
  background: linear-gradient(180deg, #fdf6e3 0%, #fbf2dc 100%);
  border: 1px solid rgba(196, 99, 56, 0.18);
  border-radius: 12px;
  color: var(--ink);
}
.welcome-banner h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.welcome-banner p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.welcome-banner .accent { color: var(--accent); font-weight: 600; }
.welcome-banner-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: transparent; border: 0;
  color: var(--ink-soft); font-size: 22px; line-height: 1;
  cursor: pointer; text-decoration: none;
}
.welcome-banner-close:hover { background: rgba(139, 126, 106, 0.15); }

/* ===== recipe search ===== */
.recipe-search {
  position: relative;
  margin: 18px 0 0;
}
.recipe-search input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 40px 12px 16px;
  font: inherit; font-size: 15px;
  background: #fff;
  border: 1px solid rgba(139, 126, 106, 0.3);
  border-radius: 10px;
  color: var(--ink);
}
.recipe-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 99, 56, 0.12);
}
.recipe-search-clear {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(139, 126, 106, 0.18);
  color: var(--ink); font-size: 18px; line-height: 1;
  text-decoration: none;
}
.recipe-search-clear:hover { background: rgba(139, 126, 106, 0.32); }

/* ===== category chips (secondary nav) ===== */
.cats-chips-wrap { margin-top: -4px; }
.cats-chips {
  gap: 8px 8px;
  padding: 8px 0 4px;
}
.cats-chips .chip {
  padding: 6px 12px;
  background: rgba(139, 126, 106, 0.10);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
}
.cats-chips .chip:hover {
  background: rgba(139, 126, 106, 0.18);
  color: var(--ink);
}
.cats-chips .chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cats-chips .chip.active:hover { color: #fff; }

/* ===== book grid ===== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 36px 24px;
}
@media (max-width: 640px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 16px; }
}
.book-card { display: block; }

/* ───── Row-section: горизонтальные полосы на главной ───── */
.row-section {
  margin: 0 0 32px;
}
.row-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.row-header:hover { opacity: 0.85; }
.row-header:hover .row-all { color: var(--accent); transform: translateX(4px); }
.row-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.row-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}
.row-all {
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  transition: color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.row-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 180px;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 16px;
  margin: 0 -4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.row-strip > .book-card,
.row-strip > .mc-card {
  scroll-snap-align: start;
}
.row-strip--mc {
  grid-auto-columns: 260px;
}
.row-strip::-webkit-scrollbar { height: 6px; }
.row-strip::-webkit-scrollbar-track { background: transparent; }
.row-strip::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}
.row-strip::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
@media (max-width: 640px) {
  .row-strip { grid-auto-columns: 150px; gap: 16px; }
  .row-title { font-size: 22px; }
  .row-section { margin-bottom: 40px; }
}
.book-card .cover-wrap {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--paper-2);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line-2);
  transition: transform var(--t), box-shadow var(--t);
}

/* skeleton shimmer while cover image is loading */
.book-card .cover-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    var(--paper-2) 0%,
    rgba(255, 255, 255, 0.5) 40%,
    var(--paper-2) 80%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  z-index: 0;
  opacity: 1;
  transition: opacity .25s ease;
}
.book-card .cover-wrap.loaded::before { opacity: 0; pointer-events: none; }
.book-card .cover-wrap .cover-img,
.book-card .cover-wrap .placeholder {
  position: relative;
  z-index: 1;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.book-card:hover .cover-wrap {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}
.book-card .cover-wrap .cover-img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
  transition: opacity .35s ease, transform .5s cubic-bezier(.2, .8, .2, 1), filter .35s ease;
  z-index: 1;
  transform-origin: center center;
}
.book-card .cover-wrap > img:not(.cover-img) {
  width: 100%; height: 100%; object-fit: cover;
}

/* preview stack: 3 pages overlaid on the cover, fade in on hover */
.preview-stack {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
}
.preview-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #fff;
  opacity: 0;
  transition: opacity .35s ease;
}
.preview-dots {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 4;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.preview-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background .25s ease, transform .25s ease;
}
.preview-dots span.active {
  background: #fff;
  transform: scale(1.4);
}

/* show previews only on hover (and only on hover-capable devices) */
@media (hover: hover) {
  /* Книги с preview-страницами: при hover показываем превью, скрываем cover */
  .book-card[data-previews]:hover .cover-img { opacity: 0; }
  .book-card[data-previews]:hover .preview-img.active { opacity: 1; }
  .book-card[data-previews]:hover .preview-dots { opacity: 1; }
  /* Рецепты (нет preview): hover-zoom + лёгкое затемнение для глубины */
  .book-card:not([data-previews]):hover .cover-img {
    transform: scale(1.06);
    filter: brightness(1.08) saturate(1.12) contrast(1.02);
  }
  .book-card:not([data-previews]):hover .cover-wrap {
    box-shadow: 0 12px 32px -8px rgba(43, 31, 20, 0.28), 0 4px 10px rgba(43, 31, 20, 0.12);
  }
}
.book-card .cover-wrap .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
  background: linear-gradient(135deg, #1a2332 0%, #0d1419 100%);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.3;
}
.book-card .title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  color: var(--ink);
  margin: 14px 0 0;
}
.book-card .author {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* favorite heart */
.fav-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: background var(--t-fast), transform var(--t-fast);
  z-index: 5;
}
.fav-btn:hover { background: #fff; transform: scale(1.06); }
.fav-btn.on { color: var(--accent); }

/* favorite heart pop animation (Twitter-style) */
.fav-btn.popping { animation: fav-pop .5s cubic-bezier(.4,0,.2,1); }
.fav-btn.popping::before,
.fav-btn.popping::after {
  content: "";
  position: absolute;
  width: 100%; height: 100%;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
}
.fav-btn.popping::before {
  background: radial-gradient(circle, var(--accent) 8%, transparent 0) 0 0,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 100% 0,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 0 100%,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 100% 100%,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 50% 0,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 50% 100%,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 0 50%,
              radial-gradient(circle, var(--accent) 8%, transparent 0) 100% 50%;
  background-size: 8px 8px;
  background-repeat: no-repeat;
  animation: fav-particles .55s ease-out forwards;
}
@keyframes fav-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(0.85); }
  60%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes fav-particles {
  0%   { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* progress on book card */
.card-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(0,0,0,0.18);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  overflow: hidden;
  z-index: 5;
}
.card-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
}
.card-progress-pill {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(255,255,255,0.92);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  z-index: 5;
}

/* ===== buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-soft); color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--accent); }
.btn-block { display: flex; width: 100%; }

/* ===== forms ===== */
.form { max-width: 380px; margin: 60px auto; }
.form h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.form .lead { margin-bottom: 32px; font-size: 15px; }
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.field input[type="email"],
.field input[type="password"],
.field input[type="text"],
.field textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 85, 60, 0.12);
}
.errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: #b03a2e;
  font-size: 13px;
}
.helptext { font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
.form-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
}
.form-foot a { color: var(--accent); }

/* ===== messages ===== */
.messages { margin: 0 0 24px; }
.messages .msg {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14px;
  margin-bottom: 8px;
}
.messages .msg.error { border-color: #b03a2e; color: #b03a2e; }
.messages .msg.success { border-color: var(--accent); color: var(--accent); }

/* ===== back link ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.back-link:hover { color: var(--accent); }

/* ===== book detail ===== */
.book-detail {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 56px;
  margin-top: 32px;
}
@media (max-width: 720px) {
  .book-detail { grid-template-columns: 1fr; gap: 32px; }
  .book-detail .cover-col { max-width: 240px; }
}
.book-detail .cover-col img,
.book-detail .cover-col .placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line-2);
}
.book-detail h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.book-detail .meta {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}
.book-detail .meta span + span::before {
  content: " · ";
  margin: 0 4px;
  color: var(--ink-faint);
}
.book-detail .desc {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 32px;
  max-width: 640px;
}
.book-detail .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* expert note from the chef */
.editor-note {
  background: linear-gradient(135deg, #fbe9d2 0%, #f5dcc1 100%);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 28px;
  max-width: 640px;
}
.editor-note-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.editor-note-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}
.editor-note-body {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
}

/* generic info block (about author, etc.) */
.info-block {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin: 0 0 28px;
  max-width: 640px;
}
.info-block h3 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 14px;
}
.info-block-body {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}

.bookmark-list {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.bookmark-list h3 {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  margin: 0 0 18px;
}
.bookmark-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.bookmark-item .page-no {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  color: var(--accent);
  min-width: 56px;
}
.bookmark-item .note {
  flex: 1;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}
.bookmark-item .note.empty { color: var(--ink-faint); font-style: italic; }
.bookmark-item .del {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  font-size: 13px;
  padding: 2px 6px;
}
.bookmark-item .del:hover { color: #b03a2e; }
.bookmarks-empty {
  font-style: italic;
  color: var(--ink-faint);
  font-family: var(--serif);
  font-size: 15px;
}

/* ===== footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 calc(40px + env(safe-area-inset-bottom));
  margin-top: 80px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
  font-family: var(--serif);
  font-style: italic;
}
.site-footer a { color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.site-footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ===== empty state ===== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-mute);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
}

/* hidden attribute works on any element */
[hidden] { display: none !important; }

/* ===== reader ===== */
.reader {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  --reader-bg: var(--paper);
  --reader-fg: var(--ink);
  --reader-page-shadow: 0 2px 6px rgba(43, 31, 20, .12), 0 18px 40px -14px rgba(43, 31, 20, .22);
}
.reader.theme-dark {
  background: #1a1814;
  --reader-bg: #1a1814;
  --reader-fg: #e0d8c8;
  --reader-page-shadow: 0 2px 6px rgba(0,0,0,.4), 0 18px 40px -14px rgba(0,0,0,.6);
}
.reader.theme-dark .reader-header {
  background: rgba(26, 24, 20, 0.95);
  border-bottom-color: rgba(255,255,255,0.08);
  color: var(--reader-fg);
}
.reader.theme-dark .reader-header .title { color: var(--reader-fg); }
.reader.theme-dark .icon-btn { color: var(--reader-fg); }
.reader.theme-dark .icon-btn:hover { background: rgba(255,255,255,0.08); }
.reader.theme-dark .reader-page-canvas { filter: brightness(0.85) contrast(0.96); }
.reader.theme-dark .reader-page { background: #efe6d2; }
.reader.theme-dark .pages { color: rgba(255,255,255,0.6); }

/* mode/spread visibility */
.reader.mode-scroll .paged-only { display: none; }
.reader.mode-paged .scroll-only { display: none; }
.reader-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 241, 234, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  transition: transform var(--t);
}
.reader-header.hidden { transform: translateY(-100%); }
.reader-progress {
  position: sticky;
  top: 0;
  z-index: 29;
  height: 2px;
  background: transparent;
  pointer-events: none;
  margin-top: -2px;
}
.reader-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width .25s ease;
}
.reader-header .title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .reader-header .title { font-size: 13px; }
  .reader-header {
    padding: 10px 8px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-left: calc(8px + env(safe-area-inset-left, 0px));
    padding-right: calc(8px + env(safe-area-inset-right, 0px));
    gap: 6px;
  }
  .reader-header .controls { gap: 2px; }
  .reader-header .controls .pages { padding: 0 6px; font-size: 13px; }
  /* Apple HIG / Material — минимум 44×44 для тача. Икона остаётся 18px,
     растёт только hit-area. */
  .reader .icon-btn { width: 44px; height: 44px; }
  /* На мобиле прячем вторичные контролы — оставляем essentials:
     back, lang, prev/next, page-counter, search, bookmarks.
     Layout/theme/fullscreen/zoom — в landscape или на десктопе. */
  .reader-header .layout-toggle,
  .reader-header #theme-btn,
  .reader-header #fullscreen-btn,
  .reader-header .zoom-group { display: none; }
  /* Прячем title — на 390px он отнимает место у контролов; останется в title-bar браузера */
  .reader-header .title { display: none; }
  /* Резерв снизу — чтобы последняя страница не упиралась в home-indicator. */
  .reader-stage { padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.reader-header .controls { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.reader-header .controls .pages {
  font-size: 13px; color: var(--ink-mute); padding: 0 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn[disabled] { color: var(--ink-faint); cursor: default; }
.icon-btn[disabled]:hover { background: transparent; }

.reader-stage {
  flex: 1;
  position: relative;
  overflow: auto;
  min-height: 0;
  scroll-behavior: smooth;
}

/* paged mode: pages container centered in viewport */
.reader.mode-paged .reader-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  perspective: 1500px;
}
.reader.mode-paged .reader-pages {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  transition: transform .26s cubic-bezier(.2,.7,.2,1), opacity .2s ease;
  transform-origin: center center;
}

/* Native (prerendered) reader — <img> page stack, vertical feed, no PDF.js.
 * Дефолтный aspect-ratio — A4 portrait, чтобы lazy-страницы занимали высоту
 * до загрузки и scrollIntoView/scrollTop приземлялись правильно.
 * JS уточнит реальный aspect после загрузки первой страницы. */
.reader-page-img {
  display: block;
  max-width: min(100%, 1200px);
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.41;
  margin: 0 auto 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
}
/* .page-slot — обёртка img'а, создаваемая reader_prerendered.js. Базовая
 * геометрия здесь (нужна всегда, даже когда ru-page.css не подгружен).
 * Без этого slot получает 100% ширины, а img внутри max-width:1200px
 * центрируется через margin:auto — overlay/положение разъезжаются. */
.page-slot {
  position: relative;
  display: block;
  /* --page-zoom задаёт reader_prerendered.js (кнопки зума в EN-режиме). */
  max-width: min(100%, calc(1200px * var(--page-zoom, 1)));
  margin: 0 auto 14px;
}
.page-slot .reader-page-img {
  margin: 0;
}
/* Vertical scroll feed для prerendered ридера. */
.reader .reader-pages:has(.reader-page-img) {
  display: block;
  max-width: 100%;
}
.reader.mode-paged .reader-pages.flip-out-forward {
  transform: translateX(-32px) scale(0.97);
  opacity: 0;
}
.reader.mode-paged .reader-pages.flip-out-back {
  transform: translateX(32px) scale(0.97);
  opacity: 0;
}
.reader.mode-paged .reader-pages.flip-in-forward {
  animation: flipInFromRight .28s cubic-bezier(.2,.7,.2,1);
}
.reader.mode-paged .reader-pages.flip-in-back {
  animation: flipInFromLeft .28s cubic-bezier(.2,.7,.2,1);
}
@keyframes flipInFromRight {
  from { transform: translateX(40px) scale(0.97); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes flipInFromLeft {
  from { transform: translateX(-40px) scale(0.97); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .reader.mode-paged .reader-pages,
  .reader.mode-paged .reader-pages.flip-in-forward,
  .reader.mode-paged .reader-pages.flip-in-back {
    transition: none;
    animation: none;
  }
}

/* scroll mode: pages stacked vertically with gaps */
.reader.mode-scroll .reader-stage { padding: 12px 0 60px; }
.reader.mode-scroll .reader-pages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .reader.mode-paged .reader-stage { padding: 8px; }
  .reader.mode-scroll .reader-stage { padding: 8px 0 60px; }
  .reader.mode-scroll .reader-pages { gap: 24px; }
  .reader-page-img {
    box-shadow: 0 2px 14px rgba(0,0,0,0.14);
    border: 1px solid rgba(0,0,0,0.06);
  }
  .reader.theme-dark .reader-page-img {
    box-shadow: 0 2px 14px rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.06);
  }
}

.reader-page {
  background: #fff;
  box-shadow: var(--reader-page-shadow);
  border-radius: var(--radius);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.reader-page-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
}
.reader-page-skeleton {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 14px;
  background: linear-gradient(135deg, #f5f1ea 0%, #ece6db 100%);
}
.reader.theme-dark .reader-page-skeleton {
  background: #2a2620;
  color: rgba(255,255,255,0.4);
}

/* tap zones — invisible left/right for page flipping (paged mode only) */
.reader-tap-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 35%;
  background: transparent;
  cursor: pointer;
  z-index: 5;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
.reader-tap-zone.left { left: 0; }
.reader-tap-zone.right { right: 0; }
@media (hover: hover) {
  .reader-tap-zone:hover {
    background: linear-gradient(to right, rgba(43,31,20,.06), transparent);
  }
  .reader-tap-zone.right:hover {
    background: linear-gradient(to left, rgba(43,31,20,.06), transparent);
  }
}

/* search bar */
.reader-search {
  position: sticky;
  top: 0;
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--reader-bg);
  border-bottom: 1px solid var(--line);
}
.reader.theme-dark .reader-search { border-bottom-color: rgba(255,255,255,0.08); }
.reader-search[hidden] { display: none; }
.reader-search input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  color: inherit;
  font-family: var(--sans);
  min-width: 0;
}
.reader.theme-dark .reader-search input { border-color: rgba(255,255,255,0.15); color: var(--reader-fg); }
.reader-search input:focus { outline: none; border-color: var(--accent); }
.reader-search .search-status {
  font-size: 12px;
  color: var(--ink-mute);
  min-width: 70px;
  white-space: nowrap;
}
.reader.theme-dark .reader-search .search-status { color: rgba(255,255,255,0.6); }
.reader-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-mute);
  z-index: 10;
  pointer-events: none;
}
.reader.theme-dark .reader-loading { color: rgba(255,255,255,0.55); }
.reader-loading[hidden] { display: none; }

.chef-loader {
  position: relative;
  width: 110px;
  height: 130px;
}
.chef-hat {
  position: absolute;
  bottom: 0;
  left: 5px;
  width: 100px;
  height: 110px;
  color: var(--accent);
  animation: hat-bob 2.4s cubic-bezier(.45,0,.55,1) infinite;
  filter: drop-shadow(0 2px 4px rgba(184, 85, 60, .25));
}
.reader.theme-dark .chef-hat { color: #e8a890; }

@keyframes hat-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-3px) rotate(1deg); }
}

.steam {
  position: absolute;
  bottom: 88px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  filter: blur(3px);
  animation: steam-rise 2.4s cubic-bezier(.45,.05,.55,.95) infinite;
}
.steam-1 { left: 28px; animation-delay: 0s; }
.steam-2 { left: 50px; animation-delay: 0.7s; width: 12px; height: 12px; }
.steam-3 { left: 72px; animation-delay: 1.4s; }

@keyframes steam-rise {
  0%   { opacity: 0; transform: translateY(0) scale(0.6); }
  20%  { opacity: 0.55; }
  60%  { opacity: 0.35; transform: translateY(-50px) scale(1.4); }
  100% { opacity: 0; transform: translateY(-90px) scale(2); }
}

.loader-bar {
  width: 160px;
  height: 3px;
  border-radius: 999px;
  background: rgba(184, 85, 60, 0.16);
  overflow: hidden;
  position: relative;
}
.reader.theme-dark .loader-bar { background: rgba(232, 168, 144, 0.18); }
.loader-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width .3s ease;
  position: relative;
}
.reader.theme-dark .loader-bar > span { background: #e8a890; }
/* Indeterminate shimmer when no real progress data yet */
.loader-bar.indeterminate > span {
  width: 35% !important;
  animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-slide {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(220%); }
  100% { transform: translateX(220%); }
}

.loader-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  letter-spacing: 0.01em;
  text-align: center;
  min-height: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .chef-hat, .steam { animation: none; opacity: 0.7; }
}

/* drawer (bookmarks panel) */
.drawer-bg {
  position: fixed; inset: 0;
  background: rgba(43, 31, 20, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  z-index: 60;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 92vw);
  height: 100dvh;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 40px rgba(43, 31, 20, .14);
  transform: translateX(100%);
  transition: transform var(--t);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer-head {
  padding: 22px 24px;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
}
.drawer-body {
  padding: 20px 24px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
  overflow: auto;
  flex: 1;
}
.bookmark-add {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 24px;
}
.bookmark-add textarea {
  width: 100%;
  min-height: 70px;
  border: 0;
  padding: 0;
  background: transparent;
  resize: vertical;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
}
.bookmark-add textarea:focus { outline: none; }
.bookmark-add .row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* simple "no access" page */
.lock {
  text-align: center;
  padding: 80px 20px;
  max-width: 480px;
  margin: 0 auto;
}
.lock h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  margin: 0 0 14px;
}
.lock p {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 32px;
}

/* hide elements when needed */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* prevent text selection in reader (deterrent) */
.reader-page, .reader-page * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ========== Legal pages (oferta / privacy / refund / contacts / subscription) ========== */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 0 64px;
  font-family: var(--serif, "Source Serif 4", serif);
  color: var(--ink, #1a1a1a);
  line-height: 1.65;
}
.legal-head { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line, #e6e0d4); }
.legal-eyebrow {
  font-family: var(--sans, "Inter", sans-serif);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute, #8a8175);
  margin-bottom: 10px;
}
.legal-title { font-size: 30px; font-weight: 600; line-height: 1.25; margin: 0 0 10px; }
.legal-meta { font-family: var(--sans, "Inter", sans-serif); font-size: 13px; color: var(--ink-mute, #8a8175); }
.legal-body h2 { font-size: 20px; font-weight: 600; margin: 28px 0 12px; }
.legal-body p { margin: 0 0 14px; }
.legal-body ul { margin: 0 0 14px; padding-left: 22px; }
.legal-body li { margin-bottom: 6px; }
.legal-body a { color: var(--accent, #b85c2b); text-decoration: underline; text-underline-offset: 2px; }
.legal-body a:hover { text-decoration: none; }
.legal-note {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--paper-muted, #f0ead9);
  border-radius: 6px;
  font-size: 15px;
}
.legal-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.legal-contacts { margin: 0 0 14px; }
.legal-contacts dt { font-family: var(--sans, "Inter", sans-serif); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute, #8a8175); margin-top: 12px; }
.legal-contacts dd { margin: 4px 0 0; padding: 0; font-size: 17px; }

/* Footer extensions */
.footer-eyebrow {
  margin-bottom: 10px;
  font-family: var(--sans, "Inter", sans-serif);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute, #8a8175);
}
.footer-links, .footer-contacts {
  margin-bottom: 8px;
  font-family: var(--sans, "Inter", sans-serif);
  font-size: 13px;
  line-height: 1.9;
}
.footer-links a, .footer-contacts a { color: inherit; }
.footer-links .dot, .footer-contacts .dot { margin: 0 6px; color: var(--ink-mute, #8a8175); }
.footer-legal {
  margin-top: 10px;
  font-family: var(--sans, "Inter", sans-serif);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute, #8a8175);
}

/* Signup consent */
.field-consent { margin: 14px 0 18px; }
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; cursor: pointer; }
.consent input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; }
.consent a { color: var(--accent, #b85c2b); text-decoration: underline; }

/* ============================================================
   FAQ блок на главной — editorial accordion
   ============================================================ */
.faq { max-width: 820px; margin: 80px auto 96px; padding: 0 24px; }
.faq-head { text-align: center; margin-bottom: 36px; }
.faq-eyebrow {
  font: 600 11px/1 -apple-system, system-ui, sans-serif;
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--accent, #b85c2b); margin-bottom: 14px;
}
.faq-title {
  font: 800 clamp(28px, 3.5vw, 40px)/1.15 "Source Serif 4", "Source Serif Pro", Georgia, serif;
  letter-spacing: -0.015em; margin: 0; color: #2a2218;
}
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
  border-bottom: 1px solid rgba(60, 40, 20, 0.12);
  padding: 4px 0;
}
.faq-item:first-of-type { border-top: 1px solid rgba(60, 40, 20, 0.12); }
.faq-item > summary {
  list-style: none; cursor: pointer;
  padding: 22px 44px 22px 4px; position: relative;
  font: 600 17px/1.35 "Source Serif 4", Georgia, serif;
  color: #2a2218; transition: color .15s ease;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; position: absolute; top: 50%; right: 8px;
  width: 14px; height: 14px;
  border-right: 2px solid #8a7860; border-bottom: 2px solid #8a7860;
  transform: translateY(-65%) rotate(45deg);
  transition: transform .2s ease, border-color .15s ease;
}
.faq-item[open] > summary::after {
  transform: translateY(-30%) rotate(-135deg);
  border-color: var(--accent, #b85c2b);
}
.faq-item > summary:hover { color: var(--accent, #b85c2b); }
.faq-item .faq-body {
  padding: 0 4px 24px;
  font: 400 16px/1.6 "Source Serif 4", Georgia, serif;
  color: #4a4032; max-width: 720px;
}
@media (max-width: 600px) {
  .faq { margin: 48px auto 64px; }
  .faq-item > summary { font-size: 16px; padding: 18px 36px 18px 0; }
  .faq-item .faq-body { font-size: 15px; }
}
