/* sv-sections.css — module styles for sv-sections.js: #sv-hit-body (spike maps), #sv-near-body (distance chart and
   ranked list) and the region panel. Uses the core tokens (--ink, --hair, --ghost …) and «shared» classes from sv-viz.css
   (.sv-seg, .sv-rangesel, .sv-btn, .sv-linkbtn, .sv-tip, .sv-sw, .sv-segbar, .sv-ptiles, .sv-psec, .sv-rows, .sv-qbars).
   Data colours are set inline from SV.COLORS; the accent appears only on chrome (links, the pressed-header underline). */

.sv-sec-dek { font-family: var(--serif); font-size: 16px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 .75rem; max-width: 50rem; text-wrap: pretty; }
.sv-cap, .sv-spk-reg, .sv-spk-foot, .sv-dist-sent, .sv-rank-sent, .sv-rank-gap .g2 { text-wrap: pretty; }
.sv-sub { font-family: var(--serif); font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0 0 .45rem; color: var(--ink); }
.sv-cap { font-family: var(--sans); font-size: 12.5px; color: var(--muted-text); line-height: 1.5; margin: .45rem 0 0; }
.sv-cap b { color: var(--ink-soft); }

/* ---------------------------------------------------------------- (1) spike maps */
.sv-hit-ctl { display: flex; flex-wrap: wrap; gap: .45rem 1.25rem; align-items: center; font-family: var(--sans); margin: 0 0 .9rem; }
.sv-spk-leg { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: 12.5px; color: var(--ink-soft); }
.sv-spk-leg > span { display: inline-flex; align-items: center; gap: .3rem; }
.sv-spk-leg svg { display: block; flex: none; }
.sv-spikes { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.4rem 18px; align-items: start; }
.sv-spk { margin: 0; min-width: 0; font-family: var(--sans); }
.sv-spk-h { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; padding: .1rem 0; margin: 0; cursor: pointer; text-align: start; color: var(--ink); min-height: 32px; max-width: 100%; }
.sv-spk-h svg { display: block; flex: none; }
.sv-spk-h .t { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1.2; }
.sv-spk-h .go { font-family: var(--sans); font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.sv-spk-h:hover .t { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sv-spk-h:hover .go, .sv-spk-h:focus-visible .go { opacity: 1; }
.sv-spk-h[aria-pressed="true"] .t { box-shadow: inset 0 -2px 0 var(--accent); }
.sv-spk.off .sv-spk-h .t { color: var(--muted-text); }
.sv-spk-n { font-size: 13px; color: var(--ink-soft); margin: .05rem 0 0; line-height: 1.4; }
.sv-spk-cap { font-size: 11.5px; color: var(--muted-text); margin: .1rem 0 .35rem; line-height: 1.35; }
.sv-spk-cap .nw, .sv-spk-reg .nw { white-space: nowrap; }
.sv-spk-map { position: relative; outline: none; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.sv-spk-map.hand { cursor: pointer; }
.sv-spk-map canvas { display: block; }
.sv-spk-map .sv-spk-ov { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.sv-spk-map:focus-visible { box-shadow: 0 0 0 2px var(--ink); border-radius: 2px; }
.sv-spk-num { font-family: var(--sans); font-size: 11.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
/* the tallest spike of each map, named (an annotation in ink, with a paper-white halo) */
.sv-spk-top { font-family: var(--sans); font-size: 11px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: rgba(255,255,255,.92); stroke-width: 3px; stroke-linejoin: round; }
.sv-spk figcaption { margin: 0; }
.sv-spk-reg { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: .35rem 0 0; }
.sv-spk-reg b { font-weight: 700; color: var(--ink); }
.sv-spk-reg .sv-rg { font-size: 13px; font-weight: 600; }
.sv-spk-foot { font-family: var(--sans); font-size: 12.5px; color: var(--muted-text); margin: 1rem 0 0; line-height: 1.5; max-width: 54rem; }
.sv-spikes .sv-tip { max-width: 17rem; }

/* ---------------------------------------------------------------- (2) near which outposts and settlements */
.sv-near-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.5rem 2.25rem; align-items: start; }
.sv-dist, .sv-rank { min-width: 0; font-family: var(--sans); }
.sv-dist-sent { font-family: var(--serif); font-size: 17px; line-height: 1.55; margin: 0 0 .6rem; color: var(--ink); }
.sv-dist-sent b { font-family: var(--sans); }
.sv-dist-leg { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: 12.5px; color: var(--ink-soft); margin: 0 0 .4rem; }
.sv-dist-leg > span { display: inline-flex; align-items: center; gap: .3rem; }
.sv-dist-leg .sw { display: inline-block; width: 14px; height: 10px; flex: none; }
.sv .sw.fill { background: var(--ink-soft); }
.sv .sw.ghost { background: var(--ghost); }
.sv .sw.hollow { background: var(--surface); box-shadow: inset 0 0 0 1.25px var(--ink); }
.sv-dist-row { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .6rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--hair); }
.sv-dist-row:last-child { border-bottom: 1px solid var(--hair); }
.sv-dist-row .lab { font-size: 13px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.sv-dist-row .bars, .sv-cmp-row .bars { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
/* a bar with its value at the end (RTL: grows from the right) */
.sv-bar { display: flex; align-items: center; gap: .35rem; min-height: 14px; }
.sv-bar > i { display: block; height: 12px; min-width: 1px; flex: none; max-width: calc(100% - 4.5rem); }
.sv-bar.fill > i { background: var(--ink-soft); }
.sv-bar.ghost > i { background: var(--ghost); }
.sv-bar.hollow > i { background: var(--surface); box-shadow: inset 0 0 0 1.25px var(--ink); }
.sv-bar > b { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.sv-bar > b small { font-weight: 400; color: var(--muted-text); font-size: 11.5px; }
.sv-bar.l > b, .sv-bar.ghost > b { font-weight: 400; color: var(--ink-soft); }
.sv-cmp { margin: .2rem 0 .3rem; }
.sv-cmp-row { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: .5rem; align-items: center; padding: .25rem 0; border-top: 1px solid var(--hair); }
.sv-cmp-row .lab { display: inline-flex; align-items: center; gap: .3rem; font-size: 13px; white-space: nowrap; }
.sv-cmp-row .lab svg { display: block; flex: none; }
.sv-cmp-row .sv-bar > i { height: 8px; }

.sv-rank-ctl { display: flex; flex-wrap: wrap; gap: .45rem 1rem; align-items: center; font-size: 13px; margin: 0 0 .55rem; }
.sv-rad { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted-text); font-size: 13px; }
.sv-rad .sv-rangesel button { min-height: 30px; padding: .1rem .6rem; color: var(--ink); }
.sv-rad .sv-rangesel button[aria-pressed="true"] { color: #fff; }
.sv-rank-hd, .sv-rank-row { display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem 8.5rem 3.6rem; gap: .7rem; align-items: center; }
.sv-rank-hd { font-size: 12px; font-weight: 700; color: var(--muted-text); padding: .25rem 0 .3rem; border-bottom: 1px solid var(--ink); line-height: 1.25; }
.sv-rank-hd small { display: block; font-weight: 400; font-size: 11.5px; }
.sv-rank-list { list-style: none; margin: 0; padding: 0; }
.sv-rank-row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--hair); padding: .42rem 0; margin: 0; text-align: start; cursor: pointer; color: var(--ink); font-size: 14px; min-height: 40px; }
.sv-rank-row:hover .nmt b, .sv-rank-row:focus-visible .nmt b { text-decoration: underline; text-underline-offset: 2px; }
.sv-rank-row[aria-current="true"] { background: var(--accent-soft); }
.sv-rank-row .nm { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.sv-rank-row .nm > svg, .sv-rank-row .nm > .sv-sw { flex: none; display: block; }
.sv-rank-row .nmt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-rank-row .nmt b { font-weight: 700; }
.sv-rank-row .nmt small { font-size: 12px; color: var(--muted-text); }
.sv-new { flex: none; font-size: 11px; font-weight: 700; color: var(--ink-soft); border: 1px solid var(--ink-soft); border-radius: 2px; padding: 0 .25rem; line-height: 1.35; }
.sv-rank-row .cell { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.sv-rank-row .cell .ml { display: none; }
.sv-rank-row .track { flex: 1 1 auto; min-width: 0; max-width: 5.2rem; display: block; }
.sv-rank-row .track i { display: block; height: 9px; min-width: 0; }
.sv-rank-row .track i.fill { background: var(--ink); }
.sv-rank-row .track i.ghost { background: var(--ghost); position: relative; }
.sv-rank-row .track i.ghost > i.fill { position: absolute; inset-block: 0; inset-inline-start: 0; height: 100%; }
.sv-rank-row .track i.hollow { background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
.sv-rank-row .cell b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 1.6rem; }
.sv-rank-row .cell.near b { font-weight: 400; }
.sv-rank-row .cell.vill b { font-weight: 400; color: var(--ink-soft); }
.sv-rank-gap { padding: .5rem 0 .55rem; border-bottom: 1px solid var(--hair); font-size: 14px; color: var(--ink-soft); }
.sv-rank-gap .g1 { line-height: 1.45; }
.sv-rank-gap .g1 b { color: var(--ink); }
.sv-rank-gap .g1 .big { font-size: 16px; }
.sv-rank-gap .sv-segbar { height: 9px; margin: .3rem 0 .25rem; }
.sv-rank-gap .g2 { font-size: 12.5px; color: var(--muted-text); line-height: 1.45; }
.sv-rank-sent { font-family: var(--serif); font-size: 16px; line-height: 1.55; margin: .7rem 0 0; color: var(--ink); }
.sv-rank-sent b { font-family: var(--sans); }
.sv-rank .sv-actions { margin-top: .6rem; }

/* ---------------------------------------------------------------- (3) region panel */
.sv-region .sv-cmp-row .sv-bar > b { font-size: 12px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 899px) {
  .sv-near-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .sv-sec-dek { font-size: 15.5px; }
  .sv-spikes { row-gap: 1.1rem; }
  .sv-spk-h { min-height: 44px; min-width: 44px; }
  .sv-spk-h .t { font-size: 16px; }
  .sv-spk-h .go { display: none; }
  .sv-spk-n { font-size: 12.5px; }
  .sv-spk-reg { font-size: 12.5px; }
  .sv-hit-ctl .sv-seg button, .sv-rank-ctl .sv-seg button { min-height: 44px; }
  .sv-rad .sv-rangesel button { min-height: 44px; min-width: 44px; }
  .sv-dist-row { grid-template-columns: 4.2rem minmax(0, 1fr); }
  /* the ranked list as cards */
  .sv-rank-hd { display: none; }
  .sv-rank-list { border-top: 1px solid var(--ink); }
  .sv-rank-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "nm nm nm" "a b c"; gap: .3rem .8rem; padding: .55rem 0; min-height: 44px; }
  .sv-rank-row .nm { grid-area: nm; }
  .sv-rank-row .nmt { white-space: normal; }
  .sv-rank-row .cell.linked { grid-area: a; }
  .sv-rank-row .cell.near { grid-area: b; }
  .sv-rank-row .cell.vill { grid-area: c; }
  .sv-rank-row .cell { flex-wrap: wrap; row-gap: .1rem; }
  .sv-rank-row .cell .ml { display: block; flex: 1 1 100%; font-size: 11.5px; color: var(--muted-text); font-weight: 400; }
}
@media (forced-colors: active) { .sv-spk-map canvas { forced-color-adjust: none; } }
@media print { .sv-hit-ctl .sv-seg, .sv-rank-ctl { display: none; } }
