/* Travel Risk Atlas - warm data-editorial design system.
   Structure comes from rules and spacing, not shadows and cards. */

/* ---------- Tokens ---------- */
:root {
  --paper:        #FBF8F3;
  --paper-2:      #F4EFE6;
  --paper-3:      #EBE4D7;
  --ink:          #1D1A16;
  --ink-2:        #4A443B;
  --ink-3:        #756D60;
  --rule:         #DED5C4;
  --rule-strong:  #C4B8A1;
  --accent:       #0E5A57;
  --accent-2:     #0A403E;
  --accent-soft:  #DDEAE7;
  --focus:        #0E5A57;

  /* Risk ramp: muted and earthy so it sits on cream paper, and monotonic
     enough in weight that the bands stay separable for colour-vision
     deficiency. Never used without its band label alongside. */
  --risk-1: #6E9E86;
  --risk-2: #A8BC6F;
  --risk-3: #E0AF57;
  --risk-4: #CB7746;
  --risk-5: #A24435;
  --risk-none: #DCD5C8;

  --font-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --space-9: 96px;

  --measure: 68ch;
  --wrap: 1180px;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #161512;
    --paper-2:     #1F1D19;
    --paper-3:     #2A2721;
    --ink:         #F0EBE1;
    --ink-2:       #C6BEB0;
    --ink-3:       #968D7E;
    --rule:        #383429;
    --rule-strong: #4E483A;
    --accent:      #6FBAB2;
    --accent-2:    #A5D6D0;
    --accent-soft: #1B2E2C;
    --focus:       #6FBAB2;
    --risk-1: #4F8069;
    --risk-2: #7E9550;
    --risk-3: #B98C3C;
    --risk-4: #A85D33;
    --risk-5: #8A3629;
    --risk-none: #322E26;
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.02rem; font-family: var(--font-sans); font-weight: 600; }
p  { margin: 0 0 var(--space-4); max-width: var(--measure); }
a  { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--space-7) 0; }
table { border-collapse: collapse; width: 100%; }
.num { font-variant-numeric: tabular-nums; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--space-5); }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 var(--space-5); }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink);
  color: var(--paper); padding: var(--space-3) var(--space-4); z-index: 200;
}
.skip:focus { left: var(--space-4); top: var(--space-3); }

/* Used by three templates and, until now, defined by none of them — two got
   away with it via an inline left:-9999px. Clipping beats moving off-canvas:
   it does not create a scrollable overflow area and does not break in RTL. */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.eyebrow {
  font-size: .72rem; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--space-3);
}
.lede { font-size: 1.16rem; color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }

/* ---------- Header ---------- */
.site-head {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  position: sticky; top: 0; z-index: 60;
}
.site-head__in {
  display: flex; align-items: center; gap: var(--space-5);
  max-width: var(--wrap); margin: 0 auto;
  padding: var(--space-3) var(--space-5); min-height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-serif); font-size: 1.16rem; font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -.015em;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand__mark { flex: none; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-5); }
.site-nav a {
  color: var(--ink-2); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: 6px 0; border-bottom: 2px solid transparent; transition: color .18s ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  /* Two rows of nav make the header 167px tall — a fifth of a phone screen.
     Sticking that to the top costs more than it gives on long article pages,
     so it scrolls away and the reader gets the full viewport. */
  .site-head { position: static; }
  .site-head__in { flex-wrap: wrap; gap: var(--space-2); }
  /* Wrap rather than scroll. Five items overflow a 320px phone by ~70px, and a
     horizontally scrolling bar just hides "About" behind an edge most people
     never discover. Wrapping keeps every destination visible and tappable. */
  .site-nav {
    width: 100%; margin-left: 0; flex-wrap: wrap;
    gap: 0 var(--space-4); padding-bottom: 2px;
  }
  .site-nav a {
    white-space: nowrap; display: inline-flex; align-items: center;
    min-height: 44px;              /* full touch target */
    padding: 0; border-bottom-width: 2px;
  }
}

/* ---------- Hero ---------- */
.hero { padding: var(--space-8) 0 var(--space-5); }
.hero h1 { max-width: 17ch; margin-bottom: var(--space-4); }
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-7); align-items: end;
}
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; gap: var(--space-5); } }
.hero__single { max-width: 900px; }
.hero__single h1 { max-width: 20ch; }

