.karta-root a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.exposure-cta { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 0; padding: 14px 28px; background: #1d1d1f; color: #fff; border-radius: 12px; font-size: 15px; font-weight: 600; text-decoration: none !important; transition: background 0.2s; max-width: 480px; }
.exposure-cta:hover { background: #000; }
.exposure-cta-arrow { font-size: 18px; transition: transform 0.2s; }
.exposure-cta:hover .exposure-cta-arrow { transform: translateX(4px); }
.exposure-cta-bottom { max-width: 540px; margin: 48px auto 0; padding: 18px 36px; font-size: 17px; }

  .karta-root {
    --bg: #f7f7f5;
    --ink: #0f172a;
    --muted: #475569;
    --line: #e5e7eb;
    --card: #ffffff;
    --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06);
    --radius: 16px;
  
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 1400px; margin: 0 auto; padding: 40px 24px 80px; }

  /* ── Header ─────────────────────────────────────── */
  header.page { max-width: 860px; margin: 0 auto 28px; padding-top: 100px; }
  .eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 12px; }
  .karta-root h1 { font-size: 44px; line-height: 1.05; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.02em; max-width: 860px; }
  .karta-root h1 em { font-style: normal; background: linear-gradient(180deg, transparent 60%, #fde68a 60%); padding: 0 4px; }
  .lede { font-size: 17px; line-height: 1.55; color: #334155; max-width: 760px; margin: 0 0 20px; }
  .lede a { color: var(--ink); }

  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
  .stat-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 8px; }
  .stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1; }
  .stat-value .unit { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 4px; }
  .stat-sub { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }

  /* ── Report section wrapper ─────────────────────── */
  .report-section { margin: 72px 0; }
  .report-section .prose { max-width: 860px; margin: 0 auto 24px; padding: 0 4px; }

  /* ── Top/Bottom 5 panels ────────────────────────── */
  .ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 20px; }
  .rank-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
  .rank-card h3 { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
  .rank-card h3::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
  .rank-card.good h3 { color: #15803d; }
  .rank-card.bad h3 { color: #b91c1c; }
  /* Women dimension uses the pink↔blue diverging palette instead of red/green
     — "bad" slot holds the female-dominated column (pink), "good" slot the
     male-dominated column (blue). "Good/bad" is just a sort direction here. */
  #ranks-women .rank-card.bad h3 { color: #db2777; }
  #ranks-women .rank-card.good h3 { color: #2563eb; }
  .rank-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
  .rank-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .rank-list li:last-child { border-bottom: 0; }
  .rank-list .label { font-weight: 500; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rank-list .val { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; flex-shrink: 0; }
  .rank-list .sub { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }

  /* ── Treemap ────────────────────────────────────── */
  /* Pure HTML div layout instead of SVG+foreignObject — Safari renders
     foreignObject inconsistently, especially on dimension switches. Plain
     absolutely-positioned divs give identical layout with full cross-browser
     reliability and easier CSS (transitions, text wrapping, hover). */
  .treemap-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
  /* min-height matches mapHeight() JS logic to reserve space before D3 paints — prevents CLS */
  .treemap { position: relative; width: 100%; min-height: 620px; }
  .tile { position: absolute; border-radius: 4px; overflow: hidden; cursor: pointer; box-shadow: 0 0 0 1.5px #fff inset; transition: box-shadow .15s; }
  .tile:hover { box-shadow: 0 0 0 2.5px var(--ink) inset; z-index: 5; }
  .cell-label { padding: 6px 8px; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; font-family: 'Inter', sans-serif; line-height: 1.18; overflow: hidden; word-break: break-word; hyphens: auto; pointer-events: none; background: transparent; }
  .cell-label .t { font-weight: 600; font-size: 12px; overflow: hidden; }
  .cell-label .s { font-weight: 500; font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .legend { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
  .legend-gradient { height: 8px; width: 220px; border-radius: 4px; }

  /* ── Tooltip ────────────────────────────────────── */
  .tooltip { position: fixed; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; pointer-events: none; opacity: 0; transition: opacity .15s; max-width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); z-index: 1000; }
  .tooltip.visible { opacity: 1; }
  .tooltip .tt-title { font-weight: 600; margin: 0 0 6px; font-size: 14px; }
  .tooltip .tt-stat { display: flex; justify-content: space-between; margin: 2px 0; opacity: 0.85; gap: 12px; }
  .tooltip .tt-rationale { font-size: 12px; margin: 8px 0 0; opacity: 0.8; line-height: 1.4; }

  /* ── Drawer ─────────────────────────────────────── */
  .drawer { position: fixed; top: 0; right: 0; width: 480px; max-width: 100vw; height: 100vh; background: var(--card); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(15,23,42,0.12); transform: translateX(100%); transition: transform .3s cubic-bezier(.22,.61,.36,1); z-index: 100; overflow-y: auto; }
  .drawer.open { transform: translateX(0); }
  .drawer-inner { padding: 32px; }
  .drawer-close { position: absolute; top: 16px; right: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 18px; font-family: inherit; line-height: 1; }
  .drawer h2 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
  .drawer .isco { font-size: 12px; color: var(--muted); font-family: 'SF Mono', Menlo, monospace; margin: 0 0 20px; }
  .drawer .stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
  .drawer .stat-grid .stat { padding: 14px; box-shadow: none; border-radius: 12px; }
  .drawer .stat-grid .stat-value { font-size: 22px; }
  .drawer h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 0 8px; font-weight: 600; }
  .drawer p { font-size: 15px; line-height: 1.6; color: #334155; margin: 0 0 12px; }
  .confidence { display: inline-block; font-size: 11px; background: #f1f5f9; border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; margin-left: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }

  /* ── Prose sections ─────────────────────────────── */
  .prose { max-width: 860px; margin: 64px auto; padding: 0 4px; }
  .prose.wide { max-width: 920px; }
  .prose h2 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; color: var(--ink); }
  .prose h2 .kicker, .report-section h2 .kicker { display: block !important; font-size: 11px !important; font-weight: 600 !important; color: var(--muted) !important; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px; line-height: 1.4; }
  .prose p { font-size: 16px; line-height: 1.65; color: #334155; margin: 0 0 14px; }
  .prose p:last-child { margin-bottom: 0; }
  .prose p b { color: var(--ink); }
  .prose .pull { font-size: 19px; line-height: 1.45; color: var(--ink); font-weight: 500; border-left: 3px solid var(--ink); padding: 4px 0 4px 18px; margin: 18px 0; }
  .prose ul.limits { list-style: disc; padding: 0 0 0 20px; margin: 14px 0 0; }
  .prose ul.limits li { font-size: 14px; line-height: 1.6; color: #475569; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .prose ul.limits li:last-child { border-bottom: 0; }
  .prose ul.limits li b { color: var(--ink); }

  .callout { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; box-shadow: var(--shadow); }
  .callout .big { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin: 4px 0 10px; color: var(--ink); }
  .callout .big small { font-size: 18px; color: var(--muted); font-weight: 500; margin-left: 6px; }

  @media (max-width: 680px) {
    .prose { margin: 36px auto; }
    .prose h2 { font-size: 22px; }
    .prose p { font-size: 15px; }
    .callout { padding: 20px 22px; }
    .callout .big { font-size: 32px; }
  }

  /* ── Screen-reader / crawler only: hidden from sighted users but visible
     to SEO bots, LLM scrapers, and assistive tech. Used for the structured
     tabular fallback of every D3-rendered chart. ────────────────────────── */
  .sr-table { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

  /* ── Stacked bar composition charts (age × exposure, edu × exposure) ── */
  .stack-chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px 18px; box-shadow: var(--shadow); margin-top: 8px; }
  .stack-row { display: grid; grid-template-columns: 220px 1fr 78px; align-items: center; gap: 14px; margin-bottom: 9px; }
  .stack-row:last-of-type { margin-bottom: 4px; }
  .stack-label { font-size: 13px; color: var(--ink); font-weight: 500; text-align: right; line-height: 1.25; }
  .stack-label .score-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
  .stack-bar { display: flex; height: 30px; border-radius: 4px; overflow: hidden; background: #f1f5f9; box-shadow: inset 0 0 0 1px var(--line); }
  .stack-seg { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
  .stack-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: left; }
  .stack-legend { display: flex; gap: 20px; justify-content: center; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
  .stack-legend-item { display: inline-flex; align-items: center; gap: 6px; }
  .stack-legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
  @media (max-width: 780px) {
    .stack-row { grid-template-columns: 140px 1fr 60px; gap: 10px; }
    .stack-label { font-size: 12px; }
    .stack-bar { height: 26px; }
  }
  @media (max-width: 520px) {
    .stack-chart { padding: 16px 14px 12px; }
    .stack-row { grid-template-columns: 108px 1fr 50px; gap: 8px; }
    .stack-label { font-size: 11px; }
    .stack-bar { height: 24px; }
    .stack-seg { font-size: 10px; }
    .stack-total { font-size: 11px; }
  }

  /* ── Choropleth map ──────────────────────────────── */
  .choropleth-wrap { position: relative; min-height: 350px; margin: 24px auto; max-width: 700px; }
  .map-tooltip { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.4; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,0.1); z-index: 10; }

  /* ── Footer ─────────────────────────────────────── */
  footer.page { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
  footer.page h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); margin: 0 0 8px; }
  footer.page a { color: var(--ink); }
  .sources { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }

  /* ── Mobile ─────────────────────────────────────── */
  @media (max-width: 980px) {
    .wrap { padding: 28px 16px 60px; }
    .karta-root h1 { font-size: 32px; }
    .lede { font-size: 16px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 26px; }
    .ranks { grid-template-columns: 1fr; gap: 10px; }
    .rank-card { padding: 14px; overflow: hidden; min-width: 0; }
    .treemap-wrap { padding: 12px; }
    .treemap { min-height: 600px; }
    .cell-label { padding: 5px 7px; }
    .cell-label .t { font-size: 11px; }
    .cell-label .s { font-size: 10px; }
    .drawer { width: 100vw; }
    .drawer-inner { padding: 24px 20px; }
    .sources { grid-template-columns: 1fr; gap: 16px; }
    .controls { gap: 6px; }
    .pill { padding: 7px 12px; font-size: 12px; }
  }
  @media (max-width: 520px) {
    .karta-root h1 { font-size: 26px; }
    .stats { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
    .treemap { min-height: 540px; }
  }
  
  
