:root {
  --paper: #f8f3ea;
  --paper-deep: #eee3d3;
  --ink: #202123;
  --muted: #6c6b66;
  --line: #d7cbb8;
  --teal: #23766e;
  --teal-dark: #0f5557;
  --teal-pale: #dbeee8;
  --rose: #b75a66;
  --rose-pale: #f0d7d9;
  --ochre: #b5812f;
  --white: #fffdf8;
  --shadow: 0 24px 70px rgba(52, 43, 32, 0.12);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.story-hero {
  min-height: 88vh;
  padding: 22px clamp(18px, 4vw, 56px) 44px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.82), rgba(255, 253, 248, 0) 48%),
    var(--paper);
}

.story-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1420px;
  margin: 0 auto 34px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  text-decoration: none;
}

.brand span {
  width: 27px;
  height: 27px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--ochre) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 50%, transparent 0 9px, var(--ink) 10px 11px, transparent 12px);
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.76fr) minmax(580px, 1.24fr);
  gap: clamp(26px, 4vw, 62px);
  align-items: center;
  max-width: 1420px;
  margin: 0 auto;
}

.hero-copy {
  max-width: 690px;
}

.dateline,
.kicker {
  margin: 0 0 14px;
  color: var(--ochre);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(56px, 8vw, 116px);
  font-weight: 500;
  line-height: 0.93;
  letter-spacing: -0.01em;
}

.dek {
  margin: 24px 0 0;
  max-width: 560px;
  color: #45423d;
  font-family: var(--serif);
  font-size: clamp(19px, 2vw, 27px);
  line-height: 1.32;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.hero-actions a,
.hero-actions button,
.method a {
  min-height: 40px;
  padding: 10px 15px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}

.hero-actions button {
  background: transparent;
  color: var(--ink);
}

.hero-map-frame {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: var(--shadow);
}

.hero-map-frame svg,
#storyMap,
#distanceChart {
  display: block;
  width: 100%;
  height: auto;
}

.hero-map-frame figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.map-unit {
  stroke: rgba(255, 253, 248, 0.84);
  stroke-width: 0.52;
  vector-effect: non-scaling-stroke;
  transition: opacity 350ms ease, fill 350ms ease, stroke 350ms ease;
}

.map-unit.region-praha {
  stroke: rgba(32, 33, 35, 0.42);
  stroke-width: 0.85;
}

.map-unit.is-dimmed {
  opacity: 0.16;
}

.map-unit.is-highlight {
  stroke: var(--ink);
  stroke-width: 1.65;
}

.prague-ring {
  fill: none;
  stroke: var(--ochre);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.prague-dot {
  fill: var(--ochre);
}

.prague-text {
  fill: #6a4a18;
  font-size: 16px;
  font-weight: 760;
}

.lead-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 56px);
  transform: translateY(-32px);
}

.lead-strip div {
  min-height: 132px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: var(--white);
}

.lead-strip span,
.lead-strip small,
.scene-label,
.caption,
.map-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.lead-strip span {
  display: block;
  font-weight: 780;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lead-strip strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
}

.lead-strip small {
  display: block;
  margin-top: 9px;
}

.scrolly {
  display: grid;
  grid-template-columns: 52px minmax(320px, 0.72fr) minmax(560px, 1.28fr);
  gap: clamp(18px, 3vw, 42px);
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 56px) 80px;
}

.chapter-list {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 8px;
}

.chapter-list a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.chapter-list a.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.chapters {
  padding-top: 6vh;
}

.chapter {
  min-height: 82vh;
  padding: 14vh 0 10vh;
  border-top: 1px solid var(--line);
  opacity: 0.48;
  transition: opacity 240ms ease;
}

.chapter.is-active {
  opacity: 1;
}

.chapter h2,
.wide-feature h2,
.method h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(33px, 4.2vw, 58px);
  font-weight: 500;
  line-height: 1.02;
}

.chapter p:not(.kicker),
.wide-feature p,
.method p {
  margin: 18px 0 0;
  color: #4b4740;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.5;
}

