/* De ce mor românii — pânza cauzelor de deces.
   Pânza rămâne întunecată în ambele teme; restul paginii urmează tema. */

:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --bg-raised: #fffefb;
  --bg-sunken: #e7e4dd;
  --fg: #14161a;
  --fg-soft: #4d525a;
  --fg-faint: #454a52;
  --line: rgba(20, 22, 26, 0.14);
  --line-strong: rgba(20, 22, 26, 0.34);
  --shadow: rgba(18, 20, 26, 0.16);

  --canvas: #0c0e12;         /* fundalul pânzei, în ambele teme */
  --canvas-ink: #eceef2;
  --canvas-soft: #a4abb6;
  --canvas-line: rgba(236, 238, 242, 0.16);

  --f-circulator: #e05a6d;
  --f-tumori: #9b7ae8;
  --f-respirator: #37a8a0;
  --f-digestiv: #e0a13a;
  --f-externe: #4f9bea;
  --f-infectioase: #6fbf5a;
  --f-inceput: #d98cc0;
  --f-alte: #8f9bb0;
  --f-nedefinite: #aab2bb;

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  --container: 720px;
  --wide: 1180px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101216;
    --bg-raised: #171a20;
    --bg-sunken: #0b0d10;
    --fg: #eef0f4;
    --fg-soft: #b3bac5;
    --fg-faint: #a3aab5;
    --line: rgba(238, 240, 244, 0.15);
    --line-strong: rgba(238, 240, 244, 0.32);
    --shadow: rgba(0, 0, 0, 0.55);
    --f-circulator: #f0798a;
    --f-tumori: #ac8ff0;
    --f-respirator: #45c1b8;
    --f-digestiv: #efb254;
    --f-externe: #69ade9;
    --f-infectioase: #82d16c;
    --f-inceput: #eb9fd1;
    --f-alte: #a3aec1;
    --f-nedefinite: #bcc3cb;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101216;
  --bg-raised: #171a20;
  --bg-sunken: #0b0d10;
  --fg: #eef0f4;
  --fg-soft: #b3bac5;
  --fg-faint: #a3aab5;
  --line: rgba(238, 240, 244, 0.15);
  --line-strong: rgba(238, 240, 244, 0.32);
  --shadow: rgba(0, 0, 0, 0.55);
  --f-circulator: #f0798a;
  --f-tumori: #ac8ff0;
  --f-respirator: #45c1b8;
  --f-digestiv: #efb254;
  --f-externe: #69ade9;
  --f-infectioase: #82d16c;
  --f-inceput: #eb9fd1;
  --f-alte: #a3aec1;
  --f-nedefinite: #bcc3cb;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; letter-spacing: -0.012em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.5rem, 8.2vw, 5rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin-top: 0; }
