/* Mapa historii (/pl/historia/) — map on top, vertical chronology thread below */
.hx-head { padding-block: clamp(32px, 6vw, 64px) 8px; }
.hx-head h1 { font-size: clamp(36px, 6.5vw, 64px); line-height: 1.04; font-weight: 900; letter-spacing: -.03em; text-wrap: balance; }
.hx-layers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hx-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer; }
a.hx-chip { text-decoration: none; }
.hx-chip[aria-disabled="true"] { cursor: default; color: var(--muted); }
.hx-chip[aria-pressed="true"], .hx-chip[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.hx-chip:disabled { cursor: default; color: var(--muted); }
.hx-chip small { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }

/* sticky map + date bar */
.hx-stage { position: sticky; top: 64px; z-index: 20; background: var(--bg); padding-top: 12px; }
.hx-map { height: clamp(200px, 38vh, 440px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.hx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hx-bar label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.hx-sel { height: 40px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
.hx-btn { height: 40px; min-width: 40px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hx-btn:hover, .hx-sel:hover { border-color: var(--accent); }
.hx-status { flex-basis: 100%; font-size: 15px; color: var(--ink2); min-height: 1.6em; }
.hx-status b { color: var(--ink); }
.hx-status button { all: unset; cursor: pointer; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* thread */
.hx-thread { --rail: 34px; --axis: 12px; --bw: 1px; position: relative; padding: 28px 0 40px var(--rail); }
.hx-thread::before { content: ""; position: absolute; left: calc(var(--axis) - 1px); top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--line), var(--accent) 40%, var(--line)); }
.hx-year { position: relative; font-size: clamp(26px, 4vw, 34px); font-weight: 900; letter-spacing: -.02em; margin: 26px 0 14px; }
.hx-year::before { content: ""; position: absolute; left: calc(var(--axis) - var(--rail) - 7px); top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--bg); border: 3px solid var(--ink2); }
.hx-ev { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 18px; margin-bottom: 16px; transition: opacity .25s, box-shadow .25s, border-color .25s; scroll-margin-top: calc(64px + clamp(200px, 38vh, 440px) + 110px); }
.hx-ev::before { content: ""; position: absolute; left: calc(var(--axis) - var(--rail) - var(--bw) - 6px); top: 26px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 3px solid var(--bg); }
.hx-ev.dim { opacity: .55; }
.hx-ev.hit { border-color: var(--accent); box-shadow: var(--shadow); opacity: 1; }
.hx-ev.hit::before { background: var(--accent); width: 16px; height: 16px; left: calc(var(--axis) - var(--rail) - var(--bw) - 8px); top: 24px; }
.hx-ev.near { opacity: .9; border-style: dashed; border-color: var(--accent); }
.hx-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hx-date { color: var(--accent); }
.hx-place { color: var(--muted); background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-align: left; }
.hx-place:hover { color: var(--ink); }
.hx-ev h3 { font-size: clamp(19px, 2.4vw, 23px); line-height: 1.25; font-weight: 800; letter-spacing: -.015em; margin-top: 6px; text-wrap: balance; }
.hx-ev h3 button { all: unset; cursor: pointer; }
.hx-ev h3 button:hover { color: var(--accent); }
.hx-ev h3 button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.hx-ev p { color: var(--ink2); font-size: 16px; margin-top: 8px; max-width: 68ch; text-wrap: pretty; }
.hx-media { display: grid; gap: 12px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.hx-media figure { margin: 0; }
.hx-media img { width: 100%; max-height: 360px; object-fit: contain; background: var(--bg2); border-radius: 14px; }
.hx-media figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.hx-media figcaption a { color: inherit; }
.hx-clip { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-right: 6px; }
.hx-src { margin-top: 12px; font-size: 14px; color: var(--muted); }
.hx-src summary { cursor: pointer; font-weight: 700; }
.hx-src ol { list-style: decimal; padding-left: 20px; margin-top: 6px; }
.hx-src a { color: var(--ink2); overflow-wrap: anywhere; }

.hx-next { background: var(--bg2); border-radius: var(--radius); padding: 24px; margin: 8px 0 64px; }
.hx-next h2 { font-size: 22px; font-weight: 800; }
.hx-next ul { list-style: disc; padding-left: 20px; margin-top: 8px; color: var(--ink2); }
.hx-next p { color: var(--ink2); margin-top: 8px; font-size: 15px; }

/* map markers */
.hx-pin { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .2s; }
.hx-pin.on { background: var(--accent); width: 22px; height: 22px; margin: -4px 0 0 -4px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent), 0 1px 4px rgba(0,0,0,.4); }
.hx-pin.hover { transform: scale(1.35); }
.leaflet-container { font-family: var(--sans); background: var(--bg2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.4; }
.leaflet-popup-content b { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.leaflet-popup-content button { all: unset; display: block; cursor: pointer; padding: 3px 0; font-weight: 700; }
.leaflet-popup-content button:hover { color: var(--accent); }
.leaflet-popup-content button span { color: var(--accent); font-weight: 700; margin-right: 6px; }
@media (prefers-color-scheme: dark) { .hx-tiles { filter: invert(1) hue-rotate(180deg) brightness(1.05) contrast(.88) saturate(.6); } }
@media (max-width: 640px) {
  .hx-stage { padding-top: 8px; }
  .hx-map { height: 32vh; border-radius: 16px; }
  .hx-thread { --rail: 28px; }
  .hx-ev { padding: 16px 16px 14px; scroll-margin-top: calc(64px + 32vh + 130px); }
}
@media (prefers-reduced-motion: reduce) { .hx-ev, .hx-pin { transition: none; } }

/* ── "Kto tu rządził" (spans) ── */
.hx-range { flex: 1 1 220px; min-width: 160px; accent-color: var(--accent); height: 40px; }
.hx-num { width: 92px; }
.hx-cities { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.hx-cities .hx-chip { padding: 5px 12px; font-size: 14px; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 16px 0 0; font-size: 13px; color: var(--muted); }
.hx-key { display: inline-flex; align-items: center; gap: 6px; opacity: .55; }
.hx-key::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.hx-key.on { opacity: 1; color: var(--ink); font-weight: 700; }
.hx-year small { display: block; font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-top: 2px; }
.hx-ribbon { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin: 6px 0 18px; border: 1px solid var(--line); }
.hx-seg { flex-basis: 0; min-width: 3px; border: 0; padding: 0; margin: 0; background: var(--c); cursor: pointer; opacity: .75; }
.hx-seg + .hx-seg { box-shadow: inset 1px 0 0 var(--bg); }
.hx-seg:hover, .hx-seg.on { opacity: 1; }
.hx-seg.on { outline: 3px solid var(--ink); outline-offset: -3px; }
.hx-span { --bw: 6px; border-left: 6px solid var(--c); }
.hx-span::before { background: var(--c); }
.hx-span.hit { border-color: var(--c); border-left-width: 6px; box-shadow: var(--shadow), 0 0 0 2px var(--c); }
.hx-span.hit::before { background: var(--c); }
.hx-dur { color: var(--ink2); }
.hx-ruler { font-weight: 700; color: var(--ink) !important; margin-top: 4px !important; }
.hx-cpin { width: 18px; height: 18px; background: var(--muted); }
.hx-cpin.off { background: transparent; border: 2px dashed var(--muted); box-shadow: none; }
.hx-cpin.sel { box-shadow: 0 0 0 4px var(--card), 0 0 0 7px var(--ink); }
.leaflet-tooltip.hx-tip { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-weight: 700; padding: 2px 7px; box-shadow: var(--shadow); white-space: nowrap; }
.leaflet-tooltip.hx-tip::before { display: none; }
.hx-tip b { margin-right: 4px; }

@media (max-width: 640px) {
  .hx-cities { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .hx-cities::-webkit-scrollbar { display: none; }
  .hx-cities .hx-chip { flex: 0 0 auto; }
  .hx-range { flex-basis: 100%; height: 28px; }
  .hx-bar:has(.hx-range) { gap: 6px; padding: 8px 0; }
  .hx-span { scroll-margin-top: calc(64px + 32vh + 170px); }
}