.sticky-visual {
  position: sticky;
  top: 18px;
  align-self: start;
  min-height: calc(100vh - 36px);
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.viz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  background: #f4ecdf;
}

.segmented button {
  min-width: 98px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--ink);
  color: var(--white);
}

.viz-stage {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.viz-panel {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 320ms ease, transform 320ms ease;
}

.viz-panel.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.map-note {
  position: absolute;
  right: 14px;
  bottom: 14px;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
}

.caption {
  min-height: 42px;
  padding-top: 12px;
}

.chart-axis,
.chart-grid {
  stroke: #d4c8b7;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-grid {
  stroke-dasharray: 3 5;
}

.chart-label,
.chart-tick {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.band-bar {
  fill: var(--teal);
}

.band-bg {
  fill: #efe5d6;
}

.comparison {
  display: grid;
  gap: 20px;
  padding: 20px 10px;
}

.compare-row {
  display: grid;
  grid-template-columns: 160px 1fr minmax(96px, auto);
  gap: 14px;
  align-items: center;
}

.compare-row h3,
.rank-row strong {
  margin: 0;
  font-size: 16px;
}

.compare-row small,
.rank-row span,
.mini-metrics small {
  color: var(--muted);
  font-size: 12px;
}

.compare-track {
  height: 16px;
  background: #efe5d6;
}

.compare-fill {
  height: 100%;
  background: var(--teal);
}

.compare-fill.household {
  background: var(--ochre);
}

.compare-value {
  text-align: right;
  font-family: var(--serif);
  font-size: 27px;
}

.ranking {
  display: grid;
  gap: 8px;
  padding: 18px 4px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px minmax(180px, 1fr) 110px 74px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rank-index {
  color: var(--ochre);
  font-weight: 820;
}

.rank-value {
  text-align: right;
  font-family: var(--serif);
  font-size: 24px;
}

.rank-region {
  justify-self: end;
  padding: 4px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.wide-feature {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: clamp(22px, 5vw, 70px);
  max-width: 1180px;
  margin: 0 auto 74px;
  padding: 54px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  align-self: start;
  border: 1px solid var(--line);
  background: var(--line);
}

.mini-metrics div {
  min-height: 118px;
  padding: 18px;
  background: var(--white);
}

.mini-metrics strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
}

.method {
  max-width: 820px;
  margin: 0 auto;
  padding: 46px clamp(18px, 4vw, 56px) 80px;
}

.method h2 {
  font-size: clamp(30px, 4vw, 48px);
}

.method a {
  display: inline-flex;
  align-items: center;
  margin-top: 22px;
}

@media (max-width: 1080px) {
  .hero-grid,
  .scrolly,
  .wide-feature {
    grid-template-columns: 1fr;
  }

  .chapter-list {
    position: static;
    display: flex;
    padding-bottom: 6px;
  }

  .chapters {
    padding-top: 0;
  }

  .chapter {
    min-height: auto;
    padding: 48px 0;
  }

  .sticky-visual {
    position: relative;
    top: auto;
    min-height: auto;
  }

  .viz-stage {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .story-hero {
    min-height: auto;
    padding-bottom: 26px;
  }

  .story-nav,
  .hero-map-frame figcaption,
  .viz-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .lead-strip,
  .mini-metrics {
    grid-template-columns: 1fr;
  }

  .lead-strip {
    transform: none;
    padding-top: 18px;
  }

  .scrolly {
    padding-top: 38px;
  }

  .hero-copy h1 {
    font-size: clamp(47px, 16vw, 70px);
  }

  .dek,
  .chapter p:not(.kicker),
  .wide-feature p,
  .method p {
    font-size: 18px;
  }

  .sticky-visual {
    padding: 12px;
  }

  .viz-stage {
    min-height: 430px;
  }

  .compare-row {
    grid-template-columns: 1fr;
  }

  .compare-value {
    text-align: left;
  }

  .rank-row {
    grid-template-columns: 28px minmax(0, 1fr) 78px;
  }

  .rank-region {
    display: none;
  }
}