h3 { font-size: 1.22rem; letter-spacing: 0; margin-bottom: .35em; }
p { margin: 0 0 1.1em; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
b, strong { font-weight: 600; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2.4rem, var(--container)); margin-inline: auto; }
.wrap-wide { width: min(100% - 2.4rem, var(--wide)); margin-inline: auto; }
.kicker { font-family: var(--sans); font-size: .76rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: .8em; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: .92rem; color: var(--fg-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- bara de sus ---------- */
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 0;
}
.topbar .brand { font-family: var(--serif); font-size: 1rem; text-decoration: none; color: var(--canvas-soft); }
.topbar .spacer { flex: 1; }
.lang { display: flex; gap: .35rem; }
.lang a, .theme-toggle {
  font: 600 .74rem/1 var(--sans); letter-spacing: .08em;
  padding: .48rem .62rem; border-radius: 999px;
  border: 1px solid var(--canvas-line); color: var(--canvas-soft);
  background: transparent; text-decoration: none; cursor: pointer;
}
.lang a[aria-current="page"] { background: rgba(236,238,242,.12); color: var(--canvas-ink); }
.lang a:hover, .theme-toggle:hover { color: var(--canvas-ink); border-color: var(--canvas-soft); }

/* ---------- eroul ---------- */
.hero {
  position: relative; background: var(--canvas); color: var(--canvas-ink);
  padding-bottom: 3.5rem; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(130% 95% at 6% 42%, rgba(12,14,18,.95) 0%, rgba(12,14,18,.86) 34%, rgba(12,14,18,.4) 72%, rgba(12,14,18,0) 100%);
}
.hero::after {
  content: ""; position: absolute; z-index: 1; inset: auto 0 0 0; height: 120px;
  background: linear-gradient(to bottom, transparent, var(--canvas));
  pointer-events: none;
}
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block;
}
.hero .inner { position: relative; z-index: 2; padding: 1.5rem 0 0; }
.hero h1 { color: var(--canvas-ink); margin-bottom: .28em; text-wrap: balance; }
.hero .kicker { color: #f0798a; }
.hero .deck {
  font-size: clamp(1.06rem, 2.3vw, 1.3rem); line-height: 1.5;
  color: var(--canvas-ink); max-width: 34em; margin-bottom: 1.6rem;
  text-shadow: 0 1px 24px rgba(12,14,18,.9);
}
.hero .deck b { color: #fff; }
.hero .byline { font-size: .82rem; color: var(--canvas-soft); margin: 0; }
.hero .scroll-hint { margin-top: 2.6rem; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--canvas-soft); }

/* ---------- scrollytelling ---------- */
.scrolly { position: relative; background: var(--canvas); color: var(--canvas-ink); }
.scrolly .stage {
  position: sticky; top: 0; height: 100svh;
  display: flex; flex-direction: column;
}
.stage-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.2rem;
  padding: 1rem 0 .3rem; min-height: 3.4rem;
}
.stage-title { font-family: var(--serif); font-size: 1.15rem; margin: 0; color: var(--canvas-ink); }
.stage-sub { font-size: .82rem; color: var(--canvas-soft); margin: 0; }
#stage-canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: pan-y; }
.legend {
  display: flex; flex-wrap: wrap; gap: .3rem .9rem;
  padding: .55rem 0 1rem; font-size: .78rem; color: var(--canvas-soft);
}
.legend button {
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: 0; padding: .15rem 0; cursor: pointer;
  font: inherit; color: inherit; border-bottom: 1px solid transparent;
}
.legend button i { width: 10px; height: 10px; border-radius: 3px; background: var(--sw); flex: none; }
.legend button[aria-pressed="true"] { color: var(--canvas-ink); border-bottom-color: var(--sw); }
.legend .val { color: var(--canvas-ink); font-variant-numeric: tabular-nums; }

