/* =====================================================================
   VEX · Términos y condiciones
   Mismo lenguaje que la portada: barra superior opaca con borde fino, título claro y texto de lectura
   cómoda (~68ch). En escritorio, índice fijo a la izquierda que marca la sección visible;
   en celular, el índice es un desplegable al inicio. Sin efectos decorativos.
   ===================================================================== */
.legal-page { --gutter: clamp(16px, 4vw, 56px); --measure: 68ch; background: var(--canvas); }
.legal-page .blobs { display: none; }
.legal-wrap { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
#contenido { outline: none; }

/* Barra superior */
.legal-bar { position: sticky; top: 0; z-index: 50; background: var(--canvas); border-bottom: 1px solid var(--line); }
.legal-bar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.legal-bar__nav { display: flex; align-items: center; gap: 0.5rem; }
.legal-bar .brand__mark { width: 30px; height: 30px; }
@media (max-width: 480px) {
  .legal-bar .brand__text small { display: none; }
  .legal-bar__nav .btn > span:last-child { display: none; }
  .legal-bar__nav .btn { width: 40px; padding: 0; }
}
/* El panel de apariencia baja desde el botón, alineado a la derecha y siempre dentro de la pantalla */
.legal-bar [data-theme-switch] .accent { position: relative; }
.legal-bar .appearance__pop { right: 0; top: calc(100% + 8px); max-width: calc(100vw - 32px); }

/* Encabezado */
.legal-head { padding-block: clamp(2.25rem, 6vw, 4rem) clamp(1.75rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
.legal-head__eyebrow { margin: 0 0 0.6rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.legal-head h1 { font-size: clamp(2rem, 4.6vw, 3rem); }
.legal-head__lead { margin: 0.8rem 0 0; max-width: 60ch; font-size: 1.05rem; line-height: 1.6; color: var(--muted); }
.legal-head__meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin: 1.1rem 0 0; font-size: 0.88rem; color: var(--muted); }
.legal-dev { margin: 1rem 0 0; max-width: var(--measure); padding: 0.7rem 0.9rem; border-radius: 10px; font-size: 0.88rem; color: var(--text); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 25%, var(--line)); }

/* Índice + contenido */
.legal-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; padding-block: clamp(1.75rem, 4vw, 2.75rem) clamp(3rem, 7vw, 5rem); }
.legal-toc { position: sticky; top: calc(64px + 1.5rem); }
.legal-toc__box summary { list-style: none; margin-bottom: 0.6rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); cursor: default; pointer-events: none; }
.legal-toc__box summary::-webkit-details-marker { display: none; }
.legal-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; counter-reset: toc; border-left: 1px solid var(--line); }
.legal-toc li { counter-increment: toc; }
.legal-toc a { position: relative; display: flex; gap: 0.6rem; padding: 0.4rem 0.75rem; margin-left: -1px; border-left: 2px solid transparent; font-size: 0.9rem; color: var(--muted); text-decoration: none; transition: color 0.2s, border-color 0.2s; }
.legal-toc a::before { content: counter(toc); min-width: 1ch; font-variant-numeric: tabular-nums; color: var(--muted); opacity: 0.7; }
.legal-toc a:hover { color: var(--text); }
.legal-toc a[aria-current="true"] { color: var(--text); font-weight: 600; border-left-color: var(--text); }

.legal-body { max-width: var(--measure); }
.legal-sec { padding-block: 1.75rem; scroll-margin-top: calc(64px + 1rem); }
.legal-sec:first-child { padding-top: 0; }
.legal-sec + .legal-sec { border-top: 1px solid var(--line); }
.legal-sec h2 { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.9rem; font-size: clamp(1.2rem, 2vw, 1.4rem); }
.legal-sec__n { flex: none; display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.85rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-0.1em); }
.legal-sec p, .legal-sec li { line-height: 1.7; color: var(--text); }
.legal-sec p { margin: 0 0 0.75rem; }
.legal-sec p:last-child { margin-bottom: 0; }
.legal-sec ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.legal-sec li::marker { color: var(--muted); }
.legal-sec a { color: var(--text); text-underline-offset: 3px; }
.legal-muted { color: var(--muted) !important; }
.legal-contact { list-style: none; padding: 0 !important; }

/* Pie */
.legal-foot { border-top: 1px solid var(--line); }
.legal-foot__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 1.25rem; font-size: 0.88rem; color: var(--muted); }

/* Tableta y celular: el índice pasa arriba como desplegable */
@media (max-width: 860px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .legal-toc { position: static; }
  .legal-toc__box { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .legal-toc__box summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin: 0; padding: 0 1rem; font-size: 0.92rem; color: var(--text); cursor: pointer; pointer-events: auto; }
  .legal-toc__box summary::after { content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
  .legal-toc__box[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
  .legal-toc ol { padding: 0 0.5rem 0.6rem; border-left: 0; }
  .legal-toc a { min-height: 40px; align-items: center; border-left: 0; border-radius: 8px; }
  .legal-toc a[aria-current="true"] { background: var(--surface-2); }
}
:root[data-motion="reduced"] .legal-page * { scroll-behavior: auto !important; }
