/* ---------- Reset & tokens ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg-soft: #12121a;
  --card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7e7ee;
  --muted: #8a8a9a;
  --accent: #7c5cff;
  --accent-2: #19d3c5;
  --grad: linear-gradient(120deg, #7c5cff 0%, #19d3c5 100%);
  --radius: 16px;
  --maxw: 1080px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }

/* ---------- Background canvas + noise ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

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

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 60px);
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  color: var(--accent);
  font-size: 1.1rem;
  animation: spin 8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.brand-text .cursor { color: var(--accent-2); animation: blink 1.1s step-end infinite; }

.nav-links { display: flex; gap: 28px; font-size: 0.95rem; color: var(--muted); }
.nav-links a { position: relative; transition: color 0.2s ease; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: var(--grad);
  transition: width 0.25s ease;
}
.nav-links a:hover::after { width: 100%; }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 5vw, 40px); }

.section { padding: clamp(80px, 12vh, 140px) 0; }

.section-head { margin-bottom: 48px; }
.section-head.center { text-align: center; }

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.section-head.center .section-title { justify-content: center; }

.section-title .num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.section-sub { color: var(--muted); margin-top: 12px; max-width: 52ch; }
.section-head.center .section-sub { margin-inline: auto; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 50px;
  padding-top: 80px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
}

.badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(25, 211, 197, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(25, 211, 197, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(25, 211, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 211, 197, 0); }
}

.title {
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 26px;
}
.title .line { display: block; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  max-width: 46ch;
  margin-bottom: 36px;
}

.cta-row { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 30px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 12px 40px rgba(124, 92, 255, 0.5); }

.btn-ghost { border-color: var(--border); color: var(--text); background: var(--card); }
.btn-ghost:hover { border-color: var(--accent); }

.btn-lg { padding: 16px 34px; font-size: 1.05rem; font-family: "JetBrains Mono", monospace; }

/* ---------- Terminal card ---------- */
.terminal {
  background: rgba(18, 18, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  transform: perspective(1000px) rotateY(-6deg) rotateX(2deg);
  transition: transform 0.4s ease;
}
.terminal:hover { transform: perspective(1000px) rotateY(0) rotateX(0); }

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.tdot { width: 12px; height: 12px; border-radius: 50%; }
.tdot.r { background: #ff5f56; }
.tdot.y { background: #ffbd2e; }
.tdot.g { background: #27c93f; }
.term-title {
  margin-left: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.term-body {
  padding: 22px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
}
.c-prompt { color: var(--accent-2); }
.c-dir { color: var(--accent); }
.c-out { color: var(--muted); }
.c-ok { color: #27c93f; }
.blink { animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(124, 92, 255, 0.12), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.4);
  outline: none;
}
.card:hover::before, .card:focus-visible::before { opacity: 1; }

.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.card-icon { font-size: 1.8rem; }

.card h3 { font-size: 1.25rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 18px; }

.tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag-soon { color: var(--accent-2); border-color: rgba(25, 211, 197, 0.35); }

.stack { display: flex; flex-wrap: wrap; gap: 8px; }
.stack span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 8px;
}

.card-ghost { border-style: dashed; opacity: 0.75; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 50px;
  align-items: start;
}
.about-lead { font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.6; letter-spacing: -0.01em; }

.facts { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.facts li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
}
.facts .k { color: var(--muted); }
.facts .v { color: var(--text); text-align: right; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact .btn { margin-top: 8px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px clamp(20px, 5vw, 40px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 120px; padding-bottom: 60px; }
  .terminal { transform: none; }
  .about-grid { grid-template-columns: 1fr; gap: 30px; }
  .nav-links { gap: 18px; }
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
