/*
 * PATRIOTAS DEL CARIBE - SISTEMA DE DISEÑO
 * Sistema de diseño moderno con paleta terrosa y elementos patrióticos
 * Mobile-first, accesible (WCAG 2.1 AA), performante
 */

/* ============================================
   1. VARIABLES CSS (Custom Properties)
   ============================================ */

:root {
  /* Colores Patrióticos (mantener identidad) */
  --patriotic-blue: #003d82;
  --patriotic-blue-hover: #002a5c;
  --patriotic-red: #c8102e;
  --patriotic-red-hover: #a00d24;

  /* Tonos Terrosos Modernos */
  --sand-light: #f5f1e8;
  --sand-medium: #e8ddc7;
  --terracotta: #d4795f;
  --terracotta-hover: #c06850;
  --olive-green: #7a8450;
  --olive-green-hover: #656d42;

  /* Neutrales */
  --white: #ffffff;
  --off-white: #fafaf8;
  --charcoal: #2c2c2c;
  --gray-medium: #6b6b6b;
  --gray-light: #d9d9d9;
  --gray-lighter: #f0f0f0;

  /* Gradientes */
  --gradient-hero: linear-gradient(135deg, #003d82 0%, #0056b3 50%, #7a8450 100%);
  --gradient-section: linear-gradient(180deg, #f5f1e8 0%, #ffffff 100%);
  --gradient-overlay: linear-gradient(180deg, rgba(0, 61, 130, 0.7) 0%, rgba(0, 61, 130, 0.9) 100%);

  /* Tipografía */
  --font-primary: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  --font-secondary: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-accent: 'Montserrat', 'Helvetica Neue', sans-serif;

  /* Escala Tipográfica Responsive (clamp) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);    /* 12-14px */
  --text-sm: clamp(0.875rem, 0.85rem + 0.25vw, 1rem);      /* 14-16px */
  --text-base: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);     /* 16-18px */
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);      /* 18-22px */
  --text-xl: clamp(1.5rem, 1.3rem + 0.8vw, 2rem);          /* 24-32px */
  --text-2xl: clamp(2rem, 1.5rem + 1.5vw, 3rem);           /* 32-48px */
  --text-3xl: clamp(2.5rem, 2rem + 2vw, 4rem);             /* 40-64px */

  /* Pesos de Fuente */
  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Line Heights */
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.75;

  /* Espaciado (Sistema de 8px) */
  --space-1: 0.5rem;   /* 8px */
  --space-2: 1rem;     /* 16px */
  --space-3: 1.5rem;   /* 24px */
  --space-4: 2rem;     /* 32px */
  --space-5: 3rem;     /* 48px */
  --space-6: 4rem;     /* 64px */
  --space-8: 6rem;     /* 96px */
  --space-10: 8rem;    /* 128px */

  /* Contenedores */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-max: 1440px;

  /* Breakpoints (para JS) */
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
}

/* ============================================
   2. RESET Y NORMALIZACÍON
   ============================================ */

/* Box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Resetear márgenes */
* {
  margin: 0;
  padding: 0;
}

/* HTML y Body */
html {
  font-size: 100%; /* 16px base */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--charcoal);
  background-color: var(--off-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main */
main {
  flex: 1;
}

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

/* Formularios */
input, button, textarea, select {
  font: inherit;
}

/* Evitar text overflow */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ============================================
   3. TIPOGRAFÍA
   ============================================ */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--patriotic-blue);
  margin-bottom: var(--space-3);
}

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

h2 {
  font-size: var(--text-2xl);
  border-bottom: 3px solid var(--patriotic-red);
  padding-bottom: var(--space-2);
  margin-top: var(--space-6);
}

h3 {
  font-size: var(--text-xl);
  color: var(--charcoal);
  margin-top: var(--space-5);
}

h4 {
  font-size: var(--text-lg);
}

h5, h6 {
  font-size: var(--text-base);
}

