/* antifraud public pages — design tokens per design spec.
   Hand-written CSS, no Tailwind. Dark-first technical-panel aesthetic.
   Reference: urlscan.io meets Cloudflare Radar. */

:root {
  /* Surfaces */
  --bg:          #0A0B0D;
  --surface-1:  #13151A;
  --surface-2:  #1A1D24;
  --border:     #1F2329;

  /* Text */
  --fg:         #E8EAED;
  --fg-dim:     #9AA0A6;
  --fg-muted:   #6A6F78;

  /* Accents */
  --mono-green: #4FD1C5;
  --accent:     #5B8DEF;
  --success:    #40C878;
  --danger:     #E85A5A;
  --warning:    #E8A840;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-8: 48px;
  --sp-10: 64px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;

  /* Fonts — system fallbacks for Phase-2; switch to self-hosted Inter/JetBrains in Phase-3 */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent); color: var(--bg); }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--font-mono); }
pre { white-space: pre-wrap; word-wrap: break-word; }

/* ----- Nav ----- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 11, 13, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-5);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.nav-brand {
  color: var(--fg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.nav-brand::before {
  content: "●";
  color: var(--accent);
}
.nav-links { display: flex; gap: var(--sp-4); flex: 1; }
.nav-links a { color: var(--fg-dim); }
.nav-links a:hover { color: var(--fg); text-decoration: none; }
.nav-portal {
  margin-left: auto;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--fg);
}
.nav-portal:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ----- Page ----- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-5);
}
.page-narrow {
  max-width: 880px;
}

/* ----- Hero ----- */
.hero h1 {
  font-size: 40px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-3);
}
.hero .sub {
  color: var(--fg-dim);
  font-size: 17px;
  margin: 0 0 var(--sp-6);
}

/* ----- Verdict card ----- */
.verdict {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.verdict.real-browser { border-color: var(--success); background: rgba(64, 200, 120, 0.06); }
.verdict.automation,
.verdict.antidetect-browser,
.verdict.fraud-suspected { border-color: var(--danger); background: rgba(232, 90, 90, 0.06); }
.verdict.unknown { border-color: var(--warning); background: rgba(232, 168, 64, 0.06); }
.verdict-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.verdict-family {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.verdict-confidence {
  font-family: var(--font-mono);
  color: var(--fg-dim);
  font-size: 13px;
}
.verdict-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.verdict-bar > span {
  display: block;
  height: 100%;
  background: currentColor;
  transition: width 300ms ease-out;
}
.verdict.real-browser .verdict-bar > span { background: var(--success); }
.verdict.automation .verdict-bar > span,
.verdict.antidetect-browser .verdict-bar > span,
.verdict.fraud-suspected .verdict-bar > span { background: var(--danger); }
.verdict.unknown .verdict-bar > span { background: var(--warning); }
.verdict-tool {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

/* ----- Panel ----- */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.panel-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 var(--sp-4);
}

/* ----- Fingerprint stream ----- */
.fp-stream { font-family: var(--font-mono); font-size: 13px; line-height: 1.8; }
.fp-stream .row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-1) 0;
  /* Long values wrap underneath the label without pushing the label
     box around — grid keeps column widths fixed. Alignment at top so
     multi-line values stack cleanly. */
  align-items: start;
  border-bottom: 1px solid rgba(31, 35, 41, 0.4);
  opacity: 0;
  transform: translateY(4px);
  animation: fp-row 300ms ease-out forwards;
}
@keyframes fp-row { to { opacity: 1; transform: translateY(0); } }
.fp-stream .label { color: var(--fg-muted); }
.fp-stream .value {
  color: var(--mono-green);
  /* Full values — long UAs, hashes, extension lists wrap to multiple
     lines instead of getting truncated. Break any character so hex
     hashes and unspaced tokens still fit. */
  word-break: break-all;
  white-space: pre-wrap;
}

/* ----- Signal rows ----- */
.signal-row {
  display: grid;
  grid-template-columns: 1fr 80px 2fr;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.signal-row:last-child { border-bottom: none; }
.signal-row .sig-name { color: var(--fg-dim); font-family: var(--font-mono); font-size: 12px; }
.signal-row .sig-bar {
  background: var(--border);
  height: 8px;
  border-radius: 2px;
  align-self: center;
  overflow: hidden;
}
.signal-row .sig-bar > span { display: block; height: 100%; background: var(--accent); }
.signal-row .sig-detail { color: var(--fg-dim); font-size: 13px; }

/* ----- Grid ----- */
.grid-2col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--sp-5);
}
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
@media (max-width: 820px) {
  .grid-2col, .grid-3col { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
}

/* ----- Section dividers ----- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-10) 0 var(--sp-5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ----- Profile cards ----- */
.profile-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.profile-id { font-family: var(--font-mono); color: var(--fg); font-weight: 500; }
.profile-family { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); }
.profile-metrics { display: flex; gap: var(--sp-4); font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--r-md);
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ----- Form controls ----- */
.textarea-mono {
  width: 100%;
  background: var(--bg);
  color: var(--mono-green);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 280px;
}
.textarea-mono:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* ----- Footer ----- */
.footer {
  max-width: 1280px;
  margin: var(--sp-10) auto var(--sp-5);
  padding: var(--sp-5);
  color: var(--fg-muted);
  font-size: 12px;
  display: flex;
  gap: var(--sp-5);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--fg-muted); }
.footer a:hover { color: var(--fg); }

/* ----- Pulse placeholder ----- */
.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1.0; }
}

/* ----- Session hero (demo page) -----
   The top strip that shows the visitor who they look like to us:
   flag + IPs + ISP + browser identity, with a compact verdict card
   on the right. Everything else on the page collapses by default. */
.session-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
@media (max-width: 800px) {
  .session-hero { grid-template-columns: 1fr; }
}
.session-identity {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.ip-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-mono);
}
.ip-row .flag {
  font-size: 28px;
  line-height: 1;
  filter: saturate(1.2);
}
.ip-row .flag.unknown { opacity: 0.3; }
.ip-row .label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 92px;
}
.ip-row .value {
  font-size: 16px;
  color: var(--fg);
  font-weight: 500;
}
.ip-row .geo {
  color: var(--fg-dim);
  font-family: var(--font-sans);
  font-size: 13px;
}
.ip-row .isp {
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  margin-left: auto;
}
.ip-row.mismatch .value {
  color: var(--danger);
}
.ip-row.mismatch::before {
  content: "⚠";
  color: var(--danger);
  font-size: 18px;
  margin-right: var(--sp-2);
}

.ua-bar {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: 13px;
}
.ua-bar .chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.ua-bar .chip strong {
  color: var(--fg);
  font-weight: 500;
}

/* Verdict card — compact, right-hand side of the hero. Family class
   paints the entire card so a visitor sees the answer at a glance
   without having to read the family text first. */
.verdict-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  /* Centre vertically so the verdict family visually matches the
     session-identity card's content on the same row, no matter which
     side ends up taller. */
  justify-content: center;
  gap: var(--sp-2);
  position: relative;
  overflow: hidden;
}
.verdict-card::before {
  /* Vertical accent stripe on the left edge, 4px wide, full height. */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--fg-muted);
  transition: background 0.2s ease;
}
.verdict-card .verdict-family {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.1;
  margin: var(--sp-1) 0 var(--sp-3);
}
.verdict-card .verdict-label {
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-1);
}
.verdict-card .verdict-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--sp-2);
}
.verdict-card .verdict-bar span {
  display: block;
  height: 100%;
  background: var(--fg-muted);
  transition: width 0.3s ease, background 0.3s ease;
}
.verdict-card .verdict-confidence {
  color: var(--fg-dim);
  font-size: 12px;
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
}
.verdict-card .verdict-tool {
  color: var(--fg-dim);
  font-size: 13px;
  font-family: var(--font-mono);
}

.verdict-card.real-browser {
  border-color: #1e4d34;
  background: linear-gradient(180deg, rgba(64,200,120,0.08), var(--surface-1));
}
.verdict-card.real-browser::before   { background: var(--success); }
.verdict-card.real-browser .verdict-family { color: var(--success); }
.verdict-card.real-browser .verdict-bar span { background: var(--success); }

.verdict-card.automation {
  border-color: #6b2020;
  background: linear-gradient(180deg, rgba(232,90,90,0.12), var(--surface-1));
}
.verdict-card.automation::before     { background: var(--danger); }
.verdict-card.automation .verdict-family { color: var(--danger); }
.verdict-card.automation .verdict-bar span { background: var(--danger); }

.verdict-card.antidetect-browser {
  border-color: #6b4e1a;
  background: linear-gradient(180deg, rgba(232,168,64,0.12), var(--surface-1));
}
.verdict-card.antidetect-browser::before { background: var(--warning); }
.verdict-card.antidetect-browser .verdict-family { color: var(--warning); }
.verdict-card.antidetect-browser .verdict-bar span { background: var(--warning); }

.verdict-card.fraud-suspected {
  border-color: #4f2270;
  background: linear-gradient(180deg, rgba(140,80,220,0.12), var(--surface-1));
}
.verdict-card.fraud-suspected::before  { background: #a87bff; }
.verdict-card.fraud-suspected .verdict-family { color: #a87bff; }
.verdict-card.fraud-suspected .verdict-bar span { background: #a87bff; }

.verdict-card.unknown        { border-color: var(--border); }
.verdict-card.unknown::before{ background: var(--fg-muted); }

/* TLS / edge fingerprint block — a dense table of edge-captured
   parameters. Visible above the fold because these are the hardest
   signals a client-side script can forge. */
.tls-block {
  margin-top: var(--sp-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
}
.tls-block h3 {
  margin: 0 0 var(--sp-3);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tls-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: var(--sp-5);
  row-gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 12px;
}
.tls-grid dt {
  color: var(--fg-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.tls-grid dd {
  margin: 0;
  color: var(--fg);
  word-break: break-all;
}
.tls-grid dd.hash { color: var(--mono-green); }

/* Collapsible secondary panels: one-line header, clickable caret. */
.collapse {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-top: var(--sp-4);
}
.collapse > summary {
  cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary::after {
  content: "▾";
  color: var(--fg-muted);
  transition: transform 0.15s ease;
}
.collapse[open] > summary::after { transform: rotate(180deg); }
.collapse > summary:hover { color: var(--fg); }
.collapse .body { padding: 0 var(--sp-4) var(--sp-4); }
.collapse .count {
  background: var(--surface-2);
  color: var(--fg-dim);
  padding: 1px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}

/* ----- Accessibility motion ----- */
@media (prefers-reduced-motion: reduce) {
  .fp-stream .row { animation: none; opacity: 1; transform: none; }
  .pulse { animation: none; }
}
