/* ==========================================================================
   Онегин Gourmet — «Сказки для взрослых»
   Дизайн-система перенесена с vessel-magazine.no (issue 8, Craft in Public Space)
   Токены оригинала: --baseColor1 #1e1002, --baseColor3 #fffbb9, --accentColor #f9bfb2
   Шрифты оригинала: Migra (serif) / Founders Grotesk (sans)
   Замена с поддержкой кириллицы: Playfair Display / Golos Text
   ========================================================================== */

:root {
  --ink:    #1e1002;          /* baseColor1 */
  --paper:  #fffbb9;          /* baseColor3 */
  --accent: #f9bfb2;          /* accentColor / tocColor */
  --dark:   #1e1002;          /* menuBgColor */

  --sans: "Golos Text", -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Playfair Display", Georgia, Cambria, "Times New Roman", Times, serif;

  /* базовый кегль оригинала: 19.984px при ширине окна 1249px */
  --fs: clamp(15px, 1.6vw, 21px);

  --fs-xs:   calc(var(--fs) * 0.667);   /* 13.32 — подписи */
  --fs-sm:   calc(var(--fs) * 0.75);    /* 14.99 — рубрики */
  --fs-md:   calc(var(--fs) * 0.917);   /* 18.32 */
  --fs-lg:   calc(var(--fs) * 1.0417);  /* 20.82 */
  --fs-xl:   calc(var(--fs) * 1.1667);  /* 23.31 — пилюли */
  --fs-2xl:  calc(var(--fs) * 1.4167);  /* 28.31 — заголовки футера */
  --fs-3xl:  calc(var(--fs) * 2.5);     /* 49.96 — serif-заголовки */
  --fs-4xl:  calc(var(--fs) * 2.9167);  /* 58.29 — sans-заголовки */
  --fs-5xl:  calc(var(--fs) * 4.1667);  /* 83.27 — визуальное эссе */

  --lh: 1.333;

  --pad:   clamp(18px, 4vw, 56px);      /* поля страницы (50px в оригинале) */
  --gap-y: calc(var(--fs) * 3.75);      /* 74.94px — отбивка блока */
  --gap-x: clamp(28px, 4.4vw, 92px);    /* просвет между изображением и текстом */
  --maxw:  1560px;                      /* предел ширины полосы набора */
  --barh:  calc(var(--fs) * 3.1);       /* высота верхней панели */

  --rule: 1px solid var(--ink);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------- reset / base */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--paper);   /* поле за пределами полосы набора — тоже бумага */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, p, ol, ul, figure, blockquote { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--ink); }

/* -------------------------------------------------- circled numeral ⑴ */
/* оригинал использует глифы ①②③ шрифта Migra; здесь — рисуем кружок,
   чтобы кегль и обводка были одинаковыми в любом шрифте                 */
.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65em; height: 1.65em;
  margin-right: 0.55em;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--serif);
  font-style: normal;
  font-size: 0.72em;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  flex: none;
  transform: translateY(-0.04em);
}
.num--sm { margin: 0 0 0 0.15em; transform: translateY(0.05em); }

/* ─────────────────────────────────────────────────────── ПИЛЮЛИ ───── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.42em 0.95em 0.5em;
  border-radius: 999px;
  font-family: var(--serif);
  font-size: var(--fs-xl);
  line-height: 1.15;
  white-space: nowrap;
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}

.pill--menu {
  border: 1px solid var(--accent);
  color: var(--accent);
}
.pill--menu:hover { background: var(--accent); color: var(--dark); }
.pill--menu:hover .burger i { background: var(--dark); }

.burger { display: inline-flex; flex-direction: column; gap: 4px; width: 22px; }
.burger i { display: block; height: 1px; background: var(--accent); transition: background .35s var(--ease); }

/* пилюля оглавления живёт внутри героя и не перекрывает полосу набора */
.pill--toc {
  position: absolute;
  left: var(--pad);
  bottom: calc(var(--pad) * 0.9);
  z-index: 20;
  background: var(--accent);
  color: var(--ink);
}
.pill--toc .arr { transition: transform .35s var(--ease); }
.pill--toc:hover { background: var(--paper); }
.pill--toc:hover .arr { transform: translateY(3px); }

