/* Narratives (2026-11-08, revisión «Blockboard 5.4», t87).
   `nrb-*`: las burbujas y lo que integra con los hilos (t98; con la vista
   previa en /narratives, la ficha de un hilo y la pieza `nr.bubbles`). La
   página «Soon» (`nrs-*`) se retiró en t98. Sólo tokens de `blockboard.css`. */

/* --- Colores de las burbujas: verde crece, rojo cae, gris estable, azul
   emergente (el concepto del usuario, imagen 25). */
.nrb-svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; --nrb-base: var(--bg); }
/* En claro, las burbujas se oscurecen hacia el texto y no hacia el fondo:
   mezcladas con blanco salían pastel y el rótulo blanco no se leía. */
:root[data-theme="light"] .nrb-svg { --nrb-base: var(--text); }
:root[data-theme="light"] .nrb-glow { opacity: .14; }
.nrb-s0.t-up { stop-color: color-mix(in srgb, var(--up-fill) 70%, var(--ink-000)); }
.nrb-s1.t-up { stop-color: color-mix(in srgb, var(--up-fill) 72%, var(--nrb-base)); }
.nrb-s2.t-up { stop-color: color-mix(in srgb, var(--up-fill) 45%, var(--nrb-base)); }
.nrb-s0.t-down { stop-color: color-mix(in srgb, var(--down) 65%, var(--ink-000)); }
.nrb-s1.t-down { stop-color: color-mix(in srgb, var(--down) 78%, var(--nrb-base)); }
.nrb-s2.t-down { stop-color: color-mix(in srgb, var(--down) 48%, var(--nrb-base)); }
.nrb-s0.t-flat { stop-color: color-mix(in srgb, var(--text-faint) 60%, var(--ink-000)); }
.nrb-s1.t-flat { stop-color: color-mix(in srgb, var(--text-faint) 80%, var(--nrb-base)); }
.nrb-s2.t-flat { stop-color: color-mix(in srgb, var(--text-faint) 50%, var(--nrb-base)); }
.nrb-s0.t-emerging { stop-color: color-mix(in srgb, var(--blue-500) 55%, var(--ink-000)); }
.nrb-s1.t-emerging { stop-color: color-mix(in srgb, var(--blue-500) 85%, var(--nrb-base)); }
.nrb-s2.t-emerging { stop-color: color-mix(in srgb, var(--blue-500) 50%, var(--nrb-base)); }

.nrb-l { stroke: var(--line-strong); stroke-linecap: round; transition: stroke .2s ease, opacity .2s ease; }
.nrb-n { cursor: default; outline: none; }
.nrb-n[role="button"] { cursor: pointer; }
.nrb-c { stroke-width: 1.2; transition: filter .2s ease; }
.nrb-n.t-up .nrb-c { stroke: color-mix(in srgb, var(--up-fill) 80%, var(--ink-000)); }
.nrb-n.t-down .nrb-c { stroke: color-mix(in srgb, var(--down) 80%, var(--ink-000)); }
.nrb-n.t-flat .nrb-c { stroke: color-mix(in srgb, var(--text-faint) 80%, var(--ink-000)); }
.nrb-n.t-emerging .nrb-c { stroke: color-mix(in srgb, var(--blue-500) 70%, var(--ink-000)); }
.nrb-glow { opacity: .22; filter: blur(8px); }
.nrb-n.t-up .nrb-glow { fill: var(--up-fill); }
.nrb-n.t-down .nrb-glow { fill: var(--down); }
.nrb-n.t-flat .nrb-glow { fill: var(--text-faint); opacity: .12; }
.nrb-n.t-emerging .nrb-glow { fill: var(--blue-500); }
.nrb-t { fill: var(--ink-000); font-weight: 650; pointer-events: none; paint-order: stroke; stroke: rgba(0, 0, 0, .25); stroke-width: 2px; }
.nrb-t2 { fill: rgba(255, 255, 255, .86); font-weight: 500; pointer-events: none; font-variant-numeric: tabular-nums; }
.nrb-faded { opacity: .35; }
.nrb-svg.nrb-hl .nrb-n:not(.hl) { opacity: .28; }
.nrb-svg.nrb-hl .nrb-l:not(.hl) { opacity: .2; }
.nrb-l.hl { stroke: var(--accent); }
.nrb-n.hl .nrb-c, .nrb-n:focus-visible .nrb-c { filter: brightness(1.15); }
.nrb-n.on .nrb-c { stroke: var(--text); stroke-width: 2.5; }
.nrb-n:focus-visible .nrb-c { stroke: var(--focus); stroke-width: 3; }
.nrb-n, .nrb-l { transition: opacity .2s ease; }

