/*
SISTEMA TIPOGRÁFICO PROFESIONAL
===============================
Sistema escalable y accesible para un senior UX/UI especializado en accesibilidad
Basado en principios de diseño inclusivo y jerarquía visual estratégica
*/

/* 
VARIABLES TIPOGRÁFICAS
=====================
Sistema modular basado en escalas matemáticas y accesibilidad
*/

:root {
  /* Escala tipográfica basada en proporción áurea (1.618) y accesibilidad */
  --font-size-xs: 0.75rem;     /* 12px - Metadatos, labels pequeños */
  --font-size-sm: 0.875rem;    /* 14px - Texto secundario, captions */
  --font-size-base: 1rem;      /* 16px - Texto base (WCAG recomendado) */
  --font-size-md: 1.125rem;    /* 18px - Texto destacado, leads */
  --font-size-lg: 1.25rem;     /* 20px - Subtítulos pequeños */
  --font-size-xl: 1.5rem;      /* 24px - Subtítulos principales */
  --font-size-2xl: 1.875rem;   /* 30px - Títulos de sección */
  --font-size-3xl: 2.25rem;    /* 36px - Títulos principales */
  --font-size-4xl: 3rem;       /* 48px - Títulos hero */
  --font-size-5xl: 3.75rem;    /* 60px - Display titles */
  --font-size-6xl: 4.5rem;     /* 72px - Hero principal */
  
  /* Pesos tipográficos semánticos */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Alturas de línea optimizadas para legibilidad */
  --line-height-tight: 1.1;    /* Títulos grandes */
  --line-height-snug: 1.2;     /* Títulos medianos */
  --line-height-normal: 1.4;   /* Subtítulos */
  --line-height-relaxed: 1.6;  /* Texto base */
  --line-height-loose: 1.8;    /* Texto largo, párrafos */
  
  /* Espaciado de letras para diferentes contextos */
  --letter-spacing-tight: -0.025em;  /* Títulos grandes */
  --letter-spacing-normal: 0;        /* Texto normal */
  --letter-spacing-wide: 0.025em;    /* Texto pequeño */
  --letter-spacing-wider: 0.05em;    /* Labels, botones */
  --letter-spacing-widest: 0.1em;    /* Texto decorativo */
  
  /* Familias tipográficas */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* 
CLASES TIPOGRÁFICAS SEMÁNTICAS
==============================
Nombres que reflejan propósito, no apariencia
*/

/* Títulos principales */
.text-hero {
  font-family: var(--font-family-display);
  font-size: clamp(var(--font-size-4xl), 8vw, var(--font-size-6xl));
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: #ffffff;
  background: linear-gradient(135deg, #ff6b9d, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-display {
  font-family: var(--font-family-display);
  font-size: clamp(var(--font-size-3xl), 6vw, var(--font-size-5xl));
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: #ffffff;
}

.text-heading-1 {
  font-family: var(--font-family-display);
  font-size: clamp(var(--font-size-2xl), 4vw, var(--font-size-4xl));
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-tight);
  color: #ffffff;
}

.text-heading-2 {
  font-family: var(--font-family-display);
  font-size: clamp(var(--font-size-xl), 3vw, var(--font-size-3xl));
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
  color: #ffffff;
}

.text-heading-3 {
  font-family: var(--font-family-primary);
  font-size: clamp(var(--font-size-lg), 2.5vw, var(--font-size-2xl));
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: #ffffff;
}

.text-heading-4 {
  font-family: var(--font-family-primary);
  font-size: clamp(var(--font-size-md), 2vw, var(--font-size-xl));
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: #e0e6ed;
}

/* Texto de cuerpo */
.text-lead {
  font-family: var(--font-family-primary);
  font-size: clamp(var(--font-size-md), 2vw, var(--font-size-lg));
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-normal);
  color: #cbd5e0;
}

.text-body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-normal);
  color: #a0aec0;
}

.text-body-large {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-loose);
  letter-spacing: var(--letter-spacing-normal);
  color: #cbd5e0;
}

.text-small {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-wide);
  color: #718096;
}

.text-caption {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-wider);
  color: #4a5568;
  text-transform: uppercase;
}

/* Texto especializado */
.text-code {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: #4ecdc4;
  background: rgba(78, 205, 196, 0.1);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

.text-quote {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-loose);
  letter-spacing: var(--letter-spacing-normal);
  color: #e0e6ed;
  font-style: italic;
  position: relative;
}

.text-quote::before {
  content: '"';
  font-size: var(--font-size-3xl);
  color: #ff6b9d;
  position: absolute;
  left: -1rem;
  top: -0.5rem;
  line-height: 1;
}

/* 
MODIFICADORES SEMÁNTICOS
========================
Clases que modifican el comportamiento tipográfico
*/

/* Estados de énfasis */
.text-emphasis {
  font-weight: var(--font-weight-semibold);
  color: #ffffff;
}

.text-muted {
  opacity: 0.7;
}

.text-subtle {
  opacity: 0.6;
}

/* Colores semánticos */
.text-primary {
  color: #4ecdc4;
}

