/* ===================================================
   LIVE ZERO-DAY TRACKER — elvis.hk
   Art direction: cyber terminal · dark-first · green-on-black
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
  /* Type */
  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.1rem + 1.1vw, 2rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-hero: clamp(3rem, 1.5rem + 5vw, 6rem);

  /* Spacing */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem; --sp-20: 5rem; --sp-24: 6rem;

  /* Radius */
  --r-sm: 0.25rem; --r-md: 0.375rem; --r-lg: 0.625rem; --r-xl: 1rem; --r-full: 9999px;

  /* Fonts */
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Transition */
  --t: 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Dark Theme (Default) ── */
:root, [data-theme="dark"] {
  --bg: #080c0b;
  --bg-2: #0d1210;
  --bg-3: #111916;
  --surface: #141f1b;
  --surface-2: #1a2620;
  --border: #1e2e28;
  --border-2: #243930;
  --text: #c8d8d4;
  --text-muted: #6a8a82;
  --text-faint: #3a5550;
  --text-inv: #080c0b;

  --color-accent: #00e599;
  --color-accent-dim: rgba(0,229,153,0.08);
  --color-accent-glow: rgba(0,229,153,0.15);
  --color-red: #ff4444;
  --color-red-dim: rgba(255,68,68,0.12);
  --color-amber: #f59e0b;
  --color-amber-dim: rgba(245,158,11,0.12);
  --color-blue: #38bdf8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #f4f6f5;
  --bg-2: #edf0ee;
  --bg-3: #e6eae8;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --border: #d0dcd8;
  --border-2: #b8cdc9;
  --text: #0f1f1c;
  --text-muted: #4a6b65;
  --text-faint: #8aada8;
  --text-inv: #ffffff;

  --color-accent: #00875a;
  --color-accent-dim: rgba(0,135,90,0.08);
  --color-accent-glow: rgba(0,135,90,0.15);
  --color-red: #dc2626;
  --color-red-dim: rgba(220,38,38,0.08);
  --color-amber: #d97706;
  --color-amber-dim: rgba(217,119,6,0.08);
  --color-blue: #0369a1;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--sp-16); -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); font-size: var(--text-base); color: var(--text); background: var(--bg); min-height: 100dvh; line-height: 1.6; }
img, svg { display: block; max-width: 100%; }
a { color: var(--color-accent); text-decoration: none; transition: opacity var(--t); }
a:hover { opacity: 0.8; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: var(--r-sm); }

/* ── Container ── */
.container { width: min(1240px, 100% - var(--sp-8)); margin-inline: auto; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t);
}
.header-inner {
  display: flex; align-items: center; gap: var(--sp-6);
  padding-block: var(--sp-3);
  width: min(1240px, 100% - var(--sp-8)); margin-inline: auto;
}
.logo { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; flex-shrink: 0; }
.logo-text { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; color: var(--color-accent); }
.logo-sep { color: var(--text-faint); font-family: var(--font-mono); font-size: var(--text-sm); }
.logo-page { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); }
.nav-links { display: flex; gap: var(--sp-5); margin-left: auto; }
.nav-links a { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; transition: color var(--t); }
.nav-links a:hover { color: var(--color-accent); opacity: 1; }
.header-actions { display: flex; align-items: center; gap: var(--sp-4); flex-shrink: 0; }

/* Live badge */
.live-badge {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700;
  color: var(--color-red); letter-spacing: 0.08em;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-red);
  box-shadow: 0 0 0 0 var(--color-red);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,68,68,0.6); }
  70% { box-shadow: 0 0 0 6px rgba(255,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,68,68,0); }
}

.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-muted);
  transition: color var(--t), background var(--t);
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }

/* ── Hero ── */
.hero {
  position: relative; overflow: hidden;
  min-height: clamp(520px, 80vh, 800px);
  display: grid; grid-template-columns: 1fr 1fr;
  align-items: center; gap: var(--sp-12);
  padding: clamp(var(--sp-12), 8vw, var(--sp-24)) min(80px, 5vw);
  padding-inline: min(calc((100vw - 1240px)/2 + 40px), 80px);
  background: var(--bg);
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }

.hero-grid-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
}

