/* Cúcuta IA — estilos. Tokens de marca en assets/brand.css (con fallbacks aquí). */

:root {
  color-scheme: light dark;
  --red: var(--brand-red, #8E1B22);
  --red-bright: var(--brand-red-bright, #D4202C);
  --ink: var(--brand-ink, #1E2126);
  --steel: var(--brand-steel, #6B747C);
  --bg: var(--brand-bg, #F3F4F8);
  --surface: var(--brand-surface, #FFFFFF);

  --accent: var(--red);
  --text: var(--ink);
  --muted: #555D65;           /* acero oscurecido: contraste AA sobre fondo claro */
  --border: rgba(30, 33, 38, 0.12);
  --surface-2: #ECEEF3;
  --focus: var(--red-bright);
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.06), 0 6px 24px rgba(16, 18, 22, 0.06);

  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: var(--brand-ink, #E8EAED);
    --bg: var(--brand-bg, #111317);
    --surface: var(--brand-surface, #1A1D22);
    --steel: var(--brand-steel, #9AA3AB);
    --accent: var(--red-bright);
    --muted: #A7AFB7;
    --border: rgba(255, 255, 255, 0.1);
    --surface-2: #23272D;
    --focus: #FF6B73;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(0, 0, 0, 0.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
small, .small { font-size: 0.875rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 24px; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand-name { font-weight: 600; letter-spacing: 0.06em; font-size: 1.05rem; }
.brand-name strong { color: var(--accent); font-weight: 800; }

.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0; padding: 0; }
.site-nav a, .nav-soon {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; font-size: 0.925rem;
  color: var(--text); text-decoration: none;
}
.site-nav a:hover { background: var(--surface-2); }
.nav-soon { color: var(--muted); cursor: default; }
.pill {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  color: var(--accent); border: 1px solid currentColor;
}
@media (max-width: 520px) {
  .site-nav a, .nav-soon { padding: 4px 6px; font-size: 0.85rem; }
  .nav-soon .pill { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 40px 0 28px;
  background:
    radial-gradient(1200px 300px at 10% -10%, color-mix(in srgb, var(--red-bright) 14%, transparent), transparent 70%),
    radial-gradient(800px 260px at 100% 0%, color-mix(in srgb, var(--steel) 18%, transparent), transparent 70%),
    var(--bg);
}
.hero::after { /* rejilla sutil "tecnológica" */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 85%);
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.14; pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 800; }
.lead { margin: 10px 0 20px; max-width: 60ch; color: var(--muted); font-size: 1.05rem; }

.ask {
  display: flex; align-items: center; gap: 8px;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--red-bright) 10%, transparent);
}
.ask:focus-within { border-color: var(--accent); }
.ask-icon { color: var(--accent); display: inline-flex; flex: none; }
.ask input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 1rem; padding: 10px 4px;
}
.ask input:focus { outline: none; }
.ask:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.ask input::placeholder { color: var(--muted); opacity: 1; }
@media (max-width: 480px) {
  .ask { border-radius: var(--radius); flex-wrap: wrap; padding: 8px; }
  .ask input { flex-basis: calc(100% - 40px); }
  .ask .btn { width: 100%; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  border-radius: 999px; padding: 10px 18px; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-bright); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); padding: 6px 12px; font-size: 0.85rem; }
.btn-ghost:hover { background: var(--surface-2); }

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-width: 760px; }
.chip {
  font: inherit; font-size: 0.85rem; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.answer {
  display: flex; gap: 12px; align-items: flex-start;
  max-width: 760px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow);
}
.answer p { margin: 0; }
.answer-badge {
  flex: none; font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  color: #fff; background: var(--red); border-radius: 6px; padding: 2px 6px; margin-top: 2px;
}
.answer.is-busy #ask-answer-text::after {
  content: "▍"; margin-left: 2px; animation: blink 1s steps(2) infinite; color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .answer.is-busy #ask-answer-text::after { animation: none; } }

/* ---------- Secciones ---------- */
.section { padding-top: 28px; padding-bottom: 8px; scroll-margin-top: 72px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.section-head h2 { font-size: 1.35rem; }
.section-head p { margin: 0; font-size: 0.9rem; }

/* ---------- Tarjetas ---------- */
.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 420px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
  width: 100%; height: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--capa);
  border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-1px); border-color: var(--capa); }
.card[aria-pressed="true"] { outline: 2px solid var(--capa); outline-offset: 0; }
.card-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.card-value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.card-sub { font-size: 0.8rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

.dot {
  display: inline-block; width: 10px; height: 10px; flex: none;
  border-radius: 50%; background: var(--capa, var(--steel));
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Toggles ---------- */
.toggles {
  border: 0; margin: 0 0 12px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.toggle-row { display: contents; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 0.85rem; user-select: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 10px 5px 8px;
}
.toggle input { accent-color: var(--capa, var(--steel)); margin: 0; width: 16px; height: 16px; }
.toggle:has(input:not(:checked)) { opacity: 0.6; }
.toggle:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.toggle small { color: var(--muted); }
.toggle .line { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--steel); }
.toggle.is-pending::after { content: "(pendiente)"; color: var(--muted); font-size: 0.8em; }

/* ---------- Explorador: mapa + panel ---------- */
.explorer { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .explorer { grid-template-columns: minmax(0, 1fr) 360px; }
}
.map-wrap { position: relative; }
.map {
  height: 62vh; min-height: 340px; max-height: 720px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
  box-shadow: var(--shadow);
}
@media (min-width: 900px) { .map { height: 640px; } }
.map-status {
  position: absolute; left: 12px; right: 12px; top: 12px; margin: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.875rem; box-shadow: var(--shadow);
  max-width: 460px;
}

.panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 0 0;
}
@media (min-width: 900px) { .panel { height: 640px; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.panel-head h3 { font-size: 1.05rem; }
.panel > .muted { padding: 0 14px; margin: 4px 0 8px; }
.results {
  list-style: none; margin: 0; padding: 0 6px 8px;
  overflow-y: auto; flex: 1; max-height: 520px;
}
@media (min-width: 900px) { .results { max-height: none; } }
.list-empty { padding: 10px 8px 16px; color: var(--muted); font-size: 0.9rem; }
.result {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; align-items: flex-start; gap: 10px;
  font: inherit; color: var(--text); background: transparent;
  border: 0; border-radius: var(--radius-sm); padding: 9px 8px;
}
.result:hover { background: var(--surface-2); }
.result.is-active { background: color-mix(in srgb, var(--capa) 14%, var(--surface)); }
.result .dot { margin-top: 6px; }
.result-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.result-name { font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }
.result-sub { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.result-badges { display: flex; gap: 4px; flex: none; }
.badge {
  font-size: 0.68rem; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
}

/* ---------- Popup MapLibre ---------- */
.maplibregl-popup-content {
  background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 12px 14px; font-family: var(--font);
}
.maplibregl-popup-close-button { font-size: 18px; width: 28px; height: 28px; color: var(--muted); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.pop { padding-right: 14px; }
.pop-capa {
  display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #fff; background: var(--capa); border-radius: 6px; padding: 1px 6px;
}
.pop-title { font-size: 1rem; margin: 6px 0 8px; overflow-wrap: anywhere; }
.pop-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 10px; font-size: 0.85rem; }
.pop-dl dt { color: var(--muted); }
.pop-dl dd { margin: 0; overflow-wrap: anywhere; }
.pop-empty { font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; }
.pop-gmaps { font-size: 0.85rem; font-weight: 600; }
.maplibregl-ctrl-attrib a { color: inherit; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px; padding: 24px 0 32px;
  background: var(--surface); border-top: 1px solid var(--border);
}
.footer-inner { display: grid; gap: 8px; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-logo { height: 32px; width: auto; }
.site-footer p { margin: 0; }