/* ────────────────────────────── ВЕРХНЯЯ ПАНЕЛЬ + ПРОГРЕСС ──────── */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 72;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.progress.is-on { opacity: .85; }

.bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 68;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--pad);
  height: var(--barh);
  padding: 0 var(--pad);
  background: var(--paper);
  border-bottom: 1px solid rgba(30, 16, 2, .16);
  transform: translateY(-101%);
  transition: transform .5s var(--ease);
}
.bar.is-on { transform: none; }

.bar__brand {
  font-family: var(--serif);
  font-size: var(--fs-md);
  letter-spacing: 0.005em;
}
.bar__meta {
  font-size: calc(var(--fs) * 0.63);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-align: center;
  opacity: .7;
}
.bar__nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.6em;
  font-size: calc(var(--fs) * 0.7);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bar__link { position: relative; padding-bottom: 2px; }
.bar__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform .4s var(--ease);
}
.bar__link:hover::after { transform: none; transform-origin: 0 50%; }

/* ─────────────────────────────────────────────────────── ГЕРОЙ ────── */
.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--dark);
}
.hero__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  animation: heroZoom 14s var(--ease) both;
}
@keyframes heroZoom { from { transform: scale(1.07); } to { transform: scale(1); } }
.hero__scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(30,16,2,.55) 0%, rgba(30,16,2,.15) 30%, rgba(30,16,2,.15) 65%, rgba(30,16,2,.45) 100%);
}

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: var(--pad);
  padding: calc(var(--pad) * 0.55) var(--pad);
  color: var(--accent);
  font-size: var(--fs-sm);
  line-height: 1.25;
}
.topbar__c { text-align: center; }
.topbar__r { display: flex; justify-content: flex-end; }

.hero__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--pad);
  text-align: center;
}
.hero__mast {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 9.4vw, 152px);
  line-height: 0.95;
  letter-spacing: -0.015em;
  color: var(--paper);
  max-width: 14em;
}
.hero__start {
  margin-top: 1.8em;
  font-size: var(--fs-md);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.35em;
  text-decoration-thickness: 1px;
}
.hero__start:hover { color: var(--paper); }

/* ──────────────────────────────────────────────────── ПОДПИСИ ────── */
.cap {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  line-height: 1.375;
  color: var(--ink);
  text-align: left;
  margin-top: 0.9em;
  max-width: 46em;
}
.cap--bleed {
  max-width: var(--maxw);
  margin: 0.9em auto 0;
  padding: 0 var(--pad);
}

/* ─────────────────────────────────────────────────────── БЛОКИ ───── */
.pages {
  padding: 0 var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
}

.block {
  padding-top: var(--gap-y);
  padding-bottom: calc(var(--fs) * 2.8);
  scroll-margin-top: calc(var(--barh) + var(--fs));
}
.block + .block { border-top: var(--rule); }

.block__inner {
  display: flex;
  align-items: center;          /* текст оптически по центру изображения */
  gap: var(--gap-x);
}
.block--rev .block__inner { flex-direction: row-reverse; }

.block__figure { flex: 0 0 52%; min-width: 0; }

/* единая пропорция кадра — иначе высокие снимки ломают ритм полосы */
.shot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: rgba(30, 16, 2, .05);
}
.shot img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.block__figure--product .shot {
  aspect-ratio: 5 / 4;
  background: none;
}
.block__figure--product .shot img { object-fit: contain; }

/* приближение кадра — только для мыши: на тач-экранах :hover «залипает»
   при смене направления прокрутки и даёт рывок, а слои под will-change
   съедают видеопамять на всех 13 снимках сразу                          */
@media (hover: hover) and (pointer: fine) {
  .shot img { transition: transform 1.5s var(--ease); }
  .block:hover .shot img { transform: scale(1.035); }
  .block__figure--product:hover .shot img { transform: scale(1.02); }
}

.block__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.block--center .block__body { text-align: center; align-items: center; }
.block--left .block__body { text-align: left; align-items: flex-start; }

.cat {
  display: flex;
  align-items: center;
  font-size: calc(var(--fs) * 0.63);
  line-height: 1.2;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 1.15em;
}
.cat--light { color: var(--accent); }

