/* AcademIA · base común de los prototipos
   Tokens del sistema de diseño (paleta Tierra, Zilla Slab + DM Sans),
   reset, accesibilidad y mecánica de sesión demostrativa.
   Cada propuesta define su composición en assets/css/site.css. */

@font-face { font-family: 'Zilla Slab'; src: url('../fonts/ZillaSlab-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Zilla Slab'; src: url('../fonts/ZillaSlab-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Zilla Slab'; src: url('../fonts/ZillaSlab-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Zilla Slab'; src: url('../fonts/ZillaSlab-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Zilla Slab'; src: url('../fonts/ZillaSlab-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-var.woff2') format('woff2'); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Italic-var.woff2') format('woff2'); font-weight: 100 1000; font-style: italic; font-display: swap; }

:root {
  /* Paleta Tierra (exclusiva) */
  --damasco: #F7C59F;
  --mandarina: #F2A65A;
  --naranja: #EB7A2E;
  --terracota: #D2552A;
  --oxido: #A63A22;
  --bordo: #6E2A1F;
  --chocolate: #2B1A17;
  --crema: #FBF3E6;

  /* Ejes (orden y color del sistema) */
  --eje-1: var(--damasco);
  --eje-2: var(--mandarina);
  --eje-3: var(--naranja);
  --eje-4: var(--terracota);
  --eje-5: var(--oxido);
  --eje-6: var(--bordo);

  /* Tipografía */
  --font-title: 'Zilla Slab', 'Rockwell', 'Roboto Slab', Georgia, serif;
  --font-text: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Movimiento */
  --ease-out: cubic-bezier(.2, .7, .1, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(43, 26, 23, .12); }
a, button, input, select, label, summary { touch-action: manipulation; }
body { margin: 0; font-family: var(--font-text); line-height: 1.6; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
img, svg, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-title); font-weight: 700; line-height: 1.08; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:where(section, [id]) { scroll-margin-top: 6rem; }

/* Accesibilidad */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 1000; padding: .75rem 1rem; background: var(--chocolate); color: var(--crema); font-weight: 600; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--chocolate); outline-offset: 3px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: var(--damasco); }

/* Estado de sesión demostrativa (sin JS = sin sesión) */
html:not([data-session="on"]) [data-when="on"] { display: none !important; }
html[data-session="on"] [data-when="off"] { display: none !important; }

/* Contenido restringido: vista previa con desvanecimiento progresivo */
.locked { position: relative; }
html:not([data-session="on"]) .locked__content {
  max-height: var(--preview-h, 9rem);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 0%, transparent 92%);
  mask-image: linear-gradient(#000 0%, transparent 92%);
  user-select: none;
  pointer-events: none;
}

/* Formularios: estructura (cada propuesta define su piel) */
.f-form { display: grid; gap: 1.1rem; }
.f-field { display: grid; gap: .35rem; }
.f-label { font-weight: 600; font-size: .95rem; }
.f-control { position: relative; display: flex; }
.f-input { width: 100%; min-height: 3rem; padding: .7rem .9rem; border: 2px solid currentColor; border-radius: 0; background: transparent; }
.f-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 1.2rem) 1.3rem, calc(100% - .85rem) 1.3rem; background-size: .35rem .35rem; background-repeat: no-repeat; padding-right: 2.5rem; }
.f-select option { color: var(--chocolate); background: var(--crema); }
.f-reveal { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); padding: .35rem .6rem; border: 0; background: transparent; font-size: .85rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.f-input[type="password"], .f-input[data-match] { padding-right: 5.5rem; }
.f-hint { font-size: .875rem; opacity: .85; }
/* Error: Óxido sobre fondos claros (5.9:1) / Damasco sobre oscuros; el ícono «!» no depende sólo del color */
.f-error { color: var(--error, var(--oxido)); font-size: .9rem; font-weight: 600; display: flex; gap: .4rem; align-items: baseline; }
.f-error::before { content: '!'; display: inline-grid; place-items: center; flex: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: currentColor; color: var(--error-ink, var(--crema)); font-size: .75rem; line-height: 1; }
.f-input[aria-invalid] { border-style: dashed; border-color: var(--error, var(--oxido)); }
.f-check { display: flex; gap: .6rem; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.f-check input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--chocolate); flex: none; }
.f-actions { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; }
.f-link { font-size: .95rem; text-underline-offset: 3px; }
.f-status:empty { display: none; }
.f-status { font-size: .95rem; padding: .8rem 1rem; border-left: 4px solid currentColor; }
.demo-notice { font-size: .875rem; line-height: 1.5; }

.icon-lock, .icon-arrow { display: inline-block; vertical-align: -.1em; flex: none; }

/* Movimiento reducido: sin animaciones ni transiciones decorativas */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Con la barra comparativa presente (sólo index.html), la barra de sesión simulada
   sube en pantallas angostas para no superponerse. */
@media (max-width: 640px) { body:has(.cmp) .demo { bottom: 58px !important; } }

/* Barras fijas (sesión simulada y comparador) respetan las áreas seguras de pantallas con muesca */
.demo { margin-bottom: env(safe-area-inset-bottom, 0); margin-right: env(safe-area-inset-right, 0); }

/* Táctiles: en punteros gruesos, las acciones de listas y formularios alcanzan 44px de alto */
@media (pointer: coarse) {
  .f-reveal, .f-link, .mat__a, .row__a, .bib__a, .rl__a, .res__a, .link-btn, .gate__demo, .pj__a, .more, .hd__acc, .nav__acc, .ft a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Reflujo en pantallas angostas y con texto ampliado: los titulares largos se cortan
   con guiones (es-AR) en lugar de desbordar, y los hijos de grilla pueden encogerse. */
@media (max-width: 480px) {
  h1, h2, h3, [class*="__t"] { overflow-wrap: anywhere; hyphens: auto; }
  main *, header *, footer * { min-width: 0; }
}
/* Red de seguridad para texto ampliado: ningún desborde residual genera scroll lateral */
@media (max-width: 480px) { html { overflow-x: clip; } }
