/* Obsidian Telemetry — design tokens */
:root {
  --canvas: #0a0f1d;
  --surface-1: #0f172a;
  --surface-1-alt: #0c1322;
  --surface-2: #1e293b;
  --border: #334155;
  --border-strong: #64748b;
  --text: #f8fafc;
  --text-meta: #94a3b8;
  --text-muted: #64748b;
  --primary: #06b6d4;
  --primary-bright: #4cd7f6;
  --on-primary: #0a0f1d;
  --secondary: #10b981;
  --tertiary: #6366f1;
  --tertiary-text: #c0c1ff;
  --error: #ef4444;
  --warning: #f59e0b;
  --glow-primary: rgba(6, 182, 212, 0.15);
  --glow-secondary: rgba(16, 185, 129, 0.15);
  --overlay: rgba(15, 23, 42, 0.85);
  --font-ui: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 0.25rem;
  --r-lg: 0.5rem;
  --r-xl: 0.75rem;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --canvas: #f8fafc;
  --surface-1: #ffffff;
  --surface-1-alt: #f8fafc;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #94a3b8;
  --text: #0f172a;
  --text-meta: #475569;
  --text-muted: #64748b;
  --primary: #0891b2;
  --primary-bright: #0e7490;
  --on-primary: #ffffff;
  --secondary: #059669;
  --tertiary: #4f46e5;
  --tertiary-text: #4338ca;
  --error: #dc2626;
  --warning: #d97706;
  --glow-primary: rgba(8, 145, 178, 0.12);
  --glow-secondary: rgba(5, 150, 105, 0.12);
  --overlay: rgba(255, 255, 255, 0.85);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 400 14px/20px var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .container { padding: 0 1.5rem; } }
@media (min-width: 1280px) { .container { padding: 0 2.5rem; } }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--overlay);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; height: 56px; }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  border: 1px solid var(--primary); display: grid; place-items: center;
  box-shadow: 0 0 12px -2px var(--glow-primary);
}
.brand-mark span { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.nav { display: flex; gap: .25rem; margin-left: auto; }
.nav a {
  color: var(--text-meta); font-size: 13px; font-weight: 500; padding: .4rem .65rem;
  border-radius: var(--r-sm); white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--primary); }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; transition: all .15s;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: grid; margin-left: auto; }
  .nav {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; padding: .5rem 1rem 1rem;
    background: var(--surface-1); border-bottom: 1px solid var(--border);
  }
  .nav.open { display: flex; }
  .nav a { padding: .65rem .75rem; }
}
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark { display: none; }

/* Hero */
.hero { padding: 2.5rem 0 1.5rem; }
.eyebrow {
  font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-meta); display: inline-flex; align-items: center; gap: .5rem;
}
h1 { font-size: 26px; line-height: 34px; font-weight: 600; letter-spacing: -0.015em; margin: .5rem 0 .25rem; }
@media (min-width: 768px) { h1 { font-size: 32px; line-height: 40px; letter-spacing: -0.02em; } }
.lede { color: var(--text-meta); font-size: 16px; line-height: 24px; margin: 0; max-width: 680px; }
h2 { font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: -0.015em; margin: 0 0 .75rem; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .25rem; }

/* Beacon */
.beacon { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); box-shadow: 0 0 8px rgba(16,185,129,.6); position: relative; flex: none; }
.beacon::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--secondary); animation: pulse 1.8s ease-out infinite; }
.beacon.warn { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,.6); }
.beacon.warn::after { border-color: var(--warning); }
.beacon.err { background: var(--error); box-shadow: 0 0 8px rgba(239,68,68,.6); }
.beacon.err::after { border-color: var(--error); }
.beacon.idle { background: var(--text-muted); box-shadow: none; }
.beacon.idle::after { display: none; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3); opacity: 0; } }

/* Grid */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .grid { gap: 1.5rem; } }
.section { padding: 1rem 0; }
.span-2 { grid-column: 1 / -1; }

/* Cards */
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: border-color .2s, box-shadow .2s; min-width: 0;
}
.card.scanning { border-color: var(--primary); box-shadow: 0 0 16px -2px rgba(6,182,212,.25); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--surface-2);
}
.card-title { font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-meta); display: flex; align-items: center; gap: .5rem; }
.card-meta { font: 400 11px/14px var(--font-mono); color: var(--text-muted); }
.card-body { padding: 1rem; }

