/*
 * Shared editorial system for the education story and regional atlas.
 *
 * The important rule here is structural: every data-driven figure reserves
 * its finished footprint before story.json arrives.  That keeps a reader's
 * place stable on a slow connection and when opening a deep link.  Motion is
 * limited to small colour/opacity feedback; nothing continuously moves and no
 * chart geometry animates into place.
 */

:root {
  color-scheme: light;
  --paper: #f4efe6;
  --paper-raised: #fffdf8;
  --paper-muted: #ebe4d9;
  --ink: #172235;
  --ink-soft: #536076;
  --ink-faint: #768197;
  --night: #111c2d;
  --night-raised: #19283d;
  --night-soft: #aab8ca;
  /* These values exactly mirror EducationCharts.PALETTE.  A colour therefore
     keeps the same meaning in SVG lines, CSS bars, legends, and prose cards. */
  --series-spo: #c92f3a;
  --series-vpo: #2f70d8;
  --series-violet: #7566d7;
  --series-amber: #965b00;
  --series-teal: #147c77;
  --series-neutral: #657286;
  --accent: #c92f3a;
  --focus: #2f70d8;
  --line: rgba(52, 65, 86, 0.18);
  --line-strong: rgba(52, 65, 86, 0.32);
  --line-dark: rgba(255, 255, 255, 0.15);
  --shadow-card: 0 18px 55px rgba(30, 41, 59, 0.09);
  --shadow-float: 0 22px 70px rgba(7, 15, 28, 0.22);
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --content: 76rem;
  --reading: 48rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --radius-large: 1.5rem;
  --radius-medium: 1rem;
  --control-height: 2.75rem;
  --chart-svg-font-size: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
a,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
select {
  min-height: var(--control-height);
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

p,
h1,
h2,
h3,
figure {
  margin-top: 0;
}

p:last-child,
figure:last-child {
  margin-bottom: 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  inset: 0.5rem auto auto 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 0.6rem;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* One compact row at every scale. The navigation scrolls inside that row, so
   its intrinsic width can never widen the document on a phone. */
.story-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 4.5rem;
  padding: 0.65rem max(1rem, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(17, 28, 45, 0.96);
  color: #fff;
  box-shadow: 0 0.35rem 1.5rem rgba(8, 14, 24, 0.12);
  backdrop-filter: blur(18px);
}

.story-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  margin-right: clamp(0.75rem, 3vw, 2.25rem);
  color: #fff;
  text-decoration: none;
}

.story-brand-mark {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
}

.story-brand-mark::after {
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  margin: -1.95rem 0 0 1.95rem;
  border-radius: 50%;
  background: var(--series-spo);
  content: "";
}

.story-brand-copy {
  display: grid;
  line-height: 1.1;
  white-space: nowrap;
}

.story-brand-copy strong {
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.story-brand-copy small {
  margin-top: 0.22rem;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-nav {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.story-nav::-webkit-scrollbar {
  display: none;
}

.story-nav a {
  display: inline-flex;
  min-height: 2.75rem;
  flex: 0 0 auto;
  align-items: center;
  padding: 0.55rem 0.78rem;
  border-radius: 99rem;
  color: rgba(255, 255, 255, 0.73);
  font-size: 0.86rem;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.story-nav a:hover,
.story-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.story-error {
  position: relative;
  z-index: 90;
  padding: 0.85rem var(--gutter);
  border-bottom: 1px solid #a42731;
  background: #fff0f1;
  color: #7f1921;
  font-weight: 700;
  text-align: center;
}

/* Hero */
.story-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 0.75fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  min-height: min(50rem, calc(100svh - 4.5rem));
  padding: clamp(4rem, 8vw, 7.5rem) max(var(--gutter), calc((100vw - var(--content)) / 2));
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 16%, rgba(47, 112, 216, 0.2), transparent 30rem),
    linear-gradient(135deg, #101a2a 0%, #17263b 55%, #101a2a 100%);
  color: #fff;
}

.story-hero-copy {
  min-width: 0;
  max-width: 50rem;
}

.story-eyebrow,
.story-kicker,
.figure-overline {
  margin-bottom: 0.8rem;
  color: var(--series-spo);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  line-height: 1.35;
  text-transform: uppercase;
}

.story-hero h1 {
  max-width: 13ch;
  margin-bottom: 1.65rem;
  font-family: var(--font-serif);
  font-size: clamp(2.7rem, 6.1vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.048em;
  line-height: 0.96;
  text-wrap: balance;
}

.story-hero h1 em {
  color: #d4deec;
  font-size: 0.64em;
  font-weight: 400;
}

.story-hero-lead {
  max-width: 46rem;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  line-height: 1.72;
}

.story-hero-actions,
.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 0.72rem;
  font-size: 0.91rem;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  background: var(--series-spo);
  color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: #bd2733;
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.13);
}

.story-hero .story-hero-key {
  --paper-strong: #1c2c42;
  align-self: center;
  min-width: 0;
  padding: clamp(1.3rem, 3vw, 2rem);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: var(--shadow-float);
}

.story-hero-key > strong {
  display: block;
  margin: 0 0 0.4rem;
  color: #fff;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}

.story-hero-key > p:not(.figure-overline) {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.96rem;
}

.story-hero .story-hero-key figcaption {
  border-top-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.72);
}

/* Chapters share one grid and one spacing rhythm. */
.chapter {
  scroll-margin-top: 4.6rem;
  padding: clamp(4.5rem, 8vw, 8rem) max(var(--gutter), calc((100vw - var(--content)) / 2));
}

.chapter > * {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
}

.chapter--paper {
  background: var(--paper);
}

#fields,
#work {
  background: #ece5db;
}

.chapter--ink {
  --ink: #f7f9fc;
  --ink-soft: #afbbca;
  --ink-faint: #8e9bae;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.23);
  --paper-strong: var(--night-raised);
  background:
    radial-gradient(circle at 15% 35%, rgba(201, 47, 58, 0.09), transparent 32rem),
    var(--night);
  color: var(--ink);
}

.chapter-head {
  display: grid;
  grid-template-columns: minmax(13rem, 0.72fr) minmax(19rem, 1.28fr);
  gap: 0.6rem clamp(2rem, 6vw, 6rem);
  align-items: start;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.chapter-head .story-kicker {
  grid-column: 1;
}

.chapter-head h2 {
  grid-column: 1;
  margin-bottom: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4.6vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.042em;
  line-height: 1.02;
  text-wrap: balance;
}

.chapter-head > p:not(.story-kicker) {
  grid-column: 2;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.3vw, 1.14rem);
  line-height: 1.75;
}

.chapter-head > .definition-note {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-left: 0.25rem solid var(--series-amber);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink);
  font-size: 0.94rem;
}

.chapter--ink .chapter-head > p:not(.story-kicker) {
  color: var(--night-soft);
}

.story-grid {
  display: grid;
  min-width: 0;
  gap: clamp(1.1rem, 2.7vw, 2rem);
  align-items: start;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
}

.story-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-grid > * {
  min-width: 0;
}

/* Figures deliberately have no lifting hover effect: a chart must stay under
   the pointer while it is being inspected. */
.story-figure,
.prose,
.story-reading,
.download-panel {
  min-width: 0;
  margin-top: 0;
  margin-inline: 0;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
  padding: clamp(1.15rem, 2.7vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
}

.chapter--ink .story-figure,
.chapter--ink .prose,
.chapter--ink .story-reading {
  border-color: var(--line-dark);
  background: var(--night-raised);
  box-shadow: 0 20px 60px rgba(4, 10, 20, 0.24);
}

.story-figure-wide,
.story-reading-wide {
  width: 100%;
}

.figure-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.52fr);
  gap: 1rem 2rem;
  align-items: end;
  margin-bottom: clamp(1rem, 2.5vw, 1.65rem);
}

.figure-heading h3,
.story-reading h3,
.prose h3,
.download-panel h3,
.source-entry h3 {
  margin-bottom: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
  text-wrap: balance;
}

.figure-heading > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.chapter--ink .figure-heading > p {
  color: var(--night-soft);
}

figcaption {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.source-note {
  display: inline;
  margin-left: 0.3rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.source-note a {
  color: inherit;
}

.prose,
.story-reading {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.prose strong,
.story-reading strong {
  color: var(--ink);
}

.field-story__note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.91rem;
}

/* Controls */
.story-mode-switch,
.region-toolbar,
.lineage-controls {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.story-mode-switch {
  width: fit-content;
  max-width: 100%;
  padding: 0.28rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.45);
}

.story-mode-switch button {
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 780;
}

.story-mode-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-raised);
  box-shadow: 0 0.25rem 0.9rem rgba(23, 34, 53, 0.14);
}

.story-mode-switch button:hover:not([aria-pressed="true"]) {
  background: rgba(23, 34, 53, 0.07);
  color: var(--ink);
}

.region-toolbar label,
.lineage-controls label {
  display: grid;
  min-width: min(100%, 14rem);
  gap: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.region-toolbar select,
.lineage-controls select {
  width: 100%;
  max-width: 26rem;
  padding: 0.55rem 2.25rem 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.96rem;
  font-weight: 650;
  text-transform: none;
}

/* Stable fact cards. Placeholder and live cards intentionally share the same
   dimensions, preventing the first data render from moving the next figure. */
.fact-row,
.benchmark-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.85rem;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
}

.story-fact,
.fact-placeholder {
  display: grid;
  min-width: 0;
  min-height: 10rem;
  align-content: start;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(255, 253, 248, 0.7);
}

.chapter--ink .story-fact,
.chapter--ink .fact-placeholder {
  background: rgba(255, 255, 255, 0.045);
}

.story-fact__label,
.fact-placeholder > span {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.075em;
  line-height: 1.35;
  text-transform: uppercase;
}

.story-fact__value,
.fact-placeholder > strong {
  display: block;
  margin-top: 0.5rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.story-fact__copy,
.fact-placeholder > p {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.fact-placeholder {
  opacity: 0.58;
}

/* Chart stages: these are the finished footprints, not skeleton estimates. */
.chart-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 28rem;
  container-type: inline-size;
  contain: layout paint;
}

.chart-stage-mini {
  display: grid;
  min-height: 13rem;
  place-content: center stretch;
}

#growth-decomposition {
  min-height: 15rem;
}

#field-change-chart {
  min-height: 73rem;
}

