/* ===== Fonts (local TTF) ===== */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: bold;
  font-display: swap;
}
@font-face {
  font-family: "Merriweather";
  src: url("../fonts/Merriweather-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Merriweather";
  src: url("../fonts/Merriweather-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: bold;
  font-display: swap;
}

/* ===== Reset + base ===== */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1d1b16;
  background: #fffdf8;
  line-height: 1.6;
}
img { display: block; height: auto; max-width: min(100%, 350px); } /* <= 350px */
figure { margin: 0; }
h1, h2, h3 { font-family: Merriweather, Georgia, "Times New Roman", serif; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: #6a3e16; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Color tokens (earthy palette) ===== */
:root{
  --earth-900:#2b2417;
  --earth-800:#3c3321;
  --earth-700:#56452a;
  --earth-600:#6a5231;
  --earth-500:#8b6a3a;
  --leaf-600:#3f6b39;
  --leaf-500:#4d8346;
  --leaf-400:#6aa65e;
  --sun-400:#f6c351;
  --sun-300:#ffd77a;
  --cream-50:#fffdf8;
  --cream-100:#fff7e8;
  --line: rgba(0,0,0,.08);
  --shadow: 0 10px 24px rgba(29,27,22,.10), 0 2px 6px rgba(29,27,22,.06);
  --radius: 18px;
}

/* ===== Layout ===== */
.container {
  width: min(1100px, 90vw);
  margin: 0 auto;
  padding: 0 12px;
}

/* ===== Header (fixed) ===== */
.site-header{
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0.92) 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
}
.header-row{
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--earth-800); }
.brand img{ border-radius: 8px; }
.brand-text{ letter-spacing: 0.4px; }

.nav-list{
  display: flex; gap: 16px; list-style: none; margin: 0; padding: 0;
}
.nav-list a{
  display: inline-block; padding: 10px 14px; border-radius: 999px;
  transition: transform .2s ease, background-color .2s ease;
}
.nav-list a:hover{ background: var(--cream-100); transform: translateY(-2px); }

.burger{
  display: none; position: relative; width: 42px; height: 42px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; cursor: pointer;
}
.burger span{ position: absolute; left: 10px; right: 10px; height: 2px; background: var(--earth-800); transition: transform .25s ease, opacity .25s ease, top .25s ease; }
.burger span:nth-child(1){ top: 12px; }
.burger span:nth-child(2){ top: 20px; }
.burger span:nth-child(3){ top: 28px; }
.burger[aria-expanded="true"] span:nth-child(1){ top: 20px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2){ opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3){ top: 20px; transform: rotate(-45deg); }

/* ===== Footer ===== */
.site-footer{
  margin-top: 56px; padding: 36px 0; background: #fff; border-top:1px solid var(--line);
}
.footer-grid{
  display: grid; gap: 16px; grid-template-columns: 2fr 1fr 1fr;
}
.footer-links{ list-style: none; margin: 0; padding: 0; }
.footer-links li+li{ margin-top: 8px; }
.small{ font-size: .9rem; color: #5a564e; }

/* ===== Buttons ===== */
.btn{
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  background: linear-gradient(180deg, var(--leaf-400), var(--leaf-600));
  color: #fff; font-weight: 700; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover{ transform: translateY(-2px); filter: saturate(110%); }
.link{ margin-left: 12px; font-weight: 600; }

/* ===== Reveal animation (IO) ===== */
.reveal{ opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible{ opacity: 1; transform: translateY(0); }

/* ===== Accessibility ===== */
:focus-visible{ outline: 3px dashed var(--sun-400); outline-offset: 3px; }

/* ===== Responsive ===== */
@media (max-width: 992px){
  .footer-grid{ grid-template-columns: 1fr 1fr; }
  .nav-list{ gap: 10px; }
}
@media (max-width: 768px){
  .burger{ display: inline-block; }
  .nav-list{
    position: absolute; right: 12px; top: 64px; background: #fff; border: 1px solid var(--line);
    border-radius: 16px; padding: 12px; box-shadow: var(--shadow); display: none; flex-direction: column; min-width: 200px;
  }
  .nav-list.is-open{ display: flex; }
  .footer-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 360px){
  .brand-text{ display: none; }
}
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}
/* Header (fixed) — компактнее */
.site-header{
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0.92) 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
}
.header-row{
  display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; /* было 64px */
  gap: 12px;
}
.brand img{
  height: 28px; /* делаем логотип ниже независимо от width/height в HTML */
  width: auto; border-radius: 8px;
}
.nav-list a{
  padding: 8px 12px;              /* было 10px 14px */
  border-radius: 999px;
  transition: transform .2s ease, background-color .2s ease;
}

/* Моб. меню должно открываться под новым хеддером */
@media (max-width: 768px){
  .burger{ display: inline-block; }
  .nav-list{
    position: absolute; right: 12px; top: 56px; /* было 64px */
    background: #fff; border: 1px solid var(--line);
    border-radius: 16px; padding: 12px; box-shadow: var(--shadow);
    display: none; flex-direction: column; min-width: 200px;
  }
  .nav-list.is-open{ display: flex; }
}
/* убираем горизонтальный скролл от любых редких переполнений */
html, body { overflow-x: clip; }
/* фикс: не даём странице скроллиться по X и не копим сдвиг */
html, body{
  overflow-x: hidden;          /* вместо clip — iOS надёжнее */
  overscroll-behavior-x: none;
}

/* контейнер строго по центру и без 90vw (на iOS 100vw/90vw иногда дают дрейф) */
.container{
  width: min(1100px, 100%);    /* было 90vw */
  margin-inline: auto;
  padding-inline: 12px;
}

/* жест: по умолчанию вертикальная прокрутка страницы */
body{ touch-action: pan-y; }
:root{
  /* ...твои переменные... */
  --header-h: 56px; /* базовая высота хедера (пересчитываем из JS) */
}

/* был sticky → делаем fixed */
.site-header{
  position: fixed;           /* было: sticky */
  top: 0; left: 0; right: 0;
  z-index: 100;
  width: 100%;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0.92) 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
}

