/* ============================================================
   VIVIR+ — Design System
   Proyecto: Web institucional para municipios
   Tono: Científico, humano, esperanzador, institucional
   ============================================================ */

/* Google Fonts — cargadas vía <link> en el HTML, NO usar @import aquí
   porque @import bloquea todo el CSS si Google Fonts es lento/bloqueado */

/* ============================================================
   1. VARIABLES CSS
   ============================================================ */

:root {

  /* — Colores base — */
  --color-bg:          #F5F7FA;
  --color-bg-surface:  #ECEEF3;
  --color-bg-card:     #FFFFFF;

  /* — Acentos — */
  --color-accent-primary:   #3B82F6;
  --color-accent-secondary: #1B2A47;
  --color-accent-light:     #EBF2FF;
  --color-accent-mid:       #2563EB;

  /* — Texto — */
  --color-text-primary: #1B2A47;
  --color-text-muted:   #6B7A99;
  --color-text-faint:   #A8B4CC;
  --color-text-invert:  #FFFFFF;

  /* — Sombras (azul muy desaturado) — */
  --shadow-xs:  0 1px 3px rgba(27, 42, 71, 0.06);
  --shadow-sm:  0 2px 8px rgba(27, 42, 71, 0.08);
  --shadow-md:  0 4px 16px rgba(27, 42, 71, 0.10);
  --shadow-lg:  0 8px 32px rgba(27, 42, 71, 0.12);
  --shadow-xl:  0 16px 48px rgba(27, 42, 71, 0.14);
  --shadow-accent: 0 4px 20px rgba(59, 130, 246, 0.25);

  /* — Tipografía — */
  --font-heading: 'Montserrat', sans-serif;
  --font-body:    'Inter', sans-serif;

  /* — Escala tipográfica — */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */

  /* — Espaciado — */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* — Radios — */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* — Transiciones — */
  --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* — Z-index — */
  --z-base:    1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    300;
  --z-toast:    400;

  /* — Breakpoints (documentados como referencia) —
     sm:  640px   → Móvil grande / landscape
     md:  768px   → Tablet portrait
     lg:  1024px  → Tablet landscape / desktop pequeño
     xl:  1280px  → Desktop estándar
     2xl: 1536px  → Desktop grande
  */
}

/* ============================================================
   2. RESET Y BASE
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 { font-size: var(--text-3xl); font-weight: 800; line-height: 1.1; }
h2 { font-size: var(--text-2xl); font-weight: 700; }
h3 { font-size: var(--text-xl);  font-weight: 600; }
h4 { font-size: var(--text-lg);  font-weight: 600; }

p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  max-width: 68ch;
}

p.lead { font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.7; }

a {
  color: var(--color-accent-primary);
  text-decoration: none;
  transition: var(--transition-base);
}
a:hover { color: var(--color-accent-mid); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

strong { font-weight: 600; }

::selection { background-color: var(--color-accent-light); color: var(--color-accent-secondary); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-text-faint); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

@media (min-width: 1024px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }
  p.lead { font-size: var(--text-xl); }
}

/* ============================================================
   3. COMPONENTES REUTILIZABLES
   ============================================================ */

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm); padding: 12px var(--space-lg);
  font-family: var(--font-heading); font-size: var(--text-sm);
  font-weight: 600; letter-spacing: 0.02em;
  border-radius: var(--radius-md); border: 2px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: var(--transition-bounce);
  white-space: nowrap; user-select: none;
}

.btn-primary {
  background-color: var(--color-accent-primary);
  color: var(--color-text-invert);
  border-color: var(--color-accent-primary);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background-color: var(--color-accent-mid); border-color: var(--color-accent-mid);
  box-shadow: 0 6px 24px rgba(59,130,246,0.35); transform: translateY(-1px);
  color: var(--color-text-invert); text-decoration: none;
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary:focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 3px; }

.btn-secondary {
  background-color: transparent;
  color: var(--color-accent-secondary);
  border-color: var(--color-accent-secondary);
}
.btn-secondary:hover {
  background-color: var(--color-accent-secondary); color: var(--color-text-invert);
  transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none;
}
.btn-secondary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-secondary:focus-visible { outline: 2px solid var(--color-accent-secondary); outline-offset: 3px; }

.btn-sm { padding: 8px var(--space-md); font-size: var(--text-xs); }
.btn-lg { padding: 16px var(--space-xl); font-size: var(--text-base); }

.badge {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px 10px; font-family: var(--font-heading); font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: var(--radius-full);
  background-color: var(--color-accent-light); color: var(--color-accent-primary);
  border: 1px solid rgba(59,130,246,0.2);
}
.badge-secondary { background-color: var(--color-bg-surface); color: var(--color-text-muted); border-color: transparent; }
.badge-success { background-color: #ECFDF5; color: #059669; border-color: rgba(5,150,105,0.2); }

.card {
  background-color: var(--color-bg-card); border-radius: var(--radius-lg);
  border: 1px solid rgba(27,42,71,0.07); box-shadow: var(--shadow-sm);
  padding: var(--space-lg); transition: var(--transition-base); position: relative; overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: rgba(59,130,246,0.15); }
.card-flat { box-shadow: none; border: 1px solid rgba(27,42,71,0.10); }
.card-flat:hover { box-shadow: var(--shadow-md); }

.section-label {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-heading); font-size: var(--text-xs);
  font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-accent-primary);
}
.section-label::before {
  content: ''; display: block; width: 20px; height: 2px;
  background-color: var(--color-accent-primary); border-radius: var(--radius-full); flex-shrink: 0;
}