#convergence-chart {
  min-height: 20rem;
}

#moscow-cohort-benchmark {
  min-height: 31rem;
}

#moscow-profile {
  min-height: 33rem;
}

#region-profile {
  min-height: 74rem;
}

#employment-education-chart {
  min-height: 19rem;
}

#vacancy-chart {
  min-height: 34rem;
}

#national-chart,
#region-chart {
  min-height: 33rem;
}

.chart-stage[data-state="loading"] {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 0.9rem;
  background:
    linear-gradient(90deg, transparent 49.8%, var(--line) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, var(--line) 50%, transparent 50.2%);
}

.loading-copy {
  max-width: 24rem;
  padding: 0.65rem 0.85rem;
  border-radius: 99rem;
  background: var(--paper-raised);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: center;
}

.chapter--ink .loading-copy,
.story-hero .loading-copy {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.72);
}

/* Shared line-chart renderer */
.interactive-chart {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: 0.75rem;
  outline: none;
}

.interactive-chart:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.chart-svg-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.chart-svg-scroll svg,
.interactive-chart > svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

svg text,
.interactive-chart svg text {
  font-family: var(--font-sans);
  font-size: var(--chart-svg-font-size, 14px);
}

.chart-series-key,
.bar-legend,
.profile-legend,
.stack-legend {
  display: flex;
  min-height: 2rem;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: center;
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 780;
}

