/* El privilegio del silencio
   Sistema visual: una sola familia (Archivo) donde el PESO de la letra es el volumen.
   Lo ruidoso se escribe grueso y brilla; lo silencioso se escribe delgado y se apaga.
   Sin esquinas redondeadas, sin vidrio, sin sombras: líneas finas y una escala de color. */

:root {
  --bg: #0c0b0a;
  --surface: #131110;
  --ink: #ebe6dc;
  --ink-2: #a9a299;
  --ink-3: #6f6962;
  --rule: rgba(235, 230, 220, 0.14);
  --rule-strong: rgba(235, 230, 220, 0.34);
  --hot: #ee6b2b;            /* único acento: el ruido */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --col-w: 336px;
  --edge: 28px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; border-radius: 0; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-stretch: 100%; font-size: 14px; line-height: 1.45;
  font-variant-numeric: tabular-nums; overflow: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
p, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--hot); outline-offset: 2px; }

#map { position: fixed; inset: 0; background: var(--bg); }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(12,11,10,.94) 0, rgba(12,11,10,.6) 24%, transparent 40%),
    linear-gradient(270deg, rgba(12,11,10,.94) 0, rgba(12,11,10,.6) 24%, transparent 40%);
}

/* Etiqueta: mayúsculas pequeñas, la única "voz baja" del sistema */
.eyebrow, .section-label, .k {
  font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}

/* ── Columnas (simétricas) ────────────────────────────── */
.col {
  position: fixed; top: 0; bottom: 0; z-index: 3;
  width: calc(var(--col-w) + var(--edge) * 2); padding: var(--edge) var(--edge) 48px;
  display: flex; flex-direction: column; gap: 30px;
  pointer-events: none; overflow-y: auto; scrollbar-width: none;
}
.col::-webkit-scrollbar { display: none; }
.col > * { pointer-events: auto; }
.col-left { left: 0; }
.col-right { right: 0; padding-top: 88px; }

/* ── Título: el peso es el volumen ────────────────────── */
h1, h2 { margin: 0; font-weight: 400; }
h1 { margin-top: 12px; text-transform: uppercase; line-height: 1; }
.w-loud { display: block; font-stretch: 125%; font-weight: 800; font-size: 31px; letter-spacing: -.01em; }
.w-quiet { display: block; font-stretch: 125%; font-weight: 100; font-size: 31px; letter-spacing: .115em; margin-top: 4px; color: var(--ink-2); }
.lede { margin-top: 18px; color: var(--ink-2); font-size: 14px; max-width: 34ch; }
.lede b { color: var(--ink); font-weight: 600; }

/* ── Tres zonas ───────────────────────────────────────── */
.cards { margin-top: 10px; border-top: 1px solid var(--rule-strong); }
.card {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: baseline; column-gap: 8px;
  width: 100%; text-align: left; padding: 13px 0 12px; border-bottom: 1px solid var(--rule);
  transition: background .25s var(--ease), padding .25s var(--ease);
}
.card:hover, .card.is-active { background: rgba(235,230,220,.05); padding-left: 10px; padding-right: 10px; }
.card.is-active { border-bottom-color: var(--ink); }
.card .idx { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.card .name { font-size: 21px; line-height: 1.1; font-stretch: 88%; font-weight: var(--wt); }
.card .tag, .card .pop { grid-column: 2; font-size: 12px; color: var(--ink-3); }
.card .tag { color: var(--ink-2); margin-top: 2px; }
.card .db { grid-column: 3; grid-row: 1 / 4; align-self: center; text-align: right; font-stretch: 62%; font-weight: 600; font-size: 40px; line-height: .9; }
.card .db small { display: block; font-stretch: 100%; font-size: 10px; font-weight: 500; letter-spacing: .09em; color: var(--ink-3); margin-top: 5px; }
.card .db::before { content: ""; display: block; height: 3px; background: var(--c); margin-bottom: 7px; }

/* ── Escala de color ──────────────────────────────────── */
.ramp { height: 8px; margin-top: 10px; background: var(--ramp); }
.ramp-ticks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--ink-2); }
.ramp-ticks span:first-child { font-weight: 200; }
.ramp-ticks span:last-child { font-weight: 800; }
.ramp-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); max-width: 36ch; }

