/* =================================================================
   THREATPULSE — Additive section stylesheet
   Drop-in at bottom of existing Vytalio page.
   Everything scoped under .tp-section — zero overrides to your site.
   ================================================================= */

/* ---- Tokens (scoped to .tp-section to avoid leaking) ---- */
.tp-section {
  --tp-bg:           #06080a;
  --tp-surface:      #0c0e12;
  --tp-surface-2:    #111318;
  --tp-surface-off:  #171a20;
  --tp-border:       #1e222a;
  --tp-divider:      #161a22;
  --tp-text:         #dfe1e8;
  --tp-text-muted:   #6b7080;
  --tp-text-faint:   #363d4a;

  --tp-accent:       #3b82f6;
  --tp-accent-dim:   rgba(59, 130, 246, 0.12);
  --tp-accent-glow:  rgba(59, 130, 246, 0.25);

  --tp-red:          #ef4444;
  --tp-orange:       #f97316;
  --tp-yellow:       #eab308;
  --tp-purple:       #a855f7;
  --tp-cyan:         #06b6d4;

  --tp-red-dim:      rgba(239, 68, 68, 0.12);
  --tp-orange-dim:   rgba(249, 115, 22, 0.10);
  --tp-yellow-dim:   rgba(234, 179, 8, 0.10);
  --tp-purple-dim:   rgba(168, 85, 247, 0.10);
  --tp-cyan-dim:     rgba(6, 182, 212, 0.10);

  --tp-font:         'Inter', 'Helvetica Neue', sans-serif;
  --tp-mono:         'JetBrains Mono', 'Fira Code', monospace;
  --tp-radius:       0.5rem;
  --tp-radius-lg:    0.75rem;
  --tp-transition:   180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Section-level styles */
  font-family: var(--tp-font);
  color: var(--tp-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* ---- Layout ---- */
.tp-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
}

/* ---- Visual separator from the rest of the page ---- */
.tp-divider-line {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  padding-top: clamp(3rem, 5vw, 5rem);
}
.tp-divider-line::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--tp-border) 20%, var(--tp-border) 80%, transparent 100%);
}

/* ====================
   INTRO (replaces the standalone hero)
   ==================== */
.tp-intro {
  padding: clamp(2.5rem, 4vw, 4rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
.tp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--tp-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tp-accent);
  background: var(--tp-accent-dim);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 0.3em 0.8em;
  border-radius: 9999px;
  margin-bottom: 1.25rem;
  letter-spacing: 0.03em;
}
.tp-hero-badge svg { stroke: var(--tp-accent); flex-shrink: 0; }
.tp-intro-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--tp-text);
  max-width: 44rem;
  margin-bottom: 0.85rem;
}
.tp-intro-desc {
  font-size: clamp(0.88rem, 1.1vw, 1rem);
  line-height: 1.65;
  color: var(--tp-text-muted);
  max-width: 52rem;
  margin: 0;
}

/* ====================
   TICKER
   ==================== */
.tp-ticker-wrap {
  overflow: hidden;
  background: var(--tp-surface);
  border-top: 1px solid var(--tp-border);
  border-bottom: 1px solid var(--tp-border);
  padding: 0.5rem 0;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.tp-ticker {
  display: flex;
  gap: 3rem;
  white-space: nowrap;
  animation: tp-scroll 80s linear infinite;
  will-change: transform;
}
.tp-ticker-wrap:hover .tp-ticker { animation-play-state: paused; }
@keyframes tp-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.tp-tick {
  font-family: var(--tp-mono);
  font-size: 0.72rem;
  padding: 0.2em 0.6em;
  border-radius: 9999px;
  flex-shrink: 0;
}
.tp-tick.critical { color: var(--tp-red); background: var(--tp-red-dim); }
.tp-tick.high     { color: var(--tp-orange); background: var(--tp-orange-dim); }

/* ====================
   DASHBOARD HEADER
   ==================== */
.tp-dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.tp-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--tp-mono);
  font-weight: 700;
  font-size: clamp(0.88rem, 1.1vw, 1rem);
  color: var(--tp-text);
  margin: 0;
}
.tp-accent-bar {
  width: 3px;
  height: 1.1em;
  background: var(--tp-accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.tp-section-desc {
  font-size: 0.78rem;
  color: var(--tp-text-muted);
  margin: 0.3rem 0 1rem;
}
.tp-live-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--tp-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--tp-accent);
  background: var(--tp-accent-dim);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 0.25em 0.7em;
  border-radius: 9999px;
  letter-spacing: 0.06em;
}
.tp-live-dot {
  width: 7px; height: 7px;
  background: var(--tp-accent);
  border-radius: 50%;
  animation: tp-pulse-dot 1.5s ease-in-out infinite;
}
@keyframes tp-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.65); }
}

