.legal {
  padding-top: 168px;
  padding-bottom: var(--space-3xl);
  background-color: var(--color-bg-white);
}

.legal__inner {
  display: flex;
  align-items: flex-start;
  gap: 118px;
  max-width: calc(var(--container-max) + 4rem);
  margin-inline: auto;
  padding-inline: calc(2rem + 30px);
}

/* =====================
   SIDEBAR — Tabla de contenidos, sticky en desktop
   ===================== */
.legal__sidebar {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background-color: var(--color-white-pure);
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.legal__sidebar-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.legal__sidebar-icon {
  flex-shrink: 0;
  width: 31px;
  height: 31px;
}

.legal__sidebar-title {
  font-size: 28px;
  font-weight: var(--fw-semibold);
  color: var(--color-navy);
  margin: 0;
}

.legal__toc {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: toc;
}

.legal__toc li {
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: 30px;
  color: var(--color-navy);
  counter-increment: toc;
}

.legal__toc-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.legal__toc-link::before {
  content: counter(toc) '. ';
}

.legal__toc-link:hover {
  color: var(--color-orange);
}

.legal__toc-link.is-active {
  color: var(--color-orange);
  font-weight: var(--fw-semibold);
}

/* =====================
   CONTENIDO
   ===================== */
.legal__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 44px;
  color: var(--color-navy);
}

.legal__intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legal__eyebrow {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: #7f7f7f;
  margin: 0;
}

/* Por encima de los 28px de .legal__section-title: es el titular de la página y
   estas vistas no tienen hero que lo sostenga. */
.legal__titulo {
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  line-height: 44px;
  color: var(--color-navy);
  margin: 0;
}

.legal__lead {
  font-size: var(--fs-md);
  font-weight: var(--fw-light);
  line-height: 30px;
  margin: 0;
}

.legal__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 140px;
}

.legal__section-title {
  font-size: 28px;
  font-weight: var(--fw-semibold);
  line-height: 38px;
  color: var(--color-navy);
  margin: 0;
}

.legal__section-subtitle {
  font-size: 20px;
  font-weight: var(--fw-semibold);
  line-height: 32px;
  color: var(--color-navy);
  margin: 0;
}

.legal__section-text {
  font-size: var(--fs-md);
  font-weight: var(--fw-light);
  line-height: 30px;
  text-align: justify;
  margin: 0;
  white-space: pre-line;
  overflow-wrap: break-word;
}

/* Igual que el anterior pero sin pre-line: los párrafos del editor ya vienen
   separados de a uno, y wpautop convierte los saltos sueltos en <br>. Con
   pre-line encima, cada salto contaría dos veces. */
.legal__section p {
  font-size: var(--fs-md);
  font-weight: var(--fw-light);
  line-height: 30px;
  text-align: justify;
  margin: 0;
  overflow-wrap: break-word;
}

/* El cuerpo del documento sale del editor, así que llega sin clases: estos
   selectores le dan el mismo aspecto que tenían las clases del maquetado. */
.legal__section h3 {
  font-size: 20px;
  font-weight: var(--fw-semibold);
  line-height: 32px;
  color: var(--color-navy);
  margin: 0;
}

.legal__section ul,
.legal__section ol {
  margin: 0;
  padding-left: 1.5rem;
  font-size: var(--fs-md);
  font-weight: var(--fw-light);
  line-height: 30px;
}

/* base.css quita las viñetas en todo el sitio; dentro del texto legal sí hacen
   falta para que se entienda que es una enumeración. */
.legal__section ul {
  list-style: disc;
}

.legal__section ol {
  list-style: decimal;
}

.legal__section a {
  color: var(--color-orange);
  overflow-wrap: break-word;
}

.legal__section strong {
  font-weight: var(--fw-semibold);
}

/* =====================
   RESPONSIVE — LEGALS
   ===================== */
@media (min-width: 992px) {
  .legal__sidebar {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
  }
}

@media (max-width: 991.98px) {
  .legal {
    padding-top: 140px;
  }

  .legal__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .legal__sidebar {
    position: fixed;
    top: 108px;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 900;
    margin: 0;
  }

  .legal__content {
    margin-top: 140px;
  }

  .legal__toc {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    min-width: 0;
    scrollbar-width: none;
  }

  .legal__toc::-webkit-scrollbar {
    display: none;
  }

  .legal__toc li {
    flex-shrink: 0;
    white-space: nowrap;
    line-height: normal;
    padding-inline: 12px;
  }

  .legal__toc li:first-child {
    padding-left: 0;
  }

  .legal__toc li:last-child {
    padding-right: 0;
  }

  .legal__toc li:not(:last-child) {
    border-right: 1px solid #D9D9D9;
  }
}

@media (max-width: 575.98px) {
  .legal {
    padding-top: 120px;
  }

  .legal__sidebar-title {
    font-size: 22px;
  }

  .legal__titulo {
    font-size: 28px;
    line-height: 36px;
  }

  .legal__section-title {
    font-size: 22px;
    line-height: 34px;
  }

  .legal__section-subtitle,
  .legal__section h3 {
    font-size: 18px;
    line-height: 26px;
  }
}

/* ---- Reset mobile: el padding alineado al navbar (calc(2rem + 30px)) solo aplica en desktop; en mobile se usa el gutter estándar ---- */
@media (max-width: 991.98px) {
  .legal__inner {
    padding-inline: var(--container-pad);
  }
}