.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-5); border-top: 1px solid var(--rule); padding-top: var(--space-4);
}
.stat__n {
  font-family: var(--font-serif); font-size: 2rem; line-height: 1;
  font-variant-numeric: tabular-nums; display: block;
}
.stat__l { font-size: .78rem; color: var(--ink-3); letter-spacing: .04em; margin-top: 6px; }

/* ---------- Map ---------- */
.map-panel {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); position: relative; overflow: hidden;
}
.map-figure { margin: 0; position: relative; overflow: hidden; }
.map-figure:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.map-svg {
  display: block; width: 100%; height: auto; touch-action: pan-y;
  transform-origin: 50% 50%; will-change: transform;
}
.is-zoomed .map-svg { cursor: grab; }
.is-zoomed .map-figure:active .map-svg { cursor: grabbing; }

/* Zoom controls: visible affordance for anyone not on a touchscreen. */
.zoom-ctrl {
  position: absolute; top: var(--space-3); right: var(--space-3);
  display: flex; gap: 4px; z-index: 5;
}
.zoom-ctrl button {
  min-width: 34px; height: 34px; padding: 0 9px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink); font: 600 .9rem/1 var(--font-sans); cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .15s ease, border-color .15s ease;
}
.zoom-ctrl button:hover:not(:disabled) {
  background: var(--paper); border-color: var(--accent); color: var(--accent);
}
.zoom-ctrl button:disabled { opacity: .4; cursor: default; }
.zoom-ctrl button:last-child { font-size: .76rem; font-weight: 500; }
@media (max-width: 560px) { .zoom-ctrl button:last-child { display: none; } }
kbd {
  font: 600 .78em/1 var(--font-sans); background: var(--paper-3);
  border: 1px solid var(--rule); border-radius: 3px; padding: 2px 5px;
}
.map-svg .land {
  stroke: var(--paper); stroke-width: .5; stroke-linejoin: round;
  transition: opacity .15s ease;
  cursor: pointer;
}
.map-svg .land:hover, .map-svg .land:focus { opacity: .72; }
.map-svg .land.is-active { stroke: var(--ink); stroke-width: 1.4; }
.map-svg .dot { stroke: var(--paper); stroke-width: .8; cursor: pointer; }
.map-svg .dot:hover { opacity: .72; }
.map-svg a { outline: none; }
.map-svg a:focus-visible .land, .map-svg a:focus-visible .dot {
  stroke: var(--focus); stroke-width: 2;
}

.r1 { fill: var(--risk-1); } .r2 { fill: var(--risk-2); } .r3 { fill: var(--risk-3); }
.r4 { fill: var(--risk-4); } .r5 { fill: var(--risk-5); } .r0 { fill: var(--risk-none); }

.map-tip {
  position: absolute; pointer-events: none; opacity: 0;
  background: var(--ink); color: var(--paper);
  padding: 9px 12px; border-radius: var(--radius); font-size: .84rem;
  transform: translate(-50%, -125%); transition: opacity .12s ease;
  white-space: nowrap; z-index: 10; line-height: 1.35;
}
.map-tip.on { opacity: 1; }
.map-tip__n { font-weight: 600; display: block; }
.map-tip__s { font-variant-numeric: tabular-nums; color: #C9C2B4; }

.legend {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  align-items: center; padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--rule); font-size: .82rem;
}
.legend__item { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.legend__sw {
  width: 22px; height: 11px; border-radius: 2px; flex: none;
  border: 1px solid rgba(0,0,0,.12);
}
.legend__n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* Numbered badge, matching the markers drawn on the map. */
.legend__num, .zone-list__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%; flex: none;
  background: var(--ink-2); color: #fff;
  font: 600 .68rem/1 var(--font-sans); font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--paper);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}

/* ---------- Overseas territory insets ---------- */
.insets { margin-top: var(--space-5); }
.insets__head {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 var(--space-3);
}
.insets__row {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
}
.inset {
  margin: 0; flex: 0 1 auto; max-width: 210px;
}
.inset__map {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); padding: var(--space-2);
}
.inset__map .map-svg { width: 100%; height: auto; }
.inset figcaption {
  font-size: .78rem; color: var(--ink-2); margin-top: 6px; line-height: 1.4;
}
.inset__links {
  display: block; margin-top: 2px; font-size: .72rem; color: var(--ink-3);
}

