/* =====================================================================
   LIDABI — Design tokens  (diseno/tokens.css)
   Concepto: "Costura térmica" — frío (hielo) y calor (fuego) unidos por
   una costura degradada, sobre grafito profundo, con secciones "Frost" claras.

   Importar ANTES de cualquier otro CSS:
     <link rel="stylesheet" href="assets/css/tokens.css">
   Fuentes (en <head>, antes del CSS):
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@112..125,600..800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap">

   Contrastes verificados WCAG 2.1 (tabla en DESIGN.md §6).
   ===================================================================== */

:root {
  color-scheme: dark;

  /* ---------- 1. Paleta base (los componentes usan los ROLES de §2) ---------- */
  --graphite-950: #070A0E;
  --graphite-900: #0A0E13;   /* fondo oscuro principal */
  --graphite-850: #111821;   /* superficie elevada */
  --graphite-800: #18212C;   /* superficie 2 / hover */
  --graphite-700: #232F3D;   /* bordes fuertes */
  --graphite-600: #2A3644;   /* bordes sutiles (decorativos) */
  --steel-400:    #8597AB;   /* texto terciario en oscuro (6.62:1 sobre bg-deep; >=4.9:1 sobre resplandores y superficie) */
  --steel-300:    #9FB0C3;   /* texto secundario en oscuro (8.73:1) */
  --frost-50:     #FFFFFF;
  --frost-100:    #F4F7FA;   /* fondo de sección clara */
  --frost-200:    #E6ECF2;   /* superficie en claro */
  --frost-300:    #C9D3DE;   /* bordes decorativos en claro */
  --ink-900:      #0E1620;   /* texto en claro (16.92:1) */
  --ink-600:      #4A5A6B;   /* texto secundario en claro (6.59:1) */

  --ice-300:  #7CC4FF;       /* hielo: acento/texto en oscuro (10.32:1) */
  --ice-400:  #5FA8E8;
  --ice-500:  #2E7BC4;       /* azul del copo del logo (solo relleno/decoración) */
  --ice-700:  #1C5E9E;       /* hielo para texto en claro (6.21:1) */
  --fire-400: #FF8A45;       /* hover del CTA primario */
  --fire-500: #FF7A2F;       /* llama del logo: CTA primario */
  --fire-700: #B5470C;       /* fuego para texto en claro (5.05:1) */
  --brass-400:#E0A458;       /* oro del wordmark: detalles mínimos */

  --success-400: #3DDC97;
  --success-700: #157F4F;
  --danger-400:  #FF6B6B;
  --danger-700:  #B42318;

  /* ---------- 2. Roles semánticos (oscuro = por defecto) ---------- */
  --bg:            var(--graphite-900);
  --bg-deep:       var(--graphite-950);
  --surface:       var(--graphite-850);
  --surface-2:     var(--graphite-800);
  --border:        var(--graphite-600);
  --border-strong: var(--graphite-700);
  --text:          #EAF1F8;          /* 16.99:1 */
  --text-muted:    var(--steel-300);
  --text-subtle:   var(--steel-400);
  --accent-cold:   var(--ice-300);
  --accent-hot:    var(--fire-500);
  --accent-detail: var(--brass-400);
  --link:          var(--ice-300);
  --focus-ring:    var(--ice-300);

  --cta-bg:        var(--fire-500);
  --cta-bg-hover:  var(--fire-400);
  --cta-text:      var(--graphite-900);   /* 7.44:1 sobre fuego */
  --cta2-border:   rgba(124, 196, 255, .55);
  --cta2-text:     var(--ice-300);
  --cta2-bg-hover: rgba(124, 196, 255, .10);

  --field-bg:      var(--graphite-950);
  --field-border:  var(--steel-400);      /* 3:1+ contra el fondo (componente UI) */
  --error:         var(--danger-400);
  --ok:            var(--success-400);

  /* ---------- 3. Firmas visuales ---------- */
  --seam:   linear-gradient(90deg, var(--ice-500) 0%, var(--ice-300) 38%, var(--brass-400) 62%, var(--fire-500) 100%);
  --seam-v: linear-gradient(180deg, var(--ice-300) 0%, var(--brass-400) 55%, var(--fire-500) 100%);
  --wordmark: linear-gradient(180deg, var(--brass-400) 0%, #C9A060 35%, var(--ice-500) 85%);
  --glow-cold: radial-gradient(60% 60% at 12% 18%, rgba(46, 123, 196, .28) 0%, transparent 70%);
  --glow-hot:  radial-gradient(55% 55% at 92% 88%, rgba(255, 122, 47, .18) 0%, transparent 70%);
  --photo-scrim: linear-gradient(180deg, rgba(7, 10, 14, 0) 40%, rgba(7, 10, 14, .85) 100%);
  --photo-grade: saturate(.9) contrast(1.06);   /* filter para unificar fotos de celular */
  --grain-opacity: .05;

  /* ---------- 4. Tipografía ---------- */
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --display-stretch: 118%;   /* font-stretch de Archivo: ancho, eco del wordmark */
  --weight-display: 750;
  --weight-heading: 700;
  --weight-body: 400;
  --weight-medium: 500;
  --weight-strong: 600;

  /* Escala fluida 360px -> 1440px */
  --step--1: clamp(0.8125rem, 0.79rem + 0.10vw, 0.875rem);  /* 13-14  labels mono, legal */
  --step-0:  clamp(1rem,      0.97rem + 0.14vw, 1.0625rem); /* 16-17  cuerpo */
  --step-1:  clamp(1.125rem,  1.07rem + 0.28vw, 1.3125rem); /* 18-21  lead, botones */
  --step-2:  clamp(1.3125rem, 1.20rem + 0.52vw, 1.6875rem); /* 21-27  h3 */
  --step-3:  clamp(1.625rem,  1.42rem + 0.93vw, 2.25rem);   /* 26-36  h2 secundario */
  --step-4:  clamp(2rem,      1.63rem + 1.67vw, 3.125rem);  /* 32-50  h2 */
  --step-5:  clamp(2.375rem,  1.75rem + 2.78vw, 4.25rem);   /* 38-68  h1 */

  --lh-tight: 1.04;
  --lh-snug:  1.2;
  --lh-body:  1.6;
  --tracking-display: -0.02em;
  --tracking-label:    0.14em;
  --measure: 62ch;

  /* ---------- 5. Espaciado (base 4px) ---------- */
  --space-1: 0.25rem;  /* 4   */
  --space-2: 0.5rem;   /* 8   */
  --space-3: 0.75rem;  /* 12  */
  --space-4: 1rem;     /* 16  */
  --space-5: 1.5rem;   /* 24  */
  --space-6: 2rem;     /* 32  */
  --space-7: 3rem;     /* 48  */
  --space-8: 4rem;     /* 64  */
  --space-9: 6rem;     /* 96  */
  --space-10: 8rem;    /* 128 */
  --section-y: clamp(4rem, 2.9rem + 4.9vw, 7.5rem);   /* 64 -> 120 */
  --gutter:    clamp(1rem, 0.6rem + 1.8vw, 2rem);      /* 16 -> 32 */
  --container: 1200px;
  --container-narrow: 760px;

  /* ---------- 6. Radios ---------- */
  --radius-xs: 4px;     /* chips mono, badges */
  --radius-sm: 8px;     /* campos */
  --radius-md: 12px;    /* botones */
  --radius-lg: 20px;    /* tarjetas, fotos */
  --radius-xl: 28px;    /* paneles, marco del hero */
  --radius-pill: 999px; /* selector de idioma, chips de zona */

  /* ---------- 7. Sombras / elevación ---------- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .40), 0 1px 1px rgba(0, 0, 0, .25);
  --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .30);
  --shadow-3: 0 24px 60px -20px rgba(0, 0, 0, .70), 0 8px 20px -10px rgba(0, 0, 0, .45);
  --shadow-cta:  0 10px 30px -10px rgba(255, 122, 47, .65);
  --shadow-cold: 0 10px 30px -12px rgba(46, 123, 196, .55);
  --inner-hairline: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-light-1: 0 1px 2px rgba(14, 22, 32, .06), 0 4px 12px -4px rgba(14, 22, 32, .10);
  --shadow-light-2: 0 18px 40px -18px rgba(14, 22, 32, .28);

  /* ---------- 8. Movimiento ---------- */
  --ease-out:   cubic-bezier(.22, 1, .36, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);
  --dur-1: 120ms;   /* hover, color */
  --dur-2: 220ms;   /* acordeón, botones, barra móvil */
  --dur-3: 420ms;   /* lightbox, menú */
  --dur-4: 700ms;   /* reveals al hacer scroll */
  --reveal-distance: 16px;
  --stagger: 70ms;

  /* ---------- 9. Capas ---------- */
  --z-base: 1;
  --z-sticky: 50;   /* nav */
  --z-bar: 60;      /* barra inferior móvil */
  --z-menu: 80;     /* menú móvil */
  --z-modal: 100;   /* lightbox */

  /* ---------- 10. Medidas de componentes ---------- */
  --nav-h: 64px;
  --bar-h: 64px;     /* barra inferior móvil (+ env(safe-area-inset-bottom)) */
  --tap-min: 48px;
  --btn-h: 52px;
  --btn-h-sm: 44px;
  --icon-sm: 18px;
  --icon-md: 24px;
  --icon-lg: 40px;
  --hairline: 1px solid var(--border);
}

/* ---------- Secciones claras: class="theme-frost" en la <section> ---------- */
.theme-frost {
  color-scheme: light;
  --bg:            var(--frost-100);
  --surface:       var(--frost-50);
  --surface-2:     var(--frost-200);
  --border:        var(--frost-300);
  --border-strong: #AFBCCB;
  --text:          var(--ink-900);
  --text-muted:    var(--ink-600);
  --text-subtle:   var(--ink-600);
  --accent-cold:   var(--ice-700);
  --accent-hot:    var(--fire-700);
  --link:          var(--ice-700);
  --focus-ring:    var(--ice-700);
  --cta2-border:   var(--ice-700);
  --cta2-text:     var(--ice-700);
  --cta2-bg-hover: rgba(28, 94, 158, .08);
  --field-bg:      var(--frost-50);
  --field-border:  #7A8A9B;          /* 3.54:1 contra blanco (componente UI, WCAG 1.4.11) */
  --error:         var(--danger-700);
  --ok:            var(--success-700);
  --grain-opacity: 0;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 0ms;
    --dur-2: 0ms;
    --dur-3: 0ms;
    --dur-4: 0ms;
    --reveal-distance: 0px;
    --stagger: 0ms;
  }
}
