/* ============================
   ROOT & RESET
   ============================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #02040a;
  --bg2: #060b14;
  --accent: #00ffe0;
  --accent2: #ff2d78;
  --accent3: #7b5cff;
  --text: #e8f0ff;
  --text-dim: #4a5a7a;
  --card-bg: rgba(6, 15, 35, 0.85);
  --card-border: rgba(0, 255, 224, 0.15);
  --font-display: 'Orbitron', monospace;
  --font-mono: 'Space Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ============================
   BACKGROUND CANVAS
   ============================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================
   SCANLINES & NOISE OVERLAY
   ============================ */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 224, 0.015) 2px,
    rgba(0, 255, 224, 0.015) 4px
  );
}

.noise {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  width: 200%;
  height: 200%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: noiseShift 0.4s steps(1) infinite;
}

@keyframes noiseShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, -3%); }
  50%  { transform: translate(1%, 2%); }
  75%  { transform: translate(-1%, 1%); }
  100% { transform: translate(2%, -1%); }
}

/* ============================
   NAV
   ============================ */
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 5%;
  border-bottom: 1px solid rgba(0, 255, 224, 0.07);
  backdrop-filter: blur(8px);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--text);
}

.logo-bracket { color: var(--accent); opacity: 0.6; }
.logo-accent  { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--accent); }

.nav-cta {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  transition: background 0.2s, color 0.2s;
}

.nav-cta:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ============================
   HERO LAYOUT
   ============================ */
.hero {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: calc(100vh - 70px);
  padding: 4rem 5%;
  gap: 3rem;
}

/* ============================
   HERO LEFT
   ============================ */
.tag-line {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(0, 255, 224, 0.2);
  padding: 0.35rem 0.85rem;
  margin-bottom: 2rem;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
  background: rgba(0, 255, 224, 0.05);
  animation: fadeSlideIn 0.8s ease both;
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 1.6rem;
}

.hero-title .line {
  display: block;
  animation: fadeSlideIn 0.8s ease both;
  position: relative;
  cursor: default;
}

.hero-title .line:nth-child(1) { animation-delay: 0.1s; }
.hero-title .line:nth-child(2) { animation-delay: 0.22s; }
.hero-title .line:nth-child(3) { animation-delay: 0.34s; }

.hero-title .accent {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--accent);
  text-shadow: 0 0 40px rgba(0, 255, 224, 0.3);
}

/* Glitch effect */
.hero-title .line[data-glitch]::before,
.hero-title .line[data-glitch]::after {
  content: attr(data-glitch);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.hero-title .line[data-glitch]::before {
  color: var(--accent2);
  animation: glitch1 4s infinite;
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
  opacity: 0;
}

.hero-title .line[data-glitch]::after {
  color: var(--accent3);
  animation: glitch2 4s infinite;
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  opacity: 0;
}

@keyframes glitch1 {
  0%, 90%, 100% { opacity: 0; transform: translate(0); }
  91%            { opacity: 0.7; transform: translate(-3px, 1px); }
  93%            { opacity: 0.7; transform: translate(3px, -1px); }
  95%            { opacity: 0; }
}

@keyframes glitch2 {
  0%, 92%, 100% { opacity: 0; transform: translate(0); }
  93%            { opacity: 0.7; transform: translate(3px, 2px); }
  95%            { opacity: 0.7; transform: translate(-2px, -1px); }
  97%            { opacity: 0; }
}

.hero-sub {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-dim);
  max-width: 460px;
  margin-bottom: 2.5rem;
  animation: fadeSlideIn 0.8s 0.4s ease both;
}

/* ============================
   BUTTONS
   ============================ */
.hero-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 3rem;
  animation: fadeSlideIn 0.8s 0.5s ease both;
}

.btn-primary {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-primary:hover::before { transform: translateX(100%); }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 255, 224, 0.35);
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.btn-primary:hover svg { transform: translateX(4px); }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s;
}

.btn-ghost:hover { color: var(--text); }

/* ============================
   STATS
   ============================ */
.stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  animation: fadeSlideIn 0.8s 0.65s ease both;
}

.stat { text-align: left; }

.stat-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
}

.stat-unit {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
}

.stat-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: rgba(0, 255, 224, 0.15);
}

/* ============================
   HERO RIGHT — 3D CARD SCENE
   ============================ */
.hero-right {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 500px;
  animation: fadeSlideIn 0.8s 0.3s ease both;
}

.card-scene {
  perspective: 1000px;
  width: 360px;
  height: 340px;
  position: relative;
  z-index: 3;
}

.card-3d {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.08s linear;
  position: relative;
  will-change: transform;
}

.card-face {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(0, 255, 224, 0.05),
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.card-glow {
  position: absolute;
  inset: -20px;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 255, 224, 0.08), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Card internals */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-badge {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid rgba(0,255,224,0.3);
  padding: 0.2rem 0.6rem;
  clip-path: polygon(4px 0%, 100% 0%, calc(100% - 4px) 100%, 0% 100%);
}

.card-status {
  font-size: 0.65rem;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

/* Code block */
.card-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 3px;
  padding: 0.9rem;
  flex: 1;
  overflow: hidden;
}

.code-line { white-space: nowrap; }
.code-line.pad { padding-left: 1.2rem; }
.c-keyword { color: #ff79c6; }
.c-module  { color: var(--accent); }
.c-var     { color: #bd93f9; }
.c-fn      { color: #50fa7b; }
.c-string  { color: #f1fa8c; }
.c-key     { color: var(--text-dim); }
.c-bool    { color: var(--accent2); }

/* Token bar */
.card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.token-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.token-label strong { color: var(--accent); }

.token-bar {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.token-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent3), var(--accent));
  border-radius: 2px;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent);
}

/* ============================
   DECORATIVE ORBS & GRID
   ============================ */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 1;
  pointer-events: none;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(0,255,224,0.12), transparent 70%);
  top: -10%;
  right: -5%;
  animation: orbFloat 6s ease-in-out infinite;
}

.orb-2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,45,120,0.1), transparent 70%);
  bottom: 5%;
  left: 5%;
  animation: orbFloat 8s ease-in-out infinite reverse;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(15px, -20px); }
  66%       { transform: translate(-10px, 10px); }
}

/* Grid lines background element */
.grid-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0,255,224,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,224,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.6) 0%, transparent 70%);
  animation: gridPan 20s linear infinite;
}

@keyframes gridPan {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 40px 40px, 40px 40px; }
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================
   MOBILE RESPONSIVE
   ============================ */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 2.5rem 5%;
    min-height: auto;
    gap: 3rem;
  }

  .hero-right {
    height: 320px;
    order: -1;
  }

  .card-scene {
    width: 300px;
    height: 280px;
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .stats {
    gap: 1rem;
  }

  .stat-val { font-size: 1.3rem; }
}

@media (max-width: 600px) {
  .nav-links { display: none; }

  .nav {
    padding: 1.2rem 5%;
  }

  .hero {
    padding: 2rem 5%;
    gap: 2rem;
  }

  .hero-right { height: 280px; }

  .card-scene {
    width: 280px;
    height: 260px;
  }

  .card-face { padding: 1rem; }

  .card-code { font-size: 0.62rem; }

  .hero-title { font-size: clamp(1.8rem, 9vw, 2.5rem); }

  .hero-sub { font-size: 0.8rem; }

  .hero-actions { flex-direction: column; align-items: flex-start; }

  .stats { flex-wrap: wrap; gap: 1rem; }

  .stat-divider { display: none; }
}