/* ====================
   KPI CARDS
   ==================== */
.tp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1200px) { .tp-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .tp-kpi-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px)  { .tp-kpi-grid { grid-template-columns: 1fr; } }

.tp-card {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  padding: 1.15rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform var(--tp-transition), box-shadow var(--tp-transition), border-color var(--tp-transition);
}
.tp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.tp-card[data-accent="red"]::before    { background: var(--tp-red); }
.tp-card[data-accent="orange"]::before { background: var(--tp-orange); }
.tp-card[data-accent="yellow"]::before { background: var(--tp-yellow); }
.tp-card[data-accent="purple"]::before { background: var(--tp-purple); }
.tp-card[data-accent="cyan"]::before   { background: var(--tp-cyan); }

.tp-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.tp-card[data-accent="red"]:hover    { border-color: var(--tp-red); }
.tp-card[data-accent="orange"]:hover { border-color: var(--tp-orange); }
.tp-card[data-accent="yellow"]:hover { border-color: var(--tp-yellow); }
.tp-card[data-accent="purple"]:hover { border-color: var(--tp-purple); }
.tp-card[data-accent="cyan"]:hover   { border-color: var(--tp-cyan); }

.tp-card-rank {
  position: absolute;
  bottom: 0.65rem;
  right: 0.85rem;
  font-family: var(--tp-mono);
  font-weight: 700;
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: var(--tp-text-faint);
  opacity: 0.35;
  line-height: 1;
}
.tp-card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.tp-vendor-icon {
  width: 36px; height: 36px;
  border-radius: var(--tp-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tp-mono);
  font-weight: 700;
  font-size: 0.68rem;
  flex-shrink: 0;
}
.tp-vendor-icon.red    { background: var(--tp-red-dim);    color: var(--tp-red);    border: 1px solid rgba(239,68,68,0.3); }
.tp-vendor-icon.orange { background: var(--tp-orange-dim); color: var(--tp-orange); border: 1px solid rgba(249,115,22,0.3); }
.tp-vendor-icon.yellow { background: var(--tp-yellow-dim); color: var(--tp-yellow); border: 1px solid rgba(234,179,8,0.3); }
.tp-vendor-icon.purple { background: var(--tp-purple-dim); color: var(--tp-purple); border: 1px solid rgba(168,85,247,0.3); }
.tp-vendor-icon.cyan   { background: var(--tp-cyan-dim);   color: var(--tp-cyan);   border: 1px solid rgba(6,182,212,0.3); }

.tp-vendor-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--tp-text);
  line-height: 1.3;
  padding-right: 2rem;
}
.tp-vendor-sub {
  font-size: 0.72rem;
  color: var(--tp-text-muted);
  font-family: var(--tp-mono);
}
.tp-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.tp-metric-val {
  font-family: var(--tp-mono);
  font-weight: 700;
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  line-height: 1.2;
  color: var(--tp-text);
  display: block;
  font-variant-numeric: tabular-nums;
}
.tp-metric-val.accent { color: var(--tp-accent); }
.tp-metric-label {
  font-size: 0.68rem;
  color: var(--tp-text-muted);
  line-height: 1.4;
  margin-top: 2px;
  display: block;
}
.tp-card-cves {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tp-cve {
  font-family: var(--tp-mono);
  font-size: 0.62rem;
  padding: 0.15em 0.45em;
  border-radius: 0.25rem;
  font-weight: 500;
}
.tp-cve.crit { background: var(--tp-red-dim); color: var(--tp-red); border: 1px solid rgba(239,68,68,0.2); }
.tp-cve.high { background: var(--tp-orange-dim); color: var(--tp-orange); border: 1px solid rgba(249,115,22,0.2); }

.tp-card-threat {
  font-size: 0.7rem;
  color: var(--tp-text-muted);
  font-family: var(--tp-mono);
  border-top: 1px solid var(--tp-divider);
  padding-top: 0.45rem;
}
.tp-bar-track {
  height: 3px;
  background: var(--tp-surface-off);
  border-radius: 9999px;
  overflow: hidden;
}
.tp-bar {
  height: 100%;
  width: var(--w);
  background: var(--c);
  border-radius: 9999px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ====================
   PANELS (map, chart, table)
   ==================== */
.tp-panel {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  padding: 1.25rem;
}
.tp-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* MAP */
.tp-map-panel { margin-bottom: 1.5rem; }
.tp-map {
  width: 100%;
  height: clamp(280px, 35vw, 400px);
  position: relative;
  border-radius: var(--tp-radius);
  background: #050810;
  overflow: hidden;
}
.tp-map svg { width: 100%; height: 100%; }
.tp-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.tp-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--tp-text-muted);
  font-family: var(--tp-mono);
}
.tp-ldot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tp-ldot.pulse { animation: tp-pulse-dot 1.5s ease-in-out infinite; }

