:root {
  color-scheme: light;
  --bg: #f4f0e7;
  --surface: #fbf9f3;
  --surface-strong: #e9e3d6;
  --ink: #1b221f;
  --muted: #46514a;
  --rule: #a6aa9e;
  --link: #164f43;
  --accent: #8b2c1a;
  --band-zero: #c6c5b7;
  --band-some: #c36d42;
  --band-many: #14574b;
  --focus: #0648a8;
  --shadow: 0 16px 36px rgb(42 45 34 / 8%);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131a17;
  --surface: #1d2621;
  --surface-strong: #2a352e;
  --ink: #f4efe4;
  --muted: #c2cbbc;
  --rule: #657269;
  --link: #a9dac1;
  --accent: #ffad83;
  --band-zero: #9b9d8f;
  --band-some: #e48b61;
  --band-many: #6fc1a5;
  --focus: #96bcff;
  --shadow: 0 18px 40px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--link); text-decoration-thickness: .08em; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .14em; }
button, select { font: inherit; color: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.wrap { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 100; inset: 8px auto auto 8px; transform: translateY(-160%); padding: .7rem 1rem; background: var(--ink); color: var(--bg); }
.skip-link:focus { transform: translateY(0); }
.topbar { min-height: 72px; padding: 14px max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.wordmark { color: var(--ink); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-decoration: none; }
.wordmark span { color: var(--accent); margin-inline: .25rem; }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.language-link { font-size: .9rem; font-weight: 700; }
.theme-toggle, .quiet-button { min-height: 42px; padding: .48rem .8rem; border: 1px solid var(--rule); border-radius: 999px; background: transparent; cursor: pointer; }
.theme-toggle { display: flex; align-items: center; gap: .45rem; font-size: .86rem; }
.theme-toggle:hover, .quiet-button:hover { background: var(--surface-strong); }
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(230px, .55fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(3.2rem, 7vw, 6.4rem) clamp(3rem, 6vw, 5.2rem); }
.eyebrow { margin: 0 0 .8rem; color: var(--muted); font-size: .73rem; font-weight: 800; letter-spacing: .12em; line-height: 1.4; text-transform: uppercase; }
.eyebrow-dot { display: inline-block; width: .52rem; height: .52rem; margin-right: .5rem; border-radius: 50%; background: var(--accent); vertical-align: .02rem; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Iowan Old Style, Baskerville, Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.035em; }
h1 { max-width: 830px; margin-bottom: 1.2rem; font-size: clamp(2.8rem, 6vw, 5.7rem); line-height: .99; }
.hero-lede { max-width: 780px; margin-bottom: .85rem; font-size: clamp(1.15rem, 1.75vw, 1.45rem); line-height: 1.5; }
.hero-lede strong { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: .12em; text-underline-offset: .13em; }
.hero-source { margin-bottom: 0; color: var(--muted); font-size: .88rem; }
.hero-definition { max-width: 760px; margin: .8rem 0 0; padding-left: .9rem; border-left: 3px solid var(--accent); color: var(--muted); font-size: .9rem; }
.hero-mark { padding: 1.4rem 1.5rem 1.25rem; border: 1px solid var(--rule); border-top: 5px solid var(--band-many); background: var(--surface); box-shadow: var(--shadow); transform: rotate(1.2deg); }
.mark-kicker { margin-bottom: .25rem; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .11em; }
.mark-number { margin: 0; color: var(--band-many); font: 500 clamp(3.8rem, 7vw, 5.5rem)/.98 Iowan Old Style, Baskerville, Georgia, serif; letter-spacing: -.07em; }
.mark-number span { margin-left: .18rem; font: 800 .9rem/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .04em; }
.mark-label { max-width: 270px; margin: .65rem 0 1.05rem; font-weight: 650; line-height: 1.4; }
.mark-rule { display: flex; height: 9px; gap: 4px; margin-bottom: .55rem; }
.mark-rule i:first-child { width: 18%; background: var(--band-some); }
.mark-rule i:last-child { flex: 1; background: var(--band-many); }
.mark-foot { margin: 0; color: var(--muted); font-size: .78rem; }

.comparison { padding: clamp(1.5rem, 4vw, 3rem); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.8rem; }
.section-heading h2, .romania h2, .method h2 { margin: 0; font-size: clamp(1.9rem, 3.5vw, 3rem); line-height: 1.1; }
.section-heading .eyebrow { margin-bottom: .55rem; }
.section-aside { max-width: 390px; margin: 0; color: var(--muted); font-size: .94rem; }
.controls { display: flex; align-items: end; gap: .8rem; padding-block: 1rem 1.3rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.controls label { display: grid; gap: .35rem; min-width: 145px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.controls label:last-child { margin-left: auto; min-width: 260px; }
.controls select { width: 100%; min-height: 45px; padding: .5rem 2.2rem .5rem .72rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); color: var(--ink); }
.versus { padding-bottom: .7rem; color: var(--muted); font-family: Georgia, serif; font-size: 1.1rem; }
.selection-caption { margin: 1.15rem 0 .6rem; color: var(--muted); font-size: .84rem; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.selection-error { grid-column: 1 / -1; margin: 0; padding: 1rem; border-left: 4px solid var(--accent); background: var(--bg); font-weight: 700; }
.country-card { min-width: 0; padding: 1.25rem; border: 1px solid var(--rule); background: var(--bg); }
.country-card-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.country-card h3 { margin: 0; font: 500 clamp(1.45rem, 2.6vw, 2.2rem)/1.1 Iowan Old Style, Baskerville, Georgia, serif; }
.participation { text-align: right; }
.participation strong { display: block; font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.participation span { color: var(--muted); font-size: .72rem; }
.bar-graphic { display: block; width: 100%; height: 34px; overflow: hidden; background: var(--surface-strong); }
.bar-zero { fill: var(--band-zero); }
.bar-some { fill: var(--band-some); }
.bar-many { fill: var(--band-many); }
.bar-outline { fill: none; stroke: var(--rule); stroke-width: 2; vector-effect: non-scaling-stroke; }
.country-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .75rem; }
.country-values div { min-width: 0; }
.country-values dt { color: var(--muted); font-size: .72rem; line-height: 1.3; }
.country-values dd { margin: .15rem 0 0; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.country-values .value-many dd { color: var(--link); }
.flag { display: inline-block; margin-left: .18rem; color: var(--accent); font-size: .68em; font-weight: 800; vertical-align: .12em; }
.chart-key { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin: 1rem 0 1.2rem; color: var(--muted); font-size: .78rem; }
.chart-key span { display: inline-flex; align-items: center; gap: .45rem; }
.swatch { width: .78rem; height: .78rem; border: 1px solid var(--rule); }
.swatch-zero { background: var(--band-zero); }
.swatch-some { background: var(--band-some); }
.swatch-many { background: var(--band-many); }
.gap-strip { display: flex; flex-wrap: wrap; gap: .7rem 1.7rem; padding: 1rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-weight: 700; }
.gap-strip strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; }
.share-row p { margin: 0; color: var(--muted); font-size: .88rem; }
.share-row > div { display: flex; align-items: center; gap: .5rem; }
.quiet-button { font-size: .82rem; font-weight: 750; }
#share-status { color: var(--muted); font-size: .78rem; }

.romania { display: grid; grid-template-columns: minmax(220px, .8fr) 1.2fr; gap: clamp(2rem, 6vw, 6rem); align-items: center; padding-block: clamp(3rem, 6vw, 5.2rem); border-bottom: 1px solid var(--rule); }
.romanian-number { display: grid; justify-items: start; gap: .35rem; }
.romanian-number .eyebrow { margin-bottom: .4rem; }
.romanian-number strong { color: var(--accent); font: 500 clamp(4rem, 8vw, 6.2rem)/.9 Iowan Old Style, Baskerville, Georgia, serif; letter-spacing: -.07em; }
.romanian-number > span:last-child { max-width: 280px; color: var(--muted); }
.romania h2 { margin-bottom: .8rem; }
.romania-copy > p { max-width: 620px; margin-bottom: .75rem; }
.small-note { color: var(--muted); font-size: .92rem; }

.table-section { padding-block: clamp(3rem, 6vw, 5.3rem); }
.table-heading { align-items: center; }
.download-link { display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .85rem; border: 1px solid var(--link); border-radius: 999px; font-size: .84rem; font-weight: 750; text-decoration: none; }
.download-link:hover { background: var(--surface-strong); }
.table-intro { margin: -.55rem 0 1rem; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--rule); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
caption { padding: .65rem .9rem; color: var(--muted); font-size: .78rem; text-align: left; }
th, td { padding: .65rem .9rem; border-top: 1px solid var(--rule); text-align: right; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-strong); }
th:first-child, td:first-child { text-align: left; }
tbody tr:nth-child(even) { background: var(--bg); }
tbody tr[data-country="RO"] { box-shadow: inset 4px 0 var(--accent); font-weight: 750; }
th button { padding: .25rem 0; border: 0; background: none; color: var(--ink); font-size: .78rem; font-weight: 800; cursor: pointer; }
th[aria-sort="ascending"] button::after { content: " ↑"; }
th[aria-sort="descending"] button::after { content: " ↓"; }
.table-flags { max-width: 850px; margin: .7rem 0 0; color: var(--muted); font-size: .78rem; }

.method { display: grid; grid-template-columns: minmax(230px, .75fr) 1.25fr; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--rule); }
.method h2 { max-width: 400px; }
.method-copy p { max-width: 720px; margin-bottom: 1rem; }
details { margin-top: 1.3rem; padding: 1rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
summary { color: var(--link); font-weight: 750; cursor: pointer; }
details p:first-of-type { margin-top: .9rem; }
.footer { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; padding-block: 1.5rem 2.6rem; border-top: 1px solid var(--rule); font-size: .8rem; }
.footer > a:first-child { font-weight: 800; }
.footer p { flex-basis: 100%; margin: .25rem 0 0; color: var(--muted); }

@media (max-width: 760px) {
  .wrap { width: min(100% - 30px, 620px); }
  .topbar { min-height: 62px; padding-inline: 15px; }
  .wordmark { font-size: .65rem; }
  .top-actions { gap: .65rem; }
  .theme-toggle { padding-inline: .6rem; }
  .theme-toggle [data-theme-label] { display: none; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-block: 2.7rem 2.5rem; }
  h1 { max-width: 600px; font-size: clamp(2.5rem, 12vw, 4.3rem); }
  .hero-mark { max-width: 420px; transform: none; }
  .section-heading { display: block; }
  .section-aside { margin-top: .8rem; }
  .comparison { padding: 1.2rem; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
  .controls label { min-width: 0; }
  .controls label:last-child { min-width: 0; margin-left: 0; grid-column: 1 / -1; }
  .versus { display: none; }
  .chart-grid { grid-template-columns: 1fr; }
  .country-card { padding: 1rem; }
  .share-row { align-items: start; flex-direction: column; }
  .share-row > div { flex-wrap: wrap; }
  .romania, .method { grid-template-columns: 1fr; gap: 1.6rem; }
  .table-heading { display: flex; align-items: start; flex-direction: column; gap: 1rem; }
  .table-wrap { overscroll-behavior-inline: contain; }
}

@media (max-width: 390px) {
  .wrap { width: calc(100% - 24px); }
  .comparison { padding: .9rem; }
  .country-values dt { font-size: .66rem; }
  .country-values dd { font-size: .98rem; }
  .controls label { font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
