/* 24-7 General Solutions — design system.
   Source of truth: diseno.md (sections 2–9). Retune tokens here.

   The app was originally built on the "Industry" token names
   (--color-accent, --color-neutral-*, …). Those names are kept alive as
   aliases at the end of :root and remapped onto the brand palette, so any
   markup that still references them renders in brand colors instead of the
   old grey/blue scheme. styles-industry.css is left on disk for reference
   but is no longer loaded. */

:root {
  /* ── Marca (diseno.md §3) ─────────────────────────────────────────────── */
  --ink: #10242E;
  --mainline: #0C5F8A;
  --mainline-deep: #0A5178;
  --spray: #7FC8E8;
  --turf: #1F7A38;
  --clay: #B4551F;
  --clay-deep: #9C4413;

  /* ── Neutros y superficies ───────────────────────────────────────────── */
  --frost: #EFF5F8;
  --body-text: #3D5866;
  --muted: #6B8494;
  --line: #DCE6EC;
  --line-strong: #C2D2DB;
  --surface: #FFFFFF;

  /* ── Tipografía ──────────────────────────────────────────────────────── */
  --font-display: 'Bricolage Grotesque', 'Avenir Next', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ── Radios ──────────────────────────────────────────────────────────── */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --container: 1140px;
  --shadow-card: 0 1px 2px rgba(16, 36, 46, 0.05), 0 10px 28px rgba(16, 36, 46, 0.08);
  --shadow-float: 0 18px 48px rgba(16, 36, 46, 0.22);

  /* Escala de espaciado del sistema (múltiplos de 4). */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* ── Aliases de compatibilidad ───────────────────────────────────────── */
  --color-bg: #FFFFFF;
  --color-surface: var(--frost);
  --color-text: var(--ink);
  --color-accent: var(--mainline);
  --color-accent-2: var(--spray);
  --color-divider: var(--line);

  /* Neutros: los pasos 500–700 se usan como texto chico, así que están
     calibrados para pasar AA sobre blanco (--muted queda solo para ≥18px). */
  --color-neutral-100: #F6FAFC;
  --color-neutral-200: #EAF1F5;
  --color-neutral-300: var(--line);
  --color-neutral-400: var(--line-strong);
  --color-neutral-500: #5C7787;   /* 4.6:1 */
  --color-neutral-600: var(--body-text);   /* 7.5:1 */
  --color-neutral-700: #2E4653;
  --color-neutral-800: #1F343F;
  --color-neutral-900: var(--ink);

  --color-accent-100: #E7F2F8;
  --color-accent-200: #D2E6F1;
  --color-accent-300: #A9CFE3;
  --color-accent-400: #7FB4D0;
  --color-accent-500: #4E90B6;
  --color-accent-600: var(--mainline);
  --color-accent-700: var(--mainline-deep);
  --color-accent-800: #0A415F;
  --color-accent-900: var(--ink);

  --color-accent-2-100: #E7F2F8;
  --color-accent-2-200: #D2E6F1;
  --color-accent-2-700: var(--mainline-deep);
  --color-accent-2-800: #0A415F;
  --color-accent-2-900: var(--ink);

  --font-heading: var(--font-display);
  --font-heading-weight: 600;
  --shadow-sm: 0 1px 2px rgba(16, 36, 46, 0.06);
  --shadow-md: var(--shadow-card);
  --shadow-lg: var(--shadow-float);
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--body-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
h2 { font-size: clamp(1.55rem, 3.6vw, 2rem); font-weight: 600; }
h3 { font-size: clamp(1.25rem, 2.6vw, 1.5rem); font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }
h6 {
  font-family: var(--font-mono);
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}

p { margin: 0 0 var(--space-3); }
a { color: var(--mainline); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption { font-size: 0.75rem; margin-top: var(--space-1); color: var(--body-text); }

/* Etiqueta monoespaciada — la firma visual del sistema (§4).
   Señalética, nunca texto corrido. */
.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
}
.text-muted { color: var(--body-text); }

/* ── Accesibilidad (§9) ─────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--mainline);
  outline-offset: 2px;
  border-radius: 2px;
}
::selection { background: rgba(127, 200, 232, 0.45); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: 12px; z-index: 999;
  background: var(--mainline); color: #fff;
  padding: 12px 18px; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ══ Reglas ═════════════════════════════════════════════════════════════ */
.hr { height: 1px; border: 0; margin: var(--space-4) 0; background: var(--line); }

/* ══ Botones (§6) ═══════════════════════════════════════════════════════
   Objetivo táctil accesible: 48px de alto. Borde de 1.5px siempre presente
   (transparente en el primario) para que outline y primario no salten. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-body); font-weight: 600;
  font-size: 0.95rem; line-height: 1.2;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid transparent; border-radius: 8px;
  padding: 12px 20px; min-height: 48px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--mainline); color: #fff; }
.btn-primary:hover { background: var(--mainline-deep); }
.btn-primary:active { background: var(--mainline-deep); }

.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--mainline); color: var(--mainline); }
.btn-secondary:active { background: var(--frost); }

.btn-ghost { color: var(--mainline); padding-inline: 10px; }
.btn-ghost:hover { background: var(--color-accent-100); }

.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover { background: var(--clay-deep); }

.btn-icon { width: 48px; padding: 0; }
.btn-block { width: 100%; }
/* Compacto — sigue respetando el mínimo táctil de 44px (§9.2). */
.btn-sm { min-height: 44px; padding: 10px 16px; font-size: 0.875rem; }

/* ══ Formularios (§6) ═══════════════════════════════════════════════════ */
.field > label {
  display: block;
  font-size: 0.8125rem; font-weight: 500;
  margin-bottom: 6px;
  color: var(--body-text);
}
.input {
  width: 100%; min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;  /* 16px — evita el zoom automático de iOS al enfocar */
  color: var(--ink); caret-color: var(--mainline);
  background: #FDFEFE;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--muted); }
.input:focus-visible {
  outline: none;
  border-color: var(--mainline);
  box-shadow: 0 0 0 3px rgba(12, 95, 138, 0.18);
}
.input[aria-invalid="true"] {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(180, 85, 31, 0.14);
}
textarea.input { min-height: 96px; resize: vertical; }

.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9375rem; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
}
.radio:hover .dot { border-color: var(--mainline); }
.radio input:checked + .dot {
  border-color: var(--mainline); background: var(--mainline);
  box-shadow: inset 0 0 0 4px #fff;
}
.radio input:focus-visible + .dot { outline: 3px solid var(--mainline); outline-offset: 2px; }

/* Control segmentado (filtros de la lista). */
.seg {
  display: inline-flex; overflow: hidden;
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 3px;
}
.seg-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; min-height: 40px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--body-text); cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.seg-opt:has(input:checked) { background: var(--mainline); color: #fff; }
.seg-opt:not(:has(input:checked)):hover { background: var(--frost); }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--mainline); outline-offset: -3px; }

