/* ============================================================================
   legal-doc.css — оформление правовых документов (privacy, consent, cookies,
   offer, terms, requisites). Разметку собирает _materials/legal/tools/build_html.py.

   Идея: документ должен читаться как хорошо свёрстанная книга, а не как
   простыня. Поэтому:
     · обложка с названием, редакцией и временем чтения — сразу видно, что за документ;
     · слева содержание с подсветкой текущего раздела — в длинном тексте не теряешься;
     · номер пункта вынесен на поля и кликабелен — на любой пункт можно сослаться;
     · строка не длиннее ~72 символов, межстрочный 1.75.
   Все цвета — токены onyx.css, поэтому тёмная и светлая темы работают сами.
========================================================================== */

.ldoc-page { background: var(--bg); }
/* onyx.css задаёт html/body overflow-x: hidden — это делает body контейнером
   прокрутки, и position: sticky у содержания перестаёт работать. clip режет
   горизонтальный вылет так же, но контейнер прокрутки не создаёт. */
html:has(body.ldoc-page), body.ldoc-page { overflow-x: clip; overflow-y: visible; }

/* ── Прогресс чтения ─────────────────────────────────────────────────────── */
.ldoc-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 120;
  height: 2px;
  pointer-events: none;
}
.ldoc-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-text));
  box-shadow: 0 0 12px var(--accent);
}

/* ── Полотно ─────────────────────────────────────────────────────────────── */
.ldoc {
  position: relative;
  overflow: clip;
  padding: clamp(112px, 13vw, 156px) 0 clamp(56px, 8vw, 104px);
}
.ldoc-glow {
  position: absolute;
  inset: -240px -10% auto;
  height: 720px;
  pointer-events: none;
  background:
    radial-gradient(42% 52% at 18% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(34% 44% at 82% 10%, color-mix(in srgb, var(--accent-text) 12%, transparent), transparent 70%);
  filter: blur(8px);
  opacity: .9;
}
.ldoc-wrap { position: relative; max-width: 1180px; }

/* ── Обложка ─────────────────────────────────────────────────────────────── */
.ldoc-hero {
  max-width: 900px;
  margin: 0 0 clamp(34px, 5vw, 56px);
}
.ldoc-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint, var(--muted));
}
.ldoc-crumbs a { color: var(--muted); transition: color .18s var(--ease); }
.ldoc-crumbs a:hover { color: var(--accent-text); }

.ldoc-hero-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
}
.ldoc-hero-ico {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background:
    radial-gradient(60% 60% at 50% 40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 75%),
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--accent), transparent 70%) border-box;
  border: 1px solid transparent;
  box-shadow: 0 14px 34px -16px var(--accent);
}
.ldoc-hero-ico img {
  width: 60px; height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35));
}
.ldoc-eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ldoc-h1 {
  margin: 0 0 16px;
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(30px, 4.6vw, 56px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.035em;
  color: var(--text-strong);
  text-wrap: balance;
}
.ldoc-sub {
  max-width: 60ch;
  margin: 0 0 24px;
  font-size: clamp(16px, 1.6vw, 18.5px);
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}
.ldoc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.ldoc-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.ldoc-chip.is-accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.ldoc-metaline {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--faint, var(--muted));
}
.ldoc-metaline a { color: inherit; }

/* ── Сетка: содержание + документ ────────────────────────────────────────── */
.ldoc-grid {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: clamp(32px, 4vw, 56px);
  align-items: start;
}

