@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/plex-mono-500.woff2") format("woff2"); }

/* Colour tokens shared with the operator console. */
/* Nexthop brand pink on neutral greys (no blue cast, so the pink stays hot).
   - Pink fills carry white text: #e60073 is the hottest pink at 4.5:1 with
     white; the brand #ff3399 is only 3.4:1.
   - Pink as text: a lighter #ff85c2 on dark (8:1; the saturated brand pink
     passes 4.5:1 but shimmers in thin small text) and a deeper #c80058 on
     light (5.8:1 on white). Fills, underlines and borders keep the hot pink.
   - Selected states (query type, locations) are neutral and inverted, so pink
     stays an accent: the main action, the active tab, links, highlights.
   The theme follows the system unless the visitor picks one (theme.js sets
   data-theme on <html>). */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --hover: #f5f5f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --fg: #171717;
  --muted: #525252;
  --faint: #737373;
  --inverse-bg: #171717;
  --inverse-fg: #fafafa;
  --primary: #e60073;
  --primary-hover: #cc0066;
  --primary-fg: #ffffff;
  --primary-ink: #c80058;
  --critical: hsl(0 72% 42%);
  --medium: hsl(40 90% 27%);
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
/* Dark tokens, used for an explicit dark choice or a dark system setting
   when no choice was made. Both selectors carry the same block. */
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #171717;
  --hover: #262626;
  --border: #262626;
  --border-strong: #404040;
  --fg: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #737373;
  --inverse-bg: #f5f5f5;
  --inverse-fg: #171717;
  --primary-ink: #ff85c2;
  --critical: hsl(0 75% 64%);
  --medium: hsl(42 95% 56%);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --surface: #171717;
    --hover: #262626;
    --border: #262626;
    --border-strong: #404040;
    --fg: #f5f5f5;
    --muted: #a3a3a3;
    --faint: #737373;
    --inverse-bg: #f5f5f5;
    --inverse-fg: #171717;
    --primary-ink: #ff85c2;
    --critical: hsl(0 75% 64%);
    --medium: hsl(42 95% 56%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-family: var(--sans); font-size: 15px; -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.45; }
.wrap { margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* The header is black in both themes, as on nexthop.com.au. */
.top { border-bottom: 1px solid #262626; background: #0a0a0a; color: #fafafa; }
.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }
.brand .product { font-size: 15px; font-weight: 500; color: #d4d4d4; padding-left: 14px; border-left: 1px solid #404040; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }


.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-top: 20px; }

.kinds { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.kinds label { cursor: pointer; }
.kinds input { position: absolute; opacity: 0; pointer-events: none; }
.kinds span { display: inline-block; padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; color: var(--muted); }
.kinds label:hover span { background: var(--hover); color: var(--fg); }
.kinds input:checked + span { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-fg); }
.kinds input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="text"], select {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 7px 10px;
}
#value { flex: 1 1 320px; font-family: var(--mono); }
input[type="text"]:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
button {
  font: inherit; font-weight: 500; cursor: pointer; border-radius: 6px; padding: 7px 18px;
  background: transparent; color: var(--fg); border: 1px solid var(--border-strong);
}
/* The main action (Run, Decode). Only these are pink; every other button
   styles its own hover, so none inherits a pink one. */
button.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button:disabled { opacity: 0.55; cursor: progress; }
button.ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); padding: 4px 10px; font-family: var(--mono); font-weight: 400; }
button.ghost:hover { background: var(--hover); border-color: var(--border-strong); }

.hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
button.link { background: none; border: 0; padding: 0; color: var(--primary-ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
button.link:hover:not(:disabled) { text-decoration: underline; background: none; }
.resolve { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }

.out-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 600; margin: 0; font-family: var(--mono); word-break: break-all; }
.meta { font-size: 13px; color: var(--muted); }
.error { color: var(--critical); margin: 12px 0 0; }

.scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border-strong); padding: 6px 10px 6px 0; white-space: nowrap; }
td { border-bottom: 1px solid var(--border); padding: 6px 10px 6px 0; vertical-align: top; }
td.num, th.num { text-align: right; }
td.mono, .mono { font-family: var(--mono); }
td.path { font-family: var(--mono); word-break: break-word; min-width: 180px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-family: var(--mono); font-size: 12px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; }
.loss-some { color: var(--medium); }
.loss-all { color: var(--critical); }
.summary { margin-top: 12px; font-size: 14px; color: var(--muted); font-family: var(--mono); }

.foot { color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 32px; }

/* Result tabs: the console's document-tab strip (underline on the active
   tab, close glyph on each). It scrolls instead of wrapping. */