/* ── Panel derecho ────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--rule); padding: 18px 18px 10px; }
.ranking { margin-top: 12px; border-top: 1px solid var(--rule-strong); }
.rank {
  display: grid; grid-template-columns: 22px 1fr auto; column-gap: 8px; align-items: baseline;
  width: 100%; padding: 6px 0 0; text-align: left;
}
.rank .n { font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
.rank .nm { font-size: 14px; font-stretch: 92%; font-weight: var(--wt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .v { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.rank .bar { grid-column: 1 / -1; height: 2px; margin-top: 5px; background: var(--rule); }
.rank .bar i { display: block; height: 100%; width: var(--w); background: var(--c); transition: height .2s; }
.rank:hover .nm, .rank.is-hover .nm, .rank:hover .v, .rank.is-hover .v { color: #fff; }
.rank:hover .bar i, .rank.is-hover .bar i { background: var(--ink); }

/* ── Ficha ────────────────────────────────────────────── */
.detail { padding: 18px 20px 16px; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.detail .back { font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.detail .back:hover { color: var(--ink); }
.detail .chip { display: block; margin-top: 18px; font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.detail h2 { font-size: 34px; line-height: 1; font-stretch: 84%; font-weight: var(--wt); margin: 6px 0 6px; letter-spacing: -.01em; }
.detail .zones { color: var(--ink-3); font-size: 12.5px; }

.big { display: flex; align-items: flex-end; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule-strong); }
.big .num { font-stretch: 62%; font-weight: 600; font-size: 104px; line-height: .78; letter-spacing: -.02em; }
.big .unit { font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); line-height: 1.35; padding-bottom: 2px; }
.equiv { margin-top: 14px; color: var(--ink-2); font-size: 13.5px; }

/* Regla de sonómetro: marcas cada 5 dB */
.meter { margin-top: 18px; }
.meter .track {
  position: relative; height: 22px;
  background: repeating-linear-gradient(90deg, var(--rule-strong) 0 1px, transparent 1px calc(100% / 12)) bottom / 100% 7px no-repeat;
  border-bottom: 1px solid var(--rule-strong);
}
.meter .fill { position: absolute; left: 0; bottom: 0; height: 8px; width: var(--avg); background: var(--c); transition: width .7s var(--ease); }
.meter .peak { position: absolute; top: 0; bottom: 0; left: var(--max); width: 1px; background: var(--ink); }
.meter .peak::after { content: "PICO"; position: absolute; top: -1px; right: 5px; font-size: 9px; font-weight: 600; letter-spacing: .09em; color: var(--ink); }
.meter .ref { position: absolute; top: 6px; bottom: 0; left: var(--x); border-left: 1px dashed var(--hot); }
.meter .scale { position: relative; height: 14px; margin-top: 5px; font-size: 10.5px; color: var(--ink-3); }
.meter .scale span { position: absolute; left: var(--x); transform: translateX(-50%); }
.meter .scale span:first-child { transform: none; }
.meter .scale span:last-child { transform: translateX(-100%); }
.meter-notes { margin-top: 8px; display: grid; gap: 2px; font-size: 11.5px; color: var(--ink-3); }
.meter-notes b { color: var(--ink-2); font-weight: 600; display: inline-block; min-width: 32px; }

.stats { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule-strong); }
.stat { padding: 11px 0 10px; border-bottom: 1px solid var(--rule); }
.stat:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--rule); }
.stat.wide { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
.stat dt { font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.stat dd { margin-top: 3px; font-size: 22px; font-stretch: 84%; font-weight: 500; }
.stat dd small { display: block; font-stretch: 100%; font-weight: 400; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.stat.wide dd { font-size: 16px; font-stretch: 100%; font-weight: 400; }
.listen-note { margin-top: 12px; font-size: 11.5px; color: var(--ink-3); }
.listen-note button { color: var(--hot); border-bottom: 1px solid currentColor; }

/* ── Controles: una sola pieza segmentada ─────────────── */
.controls { position: fixed; top: var(--edge); right: var(--edge); z-index: 4; display: flex; width: var(--col-w); }
.ctl {
  height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; flex: 1;
  background: var(--surface); border: 1px solid var(--rule); margin-left: -1px;
  font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2);
  transition: color .2s, background .2s; white-space: nowrap;
}
.ctl:first-child { margin-left: 0; }
.ctl:hover { color: var(--ink); background: #1b1917; }
.ctl-round { flex: 0 0 36px; padding: 0; text-transform: none; font-size: 13px; font-weight: 700; }
.ctl[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.bars { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.bars i { width: 1.5px; height: 2px; background: currentColor; }
.ctl[aria-pressed="true"] .bars i { animation: eq .9s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -.3s !important; }
.bars i:nth-child(3) { animation-delay: -.6s !important; }
.bars i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes eq { 0%, 100% { height: 2px; } 50% { height: 12px; } }

/* ── Mapa ─────────────────────────────────────────────── */
.lbl { pointer-events: none; text-align: center; line-height: 1.05; transition: opacity .3s; text-shadow: 0 0 4px rgba(12,11,10,.95), 0 0 10px rgba(12,11,10,.8); }
.lbl .v { font-stretch: 68%; font-weight: 600; font-size: 15px; color: #fff; }
.lbl .nm { display: none; font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.8); max-width: 110px; margin-top: 2px; }
.show-names .lbl .nm { display: block; }
.hide-labels .lbl { opacity: 0; }

.tooltip {
  position: fixed; z-index: 6; pointer-events: none; transform: translate(16px, 16px);
  background: var(--ink); color: var(--bg); padding: 7px 10px 6px; white-space: nowrap;
}
.tooltip .t-n { font-size: 14px; font-stretch: 92%; font-weight: 700; }
.tooltip .t-v { font-size: 11.5px; font-weight: 500; }

.credits {
  position: fixed; left: var(--edge); bottom: 14px; z-index: 4; right: 50%;
  font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.credits .sim { color: var(--ink); font-weight: 600; }
.maplibregl-map { font-family: var(--font); }
.maplibregl-ctrl-attrib { background: transparent !important; color: var(--ink-3); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--ink-3) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); opacity: .5; }
.maplibregl-ctrl-bottom-right { right: calc(var(--col-w) + var(--edge) * 2 - 10px); }
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--rule); border-radius: 0 !important; box-shadow: none !important; }
.maplibregl-ctrl-group button { border-radius: 0 !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--rule) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) brightness(.8); }