/* Flotan un poco cuando se han colocado. Sólo `transform`, y nada con
   movimiento reducido. */
@media (prefers-reduced-motion: no-preference) {
  .nrb-settled .nrb-in { animation: nrb-float var(--nrb-p, 6s) ease-in-out var(--nrb-d, 0s) infinite alternate; }
  .nrb-svg.nrb-hl .nrb-in { animation-play-state: paused; }
  .nrb-c { transition: filter .2s ease; }
}
@keyframes nrb-float { from { transform: translate(0, -2px); } to { transform: translate(0, 3px); } }

/* Leyenda */
.nrb-key { display: inline-flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: var(--size-xs); color: var(--text-muted); }
.nrb-key > span { display: inline-flex; align-items: center; gap: 5px; }
.nrb-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; vertical-align: 0; }
.nrb-dot.t-up { background: var(--up-fill); }
.nrb-dot.t-down { background: var(--down); }
.nrb-dot.t-flat { background: var(--text-faint); }
.nrb-dot.t-emerging { background: var(--blue-500); }

/* --- La página con datos ------------------------------------------------ */
.nrb-bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); margin: 0 0 var(--s3); }
[data-nrw][hidden] { display: none !important; }
.nrb-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-sunken); border: 1px solid var(--line); }
.nrb-seg button { font: inherit; font-size: var(--size-xs); font-weight: 600; color: var(--text-muted); background: none; border: 0;
  border-radius: 7px; padding: 0 12px; min-height: 30px; min-width: 44px; cursor: pointer; white-space: nowrap; }
.nrb-seg button:hover { color: var(--text); }
.nrb-seg button[aria-pressed="true"] { background: var(--surface-hover); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.nrb-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nrb-lead { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: 0 0 var(--s4); }
.nrb-lead-c { padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font-size: var(--size-sm); color: var(--text-muted); }
.nrb-lead-c b { color: var(--text); }
.nrb-lead-q { display: block; font-size: var(--size-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; font-weight: 600; }

.nrb-map { padding: var(--s4); margin-bottom: var(--s4);
  background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--accent) 5%, var(--surface)), var(--surface) 70%); }