.hero-content { position: relative; z-index: 1; }
.hero-eyebrow { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.last-updated { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

.hero-title {
  font-family: var(--font-mono);
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: var(--text);
  text-wrap: balance;
  margin-bottom: var(--sp-6);
}
.hero-title .accent { color: var(--color-accent); }

.hero-sub {
  font-size: var(--text-base);
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: var(--sp-10);
  line-height: 1.7;
}
.hero-sub a { color: var(--color-accent); }

/* Hero stats */
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}
@media (max-width: 640px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-1);
  transition: border-color var(--t), box-shadow var(--t);
}
.stat-card:hover { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent-dim); }
.stat-card--red:hover { border-color: var(--color-red); }
.stat-card--amber:hover { border-color: var(--color-amber); }

.stat-num {
  font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700;
  color: var(--color-accent); line-height: 1;
}
.stat-card--red .stat-num { color: var(--color-red); }
.stat-card--amber .stat-num { color: var(--color-amber); }
.stat-label { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }

/* ── Terminal ── */
.hero-terminal {
  position: relative; z-index: 1;
  background: #050a08;
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,229,153,0.05);
  overflow: hidden;
  font-family: var(--font-mono);
}
[data-theme="light"] .hero-terminal { background: #0d1f18; }

.terminal-bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.terminal-title { font-size: var(--text-xs); color: #4a6b5e; margin-left: auto; }

.terminal-body { padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: 3px; }
.t-line { font-size: var(--text-xs); line-height: 1.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-prompt { color: var(--color-accent); margin-right: var(--sp-2); }
.t-info { color: #4a7a6a; }
.t-ok { color: #00e599; }
.t-red { color: #ff6b6b; }
.t-amber { color: #f59e0b; }
.t-gap { height: var(--sp-2); }
.t-cursor { color: var(--color-accent); animation: blink 1.1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Alert Banner ── */
.alert-banner {
  background: color-mix(in srgb, var(--color-red) 10%, var(--bg-2));
  border-top: 1px solid rgba(255,68,68,0.3);
  border-bottom: 1px solid rgba(255,68,68,0.3);
  padding: var(--sp-3) min(80px, 5vw);
  font-size: var(--text-sm);
  color: var(--text);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}
.alert-icon { font-size: 1em; flex-shrink: 0; }
.alert-link { color: var(--color-red); font-weight: 600; margin-left: auto; white-space: nowrap; }
.alert-link:hover { opacity: 0.8; }

/* ── Filters ── */
.section-filters {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding-block: var(--sp-4);
  position: sticky; top: 57px; z-index: 50;
}
.filters-row {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
}
.filters-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.filter-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.filter-btn {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--t);
  cursor: pointer;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.filter-btn.active { background: var(--color-accent-dim); border-color: var(--color-accent); color: var(--color-accent); }
.filter-search-wrap { margin-left: auto; }
.filter-search {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text); padding: var(--sp-1) var(--sp-4);
  border-radius: var(--r-full); width: 200px;
  transition: border-color var(--t), box-shadow var(--t);
}
.filter-search::placeholder { color: var(--text-faint); }
.filter-search:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-dim); }

/* ── CVE Table ── */
.section-table { padding-block: clamp(var(--sp-10), 6vw, var(--sp-20)); }
.section-header { margin-bottom: var(--sp-8); }
.section-header h2 { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; color: var(--text); margin-bottom: var(--sp-2); }
.section-sub { font-size: var(--text-sm); color: var(--text-muted); }

.table-wrap {
  overflow-x: auto; border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.cve-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.cve-table thead tr { background: var(--bg-3); border-bottom: 1px solid var(--border-2); }
.cve-table th {
  text-align: left; padding: var(--sp-3) var(--sp-5);
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
.cve-table td {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.cve-table tbody tr { background: var(--surface); transition: background var(--t); }
.cve-table tbody tr:hover { background: var(--surface-2); }
.cve-table tbody tr:last-child td { border-bottom: none; }
.cve-table tbody tr[style*="display:none"] { display: none; }

.cve-id {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700;
  color: var(--color-accent); white-space: nowrap;
}
.cve-id:hover { opacity: 0.75; }

.tag-type {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-muted); white-space: nowrap;
}

.age {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap;
}
.src-link {
  font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap;
  border-bottom: 1px dashed var(--border-2);
}
.src-link:hover { color: var(--color-accent); opacity: 1; border-color: var(--color-accent); }

.table-source { margin-top: var(--sp-4); font-size: var(--text-xs); color: var(--text-faint); }
.table-source a { color: var(--text-muted); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: calc(var(--text-xs) * 0.92); font-weight: 700;
  padding: 1px 7px; border-radius: var(--r-sm);
  white-space: nowrap; letter-spacing: 0.04em;
}
.badge-critical { background: var(--color-red-dim); color: var(--color-red); border: 1px solid rgba(255,68,68,0.3); }
.badge-red { background: var(--color-red-dim); color: var(--color-red); border: 1px solid rgba(255,68,68,0.25); }
.badge-high { background: var(--color-amber-dim); color: var(--color-amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-medium { background: rgba(56,189,248,0.1); color: var(--color-blue); border: 1px solid rgba(56,189,248,0.25); }
.badge-amber { background: var(--color-amber-dim); color: var(--color-amber); border: 1px solid rgba(245,158,11,0.3); }
.tag { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; padding: 2px 8px; border-radius: var(--r-sm); letter-spacing: 0.06em; }
.tag-red { background: var(--color-red-dim); color: var(--color-red); border: 1px solid rgba(255,68,68,0.3); }

/* ── Spotlight ── */
.section-spotlight {
  padding-block: clamp(var(--sp-10), 6vw, var(--sp-20));
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-spotlight h2 { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--sp-8); }

.spotlight-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--sp-5);
}

.spotlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-4);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.spotlight-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-dim), var(--shadow-md);
  transform: translateY(-2px);
}
.spotlight-card--critical { border-left: 3px solid var(--color-red); }

.spot-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.spot-date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }
.spotlight-card h3 { font-size: var(--text-base); font-weight: 700; color: var(--text); line-height: 1.3; }
.spotlight-card p { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.7; }
.spotlight-card strong { color: var(--text); }
.spot-tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.stag {
  font-family: var(--font-mono); font-size: var(--text-xs);
  padding: 1px 7px; border-radius: var(--r-sm);
  background: var(--bg-3); color: var(--text-muted);
  border: 1px solid var(--border);
}
.spot-link { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--color-accent); margin-top: auto; }

/* ── ZDI Section ── */
.section-zdi { padding-block: clamp(var(--sp-10), 5vw, var(--sp-16)); }
.section-zdi h2 { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; }

.zdi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4); margin-block: var(--sp-6);
}
.zdi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3);
  transition: border-color var(--t);
}
.zdi-card:hover { border-color: var(--color-amber); }
.zdi-id { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--color-amber); }
.zdi-product { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.zdi-note { font-size: var(--text-sm); color: var(--text-muted); max-width: 68ch; line-height: 1.7; margin-top: var(--sp-2); }

/* ── CTA ── */
.section-cta {
  padding-block: clamp(var(--sp-12), 6vw, var(--sp-20));
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.cta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: clamp(var(--sp-8), 4vw, var(--sp-12));
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: var(--sp-8);
  box-shadow: var(--shadow-lg);
}
@media (max-width: 768px) { .cta-box { grid-template-columns: 1fr; } .cta-icon { display: none; } }
.cta-icon { flex-shrink: 0; }
.cta-text h2 { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--sp-2); }
.cta-text p { font-size: var(--text-sm); color: var(--text-muted); max-width: 55ch; line-height: 1.7; }
.cta-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700;
  padding: var(--sp-3) var(--sp-6); border-radius: var(--r-md);
  border: 1px solid transparent; transition: all var(--t);
  white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #080c0b; border-color: var(--color-accent); }
