/**
 * ============================================================
 * SISTEMA DE DISEÑO — PORTAL GOBIERNO DE TAPALPA 2024-2027
 * design-system.css
 * 
 * Contiene: variables CSS, reset, tipografía base, utilidades.
 * Todas las decisiones de color, espacio y tipografía
 * viven aquí para facilitar cambios globales.
 * ============================================================
 */

/* ---------------------------------------------------------- 
   1. FUENTES (autoalojadas vía @import de Google Fonts CDN
      con fallback a pila de sistema — funciona offline también)
   ---------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------------------------------------------------------- 
   2. VARIABLES CSS — DESIGN TOKENS
   ---------------------------------------------------------- */
:root {
  /* --- Paleta institucional --- */
  --c-primary:        #0D2B4E;   /* Azul marino institucional */
  --c-primary-light:  #1A4477;   /* Variante hover */
  --c-primary-ultra:  #0A1F38;   /* Variante dark */

  --c-gold:           #C8960C;   /* Ámbar/dorado — Pueblo Mágico */
  --c-gold-light:     #E8B020;
  --c-gold-dark:      #9A720A;

  --c-green:          #1A6B44;   /* Verde bosque — sierra de Tapalpa */
  --c-green-light:    #22875A;

  --c-surface:        #F7F4EF;   /* Blanco cálido — cantera / piedra */
  --c-surface-2:      #EDE9E1;   /* Superficie secundaria */
  --c-white:          #FFFFFF;

  --c-text:           #1C1E21;   /* Texto principal */
  --c-text-secondary: #4A4F57;   /* Texto secundario */
  --c-text-muted:     #737880;   /* Texto apagado */
  --c-text-inverse:   #FFFFFF;

  --c-border:         #D8D2C8;   /* Bordes suaves */
  --c-border-strong:  #B0A898;

  --c-success:        #1E7A43;
  --c-warning:        #B8650A;
  --c-error:          #C0392B;
  --c-info:           #1565A8;

  /* --- Gradientes --- */
  --gradient-hero:    linear-gradient(135deg, #0D2B4E 0%, #1A4477 50%, #0D2B4E 100%);
  --gradient-gold:    linear-gradient(135deg, #9A720A 0%, #E8B020 100%);
  --gradient-surface: linear-gradient(180deg, #F7F4EF 0%, #EDE9E1 100%);

  /* --- Tipografía --- */
  --font-display:  'Playfair Display', 'Georgia', 'Times New Roman', serif;
  --font-body:     'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:     'SFMono-Regular', 'Cascadia Code', Consolas, monospace;

  /* Escala tipográfica modular — ratio 1.25 (Major Third) */
  --text-xs:   0.64rem;   /* 10.24px */
  --text-sm:   0.8rem;    /* 12.8px  */
  --text-base: 1rem;      /* 16px    */
  --text-md:   1.25rem;   /* 20px    */
  --text-lg:   1.563rem;  /* 25px    */
  --text-xl:   1.953rem;  /* 31.25px */
  --text-2xl:  2.441rem;  /* 39px    */
  --text-3xl:  3.052rem;  /* 48.8px  */
  --text-4xl:  3.815rem;  /* 61px    */

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

  /* Interlineados */
  --lh-tight:  1.2;
  --lh-snug:   1.35;
  --lh-normal: 1.6;
  --lh-relaxed:1.8;

  /* --- Espaciado — escala de 8px --- */
  --space-1:   0.25rem;  /* 4px  */
  --space-2:   0.5rem;   /* 8px  */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;     /* 80px */
  --space-24:  6rem;     /* 96px */
  --space-32:  8rem;     /* 128px*/

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

  --header-top: 10px;
  --header-height:  72px;
  --header-height-scrolled: 60px;

  /* --- Bordes & radios --- */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* --- Sombras --- */
  --shadow-sm:  0 1px 3px rgba(13,43,78,0.08), 0 1px 2px rgba(13,43,78,0.04);
  --shadow-md:  0 4px 12px rgba(13,43,78,0.10), 0 2px 4px rgba(13,43,78,0.06);
  --shadow-lg:  0 10px 28px rgba(13,43,78,0.14), 0 4px 8px rgba(13,43,78,0.08);
  --shadow-xl:  0 20px 48px rgba(13,43,78,0.18), 0 8px 16px rgba(13,43,78,0.10);
  --shadow-gold:0 4px 16px rgba(200,150,12,0.25);
  --shadow-card:0 2px 8px rgba(13,43,78,0.07), 0 0 0 1px rgba(13,43,78,0.04);

  /* --- Transiciones --- */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Z-index --- */
  --z-below:    -1;
  --z-base:      0;
  --z-raised:   10;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-header:   300;
  --z-modal:    400;
  --z-toast:    500;
}

/* Modo oscuro (preparado para futura activación) */
[data-theme="dark"] {
  --c-surface:        #0F1923;
  --c-surface-2:      #162030;
  --c-text:           #E8E4DC;
  --c-text-secondary: #A8A4A0;
  --c-border:         #2A3344;
  --c-border-strong:  #3A4456;
  --c-white:          #1A2535;
}

/* ---------------------------------------------------------- 
   3. RESET MODERNO
   ---------------------------------------------------------- */
*, *::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: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background-color: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Listas */
ul, ol { list-style: none; }

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

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

/* Tipografía por defecto de headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--c-primary);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
  max-width: 75ch;
}

a {
  color: var(--c-primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--c-gold); }
a:focus-visible {
  outline: 3px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button {
  cursor: pointer;
  border: none;
  background: none;
}
button:focus-visible {
  outline: 3px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Texto oculto para accesibilidad */
.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 */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--c-gold);
  color: var(--c-primary);
  font-weight: var(--fw-bold);
  padding: var(--space-3) var(--space-6);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: 0;
  outline: none;
}

/* ---------------------------------------------------------- 
   4. TIPOGRAFÍA — CLASES UTILITARIAS
   ---------------------------------------------------------- */
.text-display  { font-family: var(--font-display); }
.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-base     { font-size: var(--text-base); }
.text-md       { font-size: var(--text-md); }
.text-lg       { font-size: var(--text-lg); }
.text-xl       { font-size: var(--text-xl); }
.text-2xl      { font-size: var(--text-2xl); }
.text-3xl      { font-size: var(--text-3xl); }
.text-4xl      { font-size: var(--text-4xl); }

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

.text-primary   { color: var(--c-primary); }
.text-gold      { color: var(--c-gold); }
.text-secondary { color: var(--c-text-secondary); }
.text-muted     { color: var(--c-text-muted); }
.text-inverse   { color: var(--c-text-inverse); }
.text-center    { text-align: center; }
.text-left      { text-align: left; }
.text-right     { text-align: right; }

.uppercase      { text-transform: uppercase; letter-spacing: 0.1em; }
.tracking-wide  { letter-spacing: 0.05em; }

/* ---------------------------------------------------------- 
   5. ESPACIADO — CLASES UTILITARIAS
   ---------------------------------------------------------- */
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

/* ---------------------------------------------------------- 
   6. DISPLAY — CLASES UTILITARIAS
   ---------------------------------------------------------- */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-center     { justify-content: center; }
.justify-between    { justify-content: space-between; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.hidden { display: none; }
