:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --bg-raised: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #4a463f;
  --ink-faint: #7a756a;
  --line: #ddd6c9;
  --accent: #b3401f;
  --focus: #1c6fa8;

  --f-agriculture: #2e7d32;
  --f-industry_utilities: #3f51b5;
  --f-construction: #c77800;
  --f-trade_transport_horeca: #0288a8;
  --f-info_comm: #c2185b;
  --f-finance_insurance: #00897b;
  --f-real_estate: #8e24aa;
  --f-professional_admin_support: #f9a825;
  --f-public_admin_edu_health: #8d6e63;
  --f-arts_other_services: #757575;

  font-size: 17px;
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #17150f;
    --bg-raised: #211e17;
    --ink: #efe9dd;
    --ink-soft: #cabfa9;
    --ink-faint: #948a76;
    --line: #3a352a;
    --accent: #e08a5f;
    --focus: #6fb3e0;
  }
}

:root[data-theme="dark"] {
  --bg: #17150f;
  --bg-raised: #211e17;
  --ink: #efe9dd;
  --ink-soft: #cabfa9;
  --ink-faint: #948a76;
  --line: #3a352a;
  --accent: #e08a5f;
  --focus: #6fb3e0;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif", serif;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

main, header.masthead, footer.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

.masthead {
  padding-top: 44px;
  padding-bottom: 12px;
}

.kicker {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(2rem, 8vw, 2.9rem);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.deck {
  font-size: 1.14rem;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 34em;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}

.lead {
  font-size: 1.14rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
  font-style: italic;
}

.narrative-block {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}

.narrative-block p {
  margin: 0 0 14px;
}

.callout {
  font-size: 1.05rem;
  background: var(--bg-raised);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 2px;
}

.fine-print {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

.aside {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 16px;
  margin-top: 8px;
}
.aside summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
}
.aside p { padding-bottom: 12px; }

.noscript-note {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  color: var(--ink-soft);
}

/* ---------------- Stage / canvas ---------------- */

.stage {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 32px;
}

.stage-instruction {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 10px;
  max-width: 34em;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.year-readout {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  font-size: 1.05rem;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  touch-action: manipulation;
}

.canvas-wrap.small {
  aspect-ratio: 16 / 10;
  margin: 20px 0;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 220px;
  transform: translate(-50%, -110%);
  z-index: 5;
}

.view-toggle {
  display: flex;
  gap: 6px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.view-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-soft);
  cursor: pointer;
  flex: 1 1 auto;
}

.view-btn.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.view-btn:focus-visible, .compare-btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sentence {
  font-size: 1rem;
  min-height: 2.6em;
  color: var(--ink-soft);
}

.time-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.time-label {
  font-size: 0.85rem;
  color: var(--ink-faint);
}

#year-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  min-height: 44px;
}

.play-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.play-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.play-btn svg {
  transform: translateX(1px);
}
.play-btn[aria-pressed="true"] svg {
  transform: none;
}

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

.compare-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  padding: 9px 12px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.compare-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.legend {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 4px;
  color: var(--ink-soft);
}

.legend li.is-selected {
  color: var(--ink);
  font-weight: 600;
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

/* ---------------- bars (compensation / productivity) ---------------- */

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.bar-row .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.bar-track {
  height: 14px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.bar-fill {
  height: 100%;
}

.method-list {
  padding-left: 1.1em;
}
.method-list li { margin-bottom: 10px; }

.site-footer {
  padding: 30px 20px 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.site-footer a { color: inherit; }

@media (min-width: 760px) {
  main, header.masthead, footer.site-footer { max-width: 760px; }
  .stage { max-width: 760px; }
  .legend { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
