@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;600;700&display=swap");

:root {
  --bg-color: #050505;
  --surface-color: rgba(255, 255, 255, 0.03);
  --surface-border: rgba(255, 255, 255, 0.05);
  --primary-red: #ff2a2a;
  --primary-red-glow: rgba(255, 42, 42, 0.4);
  --text-main: #f0f0f0;
  --text-muted: #888888;
  --font-ui: "Inter", sans-serif;
  --font-mono: "Fira Code", monospace;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Custom Premium Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 42, 42, 0.2);
  border-radius: 10px;
  transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red);
  box-shadow: 0 0 10px var(--primary-red);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.6;
  overflow-x: hidden; /* Prevent horizontal scroll globally */
  width: 100%;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background effects */
.bg-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    var(--primary-red-glow) 0%,
    transparent 70%
  );
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  transition: transform 0.1s ease-out; /* Smooth follow */
  will-change: transform;
}

/* Header & Nav */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 5%;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
}

.logo img {
  height: 40px;
  filter: drop-shadow(0 0 8px var(--primary-red-glow));
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 1px;
}

.logo span {
  color: var(--primary-red);
}

nav {
  display: flex;
  gap: 30px;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  padding: 5px 0;
}

nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--primary-red);
  transition: var(--transition);
  box-shadow: 0 0 10px var(--primary-red);
}

nav a:hover,
nav a.active {
  color: var(--text-main);
}

nav a:hover::after,
nav a.active::after {
  width: 100%;
}

/* --- Responsive & Mobile Optimization --- */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1100;
  padding: 10px;
}

.menu-toggle span {
  display: block;
  width: 25px;
  height: 2px;
  background: var(--text-main);
  transition: var(--transition);
}

/* Mobile Transform State */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  header {
    padding: 20px 5%;
    height: 80px;
  }

  .menu-toggle {
    display: flex;
  }

  nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 1000;
    border-left: 1px solid var(--surface-border);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.8);

    /* Better hiding mechanism to prevent ghost scroll */
    transform: translateX(100%);
    visibility: hidden;
    transition:
      transform 0.4s cubic-bezier(0.77, 0.2, 0.05, 1),
      visibility 0.4s;
  }

  nav.open {
    transform: translateX(0);
    visibility: visible;
  }

  body.no-scroll {
    overflow: hidden;
  }

  nav a {
    font-size: 1.1rem;
    padding: 18px 0;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  }
  nav a:last-child {
    border-bottom: none;
  }

  .hero h2 {
    font-size: 2rem;
    line-height: 1.2;
  }
  .hero p {
    font-size: 0.95rem;
  }

  .container {
    padding: 40px 20px;
  }

  /* Fix Content Overlap on Small Screens */
  .accordion-header {
    flex-direction: column-reverse;
    align-items: flex-start !important;
    gap: 15px;
    padding: 20px 25px;
    position: relative;
  }

  .accordion-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: calc(100% - 40px);
  }

  .header-contributor {
    margin-left: 0;
    width: auto;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
  }

  .accordion-toggle {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 35px;
    height: 35px;
  }

  .accordion-title {
    font-size: 1rem;
    line-height: 1.4;
  }

  .meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .impact-group {
    width: 100%;
    justify-content: space-between;
  }
  .target-tag {
    width: auto;
    font-size: 0.7rem;
  }
}

/* Main Content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 5% 80px 5%;
  min-height: calc(100vh - 200px);
}

.hero {
  text-align: center;
  margin-bottom: 80px;
  animation: fadeIn 1s ease-out;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255, 42, 42, 0.1);
  color: var(--primary-red);
  border: 1px solid rgba(255, 42, 42, 0.2);
  border-radius: 30px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(255, 42, 42, 0.1);
}

/* Subtle Glow Effect for Logo */
.logo:hover h1 {
  color: #fff;
  text-shadow: 0 0 15px var(--primary-red-glow);
  transition: var(--transition);
}