/* D3 classes */
.tp-country { fill: #0b1020; stroke: #161e35; stroke-width: 0.5; }
.tp-country:hover { fill: #101830; }
.tp-graticule { fill: none; stroke: #0c1220; stroke-width: 0.3; }

/* CHART */
.tp-chart-wrap { position: relative; height: 260px; }

/* BOTTOM ROW */
.tp-bottom-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) { .tp-bottom-row { grid-template-columns: 1fr; } }

/* TABLE */
.tp-table-wrap { overflow-x: auto; }
.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.tp-table thead th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  color: var(--tp-text-muted);
  font-family: var(--tp-mono);
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--tp-border);
  white-space: nowrap;
}
.tp-table tbody td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--tp-divider);
  color: var(--tp-text);
  white-space: nowrap;
}
.tp-table tbody tr:last-child td { border-bottom: none; }
.tp-table tbody tr:hover td { background: var(--tp-surface-off); }
.tp-section .mono { font-family: var(--tp-mono); font-weight: 600; font-size: 0.72rem; }

/* Badges */
.tp-cvss {
  font-family: var(--tp-mono);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.15em 0.45em;
  border-radius: 0.25rem;
}
.tp-cvss.crit { background: var(--tp-red-dim); color: #f87171; }
.tp-cvss.high { background: var(--tp-orange-dim); color: #fb923c; }

.tp-status {
  font-family: var(--tp-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2em 0.5em;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}
.tp-status.zero-day  { background: var(--tp-red-dim); color: var(--tp-red); border: 1px solid rgba(239,68,68,0.3); }
.tp-status.kev       { background: var(--tp-yellow-dim); color: var(--tp-yellow); border: 1px solid rgba(234,179,8,0.3); }
.tp-status.active    { background: var(--tp-red-dim); color: var(--tp-red); border: 1px solid rgba(239,68,68,0.3); }
.tp-status.emergency { background: var(--tp-purple-dim); color: var(--tp-purple); border: 1px solid rgba(168,85,247,0.3); }

/* ====================
   CTA BANNER
   ==================== */
.tp-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
}
.tp-cta-text h3 {
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  font-weight: 700;
  color: var(--tp-text);
  margin: 0 0 0.3rem;
}
.tp-cta-text p {
  font-size: 0.82rem;
  color: var(--tp-text-muted);
  line-height: 1.5;
  max-width: 44rem;
  margin: 0;
}
.tp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--tp-font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7em 1.6em;
  border-radius: var(--tp-radius);
  text-decoration: none;
  transition: all var(--tp-transition);
  cursor: pointer;
  border: none;
}
.tp-btn-primary {
  background: var(--tp-accent);
  color: #06080a;
}
.tp-btn-primary:hover {
  background: #0ea395;
  box-shadow: 0 0 24px var(--tp-accent-glow);
}

/* ====================
   SOURCES
   ==================== */
.tp-sources {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0 clamp(2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--tp-divider);
  font-size: 0.72rem;
  color: var(--tp-text-faint);
  font-family: var(--tp-mono);
}
.tp-sources-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.tp-sources-label { color: var(--tp-text-muted); font-weight: 600; }
.tp-sources a {
  color: var(--tp-text-faint);
  text-decoration: none;
  transition: color var(--tp-transition);
}
.tp-sources a:hover { color: var(--tp-accent); }

/* ====================
   MOBILE
   ==================== */
@media (max-width: 640px) {
  .tp-cta-banner { flex-direction: column; text-align: center; }
  .tp-dash-header { flex-direction: column; align-items: flex-start; }
  .tp-panel-header { flex-direction: column; }
}

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