/* ══ Tarjetas (§6) ══════════════════════════════════════════════════════ */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.card-kicker {
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--mainline);
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; line-height: 1.2; color: var(--ink); }
.card-body { margin: 0; font-size: 0.875rem; color: var(--body-text); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--color-neutral-500); }
.card.is-lead { border-top: 4px solid var(--clay); }

.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-card); }
.elev-lg { box-shadow: var(--shadow-float); }

/* ══ Tags / píldoras ════════════════════════════════════════════════════
   El color nunca comunica solo: cada tag lleva su texto (§6). */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 11px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.tag-accent { background: var(--color-accent-100); color: var(--mainline-deep); border-color: rgba(127, 200, 232, 0.65); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--mainline-deep); }
.tag-neutral { background: var(--frost); color: var(--color-neutral-700); border-color: var(--line); }
.tag-outline { background: #fff; border-color: var(--turf); color: var(--turf); }

/* Etiqueta de zona (§6) — píldora monoespaciada que abre una sección. */
.zone-tag {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 14px;
  border: 1px solid rgba(127, 200, 232, 0.65);
  border-radius: var(--r-pill); background: #fff;
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mainline);
}

/* ══ Navegación ═════════════════════════════════════════════════════════ */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.nav-brand { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; margin-right: auto; }
.nav a { color: inherit; text-decoration: none; font-size: 0.9375rem; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--mainline); }

/* ══ Tablas ═════════════════════════════════════════════════════════════ */
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th {
  text-align: left;
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--body-text);
  padding: 8px 6px;
  border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--ink); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ══ Diálogos ═══════════════════════════════════════════════════════════ */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: rgba(16, 36, 46, 0.5);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-6);
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
}
.dialog-title { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--ink); }
.dialog-body { font-size: 0.9375rem; color: var(--body-text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ══ Movimiento (§8) ════════════════════════════════════════════════════
   Todo el movimiento vive dentro de este bloque. Si una animación queda
   afuera, el sistema deja de ser usable para personas con trastornos
   vestibulares. */
@media (prefers-reduced-motion: no-preference) {
  .card:hover, .est-card:hover { transform: translateY(-3px); }
  .card, .est-card { transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; }
  .sheet { animation: sheet-in 0.28s ease; }
  .toast { animation: toast-in 0.22s ease; }
  @keyframes sheet-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
}