.steps { position: relative; z-index: 2; pointer-events: none; }
.step {
  min-height: 92svh; display: flex; align-items: center;
  padding: 3rem 0;
}
.step > div {
  pointer-events: auto;
  background: rgba(10, 12, 16, .9);
  border: 1px solid var(--canvas-line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  max-width: 30rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.step p:last-child { margin-bottom: 0; }
.step .lead { font-family: var(--serif); font-size: 1.3rem; line-height: 1.35; }
.step b { color: #fff; }
.step .tag { font: 600 .7rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--canvas-soft); display: block; margin-bottom: .7rem; }
@media (min-width: 900px) {
  .step { justify-content: flex-start; }
  .steps { width: min(100% - 3rem, var(--wide)); margin-inline: auto; }
}
@media (min-width: 1000px) {
  /* pânza lasă coloana din stânga cardurilor; antetul și legenda o urmează */
  .stage-head, .legend, .age-console { padding-left: 504px; }
  .prose .seg { margin-left: 0; }
}

/* consola de vârstă */
.age-console {
  pointer-events: auto;
  display: flex; align-items: center; gap: .8rem;
  padding: .2rem 0 1rem;
}
.age-console.is-hidden { display: none; }
.age-console input[type="range"] { flex: 1; accent-color: var(--f-circulator); min-width: 0; }
.age-console output { font: 600 .84rem var(--mono); color: var(--canvas-ink); min-width: 6.5rem; text-align: right; }
.age-console .play {
  border: 1px solid var(--canvas-line); background: none; color: var(--canvas-ink);
  width: 2.1rem; height: 2.1rem; border-radius: 999px; cursor: pointer; flex: none; font-size: .8rem;
}

/* ---------- proza ---------- */
.prose { padding: 4.5rem 0; }
.prose h2 + .lede { font-size: 1.18rem; color: var(--fg-soft); }
.prose .figure-note { font-size: .88rem; color: var(--fg-faint); border-left: 2px solid var(--line); padding-left: .9rem; }

/* ---------- clasament ---------- */
.ranking { display: grid; gap: .3rem; margin: 1.6rem 0 .5rem; }
.rank-row {
  display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: .7rem;
  padding: .38rem 0; border-bottom: 1px solid var(--line);
}
.rank-row .i { font: 600 .78rem var(--mono); color: var(--fg-faint); }
.rank-row .bar { position: relative; }
.rank-row .fill { display: block; height: 9px; border-radius: 3px; background: var(--sw); min-width: 3px; }
.rank-row .lbl { font-size: .9rem; display: block; margin-bottom: .25rem; }
.rank-row .v { font: 600 .86rem var(--mono); color: var(--fg-soft); white-space: nowrap; }

/* ---------- dumbbell Europa ---------- */
.dumb { display: grid; gap: .1rem; margin: 1.8rem 0 1rem; }
.dumb-row { display: grid; grid-template-columns: minmax(6.5rem, 8.5rem) 1fr 3.6rem; align-items: center; gap: .8rem; padding: .45rem 0; }
.dumb-row .lbl { font-size: .88rem; }
.dumb-track { position: relative; height: 22px; }
.dumb-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.dumb-line { position: absolute; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 2px; background: var(--sw); opacity: .5; }
.dumb-dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; }
.dumb-dot.eu { background: var(--bg); border: 2px solid var(--fg-faint); }
.dumb-dot.ro { background: var(--sw); }
.dumb-row .x { font: 600 .84rem var(--mono); text-align: right; color: var(--fg-soft); }
.dumb-key { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .82rem; color: var(--fg-soft); align-items: center; }
.dumb-key .note { flex-basis: 100%; color: var(--fg-faint); }
.dumb-key i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.dumb-key .eu i { border: 2px solid var(--fg-faint); }
.dumb-key .ro i { background: var(--fg); }

/* ---------- casete ---------- */
.callout {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; margin: 2rem 0;
}
.callout h3 { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.stat { border-top: 3px solid var(--sw, var(--line-strong)); padding-top: .6rem; }
.stat b { display: block; white-space: nowrap; font-family: var(--serif); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .84rem; color: var(--fg-soft); display: block; margin-top: .3rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 1.4rem 0; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-faint); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

.method { background: var(--bg-sunken); }
.sources ol { padding-left: 1.2rem; font-size: .92rem; color: var(--fg-soft); }
.sources li { margin-bottom: .55rem; }

footer.wrap { padding: 2.5rem 0 3.5rem; border-top: 1px solid var(--line); font-size: .9rem; color: var(--fg-soft); }
footer .back-home { display: inline-block; margin-bottom: .5rem; text-decoration: none; }

/* tooltip pânză */
.tip {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0;
  transform: translate(-50%, -118%);
  background: #14171d; color: #eceef2; border: 1px solid rgba(236,238,242,.2);
  border-radius: 9px; padding: .5rem .65rem; font-size: .8rem; line-height: 1.35;
  max-width: 15rem; box-shadow: 0 12px 34px rgba(0,0,0,.5);
  transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { display: block; font-size: .86rem; }
.tip .m { font-variant-numeric: tabular-nums; color: #a4abb6; }

.noscript {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.5rem auto; width: min(100% - 2.4rem, var(--container));
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
@media (max-width: 899px) {
  /* pe telefon, pânza stă sus, textul urcă peste marginea ei de jos */
  .scrolly .stage { height: 58svh; }
  .step { min-height: 100svh; align-items: flex-end; padding: 1rem 0 1.6rem; }
  .step > div { padding: 1rem 1.1rem; font-size: .95rem; line-height: 1.55; }
  .step .lead { font-size: 1.14rem; }
  .step .tag { margin-bottom: .5rem; }
  .legend { font-size: .73rem; gap: .25rem .7rem; padding: .4rem 0 .7rem; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .step > div { max-width: none; }
  .stage-head { padding-top: .7rem; }
  .dumb-row { grid-template-columns: minmax(5rem, 7rem) 1fr 2.9rem; gap: .5rem; }
}

/* comutator de unitate */
.seg { display: inline-flex; gap: .25rem; border: 1px solid var(--line); border-radius: 999px; padding: .2rem; margin-bottom: .3rem; }
.seg button {
  font: 500 .85rem/1 var(--sans); color: var(--fg-soft); background: none;
  border: 0; border-radius: 999px; padding: .45rem .8rem; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); font-weight: 600; }