.out { padding-top: 0; }
.tabs { border-bottom: 1px solid var(--border); margin: 0 -16px 12px; padding: 0 8px; }
.tab-strip { display: flex; overflow-x: auto; scrollbar-width: none; }
.tab-strip::-webkit-scrollbar { display: none; }
.tab-item { display: flex; align-items: stretch; flex-shrink: 0; }
.tab {
  height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
  max-width: 280px;
}
.tab .label { overflow: hidden; text-overflow: ellipsis; }
.tab:hover { background: var(--hover); color: var(--fg); }
.tab[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--fg); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .tab .dot { animation: none; } }
.tab-close {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--faint); cursor: pointer;
  padding: 0 10px 0 4px; font: inherit; font-size: 16px; line-height: 1; border-radius: 0;
}
.tab-item:has(.tab[aria-selected="true"]) .tab-close { border-bottom-color: var(--primary); }
.tab-close:hover { color: var(--fg); background: var(--hover); }

/* AS path chain: this network on the left, the origin on the right. */
.chains { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 18px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain-prefix { font-family: var(--mono); font-size: 13px; color: var(--muted); width: 100%; }
.as-node {
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 10px; background: var(--bg);
  display: flex; flex-direction: column; min-width: 0; max-width: 150px;
}
.as-node .asn { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.as-node .as-name { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-node .times { font-size: 11px; color: var(--muted); }
.as-node.self { border-style: dashed; }
.as-node.origin { border-color: var(--primary-ink); }
.as-arrow { color: var(--faint); font-size: 14px; }
.path-asn { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }

@media (max-width: 640px) {
  .wrap { padding: 0 12px; }
  .panel { padding: 12px; }
  .tabs { margin: 0 -12px 12px; }
}

/* Location chips: All, or any set of locations. */
.sites { border: 0; padding: 0; margin: 12px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sites legend { float: left; color: var(--muted); font-size: 14px; margin-right: 4px; padding: 0; }
.site-list { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 500;
}
button.chip:hover { background: var(--hover); color: var(--fg); }
button.chip[aria-pressed="true"] { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-fg); }

/* Per-location comparison rows and sections. */
td.loc, .site-section summary .loc { font-weight: 600; white-space: nowrap; }
td.chain-cell { min-width: 260px; }
td.chain-cell .chain .as-node { padding: 2px 8px; }
td.actions { white-space: nowrap; text-align: right; }
button.ghost.small { font-family: var(--sans); font-size: 13px; padding: 3px 10px; margin-left: 4px; }
.site-section { border-top: 1px solid var(--border); padding: 10px 0; }
.site-section:first-of-type { border-top: 0; }
.site-section summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; list-style: none; }
.site-section summary::before { content: "▸"; color: var(--faint); width: 10px; }
.site-section[open] summary::before { content: "▾"; }
.site-section summary::-webkit-details-marker { display: none; }
td.latency { min-width: 130px; padding-right: 24px; white-space: nowrap; }

/* Header navigation and the communities page. */
.nav a, a.home { color: inherit; text-decoration: none; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: #ff85c2; font-size: 14px; font-weight: 500; }  /* on the black header: 8.9:1 */
.nav a:hover { text-decoration: underline; }
.page-title { font-family: var(--sans); font-size: 18px; }
.filter-row { margin: 14px 0 6px; }
#filter { flex: 1 1 320px; font-family: var(--sans); }
.community-group { margin-top: 22px; }
.community-group h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.community-group table { table-layout: fixed; }
.community-group th:first-child, .community-group td.value { width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.known {
  border-color: var(--border-strong); color: var(--fg); cursor: help; font-family: var(--sans);
  max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.decode-row { margin-top: 14px; }
#decode-value { flex: 1 1 280px; font-family: var(--mono); }
.decoded { margin: 10px 0 0; font-size: 14px; min-height: 1.4em; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px 28px; margin-top: 8px; }
.key-card h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.key-card td.value { width: 56px; white-space: nowrap; }
.format { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--primary-ink); margin-left: 6px; }

/* Theme switch in the header. */
button.theme {
  background: transparent; border: 1px solid #404040; color: #d4d4d4; border-radius: 6px;
  padding: 3px 10px; font-size: 13px; font-weight: 500;
}
button.theme:hover { background: #262626; border-color: #525252; color: #fafafa; }
.input-error { margin: 10px 0 0; font-size: 14px; }
#value[aria-invalid="true"] { outline: 2px solid var(--critical); outline-offset: -1px; }

/* Communities on their own row under each route. */
tr.has-comm > td { border-bottom: 0; padding-bottom: 2px; }
tr.comm-row > td.comm-cell { padding-top: 0; padding-bottom: 10px; }
tr.comm-row .tags { gap: 4px 6px; }

/* The query panel stays at a readable width; results use the full page. */
#query { max-width: 1120px; }
