/* ==========================================================
   DESIGN TOKENS
   Direction: bold & vivid, web3-native. Violet -> cyan -> pink
   signal palette on a deep near-black base, with a live
   "network mesh" canvas as the page's signature element.
   ========================================================== */
:root {
  --bg: #07040f;
  --bg-alt: #0c0818;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f3f1ff;
  --text-muted: #a29dc4;

  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --gradient: linear-gradient(120deg, var(--violet), var(--cyan));
  --gradient-2: linear-gradient(120deg, var(--pink), var(--violet));
  --gradient-text: linear-gradient(100deg, #c4b5fd, #67e8f9 55%, #f9a8d4);

  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 12px 40px rgba(139, 92, 246, 0.18);

  --radius: 16px;
  --max-w: 1120px;
  --nav-h: 68px;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

body[data-theme="light"] {
  --bg: #faf9ff;
  --bg-alt: #f1edfe;
  --surface: rgba(20, 10, 40, 0.035);
  --surface-strong: rgba(20, 10, 40, 0.06);
  --border: rgba(30, 15, 60, 0.10);
  --text: #170f2c;
  --text-muted: #675f8c;

  --shadow: 0 20px 44px rgba(90, 60, 160, 0.12);
  --glow: 0 0 0 1px rgba(139, 92, 246, 0.18), 0 12px 32px rgba(139, 92, 246, 0.14);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 2000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== SIGNATURE BACKGROUND: network mesh + glow orbs ===== */
.mesh-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glow-orb {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.35;
}

.glow-orb-a {
  width: 520px;
  height: 520px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle, var(--violet), transparent 70%);
}

.glow-orb-b {
  width: 460px;
  height: 460px;
  bottom: -140px;
  right: -100px;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
}

body[data-theme="light"] .glow-orb {
  opacity: 0.22;
}

/* ===== NAVIGATION ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 48px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.brand-word {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-proto {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  margin-left: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: 1;
  position: relative;
  align-self: stretch;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

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

/* Animated tab indicator */
.nav-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  background: var(--gradient);
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

/* Hover background highlight */
.nav-hover-bg {
  position: absolute;
  background: var(--violet);
  opacity: 0;
  border-radius: 6px;
  pointer-events: none;
  transition: left 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    top 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* ===== DAY/NIGHT TOGGLE ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px;
  background: transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 0;
}

.theme-toggle:hover {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.checkmark {
  display: flex;
  align-items: center;
}

#toggle {
  width: 60px;
  height: 34px;
  display: block;
  cursor: pointer;
  border-radius: 17px;
}

#night-content {
  opacity: 0.6;
}

.inner-shadow {
  stroke-opacity: 0.12;
  stroke-width: 5;
  stroke: black;
  fill: none;
}

.nav-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s;
}

.nav-toggle-bar {
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle:hover {
  background: var(--surface);
  border-color: var(--violet);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ===== BUTTONS (single unified language) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    color 0.25s ease, background 0.25s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient);
  color: #0a0614;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(139, 92, 246, 0.38);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--glow);
  background: var(--surface-strong);
}

.btn-outline:hover svg {
  color: var(--cyan);
}

.btn-resume {
  margin-top: 8px;
}

/* ===== HERO ===== */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 88px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 32px;
}

.hero-text {
  flex: 1;
  max-width: 580px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 10px var(--cyan);
}

.hero-name {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 6.4vw, 5rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  margin: 0 0 18px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.hero-bio {
  margin: 0 0 40px;
  font-size: 1.03rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 460px;
}

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

.hero-image {
  position: relative;
  flex-shrink: 0;
}

.hero-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--violet), var(--cyan), var(--pink), var(--violet));
  animation: spin 9s linear infinite;
  filter: blur(1px);
}

.hero-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--bg);
}

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

.hero-image a {
  display: block;
  border-radius: 50%;
  position: relative;
}

.profile-pic {
  width: 290px;
  height: 290px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  transition: transform 0.35s ease;
  display: block;
  position: relative;
}

.profile-pic:hover {
  transform: scale(1.03);
}

/* ===== SECTIONS ===== */
.about,
.stack,
.contact {
  padding: 110px 32px;
}

.about,
.contact {
  background: var(--bg-alt);
}

.stack {
  background: var(--bg);
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cyan);
  letter-spacing: 0.02em;
}

.section-title {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}

.section-body {
  font-size: 1.08rem;
  color: var(--text-muted);
  line-height: 1.78;
  max-width: 640px;
  margin: 0 0 36px;
}

/* ===== STACK GRID ===== */
.tech-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-top: 48px;
}

.tech-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.tech-category {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tech-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  min-width: 92px;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    background 0.25s ease;
}

.tech-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow);
  border-color: transparent;
  background: var(--surface-strong);
}

.tech-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  filter: grayscale(0.15);
  transition: filter 0.25s ease;
}

.tech-icon-glyph {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tech-card:hover .tech-icon {
  filter: grayscale(0);
}

.tech-card:hover .tech-icon-glyph {
  color: var(--text);
}

.tech-card span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ===== PROJECTS ===== */
.projects {
  padding: 110px 32px;
  background: var(--bg);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.project-card {
  display: block;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    background 0.25s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: var(--gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--glow);
  background: var(--surface-strong);
}

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

.project-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.project-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.project-favicon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--surface-strong);
}

.project-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.project-card:hover .project-arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--cyan);
}

.project-description {
  margin: 0 0 18px;
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 100px;
}

/* ===== CONTACT ===== */
.social-links {
  display: flex;
  gap: 14px;
  margin: 40px 0 32px;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease,
    color 0.25s ease;
  text-decoration: none;
  color: var(--text-muted);
}

.social-link:hover {
  transform: translateY(-4px);
  border-color: transparent;
  box-shadow: var(--glow);
  color: var(--cyan);
}

.contact-email {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  color: var(--text-muted);
}

.contact-email a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}

.contact-email a:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px;
  background: var(--bg);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-indicator,
  .nav-hover-bg {
    display: none;
  }

  .nav-links a {
    width: 100%;
    padding: 14px 32px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
  }

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

  .header-inner {
    padding: 0 20px;
    gap: 16px;
  }

  .hero {
    flex-direction: column-reverse;
    text-align: center;
    padding: 60px 20px;
    gap: 44px;
    min-height: auto;
  }

  .eyebrow {
    justify-content: center;
  }

  .hero-bio {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .profile-pic {
    width: 220px;
    height: 220px;
  }

  .about,
  .stack,
  .projects,
  .contact {
    padding: 72px 20px;
  }

  .tech-row {
    gap: 10px;
  }

  .tech-card {
    min-width: 80px;
    padding: 16px 14px;
  }

  .site-footer {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}

/* ===== MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-ring {
    animation: none;
  }

  .star {
    animation: none !important;
  }
}