/* ============================================================
   Книги митрополита Митрофана — дизайн-система прототипа
   Палитра ТЗ §20.2: бумага, графит, морской синий, бордовый,
   серебристо-серый, умеренное старое золото.
   ============================================================ */

:root {
  --paper: #F7F3EB;          /* тёплая бумага, фон */
  --card: #FFFDF8;           /* карточки, чуть светлее бумаги */
  --ink: #26262B;            /* графит, основной текст */
  --ink-soft: #55555E;       /* вторичный текст */
  --navy: #16334F;           /* тёмный морской синий */
  --navy-deep: #0F2337;      /* футер, hover */
  --wine: #7D3B42;           /* приглушённый бордовый */
  --gold: #A98F55;           /* старое золото — только линии и детали */
  --silver: #C9C7C0;         /* серебристо-серый, рамки */
  --shadow: 0 2px 8px rgba(38, 38, 43, .08), 0 12px 32px rgba(38, 38, 43, .07);

  --serif: "Literata", "PT Serif", Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--sans);
  font-size: 17px;              /* ТЗ §22: не менее 17px */
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; display: block; }
a { color: var(--navy); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--ink); }

/* Надзаголовок-«ярлык» */
.eyebrow {
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--wine);
  font-weight: 600;
  margin-bottom: 14px;
}

/* Золотая курсовая линия — сигнатурный элемент */
.rule {
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(169, 143, 85, .15));
  border: 0;
  margin: 0 0 28px;
  position: relative;
}
.rule::before {
  content: "";
  position: absolute;
  left: 0; top: -3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

/* ---------- Шапка ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--silver);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}
.brand {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand small {
  display: block;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.nav { display: flex; gap: 26px; }
.nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 16px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--gold); }
.nav a:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }

/* ---------- Кнопки (формулировки ТЗ §21) ---------- */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 500;
  padding: 13px 26px;
  border-radius: 4px;
  border: 1.5px solid var(--navy);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: center;
}
.btn:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-outline { background: transparent; color: var(--navy); }
.btn-outline:hover { background: rgba(22, 51, 79, .07); }
.btn-quiet {
  border-color: transparent;
  color: var(--wine);
  padding-left: 0; padding-right: 0;
}
.btn-quiet:hover { text-decoration: underline; }

/* ---------- Метки ---------- */
.tag {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 3px;
  letter-spacing: .02em;
}
.tag-free { background: rgba(125, 59, 66, .1); color: var(--wine); }
.tag-format { background: rgba(22, 51, 79, .08); color: var(--navy); }
.tag-soon { background: rgba(85, 85, 94, .1); color: var(--ink-soft); }

/* ---------- Hero главной ---------- */
.hero { padding: 72px 0 64px; }
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.hero h1 { font-size: clamp(30px, 3.4vw, 46px); margin: 0 0 18px; }
.hero .roles {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 2.2vw, 24px);
  color: var(--navy);
  margin-bottom: 18px;
}
.hero .lede { font-size: 18px; color: var(--ink-soft); max-width: 46ch; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* Библиотечная стена: кладка колоннами, обложки целиком, без обрезки */
.cover-wall {
  columns: 4;
  column-gap: 12px;
}
.cover-wall img {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  break-inside: avoid;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(38, 38, 43, .12);
  border: 1px solid rgba(38, 38, 43, .08);
}

/* ---------- Секции ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--card); border-top: 1px solid var(--silver); border-bottom: 1px solid var(--silver); }
.section h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 8px; }
.section .sub { color: var(--ink-soft); margin-bottom: 30px; max-width: 60ch; }

/* Три формата */
.formats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.format-card {
  background: var(--card);
  border: 1px solid var(--silver);
  border-radius: 6px;
  padding: 30px 28px;
}
.section-alt .format-card { background: var(--paper); }
.format-card h3 { font-size: 24px; margin-bottom: 10px; }
.format-card p { color: var(--ink-soft); font-size: 16.5px; margin-bottom: 18px; }

/* Сетка книг */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 28px 24px;
}
.books-grid.featured { grid-template-columns: repeat(3, 1fr); gap: 32px 28px; }
.books-grid.featured .title { font-size: 19px; }
@media (max-width: 960px) { .books-grid.featured { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .books-grid.featured { grid-template-columns: 1fr; } }
.book-card {
  background: var(--card);
  border: 1px solid var(--silver);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.book-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.book-card a.cover-link { display: block; background: #ECE7DC; }
.book-card .cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background: #ECE7DC;
}
.book-card .meta { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.book-card .title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.35;
}
.book-card .title a { color: var(--ink); text-decoration: none; }
.book-card .title a:hover { color: var(--navy); text-decoration: underline; }
.book-card .year { font-size: 14.5px; color: var(--ink-soft); }
.book-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* Маршруты (курсовая линия) */
.routes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 32px; }
.route {
  display: block;
  text-decoration: none;
  color: var(--ink);
  padding: 18px 0 16px;
  border-top: 1px solid var(--gold);
  position: relative;
}
.route::before {
  content: "";
  position: absolute;
  top: -4px; left: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}
.route:hover .route-name { color: var(--navy); text-decoration: underline; }
.route-name { font-family: var(--serif); font-size: 20px; font-weight: 600; display: block; margin-bottom: 4px; }
.route-count { font-size: 15px; color: var(--ink-soft); }

/* Блок автора */
.author { display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: start; }
.author img { border-radius: 5px; box-shadow: var(--shadow); }
.facts { list-style: none; display: grid; gap: 12px; margin: 22px 0 26px; }
.facts li { padding-left: 22px; position: relative; font-size: 17px; }
.facts li::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 8px; height: 1.5px;
  background: var(--gold);
}

