/* ============================================================
   CRMDV - плашка об использовании cookie + типографика privacy.html
   Отдельный файл: styles.css/components.css правятся параллельно.
   Токены берутся из styles.css (:root), подключать ПОСЛЕ него.
   ============================================================ */

/* ------------------------------------------------------------
   1. Плашка cookie
   ------------------------------------------------------------
   Плашка не участвует в потоке (position: fixed) - вёрстка не сдвигается.
   До решения JS её вообще нет в DOM у тех, кто уже согласился: скрипт
   рисует её сам. Пока скрипт не отработал, элемент скрыт атрибутом hidden.
   Анимация только на transform/opacity.
*/
.cookie-bar {
  position: fixed;
  z-index: 9998; /* под зерном body::before (9999), над контентом */
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  margin-inline: auto;
  /* ⚠️ Ширину НЕ задаём в процентах: при заданных left и right `width: min(100%, 720px)`
     считает 100% от всего экрана, а левый отступ сдвигает плашку - и она вылезала за
     правый край ровно на 16 px, обрезая текст и кнопку. `width: auto` растягивает её
     между left и right, а max-width держит меру на широких экранах. */
  width: auto;
  max-width: 720px;

  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;

  background: var(--ink-800, #16161B);
  color: var(--on-dark, #F4F1EB);
  border: 1px solid var(--line-2, rgba(255, 255, 255, .14));
  border-radius: var(--r-lg, 26px);
  box-shadow: var(--sh-md, 0 18px 40px -18px rgba(0, 0, 0, .55));

  font-family: var(--f-text, system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.5;

  /* стартовое состояние: чуть ниже и прозрачная, класс .is-in поднимает */
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity .45s var(--e-out, cubic-bezier(.22, .61, .36, 1)),
    transform .45s var(--e-out, cubic-bezier(.22, .61, .36, 1));
  will-change: transform, opacity;
}

.cookie-bar[hidden] { display: none; }
.cookie-bar.is-in { opacity: 1; transform: none; }

/* уход после согласия: та же пара свойств, вниз */
.cookie-bar.is-out { opacity: 0; transform: translateY(18px); }

.cookie-bar__text {
  flex: 1 1 auto;
  margin: 0;
  color: var(--on-dark-mut, rgba(244, 241, 235, .62));
  text-wrap: pretty;
}

.cookie-bar__text b {
  display: block;
  margin-bottom: 3px;
  font-family: var(--f-display, system-ui, sans-serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--on-dark, #F4F1EB);
}

.cookie-bar__link {
  color: var(--amber, #FF7A1A);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 122, 26, .45);
  transition: text-decoration-color .2s var(--e-soft, cubic-bezier(.4, 0, .2, 1));
}
.cookie-bar__link:hover { text-decoration-color: currentColor; }

.cookie-bar__accept {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 24px;
  border: none;
  border-radius: var(--r-pill, 999px);
  background: var(--amber, #FF7A1A);
  color: #1a0d02;
  font-family: inherit;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: 0 12px 36px -14px var(--amber-glow, rgba(255, 122, 26, .42));
  transition:
    transform .25s var(--e-out, cubic-bezier(.22, .61, .36, 1)),
    box-shadow .25s var(--e-out, cubic-bezier(.22, .61, .36, 1));
}
.cookie-bar__accept:hover { transform: translateY(-2px); box-shadow: 0 20px 48px -16px var(--amber-glow, rgba(255, 122, 26, .42)); }
.cookie-bar__accept:active { transform: translateY(0); }
.cookie-bar__accept:focus-visible { outline: 2.5px solid var(--amber, #FF7A1A); outline-offset: 3px; }

/* ⚠️ На узком экране плашка занимала 199 px из 568 - треть экрана, закрывая кнопки первого
   экрана до нажатия «Хорошо». Поэтому здесь она компактнее: мельче кегль, теснее отступы,
   кнопка не на всю ширину, а прижата вправо в одну строку с заголовком. */
@media (max-width: 560px) {
  .cookie-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 13px 15px 14px;
    border-radius: var(--r-md, 18px);
  }
  .cookie-bar__text { font-size: 12.5px; line-height: 1.4; }
  .cookie-bar__text b { font-size: 14px; margin-bottom: 2px; }
  .cookie-bar__accept { align-self: flex-end; min-height: 40px; padding-inline: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-bar {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .cookie-bar.is-out { opacity: 0; }
  .cookie-bar__accept { transition: none; }
  .cookie-bar__accept:hover { transform: none; }
}

/* ------------------------------------------------------------
   2. Страница privacy.html
   ------------------------------------------------------------ */
.legal {
  background: var(--cream, #FAF7F2);
  color: var(--on-cream, #14141A);
  min-height: 100vh;
}

.legal-top {
  border-bottom: 1px solid var(--cream-300, #E7DFD2);
  background: rgba(250, 247, 242, .92);
  backdrop-filter: saturate(140%) blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.legal-top__inner {
  max-width: 860px;
  margin-inline: auto;
  padding: 14px var(--gut, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-top .brand,
.legal-top .brand:visited { color: var(--on-cream, #14141A); }

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid rgba(20, 20, 26, .14);
  background: rgba(20, 20, 26, .04);
  color: var(--on-cream, #14141A);
  font-weight: 600;
  font-size: 14px;
  transition: background .2s var(--e-soft, cubic-bezier(.4, 0, .2, 1)), transform .2s var(--e-out, cubic-bezier(.22, .61, .36, 1));
}
.legal-back:hover { background: rgba(20, 20, 26, .08); transform: translateY(-1px); }

.legal-doc {
  max-width: 860px;
  margin-inline: auto;
  padding: clamp(36px, 6vw, 72px) var(--gut, 24px) clamp(64px, 9vw, 120px);
}

.legal-doc h1 {
  font-family: var(--f-display, system-ui, sans-serif);
  font-weight: 600;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.06;
  letter-spacing: -.01em;
  text-wrap: balance;
  /* «конфиденциальности» шире экрана 320-390 px: без переноса слово вылезало за край.
     hyphens только на узких экранах: на широких он рвал слово при наличии места. */
  overflow-wrap: break-word;
}
@media (max-width: 560px) {
  .legal-doc h1 { hyphens: auto; }
}

.legal-meta {
  margin-top: 14px;
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--on-cream-mut, rgba(20, 20, 26, .60));
}

.legal-lead {
  margin-top: 22px;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.6;
  color: var(--on-cream-mut, rgba(20, 20, 26, .60));
  max-width: 62ch;
}

.legal-doc h2 {
  font-family: var(--f-display, system-ui, sans-serif);
  font-weight: 600;
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.15;
  letter-spacing: -.01em;
  margin-top: clamp(38px, 5vw, 58px);
  padding-top: 26px;
  border-top: 1px solid var(--cream-300, #E7DFD2);
}

.legal-doc h3 {
  font-family: var(--f-display, system-ui, sans-serif);
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.25;
  margin-top: 26px;
}

.legal-doc p,
.legal-doc li {
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 68ch;
}

.legal-doc p { margin-top: 14px; }

.legal-doc ul,
.legal-doc ol {
  margin-top: 14px;
  padding-left: 0;
  list-style: none;
}

.legal-doc li { position: relative; padding-left: 22px; margin-top: 9px; }
.legal-doc ul > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-700, #C2410C);
}
.legal-doc ol { counter-reset: legal; }
.legal-doc ol > li { counter-increment: legal; }
.legal-doc ol > li::before {
  content: counter(legal) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 13px;
  color: var(--amber-700, #C2410C);
}

.legal-doc a {
  color: var(--amber-700, #C2410C);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.legal-doc a:hover { text-decoration-thickness: 2px; }

/* карточка-сводка «коротко о главном» */
.legal-card {
  margin-top: 28px;
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--cream-300, #E7DFD2);
  border-radius: var(--r-md, 18px);
  box-shadow: 0 12px 30px -22px rgba(20, 20, 26, .45);
}
.legal-card h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 17px;
}
.legal-card ul { margin-top: 12px; }
.legal-card li { font-size: 15px; }

/* таблица cookie */
.legal-table-wrap { margin-top: 18px; overflow-x: auto; }
.legal-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 14.5px;
}
.legal-table th,
.legal-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cream-300, #E7DFD2);
}
.legal-table th {
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 11.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--on-cream-mut, rgba(20, 20, 26, .60));
  border-bottom-width: 2px;
}
.legal-table td:first-child { font-weight: 600; white-space: nowrap; }


.legal-foot {
  margin-top: clamp(44px, 6vw, 70px);
  padding-top: 24px;
  border-top: 1px solid var(--cream-300, #E7DFD2);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--on-cream-mut, rgba(20, 20, 26, .60));
}
