/* ====================================================================
   CYBER IP INTELLIGENCE — MAIN STYLESHEET
   Terminal / phosphor-CRT aesthetic. Single mono typeface, box-drawn
   panels, radial risk gauge, ambient matrix rain.
   ==================================================================== */

:root {
  --bg:            #05070a;
  --bg-panel:      #0a0f14;
  --bg-panel-alt:  #0d141b;
  --line:          #163024;
  --line-soft:     #0f1f19;

  --phosphor:      #3dffa0;
  --phosphor-dim:  #1f9c66;
  --phosphor-glow: rgba(61, 255, 160, 0.45);

  --amber:         #ffb454;
  --red:           #ff4d5e;
  --cyan:          #55d6ff;

  --text:          #d8fce9;
  --text-dim:      #6d8f83;
  --text-faint:    #3f544c;

  --radius: 3px;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ---------- ambient layers ---------- */

#matrix {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.16;
  pointer-events: none;
}

body::before {
  /* scanlines */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px
  );
  mix-blend-mode: multiply;
}

body::after {
  /* vignette */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
}

/* ---------- layout ---------- */

.container {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

a { color: var(--phosphor); }

::selection { background: var(--phosphor-dim); color: #04140c; }

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

.topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
  margin-bottom: 28px;
}

.topline strong { color: var(--phosphor-dim); }

.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--phosphor);
  text-shadow: 0 0 12px var(--phosphor-glow);
  margin-bottom: 4px;
}

.logo .brk { color: var(--text-faint); font-weight: 400; }

.tagline {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 22px;
}

.status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
}

.badge.warn::before { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.badge.danger::before { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ---------- boxed terminal panel (signature element) ---------- */

.term-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-panel-alt) 100%);
  border-radius: var(--radius);
  margin-bottom: 26px;
  overflow: hidden;
}

.term-panel__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(61,255,160,0.03);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.term-panel__bar::before { content: "┌─"; color: var(--text-faint); }

.term-panel__dots { display: flex; gap: 5px; margin-left: auto; }
.term-panel__dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }

.term-body {
  padding: 14px 16px;
  min-height: 168px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
}

.term-line {
  color: var(--phosphor-dim);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 3px;
  opacity: 1; /* always visible by default */
  animation: term-in 0.25s ease forwards; /* purely a cosmetic fade-in enhancement */
}
.term-line.ok  { color: var(--phosphor); }
.term-line.warn { color: var(--amber); }
.term-line.err { color: var(--red); }
.term-line .cursor {
  display: inline-block;
  width: 7px; height: 13px;
  background: var(--phosphor);
  margin-left: 2px;
  animation: blink 1s step-start infinite;
  vertical-align: -2px;
}

@keyframes term-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }

.scan-progress {
  height: 3px;
  background: var(--line-soft);
  border-top: 1px solid var(--line);
}
#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--phosphor-dim), var(--phosphor));
  box-shadow: 0 0 8px var(--phosphor-glow);
  transition: width 0.35s ease;
}

/* ---------- data grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.card {
  border: 1px solid var(--line);
  border-left: 2px solid var(--phosphor-dim);
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.2s ease;
}
.card.show { opacity: 1; transform: none; }
.card:hover { border-left-color: var(--phosphor); }

.card h3 {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.card .value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.card .sub { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

.card.threat { border-left-color: var(--amber); grid-column: span 1; }
.card.threat .risk-row { display: flex; align-items: center; gap: 14px; }

/* radial risk gauge */
.gauge {
  --pct: 0;
  width: 58px; height: 58px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--gauge-color, var(--phosphor)) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.4s ease;
}
.gauge::before {
  content: "";
  position: absolute;
}
.gauge span {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-panel);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--text);
}
.card.threat .value { font-size: 14px; }

/* ---------- generic panel sections ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2::before { content: "//"; color: var(--text-faint); }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 20px;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 13px;
}
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; color: var(--text); text-align: right; word-break: break-word; }

.api-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel-alt);
  margin-bottom: 8px;
  font-size: 12.5px;
}
.api-row code { color: var(--cyan); flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.api-row .method { color: var(--phosphor); font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--phosphor-dim);
  color: var(--phosphor);
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--phosphor); color: #04140c; }

/* ---------- IP lookup tool ---------- */
.lookup-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.lookup-form input {
  flex: 1;
  min-width: 220px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
}
.lookup-form input:focus { outline: none; border-color: var(--phosphor-dim); }
.lookup-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel-alt);
  padding: 6px 14px 14px;
}
.lookup-result .kv-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
footer a { color: var(--text-dim); }

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

@media (max-width: 640px) {
  .container { padding: 24px 14px 60px; }
  .logo { font-size: 18px; }
  .kv-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .term-line, #progressBar { animation: none !important; transition: none !important; }
}