/* ---------- Zone notes ---------- */
.zone-notes { margin-top: var(--space-6); }
.zone-notes h3 { font-size: 1.08rem; font-family: var(--font-sans);
                 margin-bottom: var(--space-4); }
.zone-list { list-style: none; margin: 0; padding: 0; max-width: 74ch; }
.zone-list li {
  display: grid; grid-template-columns: 19px 1fr; gap: var(--space-3);
  padding: var(--space-3) 0; border-top: 1px solid var(--rule);
  font-size: .9rem; line-height: 1.55;
}
.zone-list li:first-child { border-top: 0; padding-top: 0; }
.zone-list__dot {
  width: 10px; height: 10px; border-radius: 50%; margin: 6px auto 0;
}
.zone-list__num { margin-top: 3px; }
.zone-list em { font-style: normal; color: var(--ink-2); }

/* ---------- Country hero photo ---------- */
.country-photo {
  margin: var(--space-5) 0 0; position: relative;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--rule);
  /* 2:1, not the 21:8 this started as. Almost every photograph is 3:2 or 4:3,
     and a 2.625:1 letterbox threw away 42% of a typical one's height — the
     worst cases kept a quarter. At 2:1 the median photo keeps 76%, which is
     the difference between showing a landmark and showing a slice of it. */
  aspect-ratio: 2 / 1; background: var(--paper-3);
}
@media (max-width: 700px) { .country-photo { aspect-ratio: 16 / 9; } }
.country-photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* Above centre, because the expendable part of a landmark photograph is the
     ground in front of it, never the top of the subject. Centre-cropping is
     what cut the tip off the Eiffel Tower and the dome off the Taj Mahal.
     A constant beat two attempts at detecting the subject: choosing the window
     by edge energy chased busy foreground and made those crops worse, and a
     skyline detector returned "top" for 23 of 24 test photos, so it was a
     constant wearing a costume. This is the same answer, stated honestly. */
  object-position: 50% 32%;
}
.country-photo__credit {
  position: absolute; right: var(--space-2); bottom: var(--space-2);
  font-size: .68rem; line-height: 1;
  padding: 5px 9px; border-radius: 100px;
  background: rgba(20, 18, 14, .55); color: #EDE8DE;
  backdrop-filter: blur(3px);
}
.country-photo__credit a { color: #fff; text-decoration: none; }
.country-photo__credit a:hover { text-decoration: underline; }

/* ---------- Score display ---------- */
.score-badge {
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--rule-strong); background: var(--paper-2);
}
.score-badge__n {
  font-family: var(--font-serif); font-size: 2.6rem; line-height: 1;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.score-badge__b { font-size: .95rem; font-weight: 600; }
.score-badge__max { font-size: .8rem; color: var(--ink-3); }

.band-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 600; padding: 4px 11px 4px 8px;
  border-radius: 100px; border: 1px solid var(--rule-strong);
  background: var(--paper-2); color: var(--ink); white-space: nowrap;
}
.band-chip__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bd1 { background: var(--risk-1); } .bd2 { background: var(--risk-2); }
.bd3 { background: var(--risk-3); } .bd4 { background: var(--risk-4); }
.bd5 { background: var(--risk-5); }

/* ---------- Country page ---------- */
.country-head { padding: var(--space-6) 0 var(--space-5); border-bottom: 1px solid var(--rule); }
.country-head__top {
  display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-start;
  justify-content: space-between;
}
.country-title { display: flex; align-items: center; gap: var(--space-4); }
.country-title h1 { margin: 0; }
.flag { font-size: 2.4rem; line-height: 1; }
.crumbs { font-size: .82rem; color: var(--ink-3); margin-bottom: var(--space-3); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }

.adv-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.adv-chip {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 7px 11px; font-size: .8rem; background: var(--paper-2);
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink); min-height: 44px;
  transition: border-color .18s ease, background .18s ease;
}
a.adv-chip:hover {
  border-color: var(--accent); background: var(--accent-soft); color: var(--ink);
}
a.adv-chip:hover .adv-chip__ext { color: var(--accent); }
.adv-chip__body { display: flex; flex-direction: column; line-height: 1.3; }
.adv-chip__ext { color: var(--ink-3); flex: none; margin-left: 2px; }
.adv-chip strong { font-weight: 600; }
.adv-chip .lvl {
  font-variant-numeric: tabular-nums; font-weight: 600;
  padding: 1px 7px; border-radius: 3px; color: #fff; font-size: .74rem;
}

