/**
 * TYANACADEMY - BASE & RESET (FASE 2)
 * Mobile-first, accesibilidad pura y reglas estructurales.
 */

/* Reseteo integral */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-xl);
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* Enlaces limpios */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Imágenes optimizadas y responsivas */
img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Tipografía de encabezados */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  line-height: var(--lh-heading);
  letter-spacing: -0.025em;
  font-weight: var(--fw-bold);
}

h1 { font-size: var(--fs-hero); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p {
  color: var(--color-text-secondary);
}

/* Elementos de formulario */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Accesibilidad: Foco visible estricto */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

/* Enlace de salto de accesibilidad (Skip Link) */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  z-index: 1000;
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  transition: top var(--transition-normal);
}

.skip-link:focus {
  top: var(--space-md);
}

/* Contenedores con márgenes y anchos armónicos */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

/* Ocultar visualmente manteniendo lectura por screen reader */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Respeto estricto por preferencias de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