/* Подписка */
.subscribe-form { display: flex; flex-wrap: wrap; gap: 12px; max-width: 620px; }
.subscribe-form input[type="text"],
.subscribe-form input[type="email"] {
  flex: 1 1 200px;
  font-family: var(--sans);
  font-size: 17px;
  padding: 12px 14px;
  border: 1px solid var(--silver);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
}
.subscribe-form input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.consent { font-size: 14.5px; color: var(--ink-soft); margin-top: 10px; }

/* ---------- Каталог ---------- */
.catalog-head { padding: 44px 0 8px; }
.catalog-head h1 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 6px; }
.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 44px; padding: 28px 24px 72px; }

.filters { position: sticky; top: 88px; display: grid; gap: 26px; }
.filter-group h3 {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.filter-group label {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 16px;
  padding: 4px 0;
  cursor: pointer;
}
.filter-group input { accent-color: var(--navy); width: 16px; height: 16px; flex: none; transform: translateY(2px); }

.search-box input {
  width: 100%;
  font-family: var(--sans);
  font-size: 17px;
  padding: 12px 14px;
  border: 1px solid var(--silver);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
}
.search-box input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.result-count { color: var(--ink-soft); font-size: 16px; }
.reset-filters {
  background: none; border: none;
  font-family: var(--sans); font-size: 15.5px;
  color: var(--wine); cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.empty-note {
  padding: 48px 0;
  color: var(--ink-soft);
  font-size: 18px;
}

/* ---------- Страница книги ---------- */
.breadcrumbs { font-size: 15px; color: var(--ink-soft); padding: 22px 0 0; }
.breadcrumbs a { color: var(--ink-soft); }
/* .book-page живёт на том же <main class="wrap book-page">, что и .wrap —
   значит padding-shorthand здесь перетирает боковые отступы .wrap в ноль.
   На широком экране это скрыто пустым полем снаружи max-width:1180px,
   а на любой ширине ЭКРАНА уже 1180px (то есть везде на планшете и
   телефоне) текст утыкался прямо в край. Оставляем только вертикальный
   отступ, боковой — из .wrap. */
.book-page { display: grid; grid-template-columns: 340px 1fr; gap: 56px; padding-top: 34px; padding-bottom: 26px; align-items: start; }
.book-cover-big img { border-radius: 4px; box-shadow: var(--shadow); border: 1px solid rgba(38,38,43,.08); }
.book-cover-big .caption { font-size: 14.5px; color: var(--ink-soft); margin-top: 12px; text-align: center; }
.book-info h1 { font-size: clamp(28px, 3.4vw, 40px); margin: 6px 0 10px; }
.book-info .series-line { color: var(--wine); font-size: 16px; margin-bottom: 4px; }
.book-info .biblio { color: var(--ink-soft); font-size: 16px; margin-bottom: 20px; }
.book-info .annot { font-size: 18px; max-width: 60ch; margin-bottom: 30px; }

.format-blocks { display: grid; gap: 16px; max-width: 640px; }
.format-block {
  background: var(--card);
  border: 1px solid var(--silver);
  border-radius: 6px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 20px;
  align-items: center;
}
.format-block .fb-title { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.format-block .fb-details { color: var(--ink-soft); font-size: 15.5px; grid-column: 1; }
.format-block .fb-price { font-size: 21px; font-weight: 600; color: var(--ink); text-align: right; grid-row: 1; grid-column: 2; white-space: nowrap; }
.format-block .fb-action { grid-column: 2; grid-row: 2; justify-self: end; }
.format-block.disabled { opacity: .75; }

.book-details { padding: 30px 0 60px; }
.book-details .cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: start; }
.book-details h2 { font-size: 26px; margin-bottom: 14px; }
.book-details p { margin-bottom: 14px; max-width: 65ch; }
.spec-list { list-style: none; display: grid; gap: 9px; font-size: 16px; }
.spec-list li { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px dotted var(--silver); padding-bottom: 8px; }
.spec-list .k { color: var(--ink-soft); }

/* ---------- Футер ---------- */
.site-footer {
  background: var(--navy-deep);
  color: rgba(255, 255, 255, .85);
  padding: 44px 0 36px;
  margin-top: 40px;
  font-size: 15.5px;
}
.site-footer a { color: rgba(255, 255, 255, .85); }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.site-footer h3 { font-family: var(--serif); color: #fff; font-size: 18px; margin-bottom: 10px; }
.site-footer ul { list-style: none; display: grid; gap: 7px; }
.footnote { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.6); font-size: 14px; }

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
  .cover-wall { max-width: 480px; margin: 0 auto; }
  .formats-grid, .routes { grid-template-columns: 1fr 1fr; }
  .catalog-layout { grid-template-columns: 1fr; }
  .filters { position: static; grid-template-columns: 1fr 1fr; }
  .book-page { grid-template-columns: 260px 1fr; gap: 36px; }
  .book-details .cols, .site-footer .cols { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav { display: none; }
  .brand { white-space: normal; font-size: 17px; line-height: 1.25; padding: 10px 0; }
  .brand small { font-size: 10.5px; }
  .hero { padding: 44px 0 40px; }
  .formats-grid, .routes, .filters { grid-template-columns: 1fr; }
  .author { grid-template-columns: 1fr; }
  .author img { max-width: 220px; }
  .book-page { grid-template-columns: 1fr; }
  .book-cover-big { max-width: 280px; margin: 0 auto; }
  .format-block { grid-template-columns: 1fr; }
  .format-block .fb-price, .format-block .fb-action { grid-column: 1; grid-row: auto; justify-self: start; text-align: left; }
}

/* ===== v2: верх по макету hero.png ===== */

/* Двухъярусная шапка */
.site-header.v2 { padding: 0; }
.site-header.v2 .masthead {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
}
.mast-left { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.medallion {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: "Literata", serif; font-size: 22px; font-weight: 600;
}
.mast-pub { font-size: 13.5px; line-height: 1.35; color: #4A4945; }
.mast-title {
  flex: 1;
  text-align: center;
  font-family: "Literata", serif;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
}
.mast-cross {
  min-width: 220px;
  text-align: right;
  font-size: 30px;
  color: var(--gold);
  line-height: 1;
}
.mainnav { border-top: 1px solid rgba(169,143,85,.35); }
.mainnav .wrap {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 24px;
  overflow-x: auto;
}
.mainnav a {
  padding: 14px 4px 12px;
  font-size: 15.5px;
  color: #33322E;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: var(--navy); }
.mainnav a.active { color: #7A5A1E; border-bottom-color: var(--gold); }

/* Hero: сепия + рисунок пишущих рук */
.hero-v2 {
  position: relative;
  overflow: hidden;
  background: linear-gradient(102deg, #F1E6D0 0%, #EADCBE 48%, #E0CCA6 100%);
  border-bottom: 1px solid rgba(169,143,85,.35);
}
.hero-v2 .hero-art {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 70%;
  background: url("../img/hands-wide.jpg") right 30% / cover no-repeat;
  filter: sepia(.55) saturate(.8) brightness(1.14) contrast(.9);
  opacity: .92;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 38%);
  mask-image: linear-gradient(to right, transparent 0, #000 38%);
}
.hero-v2 .wrap {
  position: relative;
  display: block;
  padding-top: 84px;
  padding-bottom: 96px;
}
.hero-v2 .hero-text { max-width: 660px; }
.hero-v2 h1 {
  font-size: clamp(42px, 4.8vw, 68px);
  line-height: 1.08;
  color: var(--navy);
  margin: 0 0 22px;
}
.hero-sub {
  font-family: "Literata", serif;
  font-size: clamp(19px, 1.8vw, 25px);
  color: #6E5417;
  margin: 0 0 34px;
}
.hero-v2 .btn-outline { background: rgba(255,253,248,.75); }

/* Книжное наследие: шапка секции */
.legacy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.legacy-head h2 { margin: 0; color: var(--navy); }
.see-all {
  font-size: 15.5px;
  color: #7A5A1E;
  text-decoration: none;
  white-space: nowrap;
}
.see-all:hover { text-decoration: underline; }

@media (max-width: 960px) {
  .mast-pub, .mast-cross { display: none; }
  .mast-left { min-width: 0; }
}

/* Планшет: рисунок перестаёт быть фоном справа и становится полосой сверху.
   Кадрировать её по верху нельзя — там пустой лист, а смысл рисунка (руки,
   перо, страница) лежит в средней трети. Отсюда position по 62% высоты
   и высота полосы, привязанная к ширине: на сплюснутой ленте композиция
   разваливается независимо от точки кадра.
   Порог 1180, а не 960: до него десктопная раскладка уже не помещается —
   рисунок сжимается в щель, а верхнее меню обрезается по краю. */
@media (max-width: 1180px) {
  /* верхний отступ героя рассчитан на текст рядом с рисунком; когда рисунок
     встаёт первым, отступ читается как пустая полоса под меню */
  .hero-v2 { padding-top: 0; }
  .hero-v2 .hero-art {
    position: static;
    width: 100%;
    height: clamp(300px, 34vw, 420px);
    background-position: center 62%;
    -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
    mask-image: linear-gradient(to bottom, #000 72%, transparent);
  }
  .hero-v2 .wrap { padding-top: 8px; padding-bottom: 56px; }
}

/* ===== v2: профессиональная подача обложек ===== */

/* Лёгкая коррекция сканов: чуть больше контраста и сочности */
.book-card .cover,
.book-cover-big img,
.cover-wall img {
  filter: contrast(1.05) saturate(1.06) brightness(1.02);
}

/* Паспарту: обложка целиком на спокойной подложке, волосяная рамка */
.book-card a.cover-link {
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, #F4EFE4, #ECE5D6);
}
.book-card .cover {
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background: transparent;
  border: 0;
  filter: contrast(1.05) saturate(1.06) brightness(1.02)
          drop-shadow(0 2px 5px rgba(38, 38, 43, .22));
}

/* Крупная обложка на странице книги.
   width обязателен: без него скан рисуется в натуральную величину — мелкие
   сканы (181px) висели крошкой в колонке на 340px. */
.book-cover-big img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: 0 3px 10px rgba(38,38,43,.16), 0 14px 38px rgba(38,38,43,.12);
}

/* ===== Форма заказа печатного издания ===== */
.order-dialog {
  margin: auto;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 28px 30px 26px;
  width: min(480px, calc(100vw - 32px));
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(20, 20, 25, .25);
}
.order-dialog::backdrop { background: rgba(15, 35, 55, .45); }
.od-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.od-head h3 { font-size: 23px; margin: 0 0 6px; }
.od-close {
  border: 0; background: none; font-size: 30px; line-height: 1;
  color: var(--ink-soft); cursor: pointer; padding: 0 2px;
}
.od-close:hover { color: var(--ink); }
.od-book { color: var(--ink-soft); font-size: 15.5px; margin: 0 0 20px; }
.od-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.od-fields label { font-size: 15px; font-weight: 500; display: block; }
.od-fields .req { color: var(--wine); }
.od-fields input {
  width: 100%;
  margin-top: 6px;
  font: inherit; font-size: 16.5px;
  padding: 11px 12px;
  border: 1px solid var(--silver);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.od-fields input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.od-consent {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14.5px; color: var(--ink-soft);
  margin-bottom: 18px; cursor: pointer;
}
.od-consent input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--navy); }
.od-submit { width: 100%; }
.od-error { color: var(--wine); font-size: 14.5px; margin-top: 10px; }
.od-contacts {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid rgba(169,143,85,.4);
  font-size: 15px; color: var(--ink-soft);
}
.od-contacts-title { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.od-contacts a { color: var(--navy); }
.od-success h3 { font-size: 22px; margin-bottom: 10px; }
.od-success p { margin-bottom: 12px; }
.od-note { font-size: 13.5px; color: var(--ink-soft); }

/* Кликабельная метка «Печатная — заказать» в каталоге */
button.tag-order {
  font-family: var(--sans);
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
button.tag-order:hover { background: rgba(22, 51, 79, .16); }
button.tag-order:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Якорные переходы: цель не должна прятаться под липкой шапкой */
section[id], footer[id], [id="routes"], [id="listen"], [id="author"], [id="subscribe"] {
  scroll-margin-top: 165px;
}
@media (max-width: 960px) {
  section[id], footer[id] { scroll-margin-top: 130px; }
}

/* ===== Витрина v3: обложки на тёмно-синем, единая высота ряда ===== */
.book-card a.cover-link {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(233, 220, 190, .14), transparent 55%),
    linear-gradient(165deg, #1D3D5C 0%, #16334F 55%, #0F2337 100%);
}
.book-card .cover {
  position: absolute;
  inset: 20px 18px;
  width: calc(100% - 36px);
  height: calc(100% - 40px);
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 2px;
  filter: contrast(1.05) saturate(1.07) brightness(1.03)
          drop-shadow(0 8px 20px rgba(0, 0, 0, .5));
}
/* Белые/светлые обложки не «прилипают» к фону за счёт тени, рамка не нужна */

/* Примечание о ценах на карточке книги */
.price-note { font-size: 15px; color: var(--ink-soft); margin-top: 14px; max-width: 52ch; }

/* ===== Правки по аудиту 03.08 ===== */

/* Телефоны не рвутся переносом */
a[href^="tel:"] { white-space: nowrap; }

/* Фокус на новом меню — в палитре, а не дефолтный */
.mainnav a:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; border-radius: 2px; }

/* Skip-link для клавиатуры и дикторов */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff;
  padding: 10px 18px; z-index: 100; border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

/* Логотип епархии в медальоне */
.medallion img { width: 30px; height: 30px; object-fit: contain; }

/* Второй экран: 4 плашки разделов */
.section-tiles { padding: 40px 0 8px; }
.tiles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--silver);
  border-top: 2px solid var(--gold);
  border-radius: 6px;
  padding: 26px 24px 22px;
  text-decoration: none;
  transition: box-shadow .15s, transform .15s;
}
.tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.tile .tile-name {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.tile .tile-sub { display: block; font-size: 15px; color: var(--ink-soft); }
.tile .tag-soon { margin-top: 10px; }
@media (max-width: 960px) { .tiles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .tiles-grid { grid-template-columns: 1fr; } }

/* Фильтры каталога: шторка на мобильном */
details.filters-box > summary {
  display: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 16.5px;
  color: var(--navy);
  padding: 12px 16px;
  border: 1px solid var(--silver);
  border-radius: 6px;
  background: var(--card);
  list-style: none;
  user-select: none;
}
details.filters-box > summary::-webkit-details-marker { display: none; }
details.filters-box > summary::after { content: " ▾"; color: var(--gold); }
details.filters-box[open] > summary::after { content: " ▴"; }

/* Мобильный слой */
@media (max-width: 640px) {
  /* шапка не съедает экран */
  .site-header { position: static; }
  section[id], footer[id] { scroll-margin-top: 24px; }

  /* каталог: две колонки, компактное паспарту */
  #books.books-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  #books .book-card .cover { inset: 12px 10px; width: calc(100% - 20px); height: calc(100% - 24px); }
  #books .book-card .meta { padding: 10px 12px 14px; }
  #books .book-card .title { font-size: 15px; }

  /* фильтры-шторка */
  details.filters-box > summary { display: block; }

  /* намёк, что меню прокручивается */
  .mainnav .wrap {
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }
}
details.filters-box[open] > summary { margin-bottom: 18px; }

/* Подзаголовок каталога на главной: переносим, не распираем экран */
#catalog .see-all { white-space: normal; text-align: right; }
@media (max-width: 640px) { #catalog .see-all { display: none; } }

/* ===== Видеоразделы: Проповеди / Интервью ===== */
.video-intro { max-width: 70ch; color: var(--ink-soft); margin-bottom: 34px; }
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 26px 22px;
}
.video-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--silver);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow .15s, transform .15s;
}
.video-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.vc-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(165deg, #1D3D5C 0%, #16334F 55%, #0F2337 100%);
}
.vc-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.vc-thumb::after {              /* кнопка воспроизведения */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(15, 35, 55, .72) no-repeat 55% 50% / 18px
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 3.8v16.4L20.5 12z" fill="%23EFE7D6"/></svg>');
  border: 1.5px solid rgba(239, 231, 214, .8);
}
.vc-ph {                        /* заглушка без превью */
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 14px 16px;
  color: rgba(239, 231, 214, .85);
  font-family: var(--serif);
  font-size: 15px;
}
.vc-meta { padding: 14px 16px 18px; }
.vc-date { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 6px; }
.vc-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.video-card:hover .vc-title { color: var(--navy); }

/* ===== Страница биографии ===== */
.bio-hero {
  background: linear-gradient(102deg, #F1E6D0 0%, #EADCBE 60%, #E3D0AE 100%);
  border-bottom: 1px solid rgba(169, 143, 85, .35);
  padding: 56px 0 48px;
}
.bio-hero .wrap { display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: center; }
.bio-portrait img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid rgba(169, 143, 85, .6);
  outline: 1px solid rgba(169, 143, 85, .25);
  outline-offset: 5px;
  box-shadow: 0 6px 22px rgba(60, 48, 30, .22);
}
.bio-hero h1 { font-size: clamp(30px, 3.4vw, 44px); color: var(--navy); margin: 6px 0 12px; }
.bio-hero .bio-lede { font-size: 18.5px; color: #4A4438; max-width: 60ch; }
.bio-body { padding: 56px 0 72px; }
.bio-body .wrap { display: grid; grid-template-columns: 1fr 300px; gap: 64px; align-items: start; }
.bio-text h2 {
  font-size: 24px;
  color: var(--navy);
  margin: 40px 0 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(169, 143, 85, .45);
}
.bio-text h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.bio-text p { margin-bottom: 14px; max-width: 66ch; }
.bio-note { font-size: 15px; color: var(--ink-soft); }

/* Вехи */
.milestones {
  position: sticky;
  top: 170px;
  background: var(--card);
  border: 1px solid var(--silver);
  border-top: 2px solid var(--gold);
  border-radius: 6px;
  padding: 24px 24px 18px;
}
.milestones h2 { font-size: 19px; margin-bottom: 16px; }
.milestones ol { list-style: none; }
.milestones li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(201, 199, 192, .5);
  font-size: 15px;
  line-height: 1.45;
}
.milestones li:last-child { border-bottom: 0; }
.milestones .y { font-family: var(--serif); font-weight: 600; color: var(--navy); }
@media (max-width: 960px) {
  .bio-hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .bio-portrait { max-width: 220px; margin: 0 auto; }
  .bio-body .wrap { grid-template-columns: 1fr; gap: 40px; }
  .milestones { position: static; }
}
.vc-date, .vc-title { display: block; }

/* Кинематографический грейд превью: тил в тенях, тёплый свет, контраст */
.vc-thumb img {
  filter: contrast(1.16) saturate(1.32) brightness(1.02);
}
.vc-thumb::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(16, 64, 96, .55) 0%,
    rgba(18, 52, 84, .18) 32%,
    rgba(255, 168, 92, .22) 68%,
    rgba(6, 16, 30, .78) 100%);
  mix-blend-mode: overlay;
  z-index: 1;
  pointer-events: none;
}
.vc-thumb::after { z-index: 2; }

/* Вариант Б: типографский пэкшот вместо кадра */
.vc-plate {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 20px 16px;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(233, 220, 190, .16), transparent 55%),
    linear-gradient(165deg, #1D3D5C 0%, #16334F 55%, #0F2337 100%);
}
.vc-plate::before { display: none; }
.vc-plate::after { display: none; }
.vp-label {
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #C8B78E;
  margin-bottom: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(169, 143, 85, .55);
  align-self: flex-start;
}
.vp-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  color: #F2ECDD;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vp-play {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(239, 231, 214, .12) no-repeat 58% 50% / 13px
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 3.8v16.4L20.5 12z" fill="%23EFE7D6"/></svg>');
  border: 1px solid rgba(169, 143, 85, .6);
}

/* Встроенный плеер видео */
.player-dialog {
  margin: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(960px, calc(100vw - 32px));
  background: #0F2337;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.player-dialog::backdrop { background: rgba(8, 16, 28, .8); }
.pl-frame { aspect-ratio: 16 / 9; }
.pl-frame iframe, .pl-frame video { width: 100%; height: 100%; display: block; background: #000; }
.pl-frame video[hidden], .pl-frame iframe[hidden] { display: none; }
.pl-title {
  font-family: var(--serif);
  font-size: 16.5px;
  color: #EFE7D6;
  padding: 14px 52px 16px 18px;
}
.pl-close {
  position: absolute;
  top: 8px; right: 10px;
  z-index: 2;
  border: 0;
  background: rgba(15, 35, 55, .6);
  color: #EFE7D6;
  font-size: 26px;
  line-height: 1;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
}
.pl-close:hover { background: rgba(15, 35, 55, .9); }

/* ===== Фотоархив ===== */
.photo-section { margin-bottom: 44px; }
.photo-section h2 { font-size: 24px; color: var(--navy); margin-bottom: 6px; }
.photo-section .ps-sub { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 18px; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.photo-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 5px;
  border: 1px solid var(--silver);
  background: #E8E2D4;
  cursor: zoom-in;
  padding: 0;
}
.photo-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .25s;
}
.photo-card:hover img { transform: scale(1.04); }
.photo-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
@media (max-width: 960px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .photo-grid { grid-template-columns: 1fr; } }

/* Лайтбокс */
.photo-lb {
  margin: auto;
  border: 0;
  padding: 0;
  background: #0F2337;
  border-radius: 8px;
  width: min(1100px, calc(100vw - 28px));
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}
.photo-lb::backdrop { background: rgba(8, 16, 28, .84); }
.photo-lb img { width: 100%; max-height: 78vh; object-fit: contain; display: block; }
.photo-lb .lb-cap {
  font-family: var(--serif);
  font-size: 16px;
  color: #EFE7D6;
  padding: 13px 54px 15px 18px;
}

/* ===== Юридические страницы ===== */
.legal-page { max-width: 820px; }
.legal-page h1 { font-size: clamp(26px, 3vw, 36px); margin-bottom: 8px; }
.legal-updated { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 26px; }
.legal-note {
  background: rgba(169, 143, 85, .1);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  font-size: 15px;
  color: #5A4E33;
  border-radius: 0 4px 4px 0;
  margin-bottom: 30px;
}
.legal-page h2 { font-size: 20px; color: var(--navy); margin: 30px 0 10px; }
.legal-page p, .legal-page li { font-size: 16.5px; margin-bottom: 10px; max-width: 74ch; }
.legal-page ul { padding-left: 22px; margin-bottom: 12px; }
.doc-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 34px; }
.doc-nav a {
  font-size: 14.5px;
  padding: 7px 14px;
  border: 1px solid var(--silver);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}
.doc-nav a:hover { border-color: var(--navy); color: var(--navy); }
.doc-nav a.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Строка документов в футере */
.footer-docs {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 13.5px;
}
.footer-docs a { color: rgba(239, 231, 214, .75); text-decoration: none; margin-right: 18px; }
.footer-docs a:hover { color: #fff; text-decoration: underline; }

/* Акцепт оферты в форме заказа */
.od-terms { font-size: 13.5px; color: var(--ink-soft); margin: -6px 0 14px; }
.od-terms a { color: var(--navy); }

/* ===== Правки мобильного аудита 04.08 ===== */

/* [hidden] должен побеждать любые display */
[hidden] { display: none !important; }

/* Тап-подсветка в палитре вместо системной серой */
a, button, summary, .photo-card { -webkit-tap-highlight-color: rgba(22, 51, 79, .1); }

/* Плашки разделов не распирают экран (ломалось на 414px) */
.tiles-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { min-width: 0; }
@media (max-width: 960px) { .tiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles-grid { grid-template-columns: minmax(0, 1fr); } }

/* Диалоги: прокрутка внутри, фон не «уезжает» */
.order-dialog, .player-dialog, .photo-lb {
  max-height: min(88dvh, 780px);
  overscroll-behavior: contain;
}
.order-dialog { overflow-y: auto; }
html:has(dialog[open]) { overflow: hidden; }

/* Крестики — полноценные тач-зоны 44px */
.od-close {
  width: 44px; height: 44px; min-width: 44px; flex: 0 0 44px;
  display: flex; align-items: center; justify-content: center;
  margin: -8px -10px 0 0;
}
.pl-close { width: 44px; height: 44px; font-size: 28px; }

/* Мобильный слой правок */
@media (max-width: 640px) {
  /* кнопки покупки в карточках — по пальцу */
  .book-card .tag-order { padding: 11px 12px; font-size: 14.5px; line-height: 1.25; }
  .book-card .tags { gap: 10px; }

  /* фильтры и сброс */
  .filter-group label { padding: 7px 0; }
  .filter-group input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); }
  .reset-filters { min-height: 44px; }

  /* кнопка отправки заявки всегда на виду */
  .order-dialog .od-submit {
    position: sticky; bottom: 0;
    box-shadow: 0 -10px 18px var(--card);
  }
  .od-contacts { font-size: 14px; }

  /* фото на весь экран */
  .photo-lb { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
  .photo-lb::backdrop { background: rgba(6, 12, 22, .92); }
  .photo-lb img { max-height: 82dvh; }

  /* меню-лента: фейд у правого края */
  .mainnav .wrap { padding-right: 30px; }
}

/* ===== Аудиоплеер книги ===== */
.audio-player {
  background: linear-gradient(165deg, #1D3D5C 0%, #16334F 55%, #0F2337 100%);
  border-radius: 8px;
  padding: 20px 22px 18px;
  color: #EFE7D6;
  margin-top: 16px;
}
.ap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.ap-title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.ap-narrator { font-size: 13.5px; color: rgba(239, 231, 214, .65); }
.ap-row { display: flex; align-items: center; gap: 14px; }
.ap-play {
  width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 50%;
  border: 1.5px solid rgba(169, 143, 85, .8);
  background: rgba(239, 231, 214, .1) no-repeat 56% 50% / 18px
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 3.8v16.4L20.5 12z" fill="%23EFE7D6"/></svg>');
  cursor: pointer;
  transition: background-color .15s;
}
.ap-play:hover { background-color: rgba(239, 231, 214, .2); }
.ap-play.playing {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="5" y="4" width="4.5" height="16" fill="%23EFE7D6"/><rect x="14.5" y="4" width="4.5" height="16" fill="%23EFE7D6"/></svg>');
  background-position: 50% 50%;
}
.ap-mid { flex: 1; min-width: 0; }
.ap-bar {
  height: 6px; border-radius: 3px;
  background: rgba(239, 231, 214, .18);
  cursor: pointer; position: relative;
}
.ap-fill { height: 100%; border-radius: 3px; background: var(--gold); width: 0; }
.ap-times { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(239, 231, 214, .7); margin-top: 7px; }
.ap-tools { display: flex; align-items: center; gap: 10px; }
.ap-rate {
  font: inherit; font-size: 13px;
  background: rgba(239, 231, 214, .1); color: #EFE7D6;
  border: 1px solid rgba(239, 231, 214, .25); border-radius: 4px;
  padding: 7px 9px; cursor: pointer;
}
.ap-note {
  font-size: 13px; color: rgba(239, 231, 214, .62);
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(169, 143, 85, .3);
}
.ap-note b { color: #EFE7D6; font-weight: 600; }
.ap-buy { margin-top: 12px; }
@media (max-width: 640px) {
  .ap-row { flex-wrap: wrap; }
  .ap-mid { order: 3; flex-basis: 100%; }
  .ap-tools { margin-left: auto; }
}

/* Метка «Фрагмент бесплатно» в каталоге */
.tag-listen {
  background: rgba(169, 143, 85, .18);
  color: #6E5417;
  text-decoration: none;
  font-weight: 600;
}
.tag-listen:hover { background: rgba(169, 143, 85, .3); }
#audio { scroll-margin-top: 180px; }

/* ===== Мобильная читаемость ===== */
@media (max-width: 640px) {
  /* Мелкие капители надзаголовков и юридических ссылок задуманы как
     деликатные, но 13px на телефоне уже не читаются — поднимаем, сохраняя
     разрядку и приглушённый цвет. */
  .eyebrow { font-size: 14.5px; }
  .footer-docs { font-size: 15px; line-height: 2; }
  .footer-docs a { display: inline-block; padding: 4px 0; }
}

/* ===== Телефон боком (ландшафт) =====
   Все мобильные правила выше написаны через max-width: 640px. Но телефон,
   повёрнутый боком, — это 844px ширины при 390px высоты: под них он не
   подпадает и получает десктопную раскладку на экране высотой в треть.
   Отсюда три поломки разом: у плеера уезжало управление, у формы заказа —
   кнопка покупки, шапка съедала 36% экрана. Признак ландшафта — не ширина,
   а МАЛАЯ ВЫСОТА. */
@media (max-height: 520px) {
  /* Шапка перестаёт липнуть: на низком экране она важнее не бывает контента */
  .site-header { position: static; }
  .site-header .masthead, .site-header.v2 .masthead { padding-top: 8px; padding-bottom: 8px; }
  .mast-pub { display: none; }

  /* Диалоги считают размер от ВЫСОТЫ экрана, иначе 16/9-кадр не помещается */
  .order-dialog, .player-dialog, .photo-lb { max-height: 96dvh; }

  /* Кадр 16/9 не должен быть выше окна: ширину задаёт высота, а не наоборот.
     Иначе низ видео с панелью управления оказывается за краем экрана. */
  .player-dialog { width: min(96vw, calc((96dvh - 56px) * 16 / 9)); }
  .pl-title { padding: 6px 12px; font-size: 14.5px; }

  /* Кнопка покупки всегда на виду — на десктопе она статична, но здесь
     экран низкий и до неё пришлось бы скроллить вслепую */
  .order-dialog .od-submit {
    position: sticky; bottom: 0;
    box-shadow: 0 -10px 18px var(--card);
  }
  #audio { scroll-margin-top: 12px; }
}

/* ===== Полоса перемотки: видно тонко, нажимать крупно =====
   Высота 6px рисуется красиво, но пальцем в неё не попасть. Растим ЗОНУ
   НАЖАТИЯ отступами, а саму полосу оставляем прежней через background-clip. */
.ap-bar {
  padding: 16px 0;
  height: 38px;
  background-clip: content-box;
  box-sizing: border-box;
}

/* ===== Длинные слова на узком экране =====
   «конфиденциальности» — 27 знаков: на 320px не переносилось и уводило всю
   страницу вбок. Единственный горизонтальный overflow на сайте. */
.legal-page h1, .book-info h1, h1, h2 { overflow-wrap: break-word; hyphens: auto; }

@media (max-width: 640px) {
  /* Мелкий текст, добитый до читаемого */
  .tag-free, .tag-format, .tag-soon, .tag-listen, .vc-date { font-size: 14.5px; }
  .filter-group h3 { font-size: 14px; }
  .ap-note, .ap-rate { font-size: 14px; }
  .ap-times { font-size: 13.5px; }

  /* Тач-цели до 44px: чекбоксам фильтров не хватало четырёх пикселей */
  .filter-group label { padding: 11px 0; }
  .od-consent input { width: 22px; height: 22px; }
}

/* ===== Лента разделов прокручивается — покажем это =====
   Фейд у правого края был объявлен только до 640px, а прячется меню
   вплоть до 843px: на iPad портрет «Контакты» не видны и намёка нет. */
@media (max-width: 900px) {
  .mainnav .wrap {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  }
}

/* Палец вместо мыши — признак вернее любой ширины: телефон боком имеет
   844px и под мобильные правила не подпадает, а нажимают там всё так же
   пальцем. Чекбокс согласия был 13×16 — в него не попасть. */
@media (pointer: coarse) {
  .od-consent input { width: 22px; height: 22px; flex: 0 0 22px; }
  .filter-group label { padding: 11px 0; }
}