.text-secondary {
  color: #ff6b9d;
}

.text-accent {
  color: #7ed321;
}

.text-warning {
  color: #f5a623;
}

.text-success {
  color: #7ed321;
}

.text-error {
  color: #d0021b;
}

/* Gradientes tipográficos */
.text-gradient-primary {
  background: linear-gradient(135deg, #ff6b9d, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-secondary {
  background: linear-gradient(135deg, #4ecdc4, #7ed321);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 
APLICACIONES ESPECÍFICAS DEL PORTFOLIO
======================================
Clases para elementos específicos del portafolio
*/

/* Hero section */
.hero-title {
  @apply text-hero;
  margin-bottom: var(--space-whisper);
}

.hero-subtitle {
  @apply text-lead;
  margin-bottom: var(--space-tension-md);
  opacity: 0.9;
}

.hero-description {
  @apply text-body-large;
  max-width: 65ch; /* Longitud óptima de línea para legibilidad */
  margin-left: auto;
  margin-right: auto;
}

/* Section titles */
.section-title {
  @apply text-display text-gradient-primary;
  text-align: center;
  margin-bottom: var(--space-tension-lg);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(135deg, #ff6b9d, #4ecdc4);
  border-radius: 2px;
}

/* Project cards */
.project-title {
  @apply text-heading-3;
  margin-bottom: var(--space-xs);
}

.project-subtitle {
  @apply text-small text-muted;
  margin-bottom: var(--space-breath);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

.project-description {
  @apply text-body;
  max-width: 50ch;
}

/* Skills */
.skill-title {
  @apply text-heading-4 text-secondary;
  margin-bottom: var(--space-md);
}

.skill-item {
  @apply text-body;
  position: relative;
  padding-left: var(--space-md);
}

.skill-item::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #4ecdc4;
  font-weight: var(--font-weight-bold);
}

/* Timeline */
.timeline-date {
  @apply text-caption text-primary;
  margin-bottom: var(--space-xs);
}

.timeline-title {
  @apply text-heading-4;
  margin-bottom: var(--space-whisper);
}

.timeline-company {
  @apply text-small text-muted;
  margin-bottom: var(--space-sm);
}

.timeline-description {
  @apply text-body;
  margin-bottom: var(--space-md);
}

/* 
RESPONSIVE TYPOGRAPHY
=====================
Adaptaciones inteligentes para diferentes dispositivos
*/

@media (max-width: 768px) {
  :root {
    /* Ajustes para tablet */
    --font-size-6xl: 3.5rem;
    --font-size-5xl: 3rem;
    --font-size-4xl: 2.5rem;
  }
  
  .hero-description {
    max-width: 55ch;
  }
  
  .project-description {
    max-width: 45ch;
  }
}

@media (max-width: 480px) {
  :root {
    /* Ajustes para móvil */
    --font-size-6xl: 2.5rem;
    --font-size-5xl: 2.25rem;
    --font-size-4xl: 2rem;
    --line-height-tight: 1.2;
  }
  
  .hero-description {
    max-width: 100%;
  }
  
  .project-description {
    max-width: 100%;
  }
  
  /* Simplificar gradientes en móvil para performance */
  .text-gradient-primary,
  .text-gradient-secondary {
    background: none;
    -webkit-text-fill-color: unset;
    color: #ffffff;
  }
}

/* 
ACCESIBILIDAD TIPOGRÁFICA
=========================
Mejoras específicas para accesibilidad
*/

/* Respeto por preferencias del usuario */
@media (prefers-reduced-motion: reduce) {
  .text-gradient-primary,
  .text-gradient-secondary {
    background: none;
    -webkit-text-fill-color: unset;
    color: #ffffff;
  }
}

/* Contraste mejorado para usuarios con baja visión */
@media (prefers-contrast: high) {
  :root {
    --font-weight-normal: 500;
    --font-weight-medium: 600;
    --font-weight-semibold: 700;
  }
  
  .text-body {
    color: #e0e6ed;
  }
  
  .text-small {
    color: #cbd5e0;
  }
}

/* Soporte para texto grande */
@media (prefers-reduced-data: reduce) {
  .text-gradient-primary,
  .text-gradient-secondary {
    background: none;
    -webkit-text-fill-color: unset;
    color: #ffffff;
  }
}

/* 
UTILIDADES TIPOGRÁFICAS
=======================
Clases de utilidad para casos específicos
*/

.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

.text-nowrap {
  white-space: nowrap;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Selección de texto personalizada */
::selection {
  background: rgba(78, 205, 196, 0.3);
  color: #ffffff;
}

::-moz-selection {
  background: rgba(78, 205, 196, 0.3);
  color: #ffffff;
}

/* 
DEBUG TYPOGRAPHY
================
Para desarrollo y testing
*/

.debug-typography * {
  outline: 1px solid rgba(255, 107, 157, 0.3);
  position: relative;
}

.debug-typography *::before {
  content: attr(class);
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(255, 107, 157, 0.8);
  color: white;
  padding: 2px 4px;
  font-size: 10px;
  font-family: monospace;
  z-index: 1000;
  pointer-events: none;
}

