/* KairSun legales — CSP estricto: solo 'self'. Sin Google Fonts. */
:root {
  --tinta: #1b1b1f;
  --tinta-suave: #4a4a55;
  --papel: #ffffff;
  --borde: #e3e3ea;
  --acento: #0F766E;
  --acento-suave: #e8f4f2;
  --alerta: #8a5a00;
  --alerta-fondo: #fff6e0;
  --alerta-borde: #e8c877;
  --gold: #A16207;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tinta: #F8FAFC;
    --tinta-suave: #CBD5E1;
    --papel: #09090B;
    --borde: #27272A;
    --acento: #2DD4BF;
    --acento-suave: #1B3635;
    --alerta: #F5C451;
    --alerta-fondo: #2e2612;
    --alerta-borde: #5c4a20;
    --gold: #F5C451;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
/* El padding horizontal vive en main (no en body) para que el footer v2
 * pueda sangrar a todo el ancho, igual que en el resto del sitio. */
body {
  margin: 0; padding: 0;
  background: var(--papel); color: var(--tinta);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-kerning: normal;
}
main { max-width: 800px; margin: 0 auto; padding: 0 20px 24px; }
header { padding: 44px 0 18px; border-bottom: 1px solid var(--borde); margin-bottom: 32px; }
.nav-mini {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 16px 0 0;
  font-size: .9rem;
}
.nav-mini a { color: var(--acento); text-decoration: none; }
.nav-mini a:hover { text-decoration: underline; text-underline-offset: 3px; }
.nav-mini a[aria-current="page"] { color: var(--tinta); font-weight: 700; text-decoration: none; }
h1 { font-size: clamp(1.7rem, 4.6vw, 2.1rem); line-height: 1.16; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 1.25rem; margin: 44px 0 12px; padding-top: 4px; text-wrap: balance; scroll-margin-top: 20px; }
h3 { font-size: 1.02rem; margin: 28px 0 8px; text-wrap: balance; scroll-margin-top: 20px; }
p, li { color: var(--tinta-suave); }
li { margin: 6px 0; }
strong { color: var(--tinta); }
a { color: var(--acento); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* Medida de lectura: 65ch en el cuerpo; tablas y cajas a su propio ancho. */
main p, main li { max-width: 65ch; }
.resumen, .salud, .aviso { max-width: calc(65ch + 40px); }
.resumen li, .resumen p, .salud p, .aviso p { max-width: none; }
::selection { background: var(--gold); color: #2B1D00; }

/* A-01: gold/mastery focus ring — never outline:none without replacement */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.35);
}
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--gold);
  color: #2B1D00;
  font-weight: 700;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

code { background: var(--acento-suave); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.fecha { font-size: .9rem; color: var(--tinta-suave); margin: 0; }
.resumen {
  background: var(--acento-suave); border-left: 4px solid var(--acento);
  padding: 18px 20px; border-radius: 0 10px 10px 0; margin: 32px 0;
}
.resumen h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--acento); padding-top: 0; }
.resumen ul { margin: 0; padding-left: 20px; }
.salud {
  background: var(--alerta-fondo); border: 1px solid var(--alerta-borde);
  padding: 18px 20px; border-radius: 10px; margin: 32px 0;
}
.salud h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--alerta); padding-top: 0; }
.aviso { border: 1px solid var(--borde); border-radius: 10px; padding: 16px 20px; margin: 24px 0; }
/* Región de scroll con foco por teclado (role/tabindex/aria-label en el HTML):
 * la tabla conserva su semántica y a 320 px sigue siendo navegable. */
.tabla-scroll {
  --tabla-sombra: rgba(27, 27, 31, 0.3);
  margin: 16px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  /* Pista de scroll solo CSS (la CSP de legales prohíbe JS): dos recortes
   * `local` viajan con el contenido y tapan las sombras `scroll` ancladas al
   * borde visible, así la sombra aparece únicamente del lado por el que
   * todavía se puede deslizar. Snap descartado: en una región tabindex=0 el
   * proximity rebota contra las flechas y saltea celdas. TOC descartado desde
   * el pass 2: con pocas secciones y sin JS el índice no aporta. */
  background-image:
    linear-gradient(to right, var(--papel) 30%, transparent),
    linear-gradient(to left, var(--papel) 30%, transparent),
    radial-gradient(farthest-side at 0 50%, var(--tabla-sombra), transparent),
    radial-gradient(farthest-side at 100% 50%, var(--tabla-sombra), transparent);
  background-position: left center, right center, left center, right center;
  background-size: 42px 100%, 42px 100%, 16px 100%, 16px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
@media (prefers-color-scheme: dark) {
  .tabla-scroll { --tabla-sombra: rgba(248, 250, 252, 0.26); }
}
table { width: 100%; border-collapse: collapse; margin: 0; font-size: .94rem; }
th, td { border: 1px solid var(--borde); padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: var(--acento-suave); color: var(--tinta); font-weight: 600; }
td { color: var(--tinta-suave); }
tbody tr:nth-child(even) { background: rgba(15, 118, 110, 0.04); }
@media (prefers-color-scheme: dark) {
  tbody tr:nth-child(even) { background: rgba(45, 212, 191, 0.05); }
}
/* Footer genérico del legal viejo: el v2 trae su propio look. */
footer:not(.site-footer) { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--borde); font-size: .88rem; }

/* El footer v2 es oscuro: un poco menos de aire antes de la banda. */
body .site-footer.ksf { margin-top: 48px; }

