/* ============================================================================
   VANTRA — общая таблица стилей сайта бренда и продуктовых страниц.

   Один файл на весь сайт намеренно: страниц две, они делят шапку, подвал,
   типографику и кнопки. Один запрос, который кэшируется при переходе между
   страницами, дешевле двух раздельных.

   ПАЛИТРА совпадает с приложением (frontend/lib/core/theme/design_tokens.dart).
   Это не украшательство: человек скачивает по сайту одно, а открывает другое,
   и расхождение он замечает раньше, чем формулирует.

   ТИРЕ. В русском тексте тире — знак препинания, а не украшение, поэтому в
   прозе оно есть. Чего нет: тире как разделителя в подписях, метках и
   навигации («Раздел — 01 — Подробнее»). Там, где нужно разделить, работают
   колонки и линейки.
   ========================================================================= */

/* --- Шрифты. Свои файлы, не сторонние серверы: сторонний сервер — это ещё
       одна точка отказа и утечка адресов посетителей. -------------------- */

@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-400-cyrillic.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-500-cyrillic.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-500-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-700-cyrillic.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/unbounded-700-latin.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-400-cyrillic.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-500-cyrillic.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-500-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-600-cyrillic.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0400-04FF, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  src: url('../assets/fonts/golos-text-600-latin.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* --- Токены ------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Светлая тема — тёплая бумага, как в приложении. */
  --bg: #F7F4ED;
  --bg-sunken: #EFEAE0;
  --surface: #FFFDF8;
  --line: rgba(43, 38, 32, 0.12);
  --line-strong: rgba(43, 38, 32, 0.24);
  --ink: #1E1B16;
  --ink-2: #575048;
  --ink-3: #8B8378;
  /* Акцент — это контраст, а не цвет: заливка кнопки есть инверсия фона.
     Так решено в приложении, и по той же причине: цветное пятно на кнопке
     мгновенно роднит макет с тысячей других. */
  --accent: #1E1B16;
  --accent-hover: #322D25;
  --on-accent: #FBF8F1;
  /* Цвет остаётся только там, где что-то значит. На сайте это единственное
     место: предупреждение про SmartScreen. */
  --warn: #9A6B18;
  --warn-soft: rgba(154, 107, 24, 0.10);

  --shadow-lift: 0 1px 2px rgba(43, 38, 32, 0.05),
                 0 12px 32px rgba(43, 38, 32, 0.08);
  --shadow-deep: 0 2px 6px rgba(43, 38, 32, 0.06),
                 0 32px 80px rgba(43, 38, 32, 0.14);

  /* Радиусы. Правило одно и соблюдается везде: всё нажимаемое — таблетка,
     всё, что держит содержимое, — 14px, картинки — 10px. */
  --r-press: 999px;
  --r-block: 14px;
  --r-image: 10px;

  --page: 1240px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --base: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130F;
    --bg-sunken: #100E0B;
    --surface: #1D1A15;
    --line: rgba(242, 237, 227, 0.12);
    --line-strong: rgba(242, 237, 227, 0.24);
    --ink: #F2EDE3;
    --ink-2: #A9A093;
    --ink-3: #736B60;
    --accent: #F2EDE3;
    --accent-hover: #FFFBF3;
    --on-accent: #15130F;
    --warn: #D9A441;
    --warn-soft: rgba(217, 164, 65, 0.12);

    --shadow-lift: 0 1px 2px rgba(0, 0, 0, 0.4),
                   0 12px 32px rgba(0, 0, 0, 0.36);
    --shadow-deep: 0 2px 6px rgba(0, 0, 0, 0.45),
                   0 32px 80px rgba(0, 0, 0, 0.55);
  }
}

/* --- Сброс и основа ---------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Якорь не должен уезжать под липкую шапку. */
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; }

