/* Páginas legales: aviso legal y política de privacidad (design-system.md, «Páginas legales»).
   Se carga después de styles.css y solo usa sus variables. */

/* Columna de lectura: 720 px como máximo e interlineado de 1,6. */
main.legal { max-width: 720px; padding: 40px 32px 16px; line-height: 1.6; }
@media (max-width: 560px) { main.legal { padding-inline: 16px; } }

.legal h1 { font-size: 28px; }
.legal .updated { margin-top: 8px; color: var(--text-muted); font-size: 14px; }
.legal h2 { margin: 32px 0 12px; font-size: 22px; }
.legal h3 { margin: 20px 0 8px; font-family: var(--font-heading); font-size: 16px; font-weight: 700; }
.legal p { margin-bottom: 14px; }
.legal ul { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding-left: 20px; }
.legal a { color: var(--accent); text-underline-offset: 3px; }
.legal a:focus-visible { box-shadow: 0 0 0 1px var(--gap), 0 0 0 3px var(--border-control); }
.legal code { padding: 1px 4px; font-size: 0.92em; background: var(--tint); border-radius: 4px; }

/* Bloque «En resumen». */
.legal .summary {
  --gap: var(--tint);
  margin-top: 24px;
  padding: 16px;
  background: var(--tint);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
}
.legal .summary h2 { margin-top: 0; }
.legal .summary ul { margin-bottom: 0; }

/* Tabla «Quién más ve tus datos»: en pantallas estrechas cada fila pasa a un bloque, sin desplazamiento horizontal. */
.legal table { width: 100%; margin-bottom: 14px; border-collapse: collapse; }
.legal th, .legal td { padding: 10px 12px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
.legal th { color: var(--text-muted); font-size: 14px; font-weight: 700; }
@media (max-width: 559px) {
  .legal thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .legal table, .legal tbody, .legal tr, .legal td { display: block; }
  .legal tr { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
  .legal td { padding: 2px 0; border-bottom: 0; }
  .legal td[data-label]::before { content: attr(data-label); display: block; color: var(--text-muted); font-size: 14px; font-weight: 700; }
}

/* «Volver al inicio» (TA-28, 17/11/26): encima del título, en las páginas legales y en las preguntas frecuentes. */
.legal .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -16px 0 8px; /* a 24 de la cabecera: el margen de la columna es de 40 */
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-radius: 6px;
}
.legal .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.legal .back-link:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--gap), 0 0 0 3px var(--accent); }
.legal .back-link svg { flex: none; }

/* Preguntas frecuentes (TA-28, design-system.md, «Preguntas frecuentes» y «Menú desplegable»). */
.faq-search { display: flex; flex-direction: column; margin-top: 16px; }
.faq-search .flabel { margin-bottom: 6px; }
.faq-field { position: relative; }
.faq-field input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 40px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  -webkit-appearance: none;
  appearance: none;
}
.faq-field input::-webkit-search-cancel-button { display: none; }
.faq-field input::placeholder { color: var(--text-muted); opacity: 1; }
.faq-field input:hover { border-color: var(--text-muted); }
.faq-field input:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--gap), 0 0 0 3px var(--border-control); }
.faq-lens { position: absolute; left: 12px; top: 14px; color: var(--text-muted); pointer-events: none; }
.faq-clear {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
}
.faq-clear[hidden] { display: none; }
.faq-clear:hover { color: var(--text); }
.faq-clear:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--border-control); }
.legal .faq-count { margin: 8px 0 0; font-size: 14px; color: var(--text-muted); }
.legal .faq-count:empty { display: none; }

.legal .faq-group h2 { margin: 24px 0 4px; }
.faq-q { border-bottom: 1px solid var(--border-subtle); }
.faq-q summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 12px 4px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  list-style: none;
  border-radius: 6px;
  cursor: pointer;
}
.faq-q summary::-webkit-details-marker { display: none; }
/* La flecha (chevron-down de Lucide, 16 px) gira al abrir. */
.faq-q summary::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--arrow) center / 16px 16px no-repeat;
  transition: transform 0.18s;
}
.faq-q[open] summary::after { transform: rotate(180deg); }
.faq-q summary:hover { background: var(--hover-overlay); }
.faq-q summary:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--gap), 0 0 0 3px var(--border-control); }
@media (hover: none) { .faq-q summary:hover { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .faq-q summary::after { transition: none; } }
.faq-a { padding: 0 4px 16px; }
.legal .faq-a p:last-child, .legal .faq-a ul:last-child { margin-bottom: 0; }

/* Mensaje final, como el bloque «En resumen». */
.legal .faq-more {
  --gap: var(--tint);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px;
  padding: 16px;
  background: var(--tint);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
}
.legal .faq-more p { margin: 0; }
.legal .faq-more .faq-more-title { font-family: var(--font-heading); font-size: 17px; font-weight: 700; }
.legal .faq-more a { font-weight: 600; }

/* Ventana de lectura (TA-37, 17/11/26; design-system.md, «Ventana de lectura»): el aviso legal, la privacidad y las
   preguntas frecuentes en una ventana, sin salir de la página. Encima de las demás ventanas, salvo la confirmación al
   salir (.scrim.over, 55). */
.scrim.reader-scrim { z-index: 52; align-items: center; }
.dialog.reader {
  gap: 0;
  max-width: 720px;
  height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
}
.reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.reader-title {
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 24px 24px;
  line-height: 1.6;
}
.reader-body > .updated:first-child { margin-top: 0; }
.reader-body .faq-more { margin-bottom: 0; }
.legal .reader-note { margin: 0; font-size: 14px; color: var(--text-muted); }
.legal .reader-note.msg-err { color: var(--status-review); }
@media (max-width: 559px) {
  .scrim.reader-scrim { padding: 0; }
  .dialog.reader {
    max-width: none;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .reader-body { padding: 16px; }
}
