:root {
  --ink: #10222d;
  --ink-2: #263c46;
  --paper: #f5efe4;
  --paper-2: #ece3d5;
  --white: #fffaf2;
  --coral: #e85d43;
  --coral-dark: #bd3c29;
  --teal: #167c78;
  --gold: #e4a83c;
  --muted: #687177;
  --line: #cfc2b0;
  --shadow: 0 22px 48px rgba(33, 39, 42, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(16,34,45,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,34,45,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: white; padding: .7rem 1rem; }
.skip-link:focus { top: 1rem; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: .7rem clamp(1rem, 4vw, 4rem);
  color: #f7f1e8;
  background: rgba(16,34,45,.96);
  border-bottom: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; font-weight: 750; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: var(--ink); background: var(--gold); border-radius: 50% 50% 10% 50%; font-size: .88rem; }
.masthead nav { display: flex; gap: clamp(.9rem, 2vw, 2rem); }
.masthead nav a { color: #d8dedc; text-decoration: none; font-size: .87rem; }
.masthead nav a:hover, .masthead nav a:focus-visible { color: white; }
.lang-switcher { display: flex; align-items: center; gap: .15rem; margin-inline-start: 1rem; padding: .2rem; border: 1px solid rgba(255,255,255,.22); border-radius: 4px; }
.lang-switcher button { padding: .36rem .52rem; color: #c8d2d1; background: transparent; border: 0; border-radius: 2px; cursor: pointer; font-size: .75rem; font-weight: 750; }
.lang-switcher button[aria-pressed="true"] { color: var(--ink); background: var(--gold); }

main { overflow: hidden; }
.control-deck {
  padding: clamp(2.5rem, 6vw, 5.5rem) clamp(1rem, 4vw, 4rem) 2.5rem;
  background:
    radial-gradient(circle at 88% 8%, rgba(232,93,67,.18), transparent 25%),
    radial-gradient(circle at 8% 85%, rgba(22,124,120,.13), transparent 24%);
}
.title-lockup { max-width: 980px; }
.eyebrow, .chart-kicker { margin: 0 0 .75rem; color: var(--coral-dark); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h1 { max-width: 900px; margin-bottom: 1rem; font-size: clamp(2.6rem, 6vw, 5.5rem); line-height: .95; }
.dek { max-width: 770px; color: var(--ink-2); font-size: clamp(1rem, 1.7vw, 1.28rem); }

.dataset-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; max-width: 880px; margin: 2rem 0 .8rem; }
.dataset-tab { display: grid; gap: .15rem; padding: 1rem 1.15rem; text-align: left; color: var(--ink); background: rgba(255,250,242,.72); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; transition: transform .2s, background .2s, color .2s; }
.dataset-tab:hover { transform: translateY(-2px); }
.dataset-tab.is-active { color: white; background: var(--ink); border-color: var(--ink); box-shadow: var(--shadow); }
.dataset-tab span { font-weight: 780; }
.dataset-tab small { opacity: .72; }
.dataset-note { max-width: 880px; min-height: 2.2rem; color: var(--muted); font-size: .88rem; }

.filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)) auto; gap: .7rem; margin: 1.2rem 0 1.8rem; padding: 1rem; background: rgba(255,250,242,.88); border: 1px solid var(--line); box-shadow: 0 10px 24px rgba(16,34,45,.06); }
.filters label { display: grid; gap: .35rem; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.filters select { width: 100%; min-width: 0; padding: .68rem 2rem .68rem .7rem; color: var(--ink); background: var(--white); border: 1px solid #bfb2a0; border-radius: 3px; text-transform: none; letter-spacing: normal; }
.filters select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(22,124,120,.34); outline-offset: 2px; }
.reset-button { align-self: end; padding: .7rem .9rem; color: var(--coral-dark); background: transparent; border: 0; border-bottom: 1px solid currentColor; cursor: pointer; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .8rem; }
.kpi { min-height: 150px; padding: 1.25rem; background: rgba(255,250,242,.88); border: 1px solid var(--line); box-shadow: 0 8px 20px rgba(16,34,45,.06); }
.kpi-dark { color: white; background: var(--ink); border-color: var(--ink); }
.kpi-accent { background: #f0c968; border-color: #d3a544; }
.kpi-label { display: block; margin-bottom: 1rem; color: inherit; opacity: .72; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.kpi strong { display: block; margin-bottom: .35rem; font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.8rem); line-height: 1; }
.kpi small { color: inherit; opacity: .68; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem clamp(1rem, 4vw, 4rem) 3rem; }
.panel { min-width: 0; padding: clamp(1.1rem, 2.5vw, 1.8rem); background: rgba(255,250,242,.94); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(16,34,45,.07); }
.panel-wide { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.panel h2 { margin-bottom: 0; font-size: clamp(1.45rem, 2.4vw, 2.15rem); line-height: 1.05; }
.chart-kicker { margin-bottom: .35rem; color: var(--teal); }
.chart-rule { padding: .35rem .55rem; color: var(--muted); background: var(--paper-2); font-size: .72rem; white-space: nowrap; }
.chart { width: 100%; min-height: 300px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: Inter, ui-sans-serif, system-ui, sans-serif; fill: var(--ink); }
.chart .muted { fill: var(--muted); }
.chart .gridline { stroke: #d9cdbd; stroke-width: 1; }
.empty-state { display: grid; place-items: center; min-height: 280px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }

.insight-panel { color: white; background: var(--ink); border-color: var(--ink); }
.insight-panel .chart-kicker { color: #f2c967; }
.insight-panel h2 { color: white; }
.insight-stack { display: grid; gap: .8rem; }
.insight { padding: 1rem 0 1rem 3rem; border-top: 1px solid rgba(255,255,255,.16); position: relative; }
.insight:first-child { border-top: 0; }
.insight-index { position: absolute; left: 0; top: .88rem; color: var(--gold); font-family: Georgia, serif; font-size: 1.65rem; }
.insight strong { display: block; margin-bottom: .22rem; font-size: 1.04rem; }
.insight p { margin-bottom: 0; color: #cbd4d4; font-size: .9rem; }

.table-section, .method-section, .download-section { padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.5rem; }
.section-heading h2, .download-section h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.7rem); line-height: .98; }
.section-heading > p { max-width: 470px; margin: 0; color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { padding: .9rem 1rem; text-align: right; border-bottom: 1px solid #e2d8ca; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: #f5efe4; background: var(--ink); font-size: .71rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:hover { background: #f4eadb; }
td { font-size: .9rem; }
.sample-tag { display: inline-block; padding: .22rem .42rem; background: #dcebe7; color: #195f5c; font-size: .7rem; font-weight: 750; }
.sample-tag.low { background: #f9dfd7; color: #a63b29; }

.quarter-story { display: grid; grid-template-columns: .3fr 1.15fr 1.2fr; gap: clamp(1.4rem, 4vw, 4rem); padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem); color: white; background: var(--coral); }
.story-number { font-family: Georgia, serif; font-size: clamp(4rem, 10vw, 10rem); line-height: .72; color: rgba(255,255,255,.23); }
.story-copy h2 { font-size: clamp(2rem, 4.4vw, 4.5rem); line-height: .96; }
.story-copy p { color: #fff4ec; }
.quarter-story .eyebrow { color: #4b241e; }
.text-button { padding: .45rem 0; color: white; background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.7); cursor: pointer; font-weight: 750; }
.month-bars { align-self: center; }
.month-row { display: grid; grid-template-columns: 70px 1fr 54px; gap: .8rem; align-items: center; margin: 1rem 0; }
.month-track { height: 18px; background: rgba(78,31,24,.22); }
.month-fill { height: 100%; background: #fff0d2; }
.month-row strong { text-align: right; }
.month-source-note { margin-top: 1.5rem; font-size: .8rem; color: #ffe9df; }

.method-section { background: #e7ded0; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.method-grid article { position: relative; padding: 2rem; background: rgba(255,250,242,.78); border-top: 5px solid var(--ink); }
.method-grid article:nth-child(2) { border-color: var(--coral); }
.method-grid article:nth-child(3) { border-color: var(--teal); }
.method-index { position: absolute; right: 1.2rem; top: .7rem; color: #c7baa7; font-family: Georgia, serif; font-size: 3rem; }
.method-grid h3 { position: relative; margin-bottom: 1.4rem; font-size: 1.25rem; }
.method-grid p { color: var(--ink-2); font-size: .9rem; }

.download-section { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 7vw, 7rem); color: white; background: var(--ink); }
.download-section p { color: #c7d0d0; }
.download-actions { display: grid; gap: .7rem; align-content: center; }
.download-button { display: flex; justify-content: space-between; gap: 1rem; width: 100%; padding: 1rem; color: white; text-decoration: none; text-align: left; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.22); cursor: pointer; }
.download-button:hover { background: rgba(255,255,255,.12); }
.download-button span { color: var(--gold); font-size: .8rem; }

footer { display: flex; justify-content: space-between; gap: 2rem; padding: 1.2rem clamp(1rem, 4vw, 4rem); color: #aeb9b8; background: #09161d; font-size: .78rem; }
footer p { margin: 0; }

html[dir="rtl"] body { font-family: Tahoma, Arial, sans-serif; }
html[dir="rtl"] h1, html[dir="rtl"] h2 { font-family: Tahoma, Arial, sans-serif; letter-spacing: 0; }
html[dir="rtl"] .eyebrow, html[dir="rtl"] .chart-kicker, html[dir="rtl"] .filters label, html[dir="rtl"] th { letter-spacing: 0; }
html[dir="rtl"] .panel-heading, html[dir="rtl"] .section-heading, html[dir="rtl"] footer { direction: rtl; }
html[dir="rtl"] .chart svg { direction: ltr; }
html[dir="rtl"] .chart svg text { font-family: Tahoma, Arial, sans-serif; }
html[dir="rtl"] th:first-child, html[dir="rtl"] td:first-child { text-align: right; }
html[dir="rtl"] th:not(:first-child), html[dir="rtl"] td:not(:first-child) { text-align: left; }
html[dir="rtl"] .insight { padding: 1rem 3rem 1rem 0; }
html[dir="rtl"] .insight-index { left: auto; right: 0; }
html[dir="rtl"] .method-index { right: auto; left: 1.2rem; }

@media (max-width: 1080px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reset-button { justify-self: start; }
  .quarter-story { grid-template-columns: .2fr 1fr; }
  .month-bars { grid-column: 2; }
}

@media (max-width: 760px) {
  .masthead nav { display: none; }
  .brand > span:last-child { display: none; }
  .lang-switcher { margin-inline-start: auto; }
  .dataset-tabs, .kpi-grid, .chart-grid, .method-grid, .download-section { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel-wide { grid-column: auto; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 1rem; }
  .quarter-story { grid-template-columns: 1fr; }
  .story-number { font-size: 5rem; }
  .month-bars { grid-column: auto; }
  footer { display: grid; }
}

@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr; }
  h1 { font-size: 2.7rem; }
  .dataset-tabs { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