.btn-primary:hover { opacity: 0.85; }
.btn-secondary { background: transparent; color: var(--color-accent); border-color: var(--border-2); }
.btn-secondary:hover { border-color: var(--color-accent); background: var(--color-accent-dim); opacity: 1; }

/* ── Footer ── */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-8);
}
.footer-inner {
  display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-sm); color: var(--text-muted); }
.footer-links { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.footer-links a { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.footer-links a:hover { color: var(--color-accent); opacity: 1; }
.footer-copy { margin-left: auto; font-size: var(--text-xs); color: var(--text-faint); max-width: 45ch; text-align: right; line-height: 1.5; }
@media (max-width: 768px) { .footer-copy { margin-left: 0; text-align: left; } }

/* ── Responsive ── */
@media (max-width: 900px) {
  .hero { padding-inline: var(--sp-6); gap: var(--sp-8); }
  .hero-terminal { display: none; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { min-height: auto; padding-block: var(--sp-12); }
  .alert-banner { padding-inline: var(--sp-4); }
  .section-filters { top: 50px; }
  .filters-row { gap: var(--sp-3); }
  .filter-search-wrap { width: 100%; }
  .filter-search { width: 100%; }
  .cve-table th:nth-child(6), .cve-table td:nth-child(6) { display: none; }
}

/* ── Row hidden state ── */
tr.hidden-row { display: none !important; }