.title {
  font-weight: 400;
  letter-spacing: -0.008em;
  text-wrap: balance;
  max-width: 15ch;
}
.block--center .title { max-width: 17ch; }
.block--sans .title { font-family: var(--sans); font-size: var(--fs-4xl); line-height: 1.02; }
.block--serif .title { font-family: var(--serif); font-size: var(--fs-3xl); line-height: 1.1; }

.preamble {
  margin-top: 1.7em;
  max-width: 32em;
  text-wrap: pretty;
}
.block--sans .preamble { font-family: var(--sans); font-size: var(--fs-md); line-height: 1.5; }
.block--serif .preamble { font-family: var(--serif); font-size: var(--fs-lg); line-height: 1.42; }

.preamble p + p { margin-top: 1em; }
.preamble .spec { margin-top: 1.5em; }

.spec {
  font-family: var(--sans) !important;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}
.spec a { text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: 1px; }
.spec a:hover { opacity: .6; }

/* ─────────────────────────────────────────── ВИЗУАЛЬНОЕ ЭССЕ ────── */
.essay {
  padding-top: var(--gap-y);
  padding-bottom: calc(var(--fs) * 1.6);
  scroll-margin-top: var(--barh);
}
.essay__media { position: relative; }
/* svh, а не vh: на мобильных vh пересчитывается, когда браузер прячет
   адресную строку, и вся полоса делает релейаут прямо во время прокрутки */
.essay__media img { width: 100%; height: min(78svh, 780px); object-fit: cover; }
.essay__scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 46% at 50% 50%, rgba(30,16,2,.55) 0%, rgba(30,16,2,0) 100%),
    linear-gradient(180deg, rgba(30,16,2,.5) 0%, rgba(30,16,2,.3) 45%, rgba(30,16,2,.55) 100%);
}
.essay__over {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 var(--pad);
  text-align: center;
}
.essay__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-5xl);
  line-height: 1.1;
  color: var(--accent);
  max-width: 11em;
  text-wrap: balance;
}

/* ─────────────────────────────────────────────────────── ФУТЕР ───── */
.foot {
  padding: calc(var(--fs) * 5) var(--pad) calc(var(--fs) * 1.8);
  background: linear-gradient(118deg, var(--paper) 0%, var(--paper) 26%, #fde8b6 55%, var(--accent) 100%);
}
.foot__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
}
.foot__col h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-2xl);
  line-height: 1.353;
  margin-bottom: 0.9em;
}
.foot__col p {
  font-family: var(--serif);
  font-size: var(--fs-md);
  line-height: 1.42;
  max-width: 20em;
  margin: 0 auto 1.1em;
}
.foot__col a { text-decoration: underline; text-underline-offset: 0.28em; text-decoration-thickness: 1px; }
.foot__col a:hover { opacity: .6; }

.foot__bar {
  display: flex;
  justify-content: space-between;
  gap: var(--pad);
  max-width: var(--maxw);
  margin: calc(var(--fs) * 3) auto 0;
  font-family: var(--sans);
  font-size: var(--fs-xs);
}
.foot__bar a:hover { opacity: .6; }

/* ───────────────────────────────────────────────── ОГЛАВЛЕНИЕ ───── */
.toc {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 65;
  background: var(--accent);
  color: var(--ink);
  padding: calc(var(--fs) * 3.6) var(--pad) calc(var(--fs) * 2.5);
  max-height: 100svh;
  overflow-y: auto;
  transform: translateY(-101%);
  transition: transform .55s var(--ease);
}
.toc[hidden] { display: block; visibility: hidden; }
.toc.is-open { transform: translateY(0); visibility: visible; }

.toc__list { border-top: 1px solid var(--ink); }
.toc__list li { border-bottom: 1px solid var(--ink); }
.toc__list a {
  display: flex;
  align-items: baseline;
  gap: var(--pad);
  padding: 0.62em 0;
  transition: opacity .25s var(--ease);
}
.toc__list a:hover { opacity: .55; }