/* ── Portada ──────────────────────────────────────────── */
.intro {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; overflow-y: auto;
  background: var(--bg); transition: opacity .8s var(--ease), visibility .8s;
}
/* ondas concéntricas: el sonido saliendo del centro */
.intro::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 27px, rgba(235,230,220,.075) 27px 28px);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 0 250px, #000 420px, transparent 78%);
          mask-image: radial-gradient(circle at 50% 50%, transparent 0 250px, #000 420px, transparent 78%);
  animation: breathe 7s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .45; } }
.intro.is-closed { opacity: 0; visibility: hidden; }
.intro-card { position: relative; width: min(760px, 100%); text-align: center; display: grid; gap: 18px; justify-items: center; }
.intro-card h2 { text-transform: uppercase; line-height: .98; margin: 6px 0 8px; }
.intro-card h2 .w-loud, .intro-card h2 .w-quiet { font-size: clamp(24px, 6.4vw, 60px); white-space: nowrap; }
.intro-card h2 .w-quiet { letter-spacing: .1em; margin-right: -.1em; margin-top: .1em; }
.intro-card p { color: var(--ink-2); font-size: 15px; max-width: 50ch; }
.intro-card #intro-stat { color: var(--ink); font-size: 19px; line-height: 1.35; font-weight: 300; max-width: 34ch; padding: 16px 0; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.intro-card #intro-stat b { font-weight: 800; }
.intro-actions { display: flex; margin-top: 8px; }
.btn { height: 46px; padding: 0 24px; border: 1px solid var(--ink); margin-left: -1px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; transition: background .2s, color .2s; }
.btn-primary { background: var(--ink); color: var(--bg); font-weight: 800; }
.btn-primary:hover { background: #fff; }
.btn-ghost { font-weight: 300; }
.btn-ghost:hover { background: rgba(235,230,220,.1); }
.intro-card .fine { font-size: 11px; color: var(--ink-3); }

/* ── Pantallas chicas ─────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --col-w: 286px; --edge: 20px; }
  .w-loud, .w-quiet { font-size: 26px; }
  .legend { display: none; }
  .big .num { font-size: 84px; }
}
@media (max-width: 820px) {
  .vignette { background: linear-gradient(180deg, rgba(12,11,10,.9) 0, transparent 24%, transparent 52%, rgba(12,11,10,.95) 100%); }
  .col { width: auto; left: 0; right: 0; padding: 0; overflow: visible; }
  .col-left { top: 0; bottom: auto; padding: 14px 16px 0; gap: 0; }
  .col-left .lede, .featured .section-label, .col-left .eyebrow { display: none; }
  h1 { margin: 0; }
  .w-loud, .w-quiet { display: inline; font-size: 15px; }
  .featured { position: fixed; left: 0; right: 0; bottom: 34px; background: var(--surface); }
  .cards { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0; }
  .card { flex: 0 0 200px; padding: 10px 14px !important; border-right: 1px solid var(--rule); border-bottom: 0; }
  .card .db { font-size: 30px; }
  .col-right { top: auto; bottom: 0; padding: 0; }
  #ranking-panel { display: none; }
  .detail { max-height: 64vh; overflow-y: auto; border-width: 1px 0 0; }
  .big .num { font-size: 72px; }
  body.has-selection .featured, body.has-selection .controls { display: none; }
  .controls { top: auto; bottom: 150px; right: 12px; width: auto; }
  #btn-reset { display: none; }
  .credits { left: 16px; right: 16px; bottom: 10px; }
  .maplibregl-ctrl-bottom-right { display: none; }
  .intro-actions { flex-direction: column; width: 100%; }
  .btn { margin: -1px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