.section { padding: var(--space-7) 0; border-bottom: 1px solid var(--rule); }
.section:last-child { border-bottom: 0; }
.section__head { margin-bottom: var(--space-5); }
.section__head h2 { margin-bottom: var(--space-2); }

/* Pillar bars */
.pillars { display: grid; gap: var(--space-3); }
.pillar { display: grid; grid-template-columns: 190px 1fr 130px; gap: var(--space-4);
          align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--rule); }
.pillar:first-child { border-top: 0; }
.pillar__name { font-weight: 500; font-size: .93rem; }
.pillar__name .imp { color: var(--ink-3); font-size: .74rem; font-weight: 400; }
.pillar__track { height: 9px; background: var(--paper-3); border-radius: 100px; overflow: hidden; }
.pillar__fill { height: 100%; border-radius: 100px; }
.pillar__meta { font-size: .8rem; color: var(--ink-3); text-align: right;
                font-variant-numeric: tabular-nums; }
.pillar__meta b { color: var(--ink); font-weight: 600; }
@media (max-width: 700px) {
  .pillar { grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-3); }
  .pillar__track { grid-column: 1 / -1; order: 3; }
  .pillar__meta { text-align: right; }
}

.pillars--context {
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 2px solid var(--rule-strong);
}
.pillars__note {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 var(--space-2);
}
.pillars--context .pillar { border-top: 0; }

/* Dashboard tiles */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.tile { background: var(--paper); padding: var(--space-4); }
.tile__l {
  font-size: .71rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 7px;
}
.tile__v {
  font-family: var(--font-serif); font-size: 1.36rem; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.tile__v small { font-size: .82rem; font-family: var(--font-sans); color: var(--ink-3); }
.tile__sub { font-size: .78rem; color: var(--ink-3); margin-top: 5px; }

/* Prose blocks */
.prose { max-width: var(--measure); }
.prose h3 { margin-top: var(--space-6); }
.prose ul { padding-left: 1.15em; }
.prose li { margin-bottom: var(--space-2); }

/* Scams & hotspots */
.scam { border-top: 1px solid var(--rule); padding: var(--space-5) 0; }
.scam:first-of-type { border-top: 0; padding-top: 0; }
.scam__head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.scam__head h3 { margin: 0; }
.tag {
  font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--rule); border-radius: 100px;
  padding: 2px 9px;
  /* Not nowrap. Most of these are two words, but a scam's location can be a
     clause ("Delhi, especially from the airport and New Delhi station"), and
     at 375px an unbreakable one of those pushed the whole page 74px wide. */
  max-width: 100%;
}
.avoid {
  border-left: 2px solid var(--accent); padding: var(--space-2) 0 var(--space-2) var(--space-4);
  margin: var(--space-3) 0; background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.avoid p { margin: 0; }
.avoid strong { color: var(--accent-2); }
.srcs {
  font-size: .82rem; color: var(--ink-3); margin-top: var(--space-3);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px var(--space-3);
}
.srcs__l {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
}
.srcs a { position: relative; }
.srcs a + a::before {
  content: "·"; position: absolute; left: calc(var(--space-3) / -2 - 2px);
  color: var(--rule-strong); text-decoration: none;
}

.hotspot {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-4);
  padding: var(--space-4) 0; border-top: 1px solid var(--rule);
}
.hotspot:first-of-type { border-top: 0; }
.hotspot__sev {
  width: 4px; border-radius: 100px; background: var(--risk-3); align-self: stretch;
}
.hotspot__sev.sev-high { background: var(--risk-5); }
.hotspot__sev.sev-med  { background: var(--risk-4); }
.hotspot__sev.sev-low  { background: var(--risk-3); }
.hotspot h4 { margin-bottom: 4px; }
.hotspot p { margin-bottom: 0; font-size: .93rem; }

