/* ==========================================================================
   BASE STYLES
   Variables CSS, reset, tipografías y utilidades fundamentales
   ========================================================================== */

/* Variables CSS definidas en :root para consistencia de diseño */
:root {
  /* Colores principales */
  --bg: #FFFFFF;
  --fg: #1F2937;
  --muted: #6B7280;
  --subtle: #E5E7EB;
  --gold: #C9A227;
  --focus: #1F2937;
  
  /* Colores adicionales para estados */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
  
  /* Gradientes */
  --gradient-gold: linear-gradient(135deg, #C9A227 0%, #F7E98E  100%);
  --gradient-shimmer: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Espaciado con escala de 8px */
  --space-xs: 0.25rem; /* 4px */
  --space-sm: 0.5rem;  /* 8px */
  --space-md: 1rem;    /* 16px */
  --space-lg: 1.5rem;  /* 24px */
  --space-xl: 2rem;    /* 32px */
  --space-2xl: 3rem;   /* 48px */
  --space-3xl: 4rem;   /* 64px */
  --space-4xl: 6rem;   /* 96px */
  
  /* Tipografía con escala fluida usando clamp() */
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.3rem + 0.8vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.6rem + 1vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 1.9rem + 1.4vw, 3.5rem);
  --text-5xl: clamp(3rem, 2.5rem + 2vw, 4.5rem);
  
  /* Alturas de línea */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Bordes y radios */
  --border-width: 1px;
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --border-radius-lg: 24px;
  --border-radius-full: 9999px;
  
  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Z-index scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1070;
}

/* Reset moderno y base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Asegurar que no se pierda el inicio de las secciones */
[id] {
  scroll-margin-top: calc(var(--space-3xl) + var(--space-2xl));
}

/* Respeto por las preferencias de movimiento reducido */
@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 {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Elementos de bloque con márgenes consistentes */
h1, h2, h3, h4, h5, h6,
p, ul, ol, dl,
blockquote, figure,
fieldset, legend {
  margin: 0 0 var(--space-md) 0;
}

/* Tipografía de encabezados con Playfair Display (serif) */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--fg);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

/* Párrafos y texto corrido */
p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--fg);
  max-width: 65ch; /* Longitud de línea óptima para legibilidad */
}

/* Enlaces base con subrayado animado */
a {
  color: var(--gold);
  text-decoration: none;
  background-image: linear-gradient(to right, currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: bottom left;
  transition: background-size var(--transition-base);
}

a:hover,
a:focus {
  background-size: 100% 2px;
}

/* Estados de foco visible para accesibilidad */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* Elementos de formulario */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Imágenes responsive por defecto */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Listas sin bullets por defecto en navegación */
ul[role="list"],
ol[role="list"],
.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Elementos ocultos visualmente pero accesibles para lectores de pantalla */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip link para accesibilidad */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  z-index: var(--z-tooltip);
  padding: var(--space-sm) var(--space-md);
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 6px;
  background-size: 0;
}

/* Utilidades de espaciado */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.pt-0 { padding-top: 0; }
.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }
.pt-2xl { padding-top: var(--space-2xl); }

.pb-0 { padding-bottom: 0; }
.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }
.pb-xl { padding-bottom: var(--space-xl); }
.pb-2xl { padding-bottom: var(--space-2xl); }

/* Utilidades de texto */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--muted); }
.text-gold { color: var(--gold); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Utilidades responsive */
.hidden { display: none; }

@media (max-width: 768px) {
  .hidden-mobile { display: none; }
}

@media (min-width: 769px) {
  .hidden-desktop { display: none; }
}

/* Estados de carga con skeleton */
.loading {
  background: linear-gradient(90deg, var(--subtle) 25%, transparent 50%, var(--subtle) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Soporte para modo de alto contraste */
@media (prefers-contrast: high) {
  :root {
    --bg: #FFFFFF;
    --fg: #000000;
    --muted: #000000;
    --gold: #B8860B;
    --subtle: #000000;
  }
  
  a, button {
    text-decoration: underline;
  }
}

/* Separador de secciones con gradiente dorado */
.section-separator {
  position: relative;
  margin: 200px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 20%, #F7E98E 50%, var(--gold) 80%, transparent 100%);
  overflow: hidden;
}

.section-separator::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.8), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Separador con efecto de resplandor */
.section-separator::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 20px;
  background: radial-gradient(ellipse, rgba(201, 162, 39, 0.3) 0%, transparent 70%);
  filter: blur(10px);
}

/* Responsive para separadores */
@media (max-width: 768px) {
  .section-separator {
    margin: 120px 0;
  }
}

@media (max-width: 480px) {
  .section-separator {
    margin: 80px 0;
  }
  
  /* Más espacio en móviles para mejor visibilidad */
  [id] {
    scroll-margin-top: calc(var(--space-4xl) + var(--space-2xl));
  }
}
