/* ========================================================================
   ipchk.ai — tokens
   Dark is the default because the page is mostly dense data; the light
   palette mirrors every token so nothing is defined in only one theme.
   ===================================================================== */
:root {
  --bg: #07090d;
  --bg-glow: #0f2b2f;
  --surface: #0d1117;
  --surface-2: #11161f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e7edf4;
  --text-muted: #8b96a6;
  --text-faint: #5d6675;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --accent-ink: #052e2b;
  --ok: #4ade80;
  --warn: #fbbf24;
  --info: #60a5fa;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1140px;
}

:root[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-glow: #d6f5ef;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --border: rgba(10, 20, 40, 0.1);
  --border-strong: rgba(10, 20, 40, 0.2);
  --text: #0e1521;
  --text-muted: #5a6577;
  --text-faint: #8b95a5;
  --accent: #0d9488;
  --accent-2: #4f46e5;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --info: #1d4ed8;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 12px 28px -14px rgba(16,24,40,.18);
}

*, *::before, *::after { box-sizing: border-box; }

/* Components below set explicit display values, which would otherwise win
   over the user-agent rule for [hidden]. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 420px at 50% -180px, var(--bg-glow) 0%, transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: 0 0 var(--radius-sm) 0; z-index: 50;
}
.skip:focus { left: 0; }

.muted { color: var(--text-muted); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 22px;
  backdrop-filter: blur(12px);
}
.topbar::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; font-weight: 650; font-size: 16px; letter-spacing: -0.02em;
}
.brand-mark { width: 21px; height: 21px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.brand-tld { color: var(--accent); }

/* Attribution sits next to the wordmark, separated by a hairline so it reads
   as a credit rather than part of the name. */
.byline {
  display: inline-flex; align-items: baseline; gap: 4px;
  margin-left: -6px; padding-left: 11px;
  border-left: 1px solid var(--border);
  font-size: 12.5px; font-weight: 550; color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
  transition: color .15s;
}
.byline:hover { color: var(--accent); }
.byline strong { font-weight: 650; color: var(--text-muted); }
.byline:hover strong { color: var(--accent); }
.byline-pre { font-weight: 400; color: var(--text-faint); }

.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  text-decoration: none; color: var(--text-muted);
  padding: 6px 11px; border-radius: 999px; font-size: 13.5px;
  transition: color .15s, background .15s;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }

.topbar-actions { display: flex; gap: 6px; }

.ghost-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .03em;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn { display: grid; place-items: center; width: 33px; padding: 0; height: 31px; }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: none; }

/* ------------------------------------------------------------------ hero */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 22px 72px; }

.hero { padding: 54px 0 40px; }
.eyebrow {
  font-size: 12.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-muted); margin-bottom: 14px;
}

.ip-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.ip-value {
  font-family: var(--mono);
  font-size: clamp(30px, 7vw, 58px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  word-break: break-all;
  background: linear-gradient(96deg, var(--text) 18%, var(--accent) 115%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.ip-value.is-loading {
  min-width: 11ch;
  border-radius: 10px;
  color: transparent;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 240% 100%;
  -webkit-background-clip: border-box; background-clip: border-box;
  animation: shimmer 1.25s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.copy-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 12px; cursor: pointer;
  transition: color .15s, border-color .15s, transform .1s;
}
.copy-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.copy-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.copy-btn:active:not(:disabled) { transform: translateY(1px); }
.copy-btn:disabled { opacity: .45; cursor: default; }
.copy-btn.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; min-height: 28px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 550;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text);
}
.chip-accent {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
}
.chip-muted { color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; }
.chip-flag { font-size: 14px; line-height: 1; }

.hero-stack {
  margin: 18px 0 0; font-size: 13.5px; color: var(--text-muted);
  font-family: var(--mono); min-height: 21px;
}
.hero-stack b { color: var(--text); font-weight: 600; }

/* ----------------------------------------------------------------- cards */
.cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "network device"
    "location location"
    "privacy privacy";
}
#card-network { grid-area: network; }
#card-device { grid-area: device; }
#card-location { grid-area: location; }
#card-privacy { grid-area: privacy; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.card-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); }
.card-icon { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card-head .chip { margin-left: auto; }
.card-note { margin: 14px 0 0; font-size: 12.5px; color: var(--text-faint); }

/* key/value rows */
.rows { margin: 0; display: grid; gap: 1px; min-width: 0; }
.rows > div {
  display: grid; grid-template-columns: minmax(96px, 30%) 1fr;
  gap: 10px 16px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--border);
  min-width: 0;
}
.rows > div:first-child { border-top: 0; padding-top: 0; }
.rows dt { font-size: 13px; color: var(--text-muted); }
.rows dd {
  margin: 0; font-family: var(--mono); font-size: 13.5px;
  word-break: break-word; min-width: 0;
}
.rows dd.is-empty { color: var(--text-faint); font-style: normal; }
.rows dd.sans { font-family: var(--sans); font-size: 14px; }
.rows .sub { display: block; font-family: var(--sans); font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.rows .skel {
  display: inline-block; width: min(160px, 70%); height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 240% 100%; animation: shimmer 1.25s linear infinite;
}

/* -------------------------------------------------------------- location */
.location-body {
  display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 22px; align-items: start;
}
.map {
  margin: 0; position: relative;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
  aspect-ratio: 2 / 1;
}
.map-canvas { color: var(--accent); position: absolute; inset: 0; }
.map-canvas svg { width: 100%; height: 100%; display: block; }
.map-pin {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.map-pin::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.5px solid var(--accent); animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.7); opacity: .9; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* With no coordinates there is nothing to plot, so the readout takes the
   full width instead of sitting next to an empty box. */
.location-body:has(> .map[hidden]) { grid-template-columns: 1fr; }

/* ---------------------------------------------------------------- checks */
.checks {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 26px;
}
.checks li {
  display: grid; grid-template-columns: 16px 1fr; gap: 11px;
  padding: 9px 0; border-top: 1px solid var(--border); align-items: start;
}
.checks .dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; justify-self: center;
  background: var(--text-faint);
}
.checks li[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.checks li[data-state="warn"] .dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.checks li[data-state="info"] .dot { background: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 18%, transparent); }
.check-title { font-size: 13.5px; font-weight: 550; }
.check-detail { font-size: 12.5px; color: var(--text-muted); }
.check-detail code { font-family: var(--mono); font-size: 12px; color: var(--text); }