/* Lists / strips */
.rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); }
@media (max-width: 800px) { .rank-grid { grid-template-columns: 1fr; gap: var(--space-5); } }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { border-top: 1px solid var(--rule); }
.rank-list a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 9px 0; text-decoration: none; color: var(--ink);
}
.rank-list a:hover .rl__n { color: var(--accent); text-decoration: underline; }
.rl__i { width: 22px; color: var(--ink-3); font-size: .8rem; font-variant-numeric: tabular-nums; }
.rl__n { flex: 1; font-size: .95rem; }
.rl__s { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; }
.rl__d { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Changes feed */
.change { border-top: 1px solid var(--rule); padding: var(--space-4) 0; display: grid;
          grid-template-columns: 120px 1fr; gap: var(--space-4); }
.change__d { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.change__t { font-size: .93rem; margin: 0; }
.change__t a { font-weight: 500; }
@media (max-width: 640px) { .change { grid-template-columns: 1fr; gap: var(--space-1); } }

/* Data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
.dtable { font-size: .89rem; min-width: 880px; }
.dtable th, .dtable td { padding: 9px var(--space-3); text-align: right; white-space: nowrap; }
.dtable th:first-child, .dtable td:first-child { text-align: left; position: sticky;
  left: 0; background: var(--paper); }
.dtable thead th {
  position: sticky; top: 0; background: var(--paper-2); z-index: 2;
  border-bottom: 1px solid var(--rule-strong); font-weight: 600;
  font-size: .78rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2); cursor: pointer; user-select: none;
}
.dtable thead th:first-child { z-index: 3; }
.dtable thead th:hover { color: var(--ink); }
.dtable thead th::after { content: ""; display: inline-block; width: 9px; }
/* Which way is good, said under every heading rather than left to guesswork. */
.th-dir {
  display: block; margin-top: 2px;
  font-size: .6rem; font-weight: 500; letter-spacing: .04em;
  text-transform: none; color: var(--ink-3);
}
.th-dir--worse { color: var(--risk-5); }
.th-dir--better { color: var(--risk-1); }
.dtable thead th[aria-sort="ascending"]::after  { content: " \2191"; }
.dtable thead th[aria-sort="descending"]::after { content: " \2193"; }
.dtable tbody tr { border-top: 1px solid var(--rule); }
.dtable tbody tr:hover td { background: var(--paper-2); }
.dtable tbody tr:hover td:first-child { background: var(--paper-2); }
.dtable td.num { font-variant-numeric: tabular-nums; }
.dtable .cell-score { font-weight: 600; }
.dtable .band-chip__dot { display: inline-block; margin-right: 7px; }

.controls { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
            margin-bottom: var(--space-4); }
/* min-width:0 lets these shrink. Without it the "Sort by" select sizes itself
   to its longest option ("Women who feel safe walking alone at night") and
   drags the whole page wider than a small phone's viewport. */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field select, .field input { max-width: 100%; }
.field label { font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
               color: var(--ink-3); }
select, input[type="search"] {
  font: inherit; font-size: .9rem; padding: 9px 11px; min-height: 42px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
input[type="search"] { min-width: 220px; }

/* Charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
              gap: var(--space-6); }
.chart-box { border: 1px solid var(--rule); border-radius: var(--radius);
             padding: var(--space-5); background: var(--paper-2); }
.chart-box h3 { font-size: 1.02rem; font-family: var(--font-sans); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .axis line, .chart-svg .axis path { stroke: var(--rule-strong); }
.chart-svg .grid line { stroke: var(--rule); stroke-dasharray: 2 3; }
.chart-svg text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-sans); }
.chart-svg .pt { cursor: pointer; }
.chart-svg .pt:hover { stroke: var(--ink); stroke-width: 1.5; }

/* Callouts, affiliates */
.note {
  border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong);
  background: var(--paper-2); padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius) var(--radius) 0; font-size: .9rem;
}
.note p:last-child { margin-bottom: 0; }
.offer {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--space-5); background: var(--paper-2); margin: var(--space-5) 0;
}
.offer h4 { margin-bottom: 6px; }
.offer p { font-size: .92rem; margin-bottom: var(--space-3); }
.offer__disc { font-size: .72rem; color: var(--ink-3); margin-top: var(--space-3); }
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 11px 20px; border-radius: var(--radius); text-decoration: none;
  font-size: .9rem; font-weight: 600; min-height: 44px; line-height: 22px;
  transition: background .18s ease;
}
.btn:hover { background: var(--accent-2); color: #fff; }
.btn--ghost { background: transparent; color: var(--accent);
              border: 1px solid var(--rule-strong); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-2); }

/* Footer */
.site-foot {
  border-top: 1px solid var(--rule); background: var(--paper-2);
  padding: var(--space-7) 0 var(--space-6); margin-top: var(--space-8);
  font-size: .88rem;
}
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: var(--space-6); }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; gap: var(--space-5); } }
.site-foot h4 { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase;
                color: var(--ink-3); margin-bottom: var(--space-3); }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 7px; }