.logo:hover img {
  transform: scale(1.05);
  transition: var(--transition);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Sections */
.section-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.section-title::before {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--primary-red);
}

/* Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 30px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-red),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 42, 42, 0.3);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 42, 42, 0.05);
}

.card:hover::before {
  transform: translateX(100%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-tag {
  font-family: var(--font-mono);
  color: var(--primary-red);
  font-size: 0.9rem;
  font-weight: 600;
}

.card h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--surface-border);
  padding-top: 15px;
  font-size: 0.85rem;
  color: #666;
}

.btn {
  display: inline-block;
  padding: 10px 24px;
  background: transparent;
  color: var(--primary-red);
  border: 1px solid var(--primary-red);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.btn:hover {
  background: rgba(255, 42, 42, 0.1);
  box-shadow: 0 0 15px rgba(255, 42, 42, 0.2);
}

.btn-primary {
  background: var(--primary-red);
  color: #fff;
}

.btn-primary:hover {
  background: #ff4d4d;
  box-shadow: 0 0 20px rgba(255, 42, 42, 0.4);
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary-red);
}

/* CVE Page Sophisticated Minimalist Layout */
.accordion-card {
  position: relative;
  padding-left: 13px;
  border-radius: 12px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
}

.accordion-card.open {
  border-color: rgba(255, 42, 42, 0.4);
}

/* Timeline vertical line */
.accordion-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 40px;
  bottom: -30px;
  width: 1px;
  background: var(--primary-red);
  opacity: 0.2;
}

.accordion-card:last-child::before {
  display: none;
}

/* Contributor Mini-badge (Header) */
.header-contributor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  margin-left: 15px;
}

.header-contributor img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--primary-red);
}

.header-contributor span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Compact Meta Row (Inside) */
.status-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 20px;
  border-radius: 8px;
  width: fit-content;
  border: 1px solid var(--surface-border);
}

.meter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meter-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.meter-track {
  width: 70px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  background: var(--sev-color);
  box-shadow: 0 0 8px var(--sev-color);
  transition: width 1.2s cubic-bezier(0.19, 1, 0.22, 1);
}

.open .meter-fill.moderate {
  width: 55%;
}
.open .meter-fill.high {
  width: 81%;
}
.open .meter-fill.critical {
  width: 98%;
}

.score-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sev-color);
}

/* Target Program Tag */
.target-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 20px;
  border-left: 1px solid var(--surface-border);
}

.target-label {
  font-size: 0.75rem;
  color: var(--text-main);
  background: rgba(255, 42, 42, 0.08);
  border: 1px solid rgba(255, 42, 42, 0.2);
  padding: 2px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Severity Config */
.moderate {
  --sev-color: #facc15;
}
.high {
  --sev-color: #fb923c;
}
.critical {
  --sev-color: #ef4444;
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate {
  animation: fadeIn 0.8s ease-out forwards;
  opacity: 0;
}

.delay-1 {
  animation-delay: 0.2s;
}
.delay-2 {
  animation-delay: 0.4s;
}
.delay-3 {
  animation-delay: 0.6s;
}

/* Simplified Stats Dashboard */
.stats-container {
  display: flex;
  justify-content: center;
  margin: 50px 0;
}

.stats-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 42, 42, 0.03);
  border: 1px solid rgba(255, 42, 42, 0.2);
  padding: 15px 40px;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  transition: var(--transition);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.stats-badge:hover {
  border-color: var(--primary-red);
  background: rgba(255, 42, 42, 0.06);
  transform: translateY(-3px);
  box-shadow: 0 5px 25px rgba(255, 42, 42, 0.1);
}

.stats-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-red);
  font-family: var(--font-mono);
  text-shadow: 0 0 15px var(--primary-red-glow);
  line-height: 1;
}

.stats-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 5px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .stats-container {
    margin: 30px 0;
  }
  .stats-badge {
    padding: 12px 30px;
    width: 90%;
  }
  .stats-number {
    font-size: 1.8rem;
  }
}