/* IP display */
.ip-hero { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .ip-hero { grid-template-columns: 1fr 1fr; } }
.ip-label { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.ip-value-row { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.ip-value {
  font: 500 28px/36px var(--font-mono); letter-spacing: -0.02em; color: var(--text);
  overflow-wrap: anywhere; min-width: 0; flex: 1;
}
.ip-value.v6 { font-size: 18px; line-height: 26px; }
@media (min-width: 768px) { .ip-value { font-size: 36px; line-height: 44px; } .ip-value.v6 { font-size: 20px; line-height: 28px; } }
.ip-value.muted { color: var(--text-muted); font-size: 16px; line-height: 24px; }
.skeleton { display: inline-block; height: 1em; width: 60%; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; vertical-align: middle; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Copy button */
.copy-btn {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: .35rem;
  height: 32px; padding: 0 .6rem; background: var(--surface-2); color: var(--text-meta);
  border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer;
  font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; transition: all .15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn .ic-check { display: none; }
.copy-btn.copied { color: var(--secondary); border-color: var(--secondary); animation: ripple .6s ease-out; }
.copy-btn.copied .ic-copy { display: none; }
.copy-btn.copied .ic-check { display: block; }
.copy-btn:disabled { opacity: .4; cursor: not-allowed; }
@keyframes ripple { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); } 100% { box-shadow: 0 0 0 10px rgba(16,185,129,0); } }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .45rem; border-radius: var(--r-sm);
  font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.badge-ok { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: var(--secondary); }
.badge-bad { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: var(--error); }
.badge-warn { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: var(--warning); }
.badge-asn { background: var(--surface-2); color: var(--primary); border: 1px solid transparent; }
.badge-idx { background: var(--surface-2); color: var(--tertiary-text); }

/* Data grid */
.data-list { list-style: none; margin: 0; padding: 0; }
.data-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .5rem 1rem; border-bottom: 1px solid var(--surface-2);
}
.data-list li:nth-child(even) { background: var(--surface-1-alt); }
.data-list li:hover { background: var(--surface-2); }
.data-list li:last-child { border-bottom: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.data-list .k { color: var(--text-meta); font-size: 13px; flex: none; }
.data-list .v { font: 400 13px/18px var(--font-mono); text-align: right; overflow-wrap: anywhere; min-width: 0; }
.dim { color: var(--text-muted); }

table.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.grid-table th {
  text-align: left; background: var(--surface-2); color: var(--text-meta); padding: .5rem 1rem;
  font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.grid-table td { padding: .5rem 1rem; border-top: 1px solid var(--surface-2); font-family: var(--font-mono); white-space: nowrap; }
.grid-table tbody tr:nth-child(even) { background: var(--surface-1-alt); }
.grid-table tbody tr:hover { background: var(--surface-2); }
.grid-table td.ui { font-family: var(--font-ui); }

/* Map */
.map-card { display: flex; flex-direction: column; }
#map { flex: 1; display: flex; flex-direction: column; min-height: 280px; }
#map > * { flex: 1; }
.map-frame { width: 100%; min-height: 280px; border: 0; display: block; border-radius: 0 0 var(--r-lg) var(--r-lg); filter: saturate(.85); }
:root:not([data-theme="light"]) .map-frame { filter: invert(.92) hue-rotate(180deg) saturate(.6) brightness(.95); }
.map-empty { height: 280px; display: grid; place-items: center; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 38px; padding: 0 1rem;
  border-radius: var(--r-sm); font: 600 13px/16px var(--font-ui); letter-spacing: .01em; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 14px rgba(6,182,212,.35); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-meta); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Input */
.cmd-input {
  display: flex; align-items: center; gap: .5rem; height: 44px; padding: 0 .75rem;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-sm); transition: all .15s;
}
.cmd-input:focus-within { border-color: var(--primary); box-shadow: 0 0 16px -2px rgba(6,182,212,.25), inset 0 0 0 1px var(--glow-primary); }
.cmd-input .prefix { font: 500 13px var(--font-mono); color: var(--text-muted); flex: none; }
.cmd-input input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 500 15px var(--font-mono); }
.kbd { font: 500 10px var(--font-mono); color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .15rem .35rem; flex: none; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r-sm); gap: 2px; flex-wrap: wrap; }
.segmented button {
  background: none; border: 0; color: var(--text-meta); padding: .35rem .65rem; border-radius: 3px; cursor: pointer;
  font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--primary); }

/* Latency meter */
.meter { height: 6px; background: var(--surface-2); border-radius: 9999px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s ease, background .3s; border-radius: inherit; }
.big-metric { font: 500 44px/48px var(--font-mono); letter-spacing: -0.03em; }
.big-metric small { font-size: 16px; color: var(--text-muted); margin-left: .25rem; }

.spark { width: 100%; height: 120px; display: block; }

/* Tools promo */
.tool-card { display: block; padding: 1rem; color: var(--text); }
.tool-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 0 16px -2px rgba(6,182,212,.25); }
.tool-card p { color: var(--text-meta); margin: .25rem 0 0; }
.tool-card .arrow { color: var(--primary); font-family: var(--font-mono); font-size: 12px; margin-top: .75rem; display: inline-block; }

/* Prose / FAQ */
.prose { color: var(--text-meta); font-size: 15px; line-height: 24px; max-width: 760px; }
.prose p { margin: 0 0 1rem; }
.prose h2 { color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }
.faq details { border-bottom: 1px solid var(--surface-2); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: .85rem 1rem; font-weight: 500; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--text-muted); }
.faq details[open] summary::after { content: "−"; color: var(--primary); }
.faq details p { margin: 0; padding: 0 1rem 1rem; color: var(--text-meta); line-height: 22px; }

.notice {
  display: flex; gap: .6rem; padding: .75rem 1rem; border-radius: var(--r-lg); font-size: 13px; line-height: 20px;
  background: var(--glow-primary); border: 1px solid rgba(6,182,212,.3); color: var(--text-meta);
}
.notice strong { color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 2.5rem; padding: 1.5rem 0 2rem; color: var(--text-muted); font-size: 12px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-inner a { color: var(--text-meta); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--overlay); backdrop-filter: blur(8px); border: 1px solid var(--secondary); color: var(--secondary);
  padding: .5rem .9rem; border-radius: var(--r-sm); font: 500 10px/12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  transition: all .2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* Resolved-IP chips in the lookup result */
button.badge { border: 1px solid transparent; font-family: var(--font-mono); }
button.badge:hover { border-color: var(--primary); }
button.badge:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
#d-resolved { display: flex; flex-wrap: wrap; justify-content: flex-end; }
#d-resolved .badge, #lookup-target { text-transform: none; letter-spacing: 0; }
.table-wrap { max-width: 100%; }
.grid-table td.ui { white-space: normal; min-width: 12rem; }
.grid-table td code { white-space: nowrap; }
.card pre { overflow-wrap: anywhere; max-width: 100%; }