/* ==========================================================================
 * 404 — página no encontrada (premium, dark, solo CSS)
 * Composición: numeral «404» fantasma + mascota en un portal con órbita.
 * ======================================================================== */

.nf-body {
  color-scheme: dark;
  background:
    radial-gradient(ellipse 78% 58% at 50% -6%, rgba(45, 212, 191, 0.16), transparent 62%),
    radial-gradient(circle at 16% 22%, rgba(245, 196, 81, 0.08), transparent 42%),
    radial-gradient(circle at 86% 18%, rgba(45, 212, 191, 0.08), transparent 44%),
    linear-gradient(180deg, #01070F 0%, #020D1A 56%, #01070F 100%);
  color: #F8FAFC;
}

.nf {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) 20px 16px;
  text-align: center;
}

/* ── Hero: numeral fantasma + mascota con halo, órbita y piso ───────────── */

.nf-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: clamp(210px, 36vw, 320px);
}

.nf-hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: min(80vw, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.15), rgba(245, 196, 81, 0.06) 46%, transparent 72%);
  filter: blur(4px);
  pointer-events: none;
}

.nf-code {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -64%);
  margin: 0;
  font-size: clamp(8.5rem, 30vw, 17rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #F5C451;
  opacity: 0.95;
  -webkit-text-stroke: 1px rgba(255, 233, 184, 0.16);
  user-select: none;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .nf-code {
    background: linear-gradient(160deg, #FFE9B8 4%, #F5C451 42%, #2DD4BF 98%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

.nf-pet-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: none;
  /* Piso: la sombra queda fija mientras la mascota respira. */
  background: radial-gradient(ellipse 58% 9% at 50% 97%, rgba(0, 0, 0, 0.6), transparent 72%);
}

.nf-pet-wrap::before {
  content: "";
  position: absolute;
  inset: -26%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.22), rgba(245, 196, 81, 0.09) 50%, transparent 72%);
  filter: blur(16px);
  pointer-events: none;
}

.nf-pet-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: auto;
  width: 132%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(245, 196, 81, 0.26);
  pointer-events: none;
}

.nf-pet {
  position: relative;
  z-index: 1;
  width: clamp(120px, 22vw, 168px);
  height: auto;
  transform-origin: 50% 88%;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5));
}

.nf-title {
  margin: 26px 0 8px;
  font-size: clamp(1.5rem, 3.8vw, 2.15rem);
  line-height: 1.18;
  color: #FAFAFA;
  text-wrap: balance;
}

.nf-lead {
  margin: 0 auto 30px;
  max-width: 52ch;
  color: #B8C4D6;
  font-size: 1rem;
  text-wrap: pretty;
}

.nf-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  text-align: left;
}

.nf-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.35);
  color: #FAFAFA;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.nf-card:hover,
.nf-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(245, 196, 81, 0.6);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.12), rgba(255, 255, 255, 0.03));
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.nf-card:active { transform: translateY(-1px) scale(0.995); }

.nf-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(245, 196, 81, 0.32);
  background: linear-gradient(160deg, rgba(245, 196, 81, 0.2), rgba(45, 212, 191, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #F5C451;
}

.nf-card__icon svg { width: 20px; height: 20px; }

.nf-card__txt { display: grid; gap: 2px; min-width: 0; }
.nf-card__txt strong { font-size: 0.98rem; color: #FAFAFA; }
.nf-card__txt span { font-size: 0.82rem; color: #B8C4D6; }

.nf-card__go {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(245, 196, 81, 0.35);
  color: #F5C451;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.75;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nf-card:hover .nf-card__go,
.nf-card:focus-visible .nf-card__go {
  transform: translateX(3px);
  opacity: 1;
  background: #F5C451;
  color: #2B1D00;
  border-color: transparent;
}

@media (max-width: 620px) {
  .nf { padding-top: 20px; }
  .nf-hero { min-height: clamp(200px, 52vw, 270px); }
  .nf-links { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes nf-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  @keyframes nf-orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  @keyframes nf-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }

  /* Dos loops sutiles: respiración de la mascota + órbita lenta. */
  .nf-pet { animation: nf-bob 6s ease-in-out infinite; }
  .nf-pet-wrap::after { animation: nf-orbit 40s linear infinite; }

  .nf-hero,
  .nf-title,
  .nf-lead,
  .nf-links {
    animation: nf-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .nf-title { animation-delay: 0.06s; }
  .nf-lead { animation-delay: 0.12s; }
  .nf-links { animation-delay: 0.18s; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-pet,
  .nf-pet-wrap::after,
  .nf-hero,
  .nf-title,
  .nf-lead,
  .nf-links {
    animation: none;
  }

  .nf-card,
  .nf-card__go {
    transition: none;
  }

  .nf-card:hover,
  .nf-card:focus-visible {
    transform: none;
  }
}

/* Scroll progress — CSS-only (legales CSP forbids scripts).
 * Default = static fallback: fixed gradient bar, fully visible, no animation.
 * Engines without `animation-timeline` (Safari/FF) keep this painted bar;
 * engines with support opt into the scroll-driven scaleX. */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  height: 3px;
  width: 100%;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: none;
  background: linear-gradient(90deg, #0F766E 0%, #2DD4BF 28%, #F5C451 62%, #FFE9B8 100%);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.35);
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::before {
      transform: scaleX(0);
      animation: ks-legal-scroll linear both;
      animation-timeline: scroll(root);
      animation-range: 0% 100%;
    }
  }
}
@keyframes ks-legal-scroll {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none !important; transform: scaleX(0) !important; opacity: 0 !important; }
}
