/* ============================================================
   CLIAR · Plataforma de datos
   Mismo sistema visual que cliar.org
   ============================================================ */
:root {
  --navy: #1D3880;
  --navy-deep: #132847;
  --navy-darker: #0A1834;
  --teal: #00A996;
  --teal-dark: #088A7A;
  --teal-light: #5FD9C8;
  --teal-soft: #E5F6F4;
  --cyan: #27ABE7;
  --ink: #14182A;
  --gray-700: #3D4459;
  --gray-500: #6B7388;
  --gray-300: #C7CCD7;
  --gray-200: #E2E5EC;
  --gray-100: #EEF1F5;
  --gray-50: #F8F9FB;
  --white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 12px 36px -16px rgba(15,31,74,0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --max: 1240px;
  --pad: 40px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.mono-s { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy-darker);
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.top-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand img { height: 22px; width: auto; filter: brightness(0) invert(1); }
.brand-sub { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-light); border-left: 1px solid rgba(255,255,255,.2); padding-left: 12px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,.72);
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
  transition: background .2s, color .2s;
}
.tabs a:hover { color: var(--white); background: rgba(255,255,255,.06); }
.tabs a.active { color: var(--white); background: rgba(0,169,150,.22); box-shadow: inset 0 -2px 0 var(--teal); }
.back { font-size: 13px; color: rgba(255,255,255,.6); flex-shrink: 0; }
.back:hover { color: var(--teal-light); }

/* ---------- Hero / panorama ---------- */
.hero {
  background: radial-gradient(1200px 500px at 85% -10%, rgba(0,169,150,.28), transparent 60%),
              linear-gradient(160deg, var(--navy-darker) 0%, var(--navy-deep) 55%, #10305E 100%);
  color: var(--white);
  padding: 64px 0 72px;
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: start; }
.kicker { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-light); }
.hero h1 { font-size: 48px; line-height: 1.06; letter-spacing: -.03em; margin: 18px 0 18px; font-weight: 700; }
.hero h1 .hl { color: var(--teal-light); }
.lead { font-size: 17px; color: rgba(255,255,255,.78); max-width: 600px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 36px; }
.kpi { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 18px 16px; }
.kpi .num { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--white); font-variant-numeric: tabular-nums; }
.kpi .lbl { font-size: 12.5px; color: rgba(255,255,255,.65); margin-top: 8px; line-height: 1.35; }

.map-card { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 18px 20px 20px; }
.map-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: rgba(255,255,255,.7); margin-bottom: 8px; }
.legend { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 8px; }
.dot-cliar { background: var(--teal); }
.dot-otra { background: var(--gray-300); }
.map-body { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
#mapa { width: 150px; height: auto; display: block; overflow: visible; }
#mapa .land { fill: rgba(255,255,255,.10); stroke: rgba(255,255,255,.35); stroke-width: .6; }
#mapa .pin { cursor: pointer; transition: r .25s var(--ease); }
#mapa .pin-cliar { fill: var(--teal); stroke: var(--white); stroke-width: 1.2; }
#mapa .pin-otra { fill: var(--gray-300); stroke: var(--navy-darker); stroke-width: 1; }
#mapa .pin.on, #mapa .pin:hover { stroke: var(--teal-light); stroke-width: 2.5; }
#mapa .halo { fill: var(--teal); opacity: .35; transform-box: fill-box; transform-origin: center; animation: halo 2.6s ease-out infinite; }
@keyframes halo { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(2.6); opacity: 0; } }
.city-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.city-list li button {
  width: 100%; text-align: left; background: transparent; border: 1px solid transparent; color: var(--white);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; font: inherit; transition: background .2s, border-color .2s;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
}
.city-list li button:hover, .city-list li button.on { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); }
.city-list .cn { font-weight: 600; font-size: 14.5px; }
.city-list .cy { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: rgba(255,255,255,.55); grid-column: 1; }
.city-list .cv { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 12px; color: var(--teal-light); text-align: right; font-variant-numeric: tabular-nums; }
.city-list .cv small { display: block; color: rgba(255,255,255,.45); font-size: 10.5px; }
.city-list .otra .cn { color: rgba(255,255,255,.7); }

/* ---------- Secciones ---------- */
.section { padding-top: 56px; padding-bottom: 72px; }
.section.narrow { max-width: 900px; }
.sec-head { margin-bottom: 28px; }
.eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-dark); display: inline-flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--teal); }
.sec-head h2 { font-size: 34px; line-height: 1.12; letter-spacing: -.025em; margin: 12px 0 10px; max-width: 900px; }
.sec-sub { color: var(--gray-500); font-size: 16.5px; max-width: 760px; }

.panel { background: var(--white); border: 1px solid var(--gray-100); border-radius: 16px; padding: 24px 24px 18px; box-shadow: 0 2px 8px -4px rgba(15,31,74,.06); }
.chart-title { font-size: 17px; letter-spacing: -.01em; line-height: 1.3; }
.chart-sub { font-size: 13.5px; color: var(--gray-500); margin: 4px 0 12px; }
.chart-note { font-size: 12.5px; color: var(--gray-500); margin-top: 10px; }
.chart-box { position: relative; width: 100%; height: 340px; }
.h-300 { height: 300px; } .h-320 { height: 320px; } .h-360 { height: 360px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.card { background: var(--white); border: 1px solid var(--gray-100); border-radius: 14px; padding: 18px 20px; }
.card .t { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); }
.card .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--navy); margin-top: 6px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.card .v small { font-size: 13px; font-weight: 500; color: var(--gray-500); letter-spacing: 0; }
.card .d { font-size: 13px; color: var(--gray-700); margin-top: 6px; line-height: 1.45; }
.card.accent { border-color: var(--teal); background: linear-gradient(180deg, var(--teal-soft), var(--white)); }
.card.accent .v { color: var(--teal-dark); }