/* Body text */
p {
  margin-bottom: var(--space-3);
  color: var(--charcoal);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead text (intro paragraphs) */
.lead {
  font-size: var(--text-lg);
  line-height: var(--lh-relaxed);
  color: var(--gray-medium);
  margin-bottom: var(--space-4);
}

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

a:hover {
  color: var(--patriotic-red-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--patriotic-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Listas */
ul, ol {
  margin-bottom: var(--space-3);
  padding-left: var(--space-4);
}

li {
  margin-bottom: var(--space-1);
  line-height: var(--lh-relaxed);
}

/* Strong y enfasis */
strong, b {
  font-weight: var(--fw-bold);
}

em, i {
  font-style: italic;
}

/* Blockquote */
blockquote {
  border-left: 4px solid var(--patriotic-red);
  padding-left: var(--space-3);
  margin: var(--space-4) 0;
  font-style: italic;
  color: var(--gray-medium);
}

/* Code */
code, pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--text-sm);
  background-color: var(--gray-lighter);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.125rem 0.25rem;
}

pre {
  padding: var(--space-2);
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

/* ============================================
   4. LAYOUT Y CONTENEDORES
   ============================================ */

/* Container principal */
.container {
  width: 100%;
  max-width: var(--container-lg);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.container-fluid {
  width: 100%;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

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

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

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

/* Section spacing */
section {
  padding: var(--space-6) 0;
}

.section-alt {
  background-color: var(--sand-light);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

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

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ============================================
   5. HEADER Y NAVEGACIÓN
   ============================================ */

/* Header principal */
.site-header {
  background-color: var(--patriotic-blue);
  color: var(--white);
  padding: var(--space-2) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.site-header.scrolled {
  box-shadow: var(--shadow-lg);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-3);
  max-width: var(--container-xl);
  margin: 0 auto;
}

/* Logo y eslogan */
.logo-eslogan {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.logo-text {
  font-family: var(--font-accent);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--white);
  margin: 0;
  line-height: 1.1;
}

.eslogan {
  font-size: var(--text-sm);
  font-weight: var(--fw-light);
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  line-height: 1;
}

/* Logo container (circular) */
.logo-container {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--white);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.logo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   6. HERO SECTIONS
   ============================================ */

/* Hero principal (homepage) */
.hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--gradient-hero);
  color: var(--white);
  overflow: hidden;
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-overlay);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--container-md);
  padding: var(--space-4);
}

.hero h1 {
  color: var(--white);
  margin-bottom: var(--space-3);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: var(--text-lg);
  margin-bottom: var(--space-5);
  color: rgba(255, 255, 255, 0.95);
  line-height: var(--lh-relaxed);
}

/* Hero pequeño (páginas internas) */
.hero-small {
  min-height: 30vh;
  padding: var(--space-6) 0;
}

.hero-small h1 {
  font-size: var(--text-2xl);
}

/* ============================================
   7. FOOTER
   ============================================ */

.site-footer {
  background-color: var(--charcoal);
  color: var(--white);
  padding: var(--space-6) 0 var(--space-3);
  margin-top: var(--space-8);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.footer-column h3 {
  color: var(--white);
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
  border-bottom: 2px solid var(--patriotic-red);
  padding-bottom: var(--space-1);
}

.footer-column p,
.footer-column a {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
}

.footer-column a:hover {
  color: var(--white);
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: var(--space-2);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   8. UTILIDADES
   ============================================ */

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--patriotic-blue); }
.text-red { color: var(--patriotic-red); }
.text-muted { color: var(--gray-medium); }
.text-white { color: var(--white); }

.font-bold { font-weight: var(--fw-bold); }
.font-medium { font-weight: var(--fw-medium); }
.font-normal { font-weight: var(--fw-regular); }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }

/* Display utilities */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Accessibility */
.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 main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--patriotic-blue);
  color: var(--white);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   9. PRINT STYLES
   ============================================ */

@media print {
  .site-header,
  .site-footer,
  .hero-overlay,
  button,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: black;
  }
}