h1, h2, h3 {
  font-family: 'Unbounded', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  /* Длинные русские слова в крупном кегле рвут макет на телефоне. */
  overflow-wrap: break-word;
  hyphens: manual;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

/* Фокус видно всегда и везде: это пол качества, а не опция. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-press);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 0.75rem; }

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

/* --- Раскладка --------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(4.5rem, 11vw, 9rem); }
.section--tight { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--edge { border-top: 1px solid var(--line); }

/* Заголовок раздела. Никаких надстрочных микрометок над каждым разделом:
   расположение на странице само говорит, где ты находишься. */
.section-head { max-width: 46ch; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head h2 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); }
.section-head p {
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  max-width: 58ch;
}

/* --- Кнопки ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  /* Ярлык обязан помещаться в одну строку на любом экране. */
  white-space: nowrap;
  padding: 0.95rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--r-press);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }

/* Физическая отдача на нажатие. */
.btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .btn, .btn:active { transition: none; transform: none; }
}

.btn--lg { padding: 1.1rem 1.9rem; font-size: 1rem; }

/* Текстовая ссылка с подчёркиванием, которое живёт отдельно от текста. */
.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: border-color var(--fast) var(--ease);
}
.link:hover { border-color: var(--ink); }

/* --- Шапка ------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--base) var(--ease);
}
/* Граница появляется только когда под шапкой уже есть прокрученное
   содержимое: на самом верху линия отрезала бы шапку без причины. */
.header.is-stuck { border-bottom-color: var(--line); }

@supports not (backdrop-filter: blur(1px)) {
  .header { background: var(--bg); }
}

.header__inner {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.brand__mark { width: 26px; height: 26px; flex: none; color: var(--ink); }
.brand__sub {
  font-family: 'Golos Text', sans-serif;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--ink-3);
  letter-spacing: 0;
  padding-left: 0.6rem;
  margin-left: 0.15rem;
  border-left: 1px solid var(--line);
}

.nav { display: flex; align-items: center; gap: 1.75rem; }
.nav a {
  text-decoration: none;
  font-size: 0.9375rem;
  color: var(--ink-2);
  transition: color var(--fast) var(--ease);
}
.nav a:hover { color: var(--ink); }

.header .btn { padding: 0.7rem 1.2rem; font-size: 0.875rem; }

.burger {
  display: none;
  width: 42px; height: 42px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-press);
  cursor: pointer;
  place-items: center;
}
.burger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--base) var(--ease), opacity var(--fast) var(--ease);
}
.burger span + span { margin-top: 4px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 860px) {
  .burger { display: grid; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    /* Закрытое меню не должно ловить фокус клавиатурой. */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--base) var(--ease),
                transform var(--base) var(--ease),
                visibility var(--base);
  }
  .nav.is-open { visibility: visible; opacity: 1; transform: none; }
  .nav a { padding: 0.9rem 0; border-bottom: 1px solid var(--line); font-size: 1.0625rem; }
  .nav .btn { margin-top: 1.25rem; width: 100%; }
}

/* --- Подвал ------------------------------------------------------------ */

.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2.5rem;
  font-size: 0.9375rem;
}
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 780px) {
  .footer__grid { grid-template-columns: 1fr; gap: 2.25rem; }
}
.footer__about p { color: var(--ink-2); margin-top: 0.9rem; max-width: 40ch; }
.footer h3 {
  font-family: 'Golos Text', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}
.footer li + li { margin-top: 0.6rem; }
.footer li a { color: var(--ink-2); text-decoration: none; }
.footer li a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.footer__bottom {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  color: var(--ink-3);
  font-size: 0.875rem;
}
.footer__bottom a { color: var(--ink-3); }

/* --- Появление при прокрутке ------------------------------------------
   Базовое состояние — видимое. Скрывает элементы только скрипт и только
   когда анимации разрешены: иначе при выключенном JS страница осталась бы
   пустой. Это не перестраховка, а разница между «без анимации» и «без
   содержимого».                                                          */

.reveal.is-hidden {
  opacity: 0;
  transform: translateY(18px);
}
.reveal.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .reveal.is-hidden { opacity: 1; transform: none; }
  .reveal.is-shown { transition: none; }
}
