/*
 * Design System — CSMC Cauquenes
 * Generado con ui-ux-pro-max (estilo "Accessible & Ethical", WCAG AAA)
 * Paleta institucional: azul Servicio de Salud Maule + rojo bandera + neutros.
 */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
  /* Color — tokens semánticos (identidad Servicio de Salud Maule / CSMC) */
  --color-primary:      #0A5BA8;  /* azul institucional SSM */
  --color-primary-600:  #084A8A;  /* azul oscuro (hover/activo) */
  --color-primary-700:  #063868;  /* azul profundo (sidebar) */
  --color-on-primary:   #FFFFFF;
  --color-secondary:    #2C7BC9;  /* azul claro */
  --color-accent:       #D52B1E;  /* rojo institucional (bandera) */
  --color-accent-600:   #B21F16;  /* rojo oscuro */
  --color-background:   #F4F7FB;  /* gris-azulado muy claro */
  --color-surface:      #FFFFFF;
  --color-foreground:   #1B2A44;  /* azul-gris oscuro para texto */
  --color-muted:        #EAF1F8;
  --color-muted-fg:     #5A6B82;
  --color-border:       #D3E0EF;
  --color-destructive:  #C0261B;
  --color-ring:         #0A5BA8;

  /* Tipografía */
  --font-display: 'Lexend', system-ui, sans-serif;
  --font-body:    'Source Sans 3', system-ui, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;      /* 16px mínimo — accesibilidad */
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-loose:  1.75;

  /* Espaciado — escala de 4 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radios y sombras */
  --radius-sm:   0.375rem;
  --radius:      0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;

  --shadow-sm: 0 1px 2px rgba(22, 78, 99, .06);
  --shadow:    0 4px 12px rgba(22, 78, 99, .08);
  --shadow-lg: 0 12px 32px rgba(22, 78, 99, .12);

  /* Layout */
  --touch-target: 44px;   /* mínimo accesible */
  --focus-ring: 3px;
  --transition: 200ms cubic-bezier(.4, 0, .2, 1);
}

/* Reset accesible */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-foreground);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
}

/* Reduced motion respetado */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Focus visible — 3-4px según guía */
:focus-visible {
  outline: var(--focus-ring) solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Tipografía global */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--color-foreground);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-4);
  font-weight: 600;
}
h1 { font-size: var(--text-4xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }

p { margin: 0 0 var(--space-4); }
a {
  color: var(--color-primary-600);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { color: var(--color-accent); }

/* Skip link accesible */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-foreground);
  color: var(--color-on-primary);
  padding: var(--space-3) var(--space-4);
  z-index: 100;
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }
