/* netprobe – embedded stylesheet (no external resources).
 *
 * Design language: minimal network-diagnostic instrument panel.
 * Fixed dark theme, technical monospace-leaning typography, very
 * restrained synthwave accents (a single duotone hairline, faint
 * background raster, small corner marks). No JavaScript is required
 * for any of this - everything here is pure CSS on top of the
 * server-rendered markup. */

* {
  box-sizing: border-box;
}

:root {
  /* base surfaces */
  --bg: #1a1a1a;
  --surface: #202020;
  --surface-raised: #242424;
  --surface-hover: #292929;

  /* borders */
  --border: #333333;
  --border-strong: #666666;

  /* text */
  --text: #dbdbdb;
  --text-muted: #8f8f8f;
  --text-dim: #666666;

  /* semantic accents - used sparingly and only with meaning */
  --accent: #46ff87;
  --accent-dim: rgba(70, 255, 135, 0.1);
  --accent-border: rgba(70, 255, 135, 0.45);

  --danger: #ff0040;
  --danger-dim: rgba(255, 0, 64, 0.1);
  --danger-border: rgba(255, 0, 64, 0.5);

  /* Warning tone. Used where a result is informative rather than wrong -
     an unanswered ICMP echo, an RDAP timeout. Deliberately desaturated
     and dim so it never reads as an error (that is --danger) and never
     reads as a success (that is --accent). */
  --warn: #e0b64a;
  --warn-dim: rgba(224, 182, 74, 0.1);
  --warn-border: rgba(224, 182, 74, 0.45);

  /* single subtle secondary accent, reserved for one decorative
     hairline under the header - never used for text or status */
  --synth: #ff2f92;

  --radius: 2px;
  --max: 880px;

  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --ease: 120ms ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

/* very faint fixed background raster - purely decorative, opacity
   kept extremely low so it never competes with content */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(219, 219, 219, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(219, 219, 219, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

a {
  color: inherit;
}

/* keyboard-only skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  background: var(--accent);
  color: #0a0a0a;
  font: 600 13px/1 var(--font-mono);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: top var(--ease);
}

.skip-link:focus {
  top: 12px;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 18px 56px;
}

/* ---------- header ---------- */

.site-header {
  margin: 4px 0 28px;
  padding-bottom: 18px;
  position: relative;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-border) 15%,
    rgba(255, 47, 146, 0.28) 55%,
    transparent 85%
  );
}

.brand-heading {
  margin: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent);
  flex: 0 0 auto;
}

.brand-name {
  font: 700 19px/1 var(--font-mono);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.site-sub {
  margin: 10px 0 0;
  font: 11px/1.4 var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.site-protocols {
  margin: 4px 0 0;
  font: 11px/1.4 var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ---------- probe form ---------- */

.probe-form {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.probe-form::before,
.probe-form::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
}

.probe-form::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  opacity: 0.7;
}

.probe-form::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  opacity: 0.7;
}

.probe-form-label {
  margin: 0 0 8px;
  font: 11px/1 var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.probe-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.probe-field input[type="text"] {
  flex: 1 1 260px;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.3 var(--font-mono);
  padding: 13px 12px;
  border-radius: var(--radius);
}

.probe-field input[type="text"]::placeholder {
  color: var(--text-dim);
}

.probe-field input[type="text"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.probe-submit {
  flex: 0 0 auto;
  min-height: 48px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font: 700 13px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}

.probe-submit:hover {
  background: var(--accent-dim);
}

.probe-submit:active {
  background: var(--accent);
  color: #0a0a0a;
}

.probe-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.probe-submit:disabled {
  cursor: progress;
  color: var(--text-muted);
  border-color: var(--border-strong);
  background: transparent;
}

.probe-form-error .probe-field input[type="text"] {
  border-color: var(--danger);
}

.probe-form-error .probe-field input[type="text"]:focus-visible {
  outline-color: var(--danger);
  border-color: var(--danger);
}

/* ---------- notices ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 0;
  border: 1px solid var(--danger-border);
  background: var(--danger-dim);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.notice-icon {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  background: var(--danger);
}

.notice p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- result panels ---------- */

.section {
  position: relative;
  margin: 18px 0 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font: 11px/1 var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* small geometric accent tick - purely structural branding, not a
   status indicator (that's the badge to the right) */
.section-title::before {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 3px;
  height: 11px;
  background: var(--accent);
}

.query-panel {
  padding: 12px 16px;
}

.query-eyebrow {
  margin: 0 0 6px;
  font: 11px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.query-value {
  margin: 0;
  /* flex so the JS-injected COPY button sits at the right edge of the same
   * line as the value, with a consistent gap. flex-wrap + min-width: 0 on
   * the value (below) keep long inputs from overflowing. */
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.query-value > .copyable {
  flex: 1 1 auto;
  min-width: 0;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-block;
  font: 10px/1 var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: var(--radius);
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.status-badge-ok {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.status-badge-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-dim);
}

.status-badge-warn {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-dim);
}

/* ---------- copyable technical values ----------
 *
 * Without JavaScript there is no "click to copy" button: every
 * identifier-like value is selectable in one gesture instead (a single
 * click selects the whole value).  app.js adds a button on top of this,
 * it never replaces it.
 *
 * This is applied via the .copyable class to technical values only
 * (addresses, PTR names, AS numbers, prefixes, CIDRs, handles, country
 * codes) - never to prose, labels or explanatory text, so ordinary
 * reading and text selection are unaffected. */

.copyable {
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
}

/* Keep long IPv6 literals from breaking the 320px layout. The value stays
 * fully selectable and wraps at safe points. */
.copyable {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- copy buttons (created by app.js only) ----------
 *
 * The buttons do not exist in the served HTML: without JavaScript nothing
 * here is ever rendered and user-select: all above remains the copy path.
 * They stay quiet until the value is hovered or focused, are always
 * present for keyboard and screen-reader users, and are permanently visible
 * (but dim) on devices without hover.
 *
 * The address row uses flex layout so the COPY button sits at the right
 * edge of the same line as the address, instead of dropping to its own
 * full-width row below it. */

.copy-btn {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  font: 700 10px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--ease), color var(--ease);
}

dd:hover > .copy-btn,
.addr-item:hover > .copy-btn,
.query-value:hover > .copy-btn,
.copy-btn:focus-visible,
.copy-btn.copy-ok,
.copy-btn.copy-fail {
  opacity: 1;
}

@media (hover: none) {
  .copy-btn {
    opacity: 0.7;
  }
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.copy-btn.copy-ok {
  color: var(--accent);
  border-color: var(--accent-border);
}

.copy-btn.copy-fail {
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Progressive state: still running. The text says CHECKING, so colour is
 * not the only signal. */
[data-pending] {
  color: var(--text-dim);
}

/* ---------- compact result summary ---------- */

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 10px 0 0;
  font: 11px/1.5 var(--font-mono);
  letter-spacing: 0.02em;
}

.summary-fact {
  white-space: nowrap;
}

.summary-label {
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

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

.summary-ok .summary-value {
  color: var(--accent);
}

.summary-warn .summary-value {
  color: var(--warn);
}

.summary-danger .summary-value {
  color: var(--danger);
}

.summary-sep {
  color: var(--text-dim);
}

/* ---------- per-address list ---------- */

.count-badge {
  color: var(--text-dim);
  border-color: var(--border);
  font-weight: 400;
}

.addr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.addr-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.addr {
  flex: 1 1 auto;
  min-width: 0;
  font: 14px/1.4 var(--font-mono);
  color: var(--accent);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.addr-kv {
  flex: 1 1 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0;
  align-items: baseline;
}

.addr-kv dt {
  font: 10px/1.6 var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin: 0;
}

.addr-kv dd {
  margin: 0;
  min-width: 0;
  font: 12px/1.6 var(--font-mono);
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.icmp {
  font: 12px/1.6 var(--font-mono);
  color: var(--text-muted);
}

.icmp-ok {
  color: var(--accent);
}

/* An unanswered echo is informative, not an error: it must not be styled
 * like --danger, which is reserved for genuine errors and rejections. */
.icmp-timeout {
  color: var(--warn);
}

.icmp-unavailable {
  color: var(--danger);
}

/* PTR states. "NONE" is a lookup result, "UNAVAILABLE" a failed lookup and
 * the em dash means the address was not looked up at all. */
.ptr {
  font: 12px/1.6 var(--font-mono);
  color: var(--text-muted);
}

.ptr-unavailable {
  color: var(--danger);
}

/* Section heading carrying a count badge, e.g. "IPv4  2". */
.section-title .count-badge {
  margin-left: 4px;
  vertical-align: 1px;
}

.kv {
  display: grid;
  grid-template-columns: minmax(92px, max-content) 1fr;
  gap: 0 16px;
  margin: 0;
}

.kv dt {
  padding-top: 3px;
  color: var(--text-muted);
  font: 11px/1.5 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kv dd {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  /* flex so the JS-injected COPY button has a clear gap from the value
   * and parks at the right edge of the same line (via margin-left: auto
   * on .copy-btn). Long values wrap, narrow viewports drop the button
   * to a new row - it never overlaps the value. */
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.kv dd > .copyable {
  flex: 1 1 auto;
  min-width: 0;
}

.kv dd:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

code, kbd, samp {
  font: 13px/1.4 var(--font-mono);
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

/* subtle emphasis for the handful of central diagnostic values
   (query subject, resolved address, ASN, prefix) - text + border
   tint only, no fill, no glow */
code.accent {
  color: var(--accent);
  border-color: var(--accent-border);
}

.hint {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

.hint.small {
  margin: 10px 0 0;
  font-size: 12px;
}

.status-text {
  margin: 0;
  color: var(--text-muted);
  font: 13px/1.5 var(--font-mono);
}

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

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .page {
    padding: 20px 14px 44px;
  }

  .section {
    padding: 12px 12px 14px;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .kv dt {
    padding-top: 12px;
  }

  .kv dd {
    padding-top: 2px;
  }

  .probe-submit {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .page {
    padding: 40px 24px 72px;
  }
}