.nrb-map-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s2); }
.nrb-map-head h2 { margin: 0; font-size: var(--size-lg); }
.nrb-map-head .nrb-key { margin-left: auto; }
.nrb-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s4); align-items: start; }
.nrb-stage { position: relative; min-height: 300px; border-radius: var(--radius);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px; }
.nrb-detail { border-left: 1px solid var(--line); padding-left: var(--s4); font-size: var(--size-sm); min-height: 200px; }
.nrb-detail-empty { color: var(--text-faint); margin: var(--s4) 0 0; }
.nrb-d-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nrb-d-head h3 { margin: 0; font-size: var(--size-md); }
.nrb-d-state { font-size: var(--size-2xs); font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.nrb-d-state.t-up { color: var(--up); } .nrb-d-state.t-down { color: var(--down); }
.nrb-d-state.t-flat { color: var(--text-muted); } .nrb-d-state.t-emerging { color: var(--blue-500); }
.nrb-d-why { margin: var(--s2) 0 var(--s3); color: var(--text-muted); }
.nrb-d-figs { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); margin: 0 0 var(--s3); }
.nrb-d-figs dt { color: var(--text-faint); font-size: var(--size-xs); }
.nrb-d-figs dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-size: var(--size-xs); }
.nrb-d-sub { display: block; font-size: var(--size-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: var(--s3) 0 var(--s1); }
.nrb-d-spark svg { width: 100%; height: 40px; display: block; }
.nrb-d-spark rect { fill: var(--text-faint); }
.nrb-d-spark rect.t-up { fill: var(--up-fill); } .nrb-d-spark rect.t-down { fill: var(--down); } .nrb-d-spark rect.t-emerging { fill: var(--blue-500); }
.nrb-d-coins { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.nrb-d-coins li { display: inline-flex; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--size-xs); font-variant-numeric: tabular-nums; }
.nrb-d-coins a { color: var(--text); font-weight: 600; text-decoration: none; }
.nrb-d-stories { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
.nrb-d-stories li { font-size: var(--size-xs); }
.nrb-d-stories a { color: var(--text); display: block; }
.nrb-d-stories .faint { font-size: var(--size-2xs); }
.nrb-d-rel { margin: var(--s3) 0 0; font-size: var(--size-xs); }
.nrb-d-more { display: inline-block; margin-top: var(--s3); font-size: var(--size-sm); }

.nrb-qs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.nrb-q { display: flex; flex-direction: column; gap: var(--s2); }
.nrb-q-sub { margin: 0; font-size: var(--size-xs); color: var(--text-muted); }
.nrb-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.nrb-rank li { display: grid; grid-template-columns: auto minmax(0, 9.5em) minmax(0, 1fr) auto 4.2em; align-items: center; gap: var(--s2); font-size: var(--size-sm); }
.nrb-rank-m li { grid-template-columns: auto minmax(0, 9.5em) minmax(0, 1fr) 5.4em; }
.nrb-rank-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrb-rank-bar { height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.nrb-rank-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.nrb-rank-bar-m i { background: var(--up-fill); }
.nrb-rank-bar-m i.neg { background: var(--down); }
.nrb-rank-c { text-align: right; font-size: var(--size-xs); }
.nrb-rank .num { font-variant-numeric: tabular-nums; text-align: right; }
.nrb-q-foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--size-xs); }
.nrb-q-foot > .faint { flex-basis: 100%; }
.nrb-chip { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-sunken); font-variant-numeric: tabular-nums; }
.nrb-states { display: grid; gap: var(--s3); }
.nrb-state-h { font-size: var(--size-sm); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nrb-state-h .faint { font-size: var(--size-2xs); }
.nrb-state-l { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.nrb-state-l a { font-size: var(--size-xs); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.nrb-state.s-emerging .nrb-state-l a { border-color: color-mix(in srgb, var(--blue-500) 50%, transparent); }
.nrb-state.s-accelerating .nrb-state-l a { border-color: color-mix(in srgb, var(--up-fill) 45%, transparent); }
.nrb-state.s-steam .nrb-state-l a, .nrb-state.s-fading .nrb-state-l a { border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.nrb-state-l a:hover { background: var(--surface-hover); }
.nrb-state-l .faint { font-size: var(--size-xs); }
.nrb-table { margin-bottom: var(--s4); }
.nrb-table td a { white-space: nowrap; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.nrb-table td a:hover { color: var(--accent); }

@media (max-width: 1100px) {
  .nrb-body { grid-template-columns: 1fr; }
  .nrb-detail { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: var(--s3); min-height: 0; }
  .nrb-qs { grid-template-columns: 1fr 1fr; }
  .nrb-qs > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .nrb-lead, .nrb-qs { grid-template-columns: 1fr; }
  .nrb-map { padding: var(--s3); }
  .nrb-map-head .nrb-key { margin-left: 0; }
  .nrb-stage { background-size: 36px 36px; }
}

/* --- t98: hilos y narrativas enlazados ------------------------------------
   Una narrativa como chapa (en un hilo: la tabla, la casilla señalada, la
   ficha del hilo) y como enlace en una conclusión; las dos abren su burbuja. */
.nrb-tags-l { display: inline-flex; flex-wrap: wrap; gap: 4px; }
a.nrb-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--text); text-decoration: none; font-size: var(--size-xs);
  white-space: nowrap; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
a.nrb-chip:hover, a.nrb-chip:focus-visible { background: var(--surface-hover); border-color: var(--line-strong); transform: translateY(-1px); }
a.nrb-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nrb-tag { padding: 1px 8px; }
.nrb-tag .nrb-dot { width: 7px; height: 7px; }
.nl-peek-tags { margin-left: auto; }
.nrb-col { white-space: normal !important; min-width: 150px; }
a.nrb-open { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px; }
a.nrb-open:hover { color: var(--accent); }
.nrb-lead-thr { display: block; margin-top: 6px; font-size: var(--size-xs); }
.nrb-lead-thr a { color: inherit; }
.nrb-names { font-size: var(--size-xs); white-space: normal !important; min-width: 140px; }
.nrb-names a { color: var(--text-muted); text-decoration: none; }
.nrb-names a:hover { color: var(--accent); }
.nrb-d-names a { color: var(--text); }
.otras.nrb-tags { margin-top: var(--s2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nrb-threads { margin-bottom: var(--s4); }
@media (max-width: 720px) { .nl-peek-tags { margin-left: 0; flex-basis: 100%; } }
/* Las narrativas de un hilo, debajo de su nombre en la tabla: texto pequeño
   con su punto, sin chapa, para que la tabla quepa como antes. */
.nrb-pl-tags { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; }
.nrb-pl-tags a.nrb-tag { padding: 0; border: 0; background: none; font-size: var(--size-2xs); color: var(--text-muted); }
.nrb-pl-tags a.nrb-tag:hover, .nrb-pl-tags a.nrb-tag:focus-visible { color: var(--accent); background: none; }