.chart-series-key {
  display: none;
}

.chart-series-key span,
.bar-legend span,
.profile-legend span,
.stack-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.bar-legend span::before,
.profile-legend span::before,
.stack-legend span::before {
  width: 0.62rem;
  height: 0.62rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--legend-color, var(--series-neutral));
  content: "";
}

.bar-legend__spo,
.profile-legend__primary,
.stack-legend__spo {
  --legend-color: var(--series-spo);
}

.bar-legend__vpo,
.stack-legend__higher {
  --legend-color: var(--series-vpo);
}

.profile-legend__benchmark,
.stack-legend__other {
  --legend-color: var(--series-neutral);
}

.bar-legend__axis {
  margin-left: auto;
  font-weight: 600;
}

.bar-legend__axis::before {
  display: none;
}

.chart-grid-line {
  stroke: rgba(83, 96, 118, 0.18);
  stroke-dasharray: 2 5;
}

.chart-axis-label {
  fill: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--chart-svg-font-size, 14px);
}

.chapter--ink .chart-grid-line,
.story-hero .chart-grid-line {
  stroke: rgba(255, 255, 255, 0.13);
}

.chapter--ink .chart-axis-label,
.story-hero .chart-axis-label {
  fill: rgba(255, 255, 255, 0.7);
}

