/* =============================================================================
   Páginas legales y de ayuda (public/legal/*.html).

   Estáticas a propósito: Google (pantalla de consentimiento de OAuth), el App Store y
   Google Play las leen sin sesión y a veces sin JavaScript, así que no pueden vivir
   detrás del gate de la SPA. Se sirven en su ruta corta desde backend/planazo/serve.py
   (prod) y desde vite.config.ts (dev).

   Estética «fotocopia», paleta «hormigón» (valores copiados de src/styles/tokens.css):
   Archivo Black en mayúsculas para los títulos, Courier Prime para todo lo demás.
   Las fuentes son copias de src/assets/fonts (OFL, ver fonts/OFL.txt).
   ============================================================================= */

@font-face {
  font-family: "Archivo Black";
  font-weight: 400;
  font-display: swap;
  src: url("/legal/fonts/archivo-black-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime";
  font-weight: 400;
  font-display: swap;
  src: url("/legal/fonts/courier-prime-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime";
  font-weight: 700;
  font-display: swap;
  src: url("/legal/fonts/courier-prime-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/legal/fonts/courier-prime-latin-400-italic.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ground: #DCDDDA;
  --surface: #EEEFEC;
  --sunken: #CFD0CC;
  --text: #111111;
  --text-2: #393B3E;
  --muted: #4C4E52;
  --brand: #D0021B;
  --brand-strong: #A30015;
  --tape: #FFD100;
  --line: rgba(17, 17, 17, 0.18);
  --shadow: #111111;

  --display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --type: "Courier Prime", "Courier New", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #151515;
    --surface: #202020;
    --sunken: #0E0E0E;
    --text: #EDEDEB;
    --text-2: #B5B5B1;
    --muted: #A1A19C;
    --brand: #FF4A4A;
    --brand-strong: #FF6B6B;
    --line: rgba(237, 237, 235, 0.18);
    --shadow: #000000;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #151515;
  --surface: #202020;
  --sunken: #0E0E0E;
  --text: #EDEDEB;
  --text-2: #B5B5B1;
  --muted: #A1A19C;
  --brand: #FF4A4A;
  --brand-strong: #FF6B6B;
  --line: rgba(237, 237, 235, 0.18);
  --shadow: #000000;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--type);
  font-size: 1.0625rem;
  line-height: 1.62;
  overflow-wrap: break-word;
}

a { color: var(--brand); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--text); color: var(--ground); padding: 8px 12px;
}
.skip:focus { left: 16px; top: 16px; z-index: 10; }

/* ---- Cabecera ---------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1080px; margin: 0 auto; padding: 18px 16px;
}
.brand {
  font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.brand i { color: var(--brand); font-style: normal; }
.top__cta {
  font-family: var(--type); font-weight: 700; font-size: 0.95rem; text-transform: lowercase;
  color: var(--text); background: var(--surface); text-decoration: none;
  border: 2px solid var(--text); padding: 6px 14px; box-shadow: 3px 3px 0 var(--shadow);
}
.top__cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }

/* ---- Título ------------------------------------------------------------------ */
.head { max-width: 1080px; margin: 0 auto; padding: 28px 16px 8px; }
.kicker { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; text-transform: lowercase; }
h1 {
  margin: 0;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(2.1rem, 7vw, 4.2rem); line-height: 0.98; letter-spacing: -0.015em;
}
h1 span {                        /* una tira de papel pegada torcida */
  display: inline-block; background: var(--surface); padding: 0.06em 0.22em 0;
  transform: rotate(-1.2deg); box-shadow: 3px 3px 0 var(--shadow);
}
.meta { margin: 22px 0 0; color: var(--text-2); font-size: 0.95rem; }

/* ---- Cuerpo: índice + texto --------------------------------------------------- */
.page {
  display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr);
  max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px;
}
@media (min-width: 900px) {
  .page { grid-template-columns: 240px minmax(0, 1fr); gap: 56px; }
  .toc { position: sticky; top: 24px; align-self: start; }
}

.toc {
  font-size: 0.9rem; background: var(--surface); border: 1px solid var(--line); padding: 16px 18px;
}
.toc p { margin: 0 0 8px; font-weight: 700; text-transform: lowercase; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin: 4px 0; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }

.doc { max-width: 70ch; }
.doc > :first-child { margin-top: 0; }
.doc h2 {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(1.25rem, 3.4vw, 1.6rem); line-height: 1.12; letter-spacing: -0.005em;
  margin: 2.4em 0 0.7em; scroll-margin-top: 20px;
}
.doc h3 { font-size: 1.05rem; font-weight: 700; margin: 1.8em 0 0.4em; }
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 0.35em 0; }
.doc strong { font-weight: 700; }

/* La versión corta: lo que importa, arriba de todo. */
.tldr {
  background: var(--surface); border: 2px solid var(--text); box-shadow: 4px 4px 0 var(--shadow);
  padding: 18px 20px; margin: 0 0 8px;
}
.tldr > p:first-child { margin-top: 0; font-weight: 700; text-transform: lowercase; }
.tldr ul { margin-bottom: 0; }

/* Tablas: se scrollean dentro de su caja, nunca la página. */
.table { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-weight: 700; background: var(--sunken); }
tr:last-child td { border-bottom: 0; }

/* En teléfono cada fila es una tarjeta: la primera celda es el título, las demás
   se leen debajo (la última, en gris, es el dato secundario: origen, dónde, cuánto). */
@media (max-width: 640px) {
  .table table, .table tbody, .table tr, .table td { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 0; border: 0; }
  .table td:first-child { font-weight: 700; margin-bottom: 4px; }
  .table td + td:last-child:not(:nth-child(2)) { color: var(--muted); margin-top: 4px; font-size: 0.86rem; }
}

/* El texto que exige la ley, citado tal cual. */
.legend {
  background: var(--sunken); padding: 14px 16px; color: var(--text-2); font-size: 0.95rem;
}

/* Datos que todavía faltan completar. Se ven a propósito: no pueden salir así. */
.todo {
  background: var(--tape); color: #111111; padding: 0 0.25em; font-weight: 700;
}

details { border-top: 1px solid var(--line); padding: 12px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; }
details > :not(summary) { margin-top: 0.6em; }

/* Índice de /legal */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 0; padding: 0; list-style: none; }
.cards a {
  display: block; height: 100%; background: var(--surface); color: var(--text); text-decoration: none;
  border: 2px solid var(--text); box-shadow: 4px 4px 0 var(--shadow); padding: 16px 18px;
}
.cards a:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow); }
.cards strong { display: block; font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 1.05rem; line-height: 1.15; margin-bottom: 6px; }
.cards span { color: var(--text-2); font-size: 0.92rem; }
.single { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---- Pie ---------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); background: var(--sunken); }
.foot__in {
  max-width: 1080px; margin: 0 auto; padding: 24px 16px 32px;
  display: grid; gap: 14px; font-size: 0.88rem; color: var(--text-2);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--text-2); }
.foot p { margin: 0; }

@media print {
  .top__cta, .toc, .foot nav, .skip { display: none; }
  body { background: #fff; color: #000; }
  h1 span { box-shadow: none; transform: none; }
  .page { display: block; }
}
