:root {
  --bg: #f7f9fc;
  --bg-alt: #eff2f8;
  --ink: #14171f;
  --muted: #5b6270;
  --card: #ffffff;
  --border: #e1e5ee;
  --indigo: #0ea5e9;
  --indigo-dim: #e3f6fe;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

#network-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.mono {
  font-family: "JetBrains Mono", monospace;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
}

/* ---------- NAV ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 252, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.nav-name {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-name .bracket {
  color: var(--indigo);
  font-weight: 500;
}

.nav-name .slash {
  color: var(--muted);
  font-weight: 400;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.nav-links {
  display: flex;
  gap: 30px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-links a {
  position: relative;
  padding: 2px 0;
  transition: color 0.15s ease;
}

.nav-links a::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--indigo);
  transition: transform 0.18s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--indigo);
}

.nav-links a.active::before {
  transform: translateY(-50%) scale(1);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- HERO ---------- */
.hero {
  padding: 100px 0 90px;
  position: relative;
  overflow: hidden;
}

.hero .wrap {
  z-index: 1;
  position: relative;
}

.terminal {
  background: #14171f;
  border-radius: 12px;
  box-shadow: 0 20px 50px -20px rgba(20, 23, 31, 0.4);
  overflow: hidden;
  max-width: 640px;
  margin-bottom: 40px;
  position: relative;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: #1d2029;
  border-bottom: 1px solid #2a2d38;
}

.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-dot:nth-child(1),
.project-titlebar .dot:nth-child(1) {
  background: #ef4444;
}

.terminal-dot:nth-child(2),
.project-titlebar .dot:nth-child(2) {
  background: #f59e0b;
}

.terminal-dot:nth-child(3),
.project-titlebar .dot:nth-child(3) {
  background: #16a34a;
}

.terminal-body {
  padding: 20px 22px 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: #c9d1d9;
  min-height: 140px;
}

.terminal-body .prompt-line {
  margin-bottom: 4px;
  opacity: 0;
}

.terminal-body .prompt-line.shown,
.terminal-body .out-line.shown {
  opacity: 1;
}

.terminal-body .out-line {
  color: #8b93a3;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.prompt-user,
.badge-ok .dot {
  color: #4ade80;
}

.prompt-path {
  color: #7ca5f5;
}

.prompt-sign {
  color: #c9d1d9;
  margin: 0 6px;
}

.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4ade80;
}

.badge-ok .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s ease-in-out infinite;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: #4ade80;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

#finalCursor {
  display: none;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero h1 .accent {
  color: var(--indigo);
  position: relative;
  white-space: nowrap;
}

.hero h1 .accent svg {
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 12px;
  overflow: visible;
}

.hero h1 .accent path {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: draw 1s cubic-bezier(0.4, 0, 0.2, 1) 1.1s forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.hero p.lede {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 32px;
}

.hero-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.btn-primary {
  background: var(--indigo);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -8px rgba(14, 165, 233, 0.55);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ---------- SCROLL REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.6s cubic-bezier(0.2, 0.7, 0.3, 1),
    transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- SECTION HEADERS ---------- */
section {
  padding: 76px 0;
  position: relative;
}

.section-eyebrow {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--indigo);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-eyebrow::before {
  content: "";
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--indigo);
}

.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.9rem;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

/* ---------- ABOUT ---------- */
#about,
#projects,
#contact {
  border-top: 1px solid var(--border);
}

.about-text {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 620px;
  margin-bottom: 34px;
}

.stack-group {
  margin-bottom: 22px;
}

.stack-group:last-child {
  margin-bottom: 0;
}

.stack-label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stack-label::before {
  content: "";
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--indigo);
}

.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  padding: 7px 13px;
  background: var(--indigo-dim);
  color: var(--indigo);
  border-radius: 6px;
  border: 1px solid rgba(14, 165, 233, 0.15);
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

.flag:hover {
  transform: translateY(-2px);
  background: var(--indigo);
  color: #fff;
}

/* ---------- PROJECTS ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  perspective: 1200px;
}

@media (max-width: 680px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: perspective(900px) rotateX(var(--ry, 0deg))
    rotateY(var(--rx, 0deg));
  transition:
    transform 0.12s ease-out,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
  will-change: transform;
}

.project-card:hover {
  box-shadow: 0 20px 40px -18px rgba(20, 23, 31, 0.28);
  border-color: #c7cde0;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    280px circle at var(--mx, 50%) var(--my, 50%),
    rgba(14, 165, 233, 0.1),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.project-card:hover::after {
  opacity: 1;
}

.project-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.project-titlebar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.project-filename {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 4px;
}

.project-body {
  padding: 18px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.12rem;
  margin-bottom: 8px;
}

.project-desc {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
  flex: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tech-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  padding: 3px 9px;
  background: var(--bg-alt);
  border-radius: 5px;
  color: var(--muted);
}

.project-link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--indigo);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.project-link:hover {
  text-decoration: underline;
}

.project-link svg {
  transition: transform 0.15s ease;
}

.project-link:hover svg {
  transform: translate(2px, -2px);
}

/* ---------- CONTACT ---------- */
.contact-terminal {
  background: #14171f;
  border-radius: 12px;
  padding: 30px 32px;
  max-width: 640px;
}

.contact-terminal p {
  font-family: "JetBrains Mono", monospace;
  color: #c9d1d9;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.contact-terminal .prompt-user {
  color: #4ade80;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-links a {
  font-family: "JetBrains Mono", monospace;
  color: #f2f4f8;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #262a36;
  transition:
    color 0.15s ease,
    padding-left 0.15s ease;
}

.contact-links a:last-child {
  border-bottom: none;
}

.contact-links a:hover {
  color: #7ca5f5;
  padding-left: 6px;
}

.contact-links .key {
  color: #4ade80;
}

footer {
  padding: 36px 0 50px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
}

footer a {
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
  transition: color 0.15s ease;
}

footer a:hover {
  color: var(--indigo);
}

@media (prefers-reduced-motion: reduce) {
  .status-dot,
  .cursor,
  .badge-ok .dot {
    animation: none;
  }

  body::before {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .project-card {
    transform: none !important;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 80px 0 60px;
  }

  section {
    padding: 54px 0;
  }

  .nav-links {
    gap: 16px;
    font-size: 0.85rem;
  }
}