.ldoc-toc { position: sticky; top: 104px; }
.ldoc-toc-inner {
  max-height: calc(100vh - 128px);
  overflow: auto;
  padding: 22px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
}
.ldoc-toc-title {
  margin: 0 0 12px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.ldoc-toc-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.ldoc-toc-list a {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  line-height: 1.38;
  color: var(--muted);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.ldoc-toc-list a:hover { color: var(--text-strong); background: var(--surface-hover, var(--bg-2)); }
.ldoc-toc-list a.is-active { color: var(--text-strong); background: var(--accent-soft); }
.ldoc-toc-list a.is-active::before {
  content: '';
  position: absolute;
  left: -1px; top: 9px; bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.ldoc-toc-n {
  font-family: var(--font-mono);
  font-size: 11px;
  padding-top: 2px;
  color: var(--faint, var(--muted));
}
.ldoc-toc-list a.is-active .ldoc-toc-n { color: var(--accent-text); }
.ldoc-toc-help {
  display: grid;
  gap: 4px;
  margin: 16px 0 0;
  padding: 14px 10px 2px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.ldoc-toc-help a { color: var(--accent-text); font-weight: 600; word-break: break-all; }

.ldoc-toc-mobile { display: none; }

/* ── Тело документа ──────────────────────────────────────────────────────── */
.ldoc-body {
  min-width: 0;
  padding: clamp(26px, 4.4vw, 60px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.ldoc-lead {
  max-width: 72ch;
  margin: 0 0 34px;
  padding: 20px 22px;
  border: 1px solid var(--accent-line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
}

.ldoc-section {
  padding: 34px 0 6px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 100px;
}
.ldoc-section:first-of-type { padding-top: 0; border-top: 0; }
.ldoc-section h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(19px, 2.1vw, 24px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--text-strong);
  text-wrap: balance;
}
.ldoc-h2-n {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent-text);
  transform: translateY(-3px);
}

/* Пункты: номер на полях, текст ровной колонкой */
.ldoc-pt {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  max-width: 78ch;
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
  scroll-margin-top: 110px;
  border-radius: 10px;
  transition: background .6s var(--ease);
}
.ldoc-l1 { margin-left: 22px; grid-template-columns: 58px minmax(0, 1fr); }
.ldoc-l2 { margin-left: 44px; grid-template-columns: 66px minmax(0, 1fr); font-size: 15px; }
.ldoc-n {
  padding-top: .28em;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--faint, var(--muted));
  text-decoration: none;
  transition: color .18s var(--ease);
  align-self: start;
}
.ldoc-l0 > .ldoc-n { color: var(--accent-text); font-weight: 700; }
.ldoc-n:hover { color: var(--accent-text); }
.ldoc-n:hover::after { content: ' #'; opacity: .7; }
.ldoc-t { text-wrap: pretty; }
.ldoc-pt:target,
.ldoc-pt.is-flash { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); }

.ldoc-body a:not(.ldoc-n):not(.btn) {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  transition: text-decoration-color .18s var(--ease);
}
.ldoc-body a:not(.ldoc-n):not(.btn):hover { text-decoration-color: var(--accent); }

.ldoc-list {
  display: grid;
  gap: 10px;
  max-width: 72ch;
  margin: 2px 0 18px 58px;
  padding: 0;
  list-style: none;
}
.ldoc-list li {
  position: relative;
  padding-left: 22px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  text-wrap: pretty;
}
.ldoc-list li::before {
  content: '';
  position: absolute;
  left: 2px; top: .7em;
  width: 7px; height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Таблицы */
.ldoc-table-wrap {
  margin: 6px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
}
.ldoc-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ldoc-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.ldoc-table th, .ldoc-table td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.ldoc-table th {
  position: sticky; top: 0;
  background: var(--surface-2, var(--bg-2));
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.ldoc-table tbody tr { transition: background .18s var(--ease); }
.ldoc-table tbody tr:hover { background: var(--surface-hover, var(--surface)); }
.ldoc-table tr:last-child td { border-bottom: 0; }
.ldoc-table td:first-child { color: var(--text-strong); font-weight: 600; }

.ldoc-end {
  margin: 34px 0 0;
  padding-top: 22px;
  border-top: 1px dashed var(--line-strong, var(--line));
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--faint, var(--muted));
}

/* ── Контакты ────────────────────────────────────────────────────────────── */
.ldoc-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px 32px;
  margin: clamp(40px, 6vw, 72px) 0 0;
  padding: clamp(24px, 3.6vw, 40px);
  border-radius: 20px;
  border: 1px solid transparent;
  background:
    radial-gradient(70% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(120deg, var(--accent), var(--line) 45%, var(--line)) border-box;
}
.ldoc-contact-kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ldoc-contact-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(19px, 2.2vw, 26px);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-strong);
}
.ldoc-contact-text { margin: 0; font-size: 13.5px; color: var(--muted); }
.ldoc-contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ldoc-contact-actions .btn { height: 44px; padding: 0 22px; display: inline-flex; align-items: center; }
.ldoc-btn-ghost {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.ldoc-btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ── Другие документы ────────────────────────────────────────────────────── */
.ldoc-related { margin: clamp(40px, 6vw, 72px) 0 0; }
.ldoc-related-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text-strong);
}
.ldoc-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.ldoc-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  min-height: 168px;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.ldoc-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: 0 22px 40px -26px var(--accent);
}
.ldoc-card-ico {
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: radial-gradient(70% 70% at 50% 40%, var(--accent-soft), transparent 80%), var(--bg-2);
  border: 1px solid var(--line);
  transition: transform .3s var(--ease);
}
.ldoc-card-ico img {
  width: 46px; height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .3));
}
.ldoc-card:hover .ldoc-card-ico { transform: translateY(-2px) rotate(-4deg) scale(1.04); }
.ldoc-card-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--text-strong);
}
.ldoc-card-desc { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.ldoc-card-go {
  position: absolute;
  right: 18px; top: 20px;
  font-size: 18px;
  color: var(--faint, var(--muted));
  transition: transform .25s var(--ease), color .25s var(--ease);
}
.ldoc-card:hover .ldoc-card-go { transform: translateX(4px); color: var(--accent-text); }

/* ── Наверх и уведомление ────────────────────────────────────────────────── */
.ldoc-top {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 90;
  width: 46px; height: 46px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text-strong);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease), border-color .2s var(--ease);
}
.ldoc-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.ldoc-top:hover { border-color: var(--accent); color: var(--accent-text); }