.site-foot a { color: var(--ink-2); text-decoration: none; }
.site-foot a:hover { color: var(--accent); text-decoration: underline; }
.foot-legal { border-top: 1px solid var(--rule); margin-top: var(--space-6);
              padding-top: var(--space-4); color: var(--ink-3); font-size: .8rem; }

/* A-Z fallback list (also the no-JS map alternative) */
.az { columns: 4 180px; column-gap: var(--space-6); }
.az a { display: block; padding: 4px 0; text-decoration: none; color: var(--ink-2);
        font-size: .89rem; break-inside: avoid; }
.az a:hover { color: var(--accent); }
/* Sized here rather than under .az, which is where it used to live - the
   search results reuse the same dot and it rendered as nothing. */
.dot-sm { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
          vertical-align: middle; }
.az .dot-sm { margin-right: 7px; }

/* ---------- (i) explainers ---------- */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 5px; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: 50%;
  background: transparent; color: var(--ink-3);
  font: 600 10px/1 var(--font-sans); font-style: italic;
  cursor: help; position: relative; vertical-align: middle;
  transition: color .15s ease, border-color .15s ease;
}
.info:hover, .info:focus-visible { color: var(--accent); border-color: var(--accent); }
/* Extend the hit area to 44px without moving the dot. */
.info::after {
  content: ""; position: absolute; inset: -14px;
}
.info__pop {
  position: absolute; bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%);
  width: max-content; max-width: 270px;
  background: var(--ink); color: var(--paper);
  padding: 10px 12px; border-radius: var(--radius);
  font: 400 .8rem/1.45 var(--font-sans); font-style: normal;
  text-align: left; letter-spacing: 0;
  opacity: 0; visibility: hidden; transition: opacity .15s ease;
  z-index: 50; pointer-events: none;
}
.info__pop::after {
  content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--ink);
}
.info__src { display: block; margin-top: 6px; color: #B7AF9F; font-size: .72rem; }
.info:hover .info__pop, .info:focus-visible .info__pop,
.info[aria-expanded="true"] .info__pop { opacity: 1; visibility: visible; }
@media (max-width: 640px) {
  /* Anchor the bubble to the whole row rather than to the (i) itself. The
     button sits at the right-hand end of a pillar label, so anchoring to it
     pushed the bubble off the side of a small phone. */
  .pillar, .pillar-card { position: relative; }
  .pillar .info, .pillar-card .info { position: static; }
  .pillar .info__pop, .pillar-card .info__pop {
    left: 0; right: 0; width: auto; max-width: none; transform: none;
    bottom: calc(100% + 6px);
  }
  .pillar .info__pop::after, .pillar-card .info__pop::after { left: 24px; }
}

/* ---------- Pillar cards (about page) ---------- */
.pillar-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; margin: var(--space-5) 0 var(--space-6);
}
.pillar-card { background: var(--paper); padding: var(--space-4) var(--space-5); }
.pillar-card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-2);
}
.pillar-card__head h3 { margin: 0; font-size: 1.05rem; }
.pillar-card__w {
  font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600;
  color: var(--accent); flex: none;
}
.pillar-card p { font-size: .89rem; margin-bottom: var(--space-2); max-width: none; }

/* ---------- Insurance table ---------- */
.itable { min-width: 1050px; }
.itable td, .itable th { text-align: left; white-space: normal; vertical-align: top;
                         font-size: .84rem; }
.itable td { padding: var(--space-3); }
.itable__name { font-weight: 600; min-width: 150px; }
.itable tbody tr { border-top: 1px solid var(--rule); }
.btn--sm { padding: 7px 13px; font-size: .82rem; min-height: 36px; line-height: 20px; }
/* Anything driven by a finger gets the full 44px. Keyed to width as well as
   pointer type: hybrid devices and emulators often report a fine pointer while
   still being used by hand. */
@media (pointer: coarse), (max-width: 760px) {
  .btn--sm { min-height: 44px; line-height: 28px; }
  .rank-list a { min-height: 44px; }
  .az a { padding: 11px 0; min-height: 44px; }
  .site-foot li { margin-bottom: 4px; }
  .site-foot a { display: inline-block; padding: 10px 0; }
  .crumbs a { display: inline-block; padding: 12px 0; }
  .brand { min-height: 44px; }
  .zoom-ctrl button { height: 44px; min-width: 44px; }
  select, input[type="search"] { min-height: 44px; }
  .srcs a { display: inline-block; padding: 6px 0; }
}
.notes-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4); margin-top: var(--space-5);
}
.notes-grid .note h4 { margin-bottom: 6px; }
.notes-grid .note p { margin: 0; }

