:root { --pq: #FFAD5B; --cl: #3BBFDE; --unk: #5a5a5a; --nodata: #2a2d33; --back: #6e6e6e; }
html { scroll-behavior: smooth; }
main { display: block; }

/* top bar */
.proto-tag { margin-left: 4px; border: 1px dashed #555; color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 11px; white-space: nowrap; }
.asof { color: var(--text-2); font-size: 13px; }
.vswitch { display: inline-flex; border: 1px solid #333; border-radius: 999px; overflow: hidden; }
.vswitch button { background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13px; padding: 5px 14px; cursor: pointer; white-space: nowrap; }
.vswitch button[aria-pressed="true"] { background: #2a2a2a; color: var(--text); }
.vswitch button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* intro with the summary tiles under it */
.intro { max-width: 1360px; margin: 0 auto; padding: 48px 24px 36px; border-bottom: 1px solid var(--line); }
.intro .kick, .chap .num { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.chap .num { color: var(--muted); font-size: 12px; }
.intro h2 { font-size: 40px; font-weight: 300; line-height: 1.15; margin: 10px 0 28px; max-width: 1000px; letter-spacing: -.01em; }
.intro h2 b { font-weight: 600; color: var(--pq); }
.intro > p { color: var(--text-2); font-size: 15px; max-width: 760px; margin: 0 0 28px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tile { background: var(--page); padding: 16px 18px 18px; min-width: 0; }
.tile .k { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tile .v { font-family: var(--font-display); font-size: 40px; font-weight: 300; line-height: 1.1; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.tile .v.pq { color: var(--pq); }
.tile .s { color: var(--text-2); font-size: 12.5px; }
.tile .s b { color: var(--text); font-weight: 600; }
.tbar { display: flex; gap: 2px; height: 8px; margin-top: 10px; }
.tbar div { height: 8px; }
.tbar div:first-child { border-radius: 4px 0 0 4px; }
.tbar div:last-child { border-radius: 0 4px 4px 0; }

/* chapters: finding on the left (sticky), evidence on the right */
.chap { max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: 320px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.chap .lede { padding: 40px 28px 40px 24px; border-right: 1px solid var(--line); }
.chap .lede-in { position: sticky; top: 28px; }
.chap .big { font-family: var(--font-display); font-size: 60px; font-weight: 300; line-height: 1; margin: 14px 0 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chap .big .unit { font-size: .45em; color: var(--text-2); }
.chap .big.ok { color: var(--pq); }
.chap h2 { font-size: 21px; font-weight: 500; line-height: 1.3; margin: 0 0 10px; }
.chap h2.notes-h { margin-top: 14px; }
.chap .lede p { color: var(--text-2); font-size: 13.5px; margin: 0 0 10px; }
.chap .lede p b { color: var(--text); }
.chap .body { padding: 36px 24px 40px; min-width: 0; display: flex; flex-direction: column; gap: 34px; }
.chap .body > div { min-width: 0; }
.chap .body h3 { font-size: 14px; margin: 0 0 6px; font-weight: 650; }
.chap.notes ul { padding-left: 18px; margin: 0; color: var(--text-2); font-size: 13px; max-width: 920px; }
.chap.notes li { margin: 0 0 7px; }
.chap.notes li b { color: var(--text); font-weight: 600; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; }
.head-row h3 { margin: 0 !important; }
.desc { color: var(--text-2); font-size: 13px; margin: 4px 0 12px; }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* legends */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: 3px; }
.legend i.dash { border-top-style: dashed; }
.legend i.box { width: 10px; height: 10px; border: 0; border-radius: 2px; vertical-align: -1px; }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { font-family: var(--font-text); fill: var(--muted); font-size: 11px; }
.chart .grid line { stroke: #262626; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .tpanel + .tpanel { margin-top: 18px; }
.chart .panel-lab { font-size: 12px; color: var(--text-2); margin: 0 0 4px; }
.chart .panel-lab i { display: inline-block; width: 16px; height: 2px; margin-right: 7px; vertical-align: 3px; }

/* map with the pinned-country card beside it */
.mapbox { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; margin-top: 10px; }
.map svg { display: block; width: 100%; height: auto; overflow: hidden; }
/* borders keep their width while the map is zoomed in */
.map .c { vector-effect: non-scaling-stroke; }
.map path.c { stroke: #121212; stroke-width: .5; cursor: pointer; }
.map path.c:hover, .map path.c.on { stroke: #f2f2f2; stroke-width: 1.2; }
.map circle.c { stroke: #121212; stroke-width: 1; cursor: pointer; }
.map circle.c:hover, .map circle.c.on { stroke: #f2f2f2; stroke-width: 1.5; }
/* fade the rest while a country is pinned (strong) or hovered (light) */
.map .c, .rank-row { transition: opacity .15s; }
.map.has-pin .c:not(.on) { opacity: .3; }
.map.has-pin .c:not(.on):hover { opacity: .75; }
.map:not(.has-pin):has(.c:hover) .c:not(:hover) { opacity: .55; }
#ranked.has-pin .rank-row:not(.on) { opacity: .4; }
#ranked.has-pin .rank-row:not(.on):hover { opacity: .8; }
#ranked:not(.has-pin):has(.rank-row:hover) .rank-row:not(:hover) { opacity: .55; }
/* the other bar charts: the hovered bar or row stays, the rest turn grey and dim (a dimmed blue
   would look like the aqua "unsettled" colour, so these fade to grey rather than to a darker hue) */
.nrow, .kx-row, .share div, .chart path.bar { transition: opacity .15s, filter .15s; }
#nets:has(.nrow:hover) .nrow:not(:hover),
#kxrows:has(.kx-row:hover) .kx-row:not(:hover),
.share:has(div:hover) div:not(:hover),
.chart svg.hov path.bar:not(.on) { opacity: .5; filter: grayscale(1); }
.csel { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.csel select { background: #1c1c1c; color: var(--text); border: 1px solid #333; border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 13px; max-width: 220px; cursor: pointer; }
.csel select:focus-visible { outline: 2px solid var(--pq); outline-offset: 1px; }
.ramp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.ramp-legend .bar { width: 150px; height: 10px; border-radius: 3px; }
.ramp-legend .nd { display: inline-block; width: 12px; height: 10px; border-radius: 2px; background: var(--nodata); margin-left: 8px; }
.ccard { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.ccard .name { font-size: 19px; font-weight: 500; margin: 0 0 2px; }
.ccard .sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.ccard .row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.ccard .row span:first-child { color: var(--text-2); }
.ccard .row span:last-child { font-variant-numeric: tabular-nums; text-align: right; }
.ccard .bigs { font-family: var(--font-display); font-size: 40px; font-weight: 300; line-height: 1; margin: 6px 0 12px; color: var(--pq); }
.ccard .spark { margin-top: 10px; }
.ccard .spark .lbl { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.ccard .hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.ccard button.linkish { background: none; border: 0; padding: 0; margin-top: 8px; color: var(--link); cursor: pointer; font: inherit; font-size: 12.5px; }

/* ranked countries */
.rank-row, .rank-head { display: grid; grid-template-columns: minmax(0, 170px) 1fr 54px 80px; gap: 10px; align-items: center; }
.rank-row { padding: 5px 0; font-size: 13px; border-top: 1px solid var(--line); cursor: pointer; }
.rank-row:hover, .rank-row.on { background: #181818; }
.rank-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .tr { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.rank-row .tr div { height: 8px; background: var(--pq); border-radius: 0 4px 4px 0; }
.rank-row .p, .rank-row .n { text-align: right; font-variant-numeric: tabular-nums; }
.rank-row .n { color: var(--text-2); }
.rank-head { font-size: 11.5px; color: var(--muted); padding-bottom: 4px; }
.rank-head span:nth-child(3), .rank-head span:nth-child(4) { text-align: right; }

/* network rows */
.nrow { display: grid; grid-template-columns: minmax(0, 200px) 1fr 52px; gap: 10px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.nrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrow .nm small { color: var(--muted); margin-left: 6px; }
.nrow .tr { height: 10px; position: relative; }
.nrow .tr .all { position: absolute; inset: 0 auto 0 0; display: flex; gap: 2px; height: 10px; }
.nrow .tr .all div { height: 10px; min-width: 1px; }
.nrow .tr .all div:last-child { border-radius: 0 4px 4px 0; }
.nrow .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* key exchange rows */
.kx-row { display: grid; grid-template-columns: minmax(0, 190px) 1fr 70px; gap: 10px; align-items: center; padding: 4px 0; font-size: 12.5px; }
.kx-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; font-size: 12px; }
.kx-row .tr { height: 10px; background: var(--track); border-radius: 0 4px 4px 0; }
.kx-row .tr div { height: 10px; border-radius: 0 4px 4px 0; }
.kx-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* Cloudflare comparison */
.share { display: flex; gap: 2px; height: 22px; }
.share div { height: 22px; }
.share div:first-child { border-radius: 4px 0 0 4px; }
.share div:last-child { border-radius: 0 4px 4px 0; }
.share-key { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.share-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; vertical-align: -1px; }
.share-key b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cf-row + .cf-row { margin-top: 18px; }
.cf-row .lab { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }

/* tooltip */
.htip { position: fixed; z-index: 30; pointer-events: none; background: #1c1c1c; border: 1px solid #333; border-radius: 6px; padding: 6px 10px; font-size: 12.5px; color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.4); white-space: nowrap; }
.htip .k { color: var(--text-2); }
.footer-logo-img { height: 40px; width: auto; }

@media (max-width: 1100px) {
  .mapbox { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .chap { grid-template-columns: 1fr; }
  .chap .lede { border-right: 0; padding: 32px 16px 0; }
  .chap .lede-in { position: static; }
  .chap .body { padding: 22px 16px 32px; }
  .chap .big { font-size: 48px; }
  .intro { padding: 32px 16px 28px; }
  .intro h2 { font-size: 28px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 30px; }
}
@media (max-width: 560px) {
  .proto-tag { display: none; }
  .brand h1 { font-size: 20px; }
  .vswitch button { padding: 5px 10px; font-size: 12.5px; }
  .tile { padding: 12px 12px 14px; }
  .tile .v { font-size: 26px; }
  .nrow { grid-template-columns: minmax(0, 110px) 1fr 40px; }
  .nrow .nm small { display: none; }
  .kx-row { grid-template-columns: minmax(0, 120px) 1fr 52px; }
  .rank-row, .rank-head { grid-template-columns: minmax(0, 1fr) 70px 46px; }
  .rank-row .n, .rank-head span:nth-child(4) { display: none; }
}