.toc__meta {
  flex: 0 0 20%;
  display: flex;
  align-items: center;
  font-size: var(--fs-sm);
  line-height: 1.22;
}
.toc__t { flex: 1 1 auto; min-width: 0; }
.toc__t em {
  display: block;
  font-family: var(--serif);
  font-style: normal;
  font-size: var(--fs-lg);
  line-height: 1.28;
}
.toc__t b {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--fs-sm);
  line-height: 1.22;
}

/* ─────────────────────────────────────────────────────── МЕНЮ ────── */
.menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--dark);
  color: var(--accent);
  padding: calc(var(--pad) * 2.1) var(--pad) calc(var(--pad) * 1.1);
  overflow-y: auto;
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.menu[hidden] { display: block; visibility: hidden; }
.menu.is-open { opacity: 1; visibility: visible; }

.menu__inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.menu__close {
  position: absolute;
  top: calc(var(--pad) * 0.5); right: var(--pad);
  background: none; border: 0; cursor: pointer;
  color: var(--accent);
  font-family: var(--sans);
  font-size: var(--fs-3xl);
  line-height: 1;
  padding: 0;
}
.menu__close:hover { color: var(--paper); }

/* две колонки — как .l / .r в оригинале */
.menu__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--pad);
}
.menu__col { display: flex; flex-direction: column; }
.menu__nav a {
  font-family: var(--serif);
  font-size: clamp(24px, 4.1vw, 52px);
  line-height: 1.285;
  transition: color .25s var(--ease);
}
.menu__nav a:hover { color: var(--paper); }

.menu__bottom {
  padding-top: calc(var(--fs) * 2.4);
  font-size: var(--fs-md);
  line-height: 1.364;
}
.menu__bottom a { text-decoration: underline; text-underline-offset: 0.3em; }

/* ─────────────────────────────────────────── ВОЗРАСТНОЙ ФИЛЬТР ─── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--dark);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  text-align: center;
}
.gate[hidden] { display: none; }
.gate__inner { max-width: 34em; }
.gate__kicker {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1.6em;
}
.gate__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-3xl);
  line-height: 1.167;
  color: var(--paper);
  margin-bottom: 0.5em;
}
.gate__text {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  line-height: 1.28;
  margin-bottom: 2em;
}
.gate__btn {
  font-family: var(--serif);
  font-size: var(--fs-xl);
  color: var(--dark);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.45em 1.4em 0.55em;
  cursor: pointer;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.gate__btn:hover { background: transparent; color: var(--accent); }

/* ───────────────────────────────────── появление при прокрутке ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .85s var(--ease), transform .85s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ─────────────────────────────────────────────────── АДАПТИВ ────── */
@media (max-width: 900px) {
  :root { --fs: clamp(16px, 2.6vw, 20px); --gap-y: calc(var(--fs) * 2.6); }

  .block__inner, .block--rev .block__inner { flex-direction: column; gap: calc(var(--fs) * 1.7); }
  .block__figure { flex: none; width: 100%; }
  .block--center .block__body { text-align: left; align-items: flex-start; }
  .block--center .title { max-width: 15ch; }
  .preamble { margin-top: 1.1em; max-width: none; }
  .block--sans .title { font-size: calc(var(--fs) * 2.1); }
  .block--serif .title { font-size: calc(var(--fs) * 1.95); }
  .shot { aspect-ratio: 4 / 3; }

  .topbar { grid-template-columns: 1fr auto; }
  .topbar__c { display: none; }
  .bar { grid-template-columns: 1fr auto; }
  .bar__meta { display: none; }

  .essay__title { font-size: calc(var(--fs) * 2.4); }
  .essay__media img { height: min(70svh, 560px); }

  .foot__cols { grid-template-columns: 1fr; gap: calc(var(--fs) * 2.4); }
  .foot__bar { flex-direction: column; gap: 0.6em; text-align: center; }

  .menu__nav { grid-template-columns: 1fr; }
  .toc__list a { flex-direction: column; gap: 0.15em; }
  .toc__meta { flex: none; }
  .toc { padding-top: calc(var(--fs) * 4.2); }

  .pill { font-size: calc(var(--fs) * 1.05); }
}

@media (max-width: 520px) {
  .hero__mast { font-size: clamp(38px, 13vw, 68px); }
  .credits__group p { letter-spacing: 0; }
}
