/* ==========================================================================
   Mipplet — páginas legales: privacidad y términos.
   Una página para leer: columna de texto angosta, índice al lado en
   escritorio y plegado arriba en el celular. Primero el resumen en corto.
   ========================================================================== */

.legal { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }

.legal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  width: min(100% - 2 * var(--gutter), 1080px);
  margin: 0 auto;
  padding-block: var(--s-5);
}

.legal__main {
  width: min(100% - 2 * var(--gutter), 1080px);
  margin: 0 auto;
  padding-block: var(--s-6) var(--s-16);
}

/* Encabezado */
.legal__head { display: grid; gap: var(--s-2); max-width: 44rem; }
.legal__eyebrow { font-size: var(--fs-label); font-weight: var(--fw-semi); color: var(--accent); }
.legal__title { font-size: var(--fs-heading); letter-spacing: var(--ls-heading); line-height: 1.06; }
.legal__meta { color: var(--text-2); font-size: var(--fs-small); }

/* Aviso de borrador: lo que falta, a la vista */
.legal__borrador {
  display: flex;
  gap: var(--s-3);
  max-width: 44rem;
  margin-top: var(--s-6);
  padding: var(--s-4) var(--s-5);
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: 1.5;
}
.legal__borrador .icon { flex: none; margin-top: 1px; color: var(--accent); }
.pend {
  padding: 0 0.3em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--fw-semi);
  box-shadow: inset 0 -1.5px 0 var(--accent-muted);
}

/* En corto */
.corto {
  max-width: 44rem;
  margin-top: var(--s-6);
  padding: var(--s-6);
  border-radius: var(--r-card);
}
.corto__t { font-size: var(--fs-subheading); letter-spacing: var(--ls-snug); }
.corto__l { display: grid; gap: var(--s-3); margin: var(--s-4) 0 0; padding: 0; list-style: none; }
.corto__l li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-3); line-height: 1.5; }
.corto__l .icon { width: 20px; height: 20px; margin-top: 2px; color: var(--accent); }

/* Cuerpo: índice y texto */
.legal__cuerpo { display: grid; gap: var(--s-8); margin-top: var(--s-10); counter-reset: sec; }

.indice { border-radius: 18px; }
.indice > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 var(--s-5);
  font-weight: var(--fw-semi);
  cursor: pointer;
  list-style: none;
}
.indice > summary::-webkit-details-marker { display: none; }
.indice > summary .icon { color: var(--text-3); transition: transform var(--dur-comp) var(--ease-out); }
.indice[open] > summary .icon { transform: rotate(180deg); }
.indice > summary:focus-visible { border-radius: 18px; }
.indice__l { display: grid; margin: 0; padding: 0 var(--s-2) var(--s-3); list-style: none; counter-reset: ind; }
.indice__l a {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  padding: var(--s-2) var(--s-3);
  border-radius: 10px;
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: 1.4;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.indice__l a::before { counter-increment: ind; content: counter(ind); color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (hover: hover) { .indice__l a:hover { background: var(--accent-soft); color: var(--text); } }
.indice__l a[aria-current="true"] { color: var(--text); font-weight: var(--fw-semi); }

.texto { max-width: 42rem; min-width: 0; }
.texto section + section { margin-top: var(--s-10); }
.texto h2 {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  font-size: var(--fs-subheading);
  letter-spacing: var(--ls-snug);
  line-height: 1.25;
  scroll-margin-top: var(--s-6);
}
.texto h2::before { counter-increment: sec; content: counter(sec); color: var(--accent); font-variant-numeric: tabular-nums; }
.texto h3 { margin-top: var(--s-5); font-size: var(--fs-body); font-weight: var(--fw-bold); }
.texto p, .texto ul { margin-top: var(--s-3); color: var(--text-2); line-height: 1.7; }
.texto ul { padding-left: 1.25rem; }
.texto li + li { margin-top: var(--s-2); }
.texto li::marker { color: var(--accent-muted); }
.texto strong { color: var(--text); font-weight: var(--fw-semi); }
.texto a { color: var(--accent); font-weight: var(--fw-semi); text-decoration: underline; text-decoration-color: var(--accent-muted); text-underline-offset: 3px; }
@media (hover: hover) { .texto a:hover { text-decoration-color: currentColor; } }
.texto .ruta { color: var(--text); font-weight: var(--fw-semi); white-space: nowrap; }

.legal__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-1) var(--s-5);
  padding: var(--s-6) var(--gutter) var(--s-8);
  border-top: 1px solid var(--border);
}
@media (hover: hover) { .legal__foot a:hover { color: var(--text); } }
.legal__foot a[aria-current="page"] { color: var(--text); font-weight: var(--fw-semi); }

@media (min-width: 960px) {
  .legal__cuerpo { grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-12); align-items: start; }
  /* Todo en una sola columna de lectura; el índice queda en el margen. */
  .legal__head, .legal__borrador, .corto { margin-left: calc(240px + var(--s-12)); }
  .indice { position: sticky; top: var(--s-6); background: none; box-shadow: none; }
  .indice > summary { pointer-events: none; padding: 0 var(--s-3); color: var(--text-3); font-size: var(--fs-caption); min-height: 32px; }
  .indice > summary .icon { display: none; }
  .indice__l { padding: 0; }
}

@media print {
  .legal__top, .indice, .legal__foot { display: none; }
  .legal__cuerpo { display: block; }
  .texto, .corto, .legal__head { max-width: none; }
  .texto section { break-inside: avoid-page; }
}
