/* ============================================
   RESET Y ESTILOS BASE
   Normalización cross-browser + base tipográfica
   ============================================ */

/* -------------------------------------------
   RESET MODERNO (inspirado en Josh Comeau)
------------------------------------------- */

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

html {
  /* Scroll suave nativo */
  scroll-behavior: smooth;
  /* Evita cambios de tamaño de texto en rotación (iOS) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Mejora el renderizado de fuentes */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--color-gray-800);
  background-color: var(--color-white);
  min-height: 100dvh;
  /* Evita overflow horizontal */
  overflow-x: hidden;
}

/* -------------------------------------------
   TIPOGRAFÍA BASE
------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-dark);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-600);
  max-width: 70ch;
}

/* -------------------------------------------
   ENLACES
------------------------------------------- */

a {
  color: var(--color-teal-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-teal-dark);
}

a:focus-visible {
  outline: 2px solid var(--color-teal-light);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* -------------------------------------------
   LISTAS
------------------------------------------- */

ul, ol {
  list-style: none;
}

/* -------------------------------------------
   IMÁGENES Y MEDIA
------------------------------------------- */

img, video, svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  /* Evita imagen "rota" con texto alterno */
  font-style: italic;
  font-size: var(--text-sm);
}

/* -------------------------------------------
   FORMULARIOS
------------------------------------------- */

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

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

input, textarea, select {
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  outline: none;
  width: 100%;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-teal-light);
  box-shadow: 0 0 0 3px rgba(39, 192, 208, 0.15);
}

/* -------------------------------------------
   TABLAS
------------------------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
}

/* -------------------------------------------
   CÓDIGO
------------------------------------------- */

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--color-gray-50);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-teal-dark);
}

pre {
  background-color: var(--color-dark);
  color: var(--color-teal-light);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

/* -------------------------------------------
   SEPARADORES
------------------------------------------- */

hr {
  border: none;
  border-top: var(--border-width) solid var(--border-color);
  margin: var(--space-8) 0;
}

/* -------------------------------------------
   SELECCIÓN DE TEXTO
------------------------------------------- */

::selection {
  background-color: rgba(39, 192, 208, 0.25);
  color: var(--color-dark);
}

/* -------------------------------------------
   SCROLLBAR PERSONALIZADO (navegadores WebKit)
------------------------------------------- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-gray-50);
}

::-webkit-scrollbar-thumb {
  background: var(--color-teal-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-teal-dark);
}

/* -------------------------------------------
   ACCESIBILIDAD - SKIP TO CONTENT
------------------------------------------- */

.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-teal-dark);
  color: var(--color-white);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: var(--space-4);
}

/* -------------------------------------------
   CLASE PARA LECTORES DE PANTALLA
------------------------------------------- */

.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;
}