.ldoc-toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 2147483001;
  padding: 11px 18px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-pop, var(--shadow-card));
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-strong);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.ldoc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Адаптив ─────────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .ldoc-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ldoc-toc { display: none; }
  .ldoc-toc-mobile {
    display: block;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
  }
  .ldoc-toc-mobile summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 18px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--text-strong);
  }
  .ldoc-toc-mobile summary::-webkit-details-marker { display: none; }
  .ldoc-toc-mobile summary span { margin-right: auto; font-weight: 500; color: var(--muted); }
  .ldoc-toc-mobile summary::after {
    content: '';
    width: 9px; height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-3px);
    transition: transform .2s var(--ease);
  }
  .ldoc-toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
  .ldoc-toc-mobile .ldoc-toc-list { padding: 0 10px 12px; }
  .ldoc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .ldoc { padding-top: 150px; }
  .ldoc-chip { height: 28px; padding: 0 11px; font-size: 10.5px; }
  .ldoc-body { border-radius: 16px; }
  .ldoc-pt { grid-template-columns: 44px minmax(0, 1fr); font-size: 15px; }
  .ldoc-l1 { margin-left: 0; grid-template-columns: 52px minmax(0, 1fr); }
  .ldoc-l2 { margin-left: 0; grid-template-columns: 60px minmax(0, 1fr); font-size: 14.5px; }
  .ldoc-n { font-size: 11.5px; }
  .ldoc-list { margin-left: 6px; }
  .ldoc-list li { font-size: 15px; }
  .ldoc-section h2 { gap: 10px; }
  .ldoc-cards { grid-template-columns: minmax(0, 1fr); }
  .ldoc-card { min-height: 0; }

  /* Таблица на телефоне — стопка карточек «название: значение»,
     без горизонтальной прокрутки. Подписи берутся из data-label. */
  .ldoc-table-wrap { overflow: visible; border: 0; background: none; }
  .ldoc-table, .ldoc-table tbody, .ldoc-table tr, .ldoc-table td { display: block; width: 100%; }
  .ldoc-table thead { display: none; }
  .ldoc-table tr {
    margin: 0 0 10px;
    padding: 6px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
  }
  .ldoc-table tbody tr:hover { background: var(--bg-2); }
  .ldoc-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  .ldoc-table tr td:last-child { border-bottom: 0; }
  .ldoc-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 3px;
  }
  .ldoc-contact-actions { width: 100%; }
  .ldoc-contact-actions > * { flex: 1 1 0; justify-content: center; }
  .ldoc-top { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ldoc-card, .ldoc-top, .ldoc-toast, .ldoc-pt, .ldoc-progress span { transition: none; }
}

/* ── Печать: только документ ─────────────────────────────────────────────── */
@media print {
  .navbar, .ldoc-progress, .ldoc-glow, .ldoc-toc, .ldoc-toc-mobile, .ldoc-contact,
  .ldoc-related, .ldoc-top, .ldoc-toast, .legal-footer, .cookie-banner { display: none !important; }
  .ldoc { padding: 0; }
  .ldoc-grid { display: block; }
  .ldoc-body { border: 0; box-shadow: none; padding: 0; background: #fff; }
  .ldoc-page, .ldoc-body, .ldoc-pt, .ldoc-list li, .ldoc-h1, .ldoc-section h2 { color: #000 !important; }
  .ldoc-chip { border-color: #999; color: #000; background: none; }
}