.chart-axis-label-end {
  display: none;
}

.chart-highlight-line {
  stroke: rgba(83, 96, 118, 0.35);
  stroke-dasharray: 4 5;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.chart-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
}

.chart-point {
  stroke: var(--paper-raised);
  stroke-width: 3;
  cursor: crosshair;
  vector-effect: non-scaling-stroke;
}

.chapter--ink .chart-point {
  stroke: var(--night-raised);
}

.chart-point:focus,
.chart-point:hover {
  r: 6;
}

.chart-hit-area {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
  touch-action: pan-y;
}

.chart-interaction {
  pointer-events: none;
}

.chart-crosshair {
  stroke: rgba(23, 34, 53, 0.46);
  stroke-dasharray: 4 4;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.chapter--ink .chart-crosshair {
  stroke: rgba(255, 255, 255, 0.55);
}

.chart-hover-point {
  stroke: var(--paper-raised);
  stroke-width: 3;
  filter: drop-shadow(0 2px 4px rgba(13, 20, 28, 0.18));
}

.chapter--ink .chart-hover-point {
  stroke: var(--night-raised);
}

.chart-direct-label {
  font-family: var(--font-sans);
  font-size: var(--chart-svg-font-size, 14px);
  font-weight: 850;
  paint-order: stroke;
  stroke: var(--paper-raised);
  stroke-linejoin: round;
  stroke-width: 4px;
}

.chapter--ink .chart-direct-label {
  stroke: var(--night-raised);
}

.chart-label-connector {
  opacity: 0.58;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-tooltip {
  position: absolute;
  z-index: 12;
  width: min(18rem, calc(100% - 1rem));
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.8rem;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 1rem 2.5rem rgba(13, 20, 28, 0.18);
  color: var(--ink);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

.chapter--ink .chart-tooltip {
  border-color: var(--line-dark);
  background: rgba(17, 28, 45, 0.97);
  color: #fff;
}

.chart-tooltip.align-right {
  transform: none;
}

.chart-tooltip-year {
  display: block;
  margin-bottom: 0.55rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
}

.chart-tooltip-body {
  display: grid;
  gap: 0.6rem;
}

.chart-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.chart-tooltip-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
}

.chart-tooltip-swatch {
  width: 0.58rem;
  height: 0.58rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--series-color);
}

.chart-tooltip-row small {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.875rem;
  line-height: 1.45;
}

.chapter--ink .chart-tooltip-row small {
  color: var(--night-soft);
}

.chart-data {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.chart-data summary {
  min-height: var(--control-height);
  padding: 0.62rem 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 780;
}

.chart-table-wrap {
  max-height: 18rem;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.chart-data table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.chart-data th,
.chart-data td {
  padding: 0.52rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.chart-data th:first-child,
.chart-data td:first-child {
  text-align: left;
}

.chapter--ink .chart-data,
.chapter--ink .chart-data th,
.chapter--ink .chart-data td,
.chapter--ink .chart-table-wrap {
  border-color: var(--line-dark);
}

.chapter--ink .chart-data summary {
  color: var(--night-soft);
}

/* Compact hero chart */
.hero-mini-svg {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
}

.hero-mini-grid {
  stroke: rgba(255, 255, 255, 0.13);
  stroke-dasharray: 3 6;
}

.hero-mini-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.hero-mini-label {
  fill: rgba(255, 255, 255, 0.86);
  font-size: var(--hero-mini-label-size, 24px);
  font-weight: 800;
  dominant-baseline: middle;
}

.hero-mini-years {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  padding-inline: 0.45rem 4.7rem;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* Custom comparison graphics */
.decomposition-row + .decomposition-row {
  margin-top: 1.5rem;
}

.decomposition-row__head {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
}

.decomposition-row__head span {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.decomposition-track {
  height: 2.25rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: rgba(83, 96, 118, 0.08);
}

.decomposition-fill {
  display: block;
  width: var(--bar-size);
  height: 100%;
  border-radius: 0.5rem;
  background: var(--bar-color);
}

.diverging-list,
.profile-list,
.vacancy-list,
.stack-bars {
  display: grid;
  gap: 0.38rem;
}

.diverging-row {
  display: grid;
  width: 100%;
  min-height: 3.45rem;
  grid-template-columns: minmax(8.5rem, 1.05fr) minmax(12rem, 1.8fr) minmax(6.8rem, auto);
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.diverging-row:hover {
  background: rgba(47, 112, 216, 0.06);
}

.diverging-row[aria-pressed="true"] {
  border-color: rgba(47, 112, 216, 0.35);
  background: rgba(47, 112, 216, 0.1);
}

.diverging-row__label {
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 720;
  line-height: 1.25;
}

.diverging-row__plot {
  position: relative;
  display: block;
  height: 2rem;
}

.diverging-row__zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line-strong);
}

.diverging-bar {
  position: absolute;
  top: var(--bar-offset);
  width: var(--bar-size);
  height: 0.55rem;
  border-radius: 99rem;
}

.diverging-bar.is-positive {
  left: 50%;
  border-radius: 0 99rem 99rem 0;
}

.diverging-bar.is-negative {
  right: 50%;
  border-radius: 99rem 0 0 99rem;
}

.diverging-bar--spo {
  background: var(--series-spo);
}

.diverging-bar--vpo {
  background: var(--series-vpo);
}

.diverging-row__values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.value-spo {
  color: var(--series-spo);
}

.value-vpo {
  color: var(--series-vpo);
}

.convergence-row {
  display: grid;
  min-height: 5.4rem;
  grid-template-columns: minmax(12rem, 1fr) minmax(17rem, 1.25fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.convergence-row__label {
  line-height: 1.35;
}

.convergence-row__values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.convergence-arrow {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 124, 119, 0.12);
  color: var(--series-teal);
  font-style: normal;
  font-weight: 900;
}

.convergence-arrow--down {
  background: rgba(150, 91, 0, 0.12);
  color: var(--series-amber);
}

/* Benchmark and paired profiles */
.benchmark-strip {
  padding: 1rem 0.25rem 1.5rem;
}

.benchmark-axis {
  position: relative;
  height: 0.55rem;
  border-radius: 99rem;
  background: linear-gradient(90deg, var(--series-neutral), var(--series-vpo));
}

.benchmark-marker {
  position: absolute;
  top: 50%;
  left: var(--marker-position);
  width: 1.1rem;
  height: 1.1rem;
  border: 0.2rem solid var(--paper-raised);
  border-radius: 50%;
  background: var(--series-spo);
  box-shadow: 0 0 0 2px var(--series-spo);
  transform: translate(-50%, -50%);
}

.chapter--ink .benchmark-marker {
  border-color: var(--night-raised);
}

.benchmark-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.benchmark-facts {
  margin-bottom: 0;
}

.profile-row,
.vacancy-row {
  display: grid;
  min-height: 3.25rem;
  grid-template-columns: minmax(9.5rem, 1.15fr) minmax(10rem, 1.6fr) minmax(6rem, auto);
  gap: 0.75rem;
  align-items: center;
  padding-block: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.profile-row__label,
.vacancy-row__label {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1.25;
}

.profile-row__tracks,
.vacancy-row__tracks {
  position: relative;
  display: block;
  height: 1.85rem;
}

.profile-bar,
.vacancy-bar {
  position: absolute;
  left: 0;
  width: var(--bar-size);
  height: 0.58rem;
  border-radius: 0 99rem 99rem 0;
}

.profile-bar--primary,
.vacancy-bar--moscow {
  top: 0.18rem;
  background: var(--series-spo);
}

.profile-bar--benchmark,
.vacancy-bar--russia {
  bottom: 0.18rem;
  background: var(--series-neutral);
}

.profile-row__values,
.vacancy-row__values {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

/* Employment and vacancy context */
.stack-legend__higher {
  --legend-color: var(--series-vpo);
}

.stack-legend__spo {
  --legend-color: var(--series-spo);
}

.stack-legend__other {
  --legend-color: var(--series-amber);
}

.stack-row {
  display: grid;
  min-height: 5.5rem;
  grid-template-columns: 6rem minmax(11rem, 1fr);
  gap: 0.45rem 0.8rem;
  align-items: center;
}

.stack-track {
  display: flex;
  height: 2.4rem;
  overflow: hidden;
  border-radius: 0.55rem;
  background: rgba(83, 96, 118, 0.08);
}

.stack-segment {
  display: block;
  width: var(--segment-size);
  height: 100%;
}

.stack-segment--higher {
  background: var(--series-vpo);
}

.stack-segment--spo {
  background: var(--series-spo);
}

.stack-segment--other {
  background: var(--series-amber);
}

.stack-row__exact {
  grid-column: 2;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* Evidence and indicator-lineage audit */
.lineage-note {
  max-width: var(--reading);
  margin-bottom: 1.5rem;
  color: var(--ink-soft);
}

code {
  padding: 0.1em 0.32em;
  border-radius: 0.3rem;
  background: rgba(83, 96, 118, 0.1);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  height: 42rem;
  margin-bottom: 0.75rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.lineage-table {
  width: 100%;
  min-width: 64rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.lineage-table th,
.lineage-table td {
  padding: 0.8rem 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.lineage-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #e7dfd3;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.lineage-table td:first-child,
.lineage-table th:first-child {
  position: sticky;
  left: 0;
}

.lineage-table td:first-child {
  z-index: 1;
  background: var(--paper-raised);
}

.lineage-table tr:hover td {
  background: #f7f0e6;
}

.lineage-table tr:hover td:first-child {
  background: #f7f0e6;
}

.lineage-table td strong,
.lineage-table td small {
  display: block;
}

.lineage-table td small {
  margin-top: 0.25rem;
  color: var(--ink-faint);
  /* Neutralise the browser's native <small> scaling inside the 0.86rem table. */
  font-size: 0.875rem;
}

.lineage-column-moved td:nth-child(3),
.lineage-column-moved td:nth-child(4) {
  background: rgba(47, 112, 216, 0.1);
  color: #225fae;
  font-weight: 750;
}

.lineage-definition-changed td:nth-child(3),
.lineage-definition-changed td:nth-child(5) {
  background: rgba(201, 47, 58, 0.11);
  color: #9f1f2a;
  font-weight: 750;
}

.lineage-added td:nth-child(3),
.lineage-added td:nth-child(4),
.lineage-removed td:nth-child(3),
.lineage-removed td:nth-child(4) {
  background: rgba(150, 91, 0, 0.11);
  color: #8a5006;
  font-weight: 750;
}

.lineage-empty,
.table-placeholder td {
  padding: 3rem 1rem !important;
  color: var(--ink-soft);
  text-align: center !important;
}

.lineage-table-status {
  margin-bottom: 2rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.method-grid,
.evidence-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: 2rem;
}

.method-grid > *,
.evidence-grid > * {
  min-width: 0;
}

.source-list,
.quality-notes {
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: rgba(255, 253, 248, 0.65);
}

.source-registry {
  display: grid;
  gap: 0;
}

.source-entry {
  display: grid;
  min-width: 0;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.source-entry:last-child {
  border-bottom: 0;
}

.source-entry__number {
  color: var(--series-spo);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
}

.source-entry__body {
  min-width: 0;
}

.source-entry h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.source-entry h3 a {
  color: var(--ink);
}

.source-entry__meta,
.source-entry__caveat {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.81rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.source-entry__caveat {
  color: #805a22;
}

.quality-notes {
  margin: 0;
  padding-left: 3rem;
  color: var(--ink-soft);
}

.quality-notes li + li {
  margin-top: 0.75rem;
}

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: center;
  margin-top: 2rem;
}

.download-panel .button-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.download-panel .button-secondary:hover {
  background: rgba(23, 34, 53, 0.06);
}

.story-footer {
  display: flex;
  min-height: 8rem;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding: 2rem max(var(--gutter), calc((100vw - var(--content)) / 2));
  background: #0b1422;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.84rem;
}

.story-build-meta {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Motion language --------------------------------------------------------
   Every entrance uses only opacity and compositor transforms.  The final box
   geometry is present from the first frame, so these effects do not move the
   article, disturb deep links, or fight a reader who is panning a chart. */
.story-nav a,
.button,
.story-mode-switch button,
.diverging-row,
.chart-data summary,
.source-entry a,
.lineage-table td {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.story-hero-copy > * {
  animation: story-rise 620ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.story-hero-copy > :nth-child(2) {
  animation-delay: 70ms;
}

.story-hero-copy > :nth-child(3) {
  animation-delay: 140ms;
}

.story-hero-copy > :nth-child(4) {
  animation-delay: 210ms;
}

.story-hero .story-hero-key {
  animation: story-rise 720ms 180ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.story-fact {
  animation: story-fact-in 420ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.fact-row .story-fact:nth-child(2),
.benchmark-facts .story-fact:nth-child(2) {
  animation-delay: 55ms;
}

.fact-row .story-fact:nth-child(3),
.benchmark-facts .story-fact:nth-child(3) {
  animation-delay: 110ms;
}

.fact-row .story-fact:nth-child(4),
.benchmark-facts .story-fact:nth-child(4) {
  animation-delay: 165ms;
}

/* The curves are already the final monotone paths; fading them in avoids the
   broken/dashed tails produced by stroke-dash drawing tricks. */
.chart-path {
  animation: chart-line-in 620ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
  animation-delay: var(--chart-series-delay, 0ms);
}

.chart-point {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: chart-point-in 380ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--chart-point-delay, 120ms);
}

.hero-mini-line,
.hero-mini-svg circle {
  animation: chart-line-in 560ms 160ms ease both;
}

.decomposition-fill,
.diverging-bar,
.profile-bar,
.vacancy-bar,
.stack-segment {
  transform: scaleX(0);
  transform-origin: left center;
  animation: chart-bar-in 560ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.diverging-bar.is-negative {
  transform-origin: right center;
}

.benchmark-marker,
.convergence-arrow {
  animation: chart-marker-in 440ms 120ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes story-rise {
  from {
    opacity: 0;
    transform: translateY(0.8rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes story-fact-in {
  from {
    opacity: 0;
    transform: translateY(0.45rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chart-line-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes chart-point-in {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes chart-bar-in {
  from {
    opacity: 0.35;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes chart-marker-in {
  from {
    opacity: 0;
    scale: 0.6;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

/* Container queries respond to the actual card width, including at browser
   zoom levels where viewport media queries alone can be misleading. */
@container (max-width: 38rem) {
  .chart-series-key {
    display: flex;
  }

  .chart-series-key::after {
    display: block;
    margin-left: auto;
    color: var(--ink-faint);
    content: "листайте график →";
    font-size: 0.75rem;
    font-weight: 650;
    white-space: nowrap;
  }

  .chart-svg-scroll svg {
    width: 47.5rem;
    max-width: none;
  }

  .chart-direct-label {
    display: none;
  }

  .chart-axis-label-end {
    display: block;
  }

  .diverging-row {
    min-height: 4.65rem;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.7rem;
  }

  .diverging-row__label {
    grid-column: 1 / -1;
  }

  .diverging-row__plot {
    min-width: 0;
  }

  .convergence-row {
    min-height: 7.1rem;
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .profile-row,
  .vacancy-row {
    min-height: 4.7rem;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.7rem;
  }

  .profile-row__label,
  .vacancy-row__label {
    grid-column: 1 / -1;
  }

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

  .stack-row__exact {
    grid-column: 1;
  }
}

/* The primary navigation names the two products; this secondary row is the
   local table of contents shared by both pages. */
.context-nav {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem max(var(--gutter), calc((100vw - var(--content)) / 2));
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  contain: inline-size;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 239, 230, 0.96);
  color: var(--ink-soft);
  scrollbar-width: none;
}

.context-nav::-webkit-scrollbar {
  display: none;
}

.context-nav a {
  display: inline-flex;
  min-height: 2.5rem;
  flex: 0 0 auto;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 99rem;
  font-size: 0.82rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.context-nav a:hover,
.context-nav a:focus-visible {
  background: var(--paper-raised);
  color: var(--ink);
}

.concise-sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.source-card {
  min-width: 0;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(255, 253, 248, 0.68);
}

.source-card h3 {
  margin-bottom: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.98rem;
}

.source-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.55;
}

@media (max-width: 62.5rem) {
  .story-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .story-hero-copy {
    max-width: 55rem;
  }

  .story-hero-key {
    width: min(100%, 42rem);
  }

  .story-grid--2,
  .method-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .chapter-head {
    grid-template-columns: 1fr;
    max-width: 58rem;
  }

  .chapter-head .story-kicker,
  .chapter-head h2,
  .chapter-head > p:not(.story-kicker) {
    grid-column: 1;
  }

  .story-reading,
  .prose {
    min-height: 0;
  }

  /* Once the editorial grids collapse, the custom graphics have more inline
     room and need fewer wrapped rows than their half-column desktop forms. */
  .chart-stage:not(.chart-stage-mini) {
    min-height: 28rem;
  }

  #national-chart,
  #region-chart {
    min-height: 28rem;
  }

  #field-change-chart {
    min-height: 56rem;
  }

  #moscow-cohort-benchmark {
    min-height: 24rem;
  }

  #moscow-profile {
    min-height: 33rem;
  }

  #region-profile {
    min-height: 61rem;
  }

  #employment-education-chart {
    min-height: 19rem;
  }

  #vacancy-chart {
    min-height: 29rem;
  }

  .method-grid,
  .evidence-grid {
    margin-top: 1.5rem;
  }
}

@media (max-width: 48rem) {
  .context-nav {
    padding-inline: var(--gutter);
  }

  :root {
    --gutter: clamp(0.85rem, 4vw, 1.5rem);
  }

  html {
    scroll-padding-top: 4.25rem;
  }

  .story-header {
    min-height: 4rem;
    padding-block: 0.5rem;
  }

  .story-brand-copy {
    display: none;
  }

  .story-brand {
    margin-right: 0.45rem;
  }

  .story-brand-mark {
    width: 2.35rem;
    height: 2.35rem;
  }

  .story-nav {
    justify-content: flex-start;
  }

  .story-nav a {
    min-height: 2.65rem;
    padding-inline: 0.68rem;
    font-size: 0.82rem;
  }

  .story-hero {
    padding-block: 3.6rem 4.5rem;
  }

  .story-hero h1 {
    max-width: 14ch;
    font-size: clamp(2.35rem, 12vw, 4rem);
  }

  .chapter {
    scroll-margin-top: 4rem;
    padding-block: 4rem;
  }

  .figure-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .story-figure,
  .prose,
  .story-reading,
  .download-panel {
    padding: 1rem;
    border-radius: 1.05rem;
  }

  .fact-row,
  .benchmark-facts {
    grid-template-columns: 1fr;
  }

  .story-fact,
  .fact-placeholder {
    min-height: 8.75rem;
  }

  #field-change-chart {
    min-height: 68rem;
  }

  #moscow-cohort-benchmark {
    min-height: 33rem;
  }

  #moscow-profile {
    min-height: 43rem;
  }

  #region-profile {
    min-height: 69rem;
  }

  #vacancy-chart {
    min-height: 35rem;
  }

  .bar-legend__axis {
    width: 100%;
    margin-left: 0;
  }

  .download-panel {
    grid-template-columns: 1fr;
  }

  .download-links {
    justify-content: flex-start;
  }
}

@media (max-width: 30rem) {
  .story-hero h1 br {
    display: none;
  }

  .story-hero-actions,
  .download-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .story-mode-switch {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .story-mode-switch button {
    width: 100%;
  }

  /* At the smallest supported width labels wrap onto extra lines.  These
     values include that final wrapped height, so loading placeholders remain
     the same size as their rendered graphics. */
  .chart-stage:not(.chart-stage-mini) {
    min-height: 30rem;
  }

  #national-chart,
  #region-chart {
    min-height: 30rem;
  }

  #growth-decomposition {
    min-height: 15rem;
  }

  #field-change-chart {
    min-height: 82rem;
  }

  #convergence-chart {
    min-height: 22rem;
  }

  #moscow-cohort-benchmark {
    min-height: 39rem;
  }

  #moscow-profile {
    min-height: 43rem;
  }

  #region-profile {
    min-height: 76rem;
  }

  #employment-education-chart {
    min-height: 19rem;
  }

  #vacancy-chart {
    min-height: 41rem;
  }

  .lineage-controls,
  .region-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lineage-controls label,
  .region-toolbar label,
  .region-toolbar select,
  .lineage-controls select {
    width: 100%;
    max-width: none;
  }

  .chart-series-key::after {
    width: 100%;
    margin-left: 0;
  }

  .hero-mini-years {
    padding-right: 3.9rem;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(23, 34, 53, 0.42);
    --line-strong: rgba(23, 34, 53, 0.62);
  }

  .chapter--ink {
    --line: rgba(255, 255, 255, 0.35);
    --line-strong: rgba(255, 255, 255, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-delay: 0ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