details.disclosure { margin: var(--space-4) 0; }
details.disclosure summary { cursor: pointer; font-size: .88rem; color: var(--ink-2);
                             padding: var(--space-2) 0; }
details.disclosure summary:hover { color: var(--ink); }

/* --- Climate strip -------------------------------------------------------
   Twelve months in one glance. Rainfall is the bar because it is the thing
   that ruins a trip; temperature rides above it as a number rather than a
   second axis, since two overlaid scales in a 300px-wide strip read as
   neither. Bars are scaled within the country: the question a reader has is
   which month is wetter than the others *here*, and a shared world scale
   would flatten every dry country into a row of stubs. */
/* One blue, three weights, and the wetter month is always the one that draws
   the eye. That means the ramp flips between themes: on cream paper the
   heaviest bar is the darkest, on near-black it is the lightest.
   Both ends are pinned by WCAG 1.4.11, which wants 3:1 for a graphic that
   carries meaning, and the binding case is not the one you would guess. A
   "good" bar always sits on a shaded is-best tile, so it is measured against
   that tint rather than the grid - which is why the light ramp starts darker
   than it looks like it needs to, and the dark ramp starts lighter. */
:root {
  --rain-good: #5E86AC;
  --rain-ok:   #4C6E8E;
  --rain-poor: #3A5673;
}
@media (prefers-color-scheme: dark) {
  :root {
    --rain-good: #567EA3;
    --rain-ok:   #7096B7;
    --rain-poor: #9DBBD6;
  }
}
.clim-verdict {
  font-family: var(--font-serif); font-size: 1.15rem; line-height: 1.5;
  margin: 0 0 var(--space-5); max-width: 60ch;
}
.clim { margin: 0; }
.clim__grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 2px; align-items: end;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); padding: var(--space-4) var(--space-3);
}
.clim__m {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: var(--radius); padding: 4px 2px; min-width: 0;
}
/* The mild, drier months get the page's own accent tint rather than a colour
   of their own — this is a recommendation, not another risk band. */
