/* Colours, type and shapes follow dns.lgbt's DESIGN.md (tokens from public/src/app/globals.css). */
:root {
  color-scheme: light dark;
  --trans-blue: #5bcefa;
  --trans-pink: #f5a9b8;
  --tint: #0b66a1;
  --grouped: #f5f5f7;
  --elevated: #ffffff;
  --label: #1d1d1f;
  --label-secondary: #606065;
  --label-tertiary: #8e8e93;
  --separator: rgb(60 60 67 / 0.16);
  --success: #17703a;
  --success-soft: rgb(52 199 89 / 0.16);
  --danger: #c00012;
  --danger-soft: rgb(255 59 48 / 0.14);
  --fill: rgb(118 118 128 / 0.12);
  --fill-secondary: rgb(118 118 128 / 0.07);
  /* Charts: dns.lgbt's validated palette, the node colour follows the node number. */
  --viz-cat-1: #2a78d6;
  --viz-cat-2: #eb6834;
  --viz-cat-3: #1baf7a;
  --viz-cat-4: #eda100;
  --viz-cat-5: #e87ba4;
  --viz-grid: #e8e8ed;
  --viz-axis: #d2d2d7;
  --map-land: #e8e8ed;
  --map-sea: #f5f5f7;
  --map-border: #ffffff;
  --map-arc: rgb(11 102 161 / 0.55);
  --map-arc-far: rgb(11 102 161 / 0.3);
  --shadow-overlay: 0 0 0 0.5px rgb(0 0 0 / 0.08), 0 8px 24px rgb(0 0 0 / 0.12);
  --shadow-card: 0 0 0 0.5px rgb(0 0 0 / 0.05), 0 1px 2px rgb(0 0 0 / 0.04);
  --pride-gradient: linear-gradient(90deg, #e0263b, #f06a00, #d99a00, #1f9a4b, #2563eb, #8b3fd1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --tint: var(--trans-blue);
    --grouped: #000000;
    --elevated: #1c1c1e;
    --label: #f5f5f7;
    --label-secondary: #a1a1a6;
    --label-tertiary: #6e6e73;
    --separator: rgb(84 84 88 / 0.6);
    --success: #30d158;
    --success-soft: rgb(48 209 88 / 0.18);
    --danger: #ff453a;
    --danger-soft: rgb(255 69 58 / 0.18);
    --fill: rgb(118 118 128 / 0.24);
    --fill-secondary: rgb(118 118 128 / 0.14);
    --viz-cat-1: #3987e5;
    --viz-cat-2: #d95926;
    --viz-cat-3: #199e70;
    --viz-cat-4: #c98500;
    --viz-cat-5: #d55181;
    --viz-grid: #2c2c2e;
    --viz-axis: #3a3a3c;
    --map-land: #2c2c2e;
    --map-sea: #1c1c1e;
    --map-border: #1c1c1e;
    --map-arc: rgb(91 206 250 / 0.6);
    --map-arc-far: rgb(91 206 250 / 0.3);
    --shadow-overlay: 0 0 0 0.5px rgb(255 255 255 / 0.1), 0 8px 24px rgb(0 0 0 / 0.5);
    --shadow-card: none;
    --pride-gradient: linear-gradient(90deg, #ff5a5f, #ff9f40, #ffd23f, #4ade80, #60a5fa, #c084fc);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grouped);
  color: var(--label);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Geist", system-ui, sans-serif;
  letter-spacing: -0.01em;
}
main { max-width: 768px; margin: 0 auto; padding: 48px 16px 64px; }
@media (min-width: 768px) { main { padding: 72px 40px 96px; } }

header { margin-bottom: 40px; }
h1 { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -0.02em; }
/* Light mode uses the deepened blue and pink (the pastels are too light on white). */
.asn {
  background: linear-gradient(90deg, #0b66a1, #b8326a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (prefers-color-scheme: dark) { .asn { background-image: linear-gradient(90deg, var(--trans-blue), var(--trans-pink)); } }
.lead { margin: 8px 0 0; max-width: 65ch; color: var(--label-secondary); font-size: 17px; line-height: 1.4; }
.pride-rule { height: 2px; width: 48px; margin-top: 24px; border-radius: 999px; background: var(--pride-gradient); }

section { margin-top: 32px; }
h2 { margin: 0 0 8px 16px; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--label-secondary); text-transform: uppercase; letter-spacing: 0.02em; }

.list { margin: 0; padding: 0; list-style: none; background: var(--elevated); border-radius: 16px; box-shadow: var(--shadow-card); overflow: hidden; }
.row { display: flex; gap: 16px; justify-content: space-between; align-items: baseline; min-height: 44px; padding: 11px 16px; position: relative; }
.list > * + * > .row::before, .list > .row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
dt { flex: none; }
dd { margin: 0; text-align: right; color: var(--label-secondary); min-width: 0; overflow-wrap: anywhere; }
ul.list .row { display: block; }
.sub { color: var(--label-secondary); font-size: 13px; margin-left: 4px; }
.mono { font-family: ui-monospace, "SF Mono", "Geist Mono", Menlo, monospace; font-size: 14px; }

a { color: var(--tint); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 4px; }
.links a.row { display: flex; align-items: center; color: var(--label); }
.links a.row:hover { text-decoration: none; background: rgb(118 118 128 / 0.07); }
.links a.row:focus-visible { outline-offset: -2px; border-radius: 0; }
.chev { color: var(--label-tertiary); font-size: 20px; line-height: 1; }

@media (max-width: 520px) {
  dl .row { flex-direction: column; gap: 2px; align-items: flex-start; }
  dd { text-align: left; }
}
/* Live peering (peering.js) */
h3 { margin: 20px 0 8px 16px; font-size: 15px; line-height: 20px; font-weight: 600; }
.note { margin: 0 16px 8px; font-size: 13px; color: var(--label-secondary); }
h3 + .list + .note { margin-top: 8px; }
.badge { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 18px; font-weight: 500; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.up { color: var(--success); background: var(--success-soft); }
.badge.down { color: var(--danger); background: var(--danger-soft); }
.list > .row + details > summary::before, .list > details + details > summary::before, .list > details + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
details > summary { list-style: none; cursor: pointer; align-items: center; }
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { background: rgb(118 118 128 / 0.07); }
details > summary:focus-visible { outline: 2px solid var(--tint); outline-offset: -2px; }
details > summary .chev { display: inline-block; margin-left: 6px; transition: transform 200ms cubic-bezier(0.32, 0.72, 0, 1); }
details[open] > summary .chev { transform: rotate(90deg); }
.peers { margin: 0; padding: 0 0 4px; list-style: none; background: rgb(118 118 128 / 0.07); }
.peers a.row { display: flex; align-items: baseline; gap: 6px; min-height: 40px; padding: 9px 16px 9px 32px; color: var(--label); font-size: 14px; }
.peers a.row:hover { text-decoration: none; background: rgb(118 118 128 / 0.07); }
.peers a.row:focus-visible { outline-offset: -2px; border-radius: 0; }
.peers li + li a.row::before { content: ""; position: absolute; top: 0; left: 32px; right: 0; border-top: 0.5px solid var(--separator); }
.peers .peer { min-width: 0; }
.peers .count { margin-left: auto; padding-left: 12px; color: var(--label-secondary); font-size: 13px; white-space: nowrap; }
dd:has(> .badge) { flex: none; }
@media (max-width: 520px) { details > summary.row { flex-direction: row; align-items: center; } }
/* Charts (traffic.js, map.js) */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--fill); }
.segmented button { font: inherit; font-size: 13px; line-height: 18px; color: var(--label); background: none; border: 0; border-radius: 999px; padding: 5px 12px; min-height: 28px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--elevated); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); font-weight: 600; }
@media (prefers-color-scheme: dark) { .segmented button[aria-pressed="true"] { background: #636366; } }
.segmented button:focus-visible { outline: 2px solid var(--tint); outline-offset: 1px; }
.segmented.range { margin: 0 0 12px 8px; }
.chart-card { background: var(--elevated); border-radius: 16px; box-shadow: var(--shadow-card); padding: 16px; }
.chart-card + .chart-card { margin-top: 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-head h3 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 8px; padding: 0; list-style: none; font-size: 13px; color: var(--label-secondary); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
figure { margin: 0; position: relative; }
.chart svg { display: block; max-width: 100%; border-radius: 4px; }
.chart svg:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .axis { stroke: var(--viz-axis); stroke-width: 1; }
.tick { fill: var(--label-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hovering .bar:not(.on) { opacity: 0.45; }
.tooltip { position: absolute; z-index: 2; min-width: 180px; padding: 10px 12px; border-radius: 12px; background: var(--elevated); box-shadow: var(--shadow-overlay); font-size: 13px; pointer-events: none; }
.tip-title { font-weight: 600; margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--label-secondary); line-height: 20px; }
.tip-value { margin-left: auto; padding-left: 12px; color: var(--label); font-variant-numeric: tabular-nums; }
.tip-total { margin-top: 4px; padding-top: 4px; border-top: 0.5px solid var(--separator); color: var(--label); }
.table-view { margin-top: 8px; font-size: 13px; }
.table-view summary { cursor: pointer; color: var(--tint); padding: 6px 0; min-height: 32px; }
.table-view summary:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 4px; }
.table-view table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: right; padding: 6px 4px; border-top: 0.5px solid var(--separator); white-space: nowrap; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view th { font-weight: 500; color: var(--label-secondary); }
.table-view-wrap { max-height: 320px; overflow-y: auto; }

.world-head { margin: 0 0 12px 8px; }
.geo { background: var(--map-sea); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-card); }
.geo-canvas { position: absolute; top: 0; left: 0; height: 100%; }
.geo-canvas > svg { display: block; width: 100%; height: 100%; }
#map:fullscreen, #map.covering { box-sizing: border-box; display: flex; flex-direction: column; margin: 0; padding: 16px; background: var(--grouped); overflow: hidden; }
#map.covering { position: fixed; inset: 0; z-index: 10; }
html.map-covering { overflow: hidden; }
#map:fullscreen .world, #map.covering .world { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#map .geo.expanded { flex: 1; min-height: 0; }
.geo.expanded:focus-visible { outline: 2px solid var(--tint); outline-offset: -2px; }
.geo.pannable { cursor: grab; touch-action: pan-y; }
.geo.dragging { cursor: grabbing; user-select: none; }
.map-expand { position: absolute; top: 10px; right: 10px; z-index: 1; font: inherit; font-size: 13px; line-height: 18px; padding: 5px 12px; min-height: 28px; border: 0; border-radius: 999px; background: var(--elevated); color: var(--label); box-shadow: var(--shadow-card), 0 1px 3px rgb(0 0 0 / 0.12); cursor: pointer; }
.map-expand:hover { background: color-mix(in srgb, var(--elevated) 88%, var(--label)); }
.map-expand:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
.geo .land, .geo .arcs path, .geo .place { vector-effect: non-scaling-stroke; }
.geo .land { fill: var(--map-land); stroke: var(--map-border); stroke-width: 0.5; }
.geo .land.on { stroke: var(--label); stroke-width: 1; }
.geo .arcs path { fill: none; stroke: var(--map-arc); stroke-linecap: round; }
.geo .arcs path.hop2 { stroke: var(--map-arc-far); }
.geo .place { fill: var(--elevated); stroke: var(--label-secondary); stroke-width: 1; }
.geo .place:hover { stroke: var(--tint); stroke-width: 2; }
.geo .place-label { fill: var(--label); font-weight: 600; paint-order: stroke; stroke: var(--map-sea); pointer-events: none; }
.pin-dot { pointer-events: none; position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--map-sea); }
.pin-dot.is-you { box-shadow: 0 0 0 2px var(--map-sea), 0 0 0 3.5px var(--tint); }
.world { position: relative; }
.world-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.legend.pins { margin: 0; }
.pin strong { color: var(--label); font-weight: 600; }
.pin .you { display: none; color: var(--tint); font-weight: 600; }
.pin.is-you .you { display: inline; }
.legend.scale { margin: 10px 0 0 16px; }
.world-head .legend.scale { margin: 0; }
.legend.scale .swatch { width: 18px; }
.world > .note { margin-top: 8px; }
.tip-sub { margin-top: 4px; font-size: 12px; }
.map-table { margin-left: 16px; margin-right: 16px; }
.map-table td:nth-child(2), .map-table td:nth-child(4), .map-table th:nth-child(2), .map-table th:nth-child(4) { white-space: normal; text-align: left; }
.map-table td:nth-child(2) { overflow-wrap: anywhere; }


@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

::selection { background: color-mix(in srgb, var(--trans-pink) 32%, transparent); }
