/* Renaissance Labs · Open Data Atlas — shares the visual language of labs.renaissancelabs.eu */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/fraunces-latin-ext-opsz-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/fraunces-latin-opsz-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fdfaf3;
  --paper-deep: #f6f0e2;
  --land: #ece4d3;
  --ink: #1c1a17;
  --ink-soft: #625b52;
  --ink-faint: #958c80;
  --rule: #e6dfd1;
  --gold: #9a7a48;
  --gold-bright: #c79a3f;
  --strong: #2d6a4f;
  --strong-bg: #e6f2ec;
  --partial: #c98a2c;
  --partial-bg: #fbf1df;
  --missing: #b84a39;
  --missing-bg: #fae8e4;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  --measure: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
h1 { font-size: clamp(34px, 4.6vw, 58px); line-height: 1.08; }
h2 { font-size: clamp(24px, 2.8vw, 34px); line-height: 1.18; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.35; }
.eyebrow { font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 600; display: block; margin-bottom: 8px; }
.lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-soft); max-width: 44em; margin-top: 12px; }
.wrap { max-width: var(--measure); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* Header */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(253, 250, 243, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand b { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.brand small { font-size: 12px; color: var(--ink-soft); }
.nav { display: flex; gap: 20px; font-size: 14px; color: var(--ink-soft); flex-wrap: wrap; }
.nav a { text-decoration: none; }
.nav a:hover, .nav a.active { color: var(--ink); font-weight: 500; }

/* Hero */
.hero { padding: 44px 0 24px; }
.stats-strip {
  display: flex; flex-wrap: wrap; gap: 28px; margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.stat b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--ink-soft); }

/* Controls & Map */
.map-shell {
  margin: 18px 0 36px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
}
.controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.seg {
  display: inline-flex; background: var(--paper-deep); border: 1px solid var(--rule);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: 13.5px;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 500;
}
.seg button.active { background: var(--ink); color: var(--paper); }
.stage-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft);
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  transition: all 0.12s;
}
.pill:hover { border-color: var(--gold); color: var(--ink); }
.pill.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 500; }

.lang-picker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--paper); border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
}
.lang-picker select, .search-input {
  font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.lang-picker select { min-width: 240px; }

.map-stage { position: relative; width: 100%; aspect-ratio: 2.05 / 1; min-height: 360px; overflow: hidden; }
.map-stage svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-stage svg:active { cursor: grabbing; }
.country-path { stroke: #fdfaf3; stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity 0.12s; }
.country-path:hover { stroke: var(--ink); stroke-width: 1.3; }
.country-path.selected { stroke: var(--ink); stroke-width: 2; }

.region-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 18px; background: var(--paper-deep); border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.region-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.region-pills .pill { font-size: 12px; padding: 3px 10px; }
.zoom-btns {
  position: absolute; right: 14px; top: 14px; z-index: 15;
  display: flex; flex-direction: column; gap: 4px;
}
.zoom-btns button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--rule);
  background: rgba(253, 250, 243, 0.94); color: var(--ink); font: inherit; font-size: 16px;
  font-weight: 600; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.zoom-btns button:hover { border-color: var(--gold); color: var(--gold); }

/* Inline Country / Region Inspector Panel */
.inspector {
  border-top: 1px solid var(--rule);
  background: #fff;
  padding: 20px 22px 24px;
}
.insp-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 14px;
}
.insp-head h2 { font-size: 26px; line-height: 1.15; }
.insp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-ghost {
  display: inline-block; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
  text-decoration: none;
}
.btn-ghost:hover { border-color: var(--gold); }
.insp-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px;
  margin-top: 14px;
}
.insp-stage {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px;
}
.insp-stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.insp-ds {
  font-size: 13px; padding: 6px 0; border-top: 1px solid var(--rule);
}
.insp-ds:first-of-type { border-top: 0; padding-top: 2px; }
.insp-ds a { font-family: var(--mono); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.insp-ds a:hover { color: var(--gold); text-decoration: underline; }
.insp-ds small { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--ink); color: var(--paper); padding: 10px 13px; border-radius: 9px;
  font-size: 13px; line-height: 1.45; max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  opacity: 0; transition: opacity 0.1s;
}
.tooltip.show { opacity: 1; }
.tooltip b { display: block; font-size: 14px; margin-bottom: 3px; }
.tooltip .tt-miss { color: #f4a498; margin-top: 4px; font-size: 12px; }

.legend {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-soft);
  background: var(--paper);
}
.legend-items { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.sw { display: inline-flex; align-items: center; gap: 6px; }
.sw i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,0.08); }