.clim__m.is-best { background: var(--accent-soft); }
.clim__t {
  font-family: var(--font-sans); font-size: .72rem; font-variant-numeric: tabular-nums;
  color: var(--ink-2); white-space: nowrap;
}
.clim__m.is-best .clim__t { color: var(--accent-2); font-weight: 600; }
.clim__bar { width: 100%; height: 92px; display: flex; align-items: flex-end; }
.clim__fill { width: 100%; border-radius: 2px 2px 0 0; background: var(--rain-ok); }
.clim__fill--good { background: var(--rain-good); }
.clim__fill--ok   { background: var(--rain-ok); }
.clim__fill--poor { background: var(--rain-poor); }
.clim__mm {
  font-size: .64rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.clim__lab {
  font-size: .74rem; color: var(--ink-2); font-weight: 600;
}
.clim__lab abbr { text-decoration: none; border: 0; }
.clim figcaption { margin-top: var(--space-3); max-width: 74ch; }
.note--health { margin-bottom: var(--space-4); }
.health-links { display: flex; flex-wrap: wrap; gap: var(--space-2); }

@media (max-width: 640px) {
  /* Twelve columns in 320px gives each month 24px, which is not enough for a
     two-digit rainfall figure. Drop the millimetres and keep the shape — the
     bars still answer "which months are wet", and the figures stay in the
     tooltip and the aria-label. */
  .clim__grid { padding: var(--space-3) var(--space-2); gap: 1px; }
  .clim__bar { height: 68px; }
  .clim__mm { display: none; }
  .clim__t { font-size: .62rem; }
}

/* Naming the scale on every legend. The world map and the country map share
   one colour ramp and measure different things — an Atlas Risk Score band
   versus what governments advise — and for 115 of 220 countries they land on
   different colours. Iran reads orange on the homepage and red on its own
   page, which looks like a bug until each legend says which scale it is. */
.legend__title {
  font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; margin-right: var(--space-2);
}
/* Shown only where the two maps actually disagree, so it reads as an
   explanation rather than boilerplate every page repeats. */
.scale-note {
  margin: var(--space-4) 0 0; max-width: 68ch;
  font-size: .88rem; line-height: 1.6; color: var(--ink-2);
  border-left: 3px solid var(--rule-strong); padding-left: var(--space-4);
}

/* --- Temperature scale ---------------------------------------------------
   A separate ramp from the risk bands on purpose. Risk is green-to-red and
   means "how dangerous"; this is blue-to-red and means "how hot", and the two
   must not be read as the same thing — so this one appears only inside the
   weather chart, always with its own key, and never carries green. */
:root {
  --temp-1: #6E88B4;   /* freezing, below 0  */
  --temp-2: #93AEC9;   /* cold, 0-10         */
  --temp-3: #C9C4A8;   /* mild, 10-18        */
  --temp-4: #E0B472;   /* warm, 18-26        */
  --temp-5: #D18A50;   /* hot, 26-32         */
  --temp-6: #B85A3C;   /* extreme, over 32   */
}
@media (prefers-color-scheme: dark) {
  :root {
    --temp-1: #5A749E; --temp-2: #7A93AE; --temp-3: #9C977E;
    --temp-4: #B98F52; --temp-5: #AC6C39; --temp-6: #94422A;
  }
}
.t1 { background: var(--temp-1); }
.t2 { background: var(--temp-2); }
.t3 { background: var(--temp-3); }
.t4 { background: var(--temp-4); }
.t5 { background: var(--temp-5); }
.t6 { background: var(--temp-6); }

/* The heat band sits between the temperatures and the rain bars, so a reader
   scanning down a column gets number, colour, then rainfall. Across the twelve
   columns it forms a continuous strip that shows the shape of the year at a
   glance — the thing a list of numbers cannot do. */
.clim__heat { width: 100%; height: 9px; border-radius: 1px; }
.clim__lo {
  font-size: .62rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
  margin-top: -2px;
}
.clim__key {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-4); margin-top: var(--space-3);
}
.clim__key .legend__sw {
  width: 22px; height: 9px; border-radius: 1px; display: inline-block;
  margin-right: 6px; vertical-align: middle;
}
.clim__key .legend__item { font-size: .8rem; color: var(--ink-2); }

@media (max-width: 640px) {
  .clim__lo { display: none; }   /* 24px a column will not hold two figures */
  .clim__heat { height: 7px; }
}

/* Caption text that has to match what is actually on screen: the nightly low
   and the rainfall figures are dropped below 640px, so the sentence describing
   them is dropped with them. */
.narrow-only { display: none; }
@media (max-width: 640px) {
  .wide-only { display: none; }
  .narrow-only { display: inline; }
}

/* A-Z search. Hidden until the script un-hides it, so a JS-less reader gets the
   full list rather than a box that does nothing. */
.country-filter { margin-top: var(--space-5); max-width: 420px; }
.country-filter input {
  width: 100%; font: inherit; font-size: .95rem;
  padding: 10px var(--space-4); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); background: var(--paper);
  color: var(--ink); min-height: 44px;
}
.country-filter input::placeholder { color: var(--ink-3); }
.country-filter__count { margin: var(--space-2) 0 0; min-height: 1.2em; }

/* Search results: a ranked list that replaces the A-Z while a query is active. */
.results { list-style: none; margin: 0 0 var(--space-6); padding: 0; }
.results__row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: var(--space-3);
  padding: 11px var(--space-2); min-height: 44px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none; color: var(--ink);
}
.results__row:hover { background: var(--paper-2); color: var(--ink); }
.results__name { font-weight: 500; }
.results__name mark {
  background: var(--accent-soft); color: inherit;
  padding: 0 1px; border-radius: 2px;
}
.results__region { font-size: .82rem; color: var(--ink-3); }
.results__score { font-size: .85rem; color: var(--ink-2); min-width: 3.2em;
                  text-align: right; }
@media (max-width: 560px) {
  /* The region is the first thing to go: the name and the score are what a
     reader is actually looking for on a phone. */
  .results__region { display: none; }
  .results__row { grid-template-columns: auto 1fr auto; }
}

/* Lakes, drawn over the land because admin-1 provinces include their share of
   the water. Same fill as the map panel so a lake reads as a hole. */
.water { fill: var(--paper-2); stroke: var(--rule); stroke-width: .5; }