.stat-number {
  font-family: var(--font-heading); font-size: var(--text-4xl);
  font-weight: 800; line-height: 1; letter-spacing: -0.03em;
  color: var(--color-accent-secondary); display: block;
}
.stat-number span.stat-unit { font-size: var(--text-2xl); font-weight: 700; color: var(--color-accent-primary); }
@media (min-width: 1024px) { .stat-number { font-size: var(--text-5xl); } }

.divider {
  width: 100%; height: 1px; border: none; margin: var(--space-lg) 0;
  background: linear-gradient(90deg, transparent, rgba(27,42,71,0.12) 20%, rgba(27,42,71,0.12) 80%, transparent);
}
.divider-accent { height: 2px; background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary)); opacity: 0.6; }

/* ============================================================
   4. LAYOUT
   ============================================================ */

.container {
  width: 100%; max-width: 1200px;
  margin-left: auto; margin-right: auto;
  padding-left: var(--space-md); padding-right: var(--space-md);
}
@media (min-width: 640px) { .container { padding-left: var(--space-lg); padding-right: var(--space-lg); } }
@media (min-width: 1024px) { .container { padding-left: var(--space-xl); padding-right: var(--space-xl); } }

.section { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
@media (min-width: 1024px) { .section { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); } }
.section-sm { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--space-lg); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start   { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-md); }
.flex-col     { display: flex; flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.gap-sm { gap: var(--space-sm); } .gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); } .gap-xl { gap: var(--space-xl); }

/* ============================================================
   5. ANIMACIONES DE ENTRADA
   Activar con clase "is-visible" via IntersectionObserver
   ============================================================ */

@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft  { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px);  } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

/* Animaciones desactivadas — causaban página invisible en algunos equipos */

/* ============================================================
   6. UTILIDADES
   ============================================================ */

.text-center { text-align: center; } .text-left { text-align: left; } .text-right { text-align: right; }
.text-muted  { color: var(--color-text-muted); }  .text-faint  { color: var(--color-text-faint); }
.text-accent { color: var(--color-accent-primary); } .text-dark { color: var(--color-accent-secondary); }
.text-white  { color: var(--color-text-invert); }
.text-sm   { font-size: var(--text-sm); }   .text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }   .text-xl   { font-size: var(--text-xl); }
.font-heading { font-family: var(--font-heading); } .font-body { font-family: var(--font-body); }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-medium { font-weight: 500; }

.mt-xs { margin-top: var(--space-xs); } .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-xs { margin-bottom: var(--space-xs); } .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); }

.p-sm { padding: var(--space-sm); } .p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); } .p-xl { padding: var(--space-xl); }

.hidden-mobile { display: none; }
.hidden-desktop { display: block; }
@media (min-width: 768px) { .hidden-mobile { display: block; } .hidden-desktop { display: none; } }
.hidden-mobile-flex { display: none; }
@media (min-width: 768px) { .hidden-mobile-flex { display: flex; } }

.overflow-hidden { overflow: hidden; } .overflow-auto { overflow: auto; }
.w-full { width: 100%; } .h-full { height: 100%; } .min-h-screen { min-height: 100vh; }
.relative { position: relative; } .absolute { position: absolute; } .sticky { position: sticky; }
.cursor-pointer { cursor: pointer; }
.opacity-0 { opacity: 0; } .opacity-50 { opacity: 0.5; } .opacity-75 { opacity: 0.75; } .opacity-100 { opacity: 1; }
.prose { max-width: 68ch; }
.prose-center { max-width: 60ch; margin-left: auto; margin-right: auto; }

/* ============================================================
   7. HELPERS ESTRUCTURALES
   ============================================================ */

.bg-dark { background-color: var(--color-accent-secondary); color: var(--color-text-invert); }
.bg-dark p, .bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4 { color: var(--color-text-invert); }
.bg-dark .text-muted { color: rgba(255,255,255,0.65); }
.bg-accent-light { background-color: var(--color-accent-light); }
.bg-surface { background-color: var(--color-bg-surface); }
.border-accent { border-left: 3px solid var(--color-accent-primary); padding-left: var(--space-md); }

.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: var(--radius-full);
  background-color: var(--color-accent-light); color: var(--color-accent-primary); flex-shrink: 0;
}
.icon-circle-lg { width: 64px; height: 64px; }

.section-divider {
  width: 48px; height: 3px; border-radius: var(--radius-full); margin: var(--space-md) 0;
  background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary));
}
.section-divider-center { margin-left: auto; margin-right: auto; }

/* ============================================================
   FIN DEL SISTEMA DE DISEÑO — VIVIR+
   Versión 1.0 | 29/03/2026
   ============================================================ */