/* ---------- Controles ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; margin-bottom: 22px; }
.ctl { display: flex; flex-direction: column; gap: 6px; }
.ctl > span { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); }
select {
  font: inherit; font-size: 15px; padding: 10px 38px 10px 14px; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white);
  appearance: none; cursor: pointer; min-width: 220px; color: var(--ink);
  background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,169,150,.12); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font: inherit; font-size: 14px; font-weight: 500; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-700); cursor: pointer; transition: all .2s;
}
.pill:hover { border-color: var(--navy); color: var(--navy); }
.pill.on { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ---------- Ficha del analito ---------- */
.ficha { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; }
.ficha h3 { font-size: 18px; margin-bottom: 6px; }
.ficha p { font-size: 14px; color: var(--gray-700); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 13.5px; }
.kv dt { color: var(--gray-500); font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.kv dd { color: var(--ink); }

/* ---------- Callout ---------- */
.callout { margin-top: 20px; background: #FFF8EC; border: 1px solid #F3DDB3; border-left: 4px solid #D9962B; border-radius: 12px; padding: 18px 20px; font-size: 14.5px; color: var(--gray-700); }
.callout b { color: var(--ink); }
.callout:empty { display: none; }

/* ---------- Hallazgos ---------- */
.findings { display: flex; flex-direction: column; gap: 22px; }
.finding { display: grid; grid-template-columns: 90px 1fr 1.1fr; gap: 28px; align-items: center; background: var(--white); border: 1px solid var(--gray-100); border-radius: 18px; padding: 28px; }
.finding .n { font-family: 'IBM Plex Mono', monospace; font-size: 46px; color: var(--teal); line-height: 1; }
.finding h3 { font-size: 22px; line-height: 1.22; letter-spacing: -.015em; margin-bottom: 10px; }
.finding p { font-size: 15px; color: var(--gray-700); }
.finding details { margin-top: 12px; font-size: 13.5px; color: var(--gray-500); }
.finding summary { cursor: pointer; color: var(--teal-dark); font-weight: 600; font-size: 13.5px; }
.finding details p { font-size: 13.5px; color: var(--gray-500); margin-top: 6px; }
.finding .chart-box { height: 230px; }

/* ---------- Metodología ---------- */
.steps { counter-reset: s; list-style: none; display: grid; gap: 10px; margin-bottom: 36px; }
.steps li { counter-increment: s; position: relative; background: var(--white); border: 1px solid var(--gray-100); border-radius: 12px; padding: 14px 18px 14px 58px; font-size: 15px; color: var(--gray-700); }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 18px; top: 14px; font-family: 'IBM Plex Mono', monospace; color: var(--teal); font-weight: 500; }
.steps b, .limits b { color: var(--ink); }
.h3 { font-size: 20px; letter-spacing: -.01em; margin: 34px 0 14px; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--gray-100); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.tbl th { text-align: left; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--white); background: var(--navy); padding: 10px 12px; font-weight: 500; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--gray-100); vertical-align: top; color: var(--gray-700); }
.tbl td:first-child { color: var(--ink); font-weight: 600; }
.tbl tr.grp td { background: var(--teal-soft); color: var(--teal-dark); font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.limits { list-style: none; display: grid; gap: 10px; }
.limits li { font-size: 15px; color: var(--gray-700); padding-left: 18px; position: relative; }
.limits li::before { content: ''; position: absolute; left: 0; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.body { font-size: 15px; color: var(--gray-700); }
.muted { color: var(--gray-500); margin-top: 18px; font-size: 13px; }
.refs { list-style: none; display: grid; gap: 10px; font-size: 13.5px; color: var(--gray-700); }
.refs a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }

/* ---------- Descargas ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dl { background: var(--white); border: 1px solid var(--gray-100); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 6px; transition: all .25s var(--ease); }
.dl b { font-size: 16px; color: var(--navy); }
.dl b::after { content: ' ↓'; color: var(--teal); }
.dl span { font-size: 13px; color: var(--gray-500); }
.dl:hover { border-color: var(--teal); transform: translateY(-3px); box-shadow: var(--shadow); }

/* ---------- Footer ---------- */
.foot { background: var(--navy-darker); color: rgba(255,255,255,.55); font-size: 13px; padding: 22px 0; }
.foot-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Animaciones ---------- */
.view { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.js .rv { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  :root { --pad: 20px; }
  .hero-grid, .grid-2, .ficha { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .finding { grid-template-columns: 1fr; gap: 14px; padding: 22px; }
  .finding .n { font-size: 34px; }
  .back { display: none; }
}
@media (max-width: 700px) {
  .top-inner { height: auto; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; padding-bottom: 8px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .brand-sub { font-size: 10px; }
  .hero { padding: 40px 0 48px; }
  .hero h1 { font-size: 29px; }
  .lead { font-size: 15.5px; }
  .map-body { grid-template-columns: 92px 1fr; gap: 10px; }
  #mapa { width: 92px; }
  .city-list li button { grid-template-columns: 1fr; padding: 7px 8px; }
  .city-list .cv { grid-row: auto; grid-column: 1; text-align: left; }
  .city-list .cv small { display: inline; margin-left: 6px; }
  .cards-3, .dl-grid { grid-template-columns: 1fr; }
  .sec-head h2 { font-size: 26px; }
  .panel { padding: 18px 14px 14px; border-radius: 14px; }
  select { min-width: 0; width: 100%; }
  .controls { flex-direction: column; align-items: stretch; }
  .chart-box { height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .rv { opacity: 1; transform: none; }
}
