/**
 * CSS Reset & Base Styles
 * Normalización moderna y configuración base
 */

/* ========================================
   BOX SIZING & RESET
   ======================================== */

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

/* ========================================
   ROOT & HTML
   ======================================== */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   BODY
   ======================================== */

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-gray-800);
  background-color: var(--color-bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ========================================
   TIPOGRAFÍA
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-black);
  margin: 0;
}

h1 {
  font-size: var(--font-size-6xl);
}

h2 {
  font-size: var(--font-size-5xl);
}

h3 {
  font-size: var(--font-size-4xl);
}

h4 {
  font-size: var(--font-size-3xl);
}

h5 {
  font-size: var(--font-size-2xl);
}

h6 {
  font-size: var(--font-size-xl);
}

p {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

strong, b {
  font-weight: var(--font-weight-bold);
}

em, i {
  font-style: italic;
}

/* ========================================
   ENLACES
   ======================================== */

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

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

/* ========================================
   LISTAS
   ======================================== */

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ========================================
   IMÁGENES Y MEDIA
   ======================================== */

img, 
picture, 
video, 
canvas, 
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

svg {
  overflow: hidden;
  vertical-align: middle;
}

/* ========================================
   FORMULARIOS
   ======================================== */

button, 
input, 
optgroup, 
select, 
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button:disabled,
[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

input,
textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
}

::placeholder {
  color: var(--color-gray-400);
  opacity: 1;
}

/* ========================================
   TABLAS
   ======================================== */

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

/* ========================================
   UTILIDADES GLOBALES
   ======================================== */

/* Remove default list styles on ul, ol elements with a list role */
[role='list'] {
  list-style: none;
}

/* Smooth scroll for anchors */
[id] {
  scroll-margin-top: calc(var(--navbar-height) + var(--space-6));
}

/* Remove all animations and transitions for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   SELECCIÓN DE TEXTO
   ======================================== */

::selection {
  background-color: var(--color-primary);
  color: var(--color-white);
  text-shadow: none;
}

::-moz-selection {
  background-color: var(--color-primary);
  color: var(--color-white);
  text-shadow: none;
}

/* ========================================
   SCROLLBAR PERSONALIZADA
   ======================================== */

/* Para navegadores WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-full);
  border: 3px solid var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

::-webkit-scrollbar-thumb:active {
  background: var(--color-gray-500);
}

/* Para Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-gray-300) var(--color-bg-secondary);
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */

/* Ocultar visualmente pero mantener 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-width: 0;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-md);
  transition: top var(--transition-fast);
}

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

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  img {
    page-break-inside: avoid;
  }

  h2,
  h3,
  p {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