/* ----------------------------------------------------------------- tools */
.section-heading {
  font-size: 13px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted); margin: 56px 0 6px;
}
.section-lede { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; max-width: 62ch; }
.tools .section-heading { margin-bottom: 18px; }

.tool-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 20px; box-shadow: var(--shadow);
  min-width: 0;
}
.field-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 9px; }
.field { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--mono); font-size: 13.5px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px;
}
.field input::placeholder { color: var(--text-faint); }
.field input:hover { border-color: var(--border-strong); }

.primary-btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; white-space: nowrap;
  transition: filter .15s, transform .1s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn[aria-busy="true"] { opacity: .6; cursor: progress; }

.tool-status { margin: 10px 0 0; font-size: 12.5px; min-height: 18px; color: var(--text-muted); }
.tool-status.is-error { color: var(--warn); }
#lookup-result, #dns-result { margin-top: 14px; }

.dns-group { border-top: 1px solid var(--border); padding: 9px 0; }
.dns-group:first-child { border-top: 0; }
.dns-group h3 {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em;
  color: var(--accent); margin-bottom: 4px; text-transform: uppercase;
}
.dns-group ul { list-style: none; margin: 0; padding: 0; }
.dns-group li { font-family: var(--mono); font-size: 13px; word-break: break-all; padding: 1px 0; }
.dns-empty { color: var(--text-faint); font-size: 13px; }

/* ------------------------------------------------------------------- api */
.snippets { display: grid; gap: 12px; }
.snippet {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.snippet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.snippet-path { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); }
.snippet-desc { font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.snippet-copy {
  margin-left: auto; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 9px; cursor: pointer;
}
.snippet-copy:hover { color: var(--text); border-color: var(--border-strong); }
.snippet pre {
  margin: 0; padding: 13px 14px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
}
.snippet pre .prompt { color: var(--text-faint); user-select: none; }

/* ---------------------------------------------------------------- footer */
.footer {
  max-width: var(--maxw); margin: 0 auto; padding: 26px 22px 46px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted);
}
.footer p { margin: 0 0 7px; max-width: 76ch; }
.footer a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dot { color: var(--text-faint); }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 8px 18px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .18s, transform .18s; z-index: 40;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .location-body { grid-template-columns: 1fr; }
  .map { order: -1; }
}
@media (max-width: 760px) {
  .cards { grid-template-columns: 1fr; grid-template-areas: "network" "device" "location" "privacy"; }
  .tool-grid { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .byline { font-size: 11.5px; }
  .byline-pre { display: none; }
  .hero { padding: 36px 0 30px; }
  main { padding: 0 16px 56px; }
  .topbar { padding: 12px 16px; }
  .rows > div { grid-template-columns: 1fr; gap: 1px; padding: 8px 0; }
  .snippet-head { flex-wrap: wrap; row-gap: 4px; }
  .snippet-path { flex: 1 1 100%; }
  .snippet-copy { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.footer-by { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.footer-by a { font-weight: 600; color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ------------------------------------------------------------------- faq */
.faq .section-heading { margin-bottom: 18px; }
.faq-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 20px; box-shadow: var(--shadow);
}
.faq-item h3 { font-size: 14.5px; margin-bottom: 7px; }
.faq-item p { margin: 0; font-size: 13.5px; color: var(--text-muted); max-width: 60ch; }
.faq-item code {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; word-break: break-all;
}
@media (max-width: 760px) {
  .faq-grid { grid-template-columns: 1fr; }
}