.header-row{
  display: flex; align-items: center; justify-content: space-between;
  min-height: 56px;          /* если менял раньше — оставь это значение */
  gap: 12px;
}

/* контент не уезжает под fixed-хеддер */
body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1d1b16;
  background: #fffdf8;
  line-height: 1.6;
  padding-top: var(--header-h);   /* <— ключевой отступ под хеддер */
}

/* чтобы выпадающее меню открывалось строго под хеддером любой высоты */
nav{ position: relative; }

@media (max-width: 768px){
  .burger{ display: inline-block; }
  .nav-list{
    position: absolute;
    right: 12px;
    top: var(--header-h);        /* было: фиксированное число пикселей */
    background: #fff; border: 1px solid var(--line);
    border-radius: 16px; padding: 12px; box-shadow: var(--shadow);
    display: none; flex-direction: column; min-width: 200px;
    z-index: 120;
  }
  .nav-list.is-open{ display: flex; }
}
.footer-links a[href*="privacy"], .footer-links a[href*="terms"]{
  color:#5a564e;
  font-size: .95rem;
}
/* ===== Floating Back-to-Top button ===== */
.to-top{
  --size: 56px;
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 120;
  width: var(--size);
  height: var(--size);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--leaf-400), var(--leaf-600));
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease, visibility .2s ease;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  touch-action: manipulation;
}

/* стрелка ↑ без иконок */
.to-top::before{
  content: "↑";
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}

/* тонкое кольцо */
.to-top::after{
  content: "";
  position: absolute; inset: -6px;
  border-radius: 999px;
  background: conic-gradient(from 270deg, rgba(77,131,70,.45), rgba(77,131,70,.15));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
  opacity: .3; pointer-events: none;
}

.to-top:hover{ transform: translateY(-2px); box-shadow: 0 16px 32px rgba(29,27,22,.14); }
.to-top.is-visible{ opacity: 1; visibility: visible; transform: translateY(0); }

@media (prefers-reduced-motion: reduce){
  .to-top{ transition: none; }
}

/* (необязательно) если хочешь скрыть текстовую ссылку в футере: */
.footer-links a[href="#main-content"]{ display: none; }
/* ==== Mobile nav drawer – fixed, закрыт по умолчанию ==== */
.nav { position: relative; z-index: 130; }

.nav-list{
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 12px;                 /* панель выезжает справа */
  left: auto;                  /* и точно НЕ занимает левую кромку */
  width: min(86vw, 340px);
  max-height: calc(100dvh - var(--header-h) - 20px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px;
  transform: translateX(120%); /* ← закрыто */
  opacity: 0;
  pointer-events: none;
  transition: transform .25s ease, opacity .2s ease;
}

/* открытое состояние */
.nav-list.is-open{
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* страховка: на маленьких точно скрывать, если не .is-open */
@media (max-width: 680px){
  .nav-list:not(.is-open){
    transform: translateX(120%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* сама кнопка-бургер поверх всего */
.burger{ position: relative; z-index: 140; }
/* ==== DESKTOP NAV: показать ссылки, скрыть бургер/оверлей ==== */
@media (min-width: 900px){
  /* список ссылок — обычная горизонтальная навигация */
  .site-header .nav-list{
    position: static !important;
    display: flex !important;
    gap: 22px !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;

    /* убрать стили «выезжающей панели» */
    left: auto !important; right: auto !important;
    width: auto !important; max-height: none !important;
    background: transparent !important;
    border: 0 !important; box-shadow: none !important; padding: 0 !important;
    z-index: auto !important;
  }

  .site-header .nav-list li{ list-style: none; }
  .site-header .nav-list a{
    display: inline-block;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    color: #2a241b;
    text-decoration: none;
  }
  .site-header .nav-list a:hover{ background: #f4efe3; }

  /* бургер и затемняющий слой на десктопе не нужны */
  .burger{ display: none !important; }
  .nav-overlay{ display: none !important; }
}
