/* Legal pages — layout inspired by docs grid, using site tokens from base.css */

.legal-page header {
  position: fixed;
  top: 0;
  background: rgb(255 255 255);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.legal-page header.scrolled,
.legal-page header.fadeup {
  transform: none;
}

.legal-main {
  margin-top: 130px;
  padding-bottom: 0;
}

.legal-shell {
  position: relative;
}

/* Верхний блок — сетка как на Vercel: боковины, левый столбец-ячейки, линии между рядами */
.legal-hero-wrap {
  border: 1px solid rgba(236, 236, 236, 1);
}

.legal-hero-grid {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 80px;
  grid-template-rows: 80px auto auto;
}

.legal-hero-gutter__cell {
  border-bottom: 1px solid rgba(236, 236, 236, 1);
  min-height: 100%;
}

.legal-hero-gutter__cell:nth-child(3n + 1) {
  border-right: 1px solid rgba(236, 236, 236, 1);
}

.legal-hero-gutter__cell:nth-child(3n) {
  border-left: 1px solid rgba(236, 236, 236, 1);
}

.legal-hero-gutter__cell:nth-child(7),
.legal-hero-gutter__cell:nth-child(9) {
  border-bottom: none;
}

.legal-hero-row--spacer {
  border-bottom: 1px solid rgba(236, 236, 236, 1);
}

.legal-hero-row--title {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 64px 44px;
  border-bottom: 1px solid rgba(236, 236, 236, 1);
  min-height: 140px;
}

.legal-hero-row--title h1 {
  margin: 0;
  max-width: 100%;
  text-align: center;
}

.legal-hero-row--meta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 64px 20px;
}

.legal-hero__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

/* Контент: боковые линии блока + пунктир между колонками */
.legal-body-area {
  --legal-toc-width: 280px;
  --legal-pad-x: 48px;
  position: relative;
  border-left: 1px solid rgba(236, 236, 236, 1);
  border-right: 1px solid rgba(236, 236, 236, 1);
}

.legal-body-area .legal-line--dash-c {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(100% - var(--legal-toc-width));
  width: 0;
  border-left: 1px dashed rgba(236, 236, 236, 1);
  pointer-events: none;
  z-index: 1;
}

.legal-hero-row--title h1 {
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.25;
}

.legal-hero__meta p {
  font-size: 12px;
  color: var(--text-subtitle);
  line-height: 1.45;
  margin: 0;
}

.legal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--legal-toc-width);
  gap: 0;
  align-items: start;
  position: relative;
  z-index: 2;
  border-bottom: 1px solid rgba(236, 236, 236, 1);
}

.legal-content {
  padding: 48px var(--legal-pad-x) 80px;
  min-width: 0;
  overflow: hidden;
}

.legal-body-area,
.legal-body {
  overflow: visible;
}

.legal-content section {
  scroll-margin-top: 110px;
}

.legal-content section + section {
  padding-top: 48px;
}

.legal-content section + section::before {
  content: "";
  display: block;
  border-top: 1px solid rgba(236, 236, 236, 1);
  margin: 0 calc(-1 * (var(--legal-pad-x) + var(--legal-toc-width))) 48px calc(-1 * var(--legal-pad-x));
}

.legal-content h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 20px;
}

.legal-content h3 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  margin: 24px 0 12px;
}

.legal-content p,
.legal-content li {
  font-size: 16px;
  line-height: 1.55;
  color: rgb(38 38 38 / 1);
}

.legal-content p {
  margin-bottom: 12px;
}

.legal-content p:last-child {
  margin-bottom: 0;
}

.legal-content ul {
  margin: 12px 0 16px;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-content ul li {
  position: relative;
  padding-left: 18px;
}

.legal-content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgb(23 23 23 / 1);
}

.legal-content a {
  color: rgb(23 23 23 / 1);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.3s;
}

.legal-content a:hover {
  opacity: 0.7;
}

.legal-content strong {
  font-weight: 500;
}

.legal-toc {
  position: sticky;
  top: 100px;
  padding: 40px 32px 48px 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.legal-toc__title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 16px;
  color: rgb(23 23 23 / 1);
}

.legal-toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legal-toc a {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-subtitle);
  padding: 6px 0;
  border-radius: 6px;
  transition: color 0.3s, background 0.3s;
}

.legal-toc a:hover {
  color: rgb(23 23 23 / 1);
}

.legal-toc a.is-active {
  color: rgb(23 23 23 / 1);
  font-weight: 500;
}

.legal-toc a.legal-toc__sub {
  padding-left: 14px;
  font-size: 13px;
}

.legal-page .footer-col-nav button[data-target] {
  cursor: pointer;
}

@media (max-width: 1024px) {
  .legal-body-area {
    --legal-toc-width: 0px;
    --legal-pad-x: 24px;
  }

  .legal-body-area .legal-line--dash-c {
    display: none;
  }

  .legal-body {
    grid-template-columns: 1fr;
  }

  .legal-content {
    padding: 40px var(--legal-pad-x) 48px;
  }

  .legal-content section + section::before {
    margin-right: calc(-1 * var(--legal-pad-x));
  }

  .legal-toc {
    position: relative;
    top: auto;
    max-height: none;
    padding: 32px var(--legal-pad-x) 40px;
    border-top: 1px solid rgba(236, 236, 236, 1);
  }

  .legal-hero-grid {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-rows: 40px auto auto;
  }

  .legal-hero-row--title {
    padding: 40px 40px 32px;
    min-height: 110px;
  }

  .legal-hero-row--meta {
    padding: 24px 40px 32px;
  }
}

@media (max-width: 767px) {
  .legal-main {
    margin-top: 56px;
  }

  .legal-hero-grid {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    grid-template-rows: 60px auto auto;
  }

  .legal-hero-row--title {
    padding: 36px 24px 28px;
    min-height: 96px;
  }

  .legal-hero-row--meta {
    padding: 10px 24px 10px;
  }

  .legal-body-area {
    --legal-pad-x: 16px;
  }

  .legal-content {
    padding: 32px var(--legal-pad-x) 40px;
  }

  .legal-content section + section {
    padding-top: 32px;
  }

  .legal-content section + section::before {
    margin-bottom: 32px;
  }

  .legal-toc {
    padding: 24px var(--legal-pad-x) 32px;
  }

  .legal-content p,
  .legal-content li {
    font-size: 14px;
  }

  .legal-toc {
    padding: 24px 16px 32px;
  }
}