/* Directory & Cards */
.sec { padding: 28px 0 44px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.search-input { min-width: 240px; flex: 1; max-width: 360px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  display: block; text-decoration: none;
  background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px;
  transition: border-color 0.14s, transform 0.14s;
}
.card:hover { border-color: var(--gold); transform: translateY(-1px); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-top h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.score-badge {
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.score-high { background: var(--strong-bg); color: var(--strong); }
.score-mid { background: var(--partial-bg); color: #8c5a12; }
.score-low { background: var(--missing-bg); color: var(--missing); }
.card-meta { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.stage-dots { display: flex; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.sdot {
  font-size: 11px; padding: 2px 7px; border-radius: 5px; font-weight: 500;
}
.s-strong { background: var(--strong-bg); color: var(--strong); }
.s-partial { background: var(--partial-bg); color: #8c5a12; }
.s-missing { background: var(--missing-bg); color: var(--missing); }

/* Detail Pages (Country / Language) */
.crumb { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.scorecard {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
  margin: 24px 0 28px;
}
.sc-item {
  background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px;
}
.sc-item b { display: block; font-size: 14px; margin-bottom: 4px; }
.sc-item small { font-size: 12px; color: var(--ink-soft); display: block; margin-top: 4px; }

.gap-box {
  background: var(--missing-bg); border: 1px solid #ecc6be; border-radius: 12px;
  padding: 18px 20px; margin: 20px 0 32px;
}
.gap-box h2 { font-size: 22px; color: #7c2d21; margin-bottom: 8px; }
.gap-box ul { list-style: disc; padding-left: 20px; color: #5c251c; font-size: 15px; }
.gap-box li { margin: 5px 0; }
.btn {
  display: inline-block; margin-top: 12px; padding: 8px 14px; border-radius: 8px;
  background: var(--ink); color: var(--paper); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.btn:hover { background: var(--gold); }

.stage-sec { margin: 28px 0; padding-top: 22px; border-top: 1px solid var(--rule); }
.stage-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ds-list { display: grid; gap: 10px; }
.ds-row {
  background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.ds-row.flagship { border-left: 3.5px solid var(--gold-bright); }
.ds-title { font-family: var(--mono); font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.ds-title:hover { color: var(--gold); text-decoration: underline; }
.ds-note { font-size: 14px; color: var(--ink-soft); margin-top: 4px; max-width: 62ch; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--paper-deep); border: 1px solid var(--rule); color: var(--ink-soft);
}
.tag.t-flag { background: #fdf3dc; border-color: #e4c680; color: #7a5718; font-weight: 600; }
.tag.t-perm { background: var(--strong-bg); border-color: #b7dec9; color: var(--strong); }
.tag.t-lab { background: #eef1f7; border-color: #ccd6e8; color: #2b4570; text-decoration: none; }
.ds-nums { font-size: 12.5px; color: var(--ink-soft); text-align: right; white-space: nowrap; }

/* Dataset Quality Badges & Rubric */
.ds-head-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.q-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.q-badge.q-a { background: #e3f4eb; border-color: #a9d9bf; color: #1d5b3e; }
.q-badge.q-b { background: #edf7f0; border-color: #c1e2cc; color: #2b6b4c; }
.q-badge.q-c { background: #fdf3dc; border-color: #e6cb8e; color: #805712; }
.q-badge.q-d { background: #fbeae6; border-color: #ebbdb3; color: #8c3424; }
.q-tier { font-weight: 500; opacity: 0.85; font-size: 11px; }
.q-reason { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; max-width: 68ch; line-height: 1.45; }
.q-details { margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.q-details summary { cursor: pointer; color: var(--gold); font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.q-details summary::-webkit-details-marker { display: none; }
.q-dims {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
  padding: 8px 10px; background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 8px;
}
.q-dim { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: #fff; border: 1px solid var(--rule); }
.rubric-card {
  background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px;
}
.rubric-card h3 { font-family: var(--serif); font-size: 18px; margin-bottom: 6px; }
.rubric-card ul { list-style: disc; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.rubric-card li { margin: 4px 0; }

.labs-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lab-chip {
  text-decoration: none; font-size: 13px; padding: 6px 12px; border-radius: 8px;
  background: #fff; border: 1px solid var(--rule);
}
.lab-chip:hover { border-color: var(--gold); }

/* Gap Table */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; border-bottom: 1px solid var(--rule); text-align: left; }
.tbl th { background: var(--paper-deep); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.tbl tr:last-child td { border-bottom: 0; }

.foot {
  margin-top: 48px; padding: 28px 0 48px; border-top: 1px solid var(--rule);
  font-size: 13.5px; color: var(--ink-soft);
}
.foot a { text-decoration: underline; }
