/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
:root {
  --bg: #F5F6F9;
  --bg-alt: #ECEEF4;
  --surface: #FFFFFF;
  --surface-2: rgba(16, 19, 28, 0.035);
  --ink: #10131C;
  --ink-soft: #545B6E;
  --line: #E1E3EC;
  --accent: #3346E0;
  --accent-ink: #1B27A6;
  --accent-soft: #E9ECFF;
  --accent2: #14A883;
  --accent2-soft: #DFF5EE;
  --gradient-brand: linear-gradient(135deg, #3346E0 0%, #6A3FE0 55%, #14A883 100%);
  --gradient-text: linear-gradient(100deg, #3346E0 0%, #7A46E0 45%, #0E9372 100%);

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

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(16, 19, 28, 0.07);
  --shadow-md: 0 20px 45px -18px rgba(16, 19, 28, 0.22);
  --shadow-glow: 0 0 0 1px rgba(51, 70, 224, 0.16), 0 18px 40px -16px rgba(51, 70, 224, 0.28);

  --max-width: 1120px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================
   RESET & BASE
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; }
p { margin: 0; }
button { font-family: inherit; }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 0 0 0.9rem;
}

.section-title {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  margin-bottom: 2.2rem;
  max-width: 30ch;
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -12px rgba(51, 70, 224, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.btn-sm { padding: 0.6rem 1.1rem; font-size: 0.85rem; }
.btn-full { width: 100%; }

/* ==========================================================
   SCROLL PROGRESS
   ========================================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--gradient-brand);
  z-index: 100;
  transition: width 0.1s linear;
}

/* ==========================================================
   REVEAL ON SCROLL
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in-view { opacity: 1; transform: none; }

/* ==========================================================
   NAV
   ========================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 246, 249, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-right: auto;
}
.nav-logo-tag { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1;
}
.nav-links a { display: inline-flex; align-items: center; color: var(--ink-soft); transition: color 0.15s ease; white-space: nowrap; }
.nav-links a:hover { color: var(--accent); }
.nav-links .tag { color: var(--ink); }
.nav-links a:hover .tag { color: var(--accent); }
.nav-links .nav-cta { margin-left: 0.5rem; color: #fff; }
.nav-links .nav-cta:hover { color: #fff; }
.nav-links a.active { color: var(--accent); }
.nav-links a.active .tag { color: var(--accent); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ==========================================================
   HERO
   ========================================================== */
.hero { padding: 5rem 1.5rem 6rem; position: relative; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.4;
  will-change: transform;
}
.blob-a {
  width: 420px; height: 420px;
  background: var(--accent);
  top: -120px; left: -100px;
  animation: floatA 16s ease-in-out infinite;
}
.blob-b {
  width: 360px; height: 360px;
  background: var(--accent2);
  bottom: -140px; right: -80px;
  animation: floatB 18s ease-in-out infinite;
}
@keyframes floatA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, -25px) scale(1.1); }
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(16,19,28,0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(16,19,28,0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 90%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
}
.hero-title {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: 0.6rem;
}
.hero-role {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--accent-ink);
  margin-bottom: 1.2rem;
  min-height: 1.6em;
}
.cursor { color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-tagline {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 42ch;
  margin-bottom: 2rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.2rem; }
.hero-meta { display: flex; gap: 1.6rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--ink-soft); }
.hero-meta span { font-family: var(--font-mono); color: var(--ink); }

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

.hero-visual { position: relative; justify-self: center; width: min(320px, 80vw); }
.hero-glow {
  position: absolute;
  inset: -30px;
  background: var(--gradient-brand);
  filter: blur(40px);
  opacity: 0.28;
  border-radius: var(--radius-lg);
  z-index: 0;
  animation: pulseGlow 5s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.22; transform: scale(1); }
  50% { opacity: 0.34; transform: scale(1.04); }
}
.hero-cutout {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 22px 34px rgba(16, 19, 28, 0.28));
  transition: transform 0.3s ease;
}
.hero-visual:hover .hero-cutout { transform: translateY(-4px); }

.hero-ring {
  position: absolute;
  z-index: 0;
  top: 50%; left: 50%;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  transform: translate(-50%, -50%);
  border: 1.5px dashed rgba(51, 70, 224, 0.3);
  border-radius: var(--radius-lg);
  animation: spinSlow 40s linear infinite;
}
@keyframes spinSlow {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.hero-badge {
  position: absolute;
  z-index: 2;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2FBE71; box-shadow: 0 0 0 4px rgba(47,190,113,0.15); animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(47,190,113,0.15); } 50% { box-shadow: 0 0 0 7px rgba(47,190,113,0.08); } }

.hero-chip {
  position: absolute;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  box-shadow: var(--shadow-sm);
  animation: floatChip 6s ease-in-out infinite;
}
.hero-chip-1 { top: 8%; left: -14%; animation-delay: 0.4s; }
.hero-chip-2 { bottom: 14%; right: -12%; animation-delay: 1.2s; }
@keyframes floatChip {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@media (max-width: 1000px) {
  .hero-chip { display: none; }
}

/* ==========================================================
   SECTIONS (generic)
   ========================================================== */
.section { padding: 5.5rem 1.5rem; }
.section-alt { background: var(--bg-alt); }
.section-inner { max-width: var(--max-width); margin: 0 auto; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: start; }
.about-text p { color: var(--ink-soft); margin-bottom: 1.1rem; font-size: 1.05rem; }
.about-text p:last-child { margin-bottom: 0; }
.about-highlights { display: flex; flex-direction: column; gap: 1rem; }
.highlight-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
}
.highlight-label { display: block; font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); margin-bottom: 0.3rem; }
.highlight-value { font-weight: 600; }

/* Marquee */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 1.1rem 0;
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: marqueeScroll 26s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-item {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--ink-soft);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.marquee-item::before { content: "•"; color: var(--accent); }
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Skills — interactive tabs */
.skills-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}
.skill-tab {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.skill-tab:hover { border-color: var(--accent); color: var(--ink); }
.skill-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 600;
}
.skills-panel { position: relative; min-height: 120px; }
.skill-panel-group {
  display: none;
  flex-wrap: wrap;
  gap: 0.7rem;
  animation: panelIn 0.35s ease;
}
.skill-panel-group.active { display: flex; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.skill-tag {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.skill-tag:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface);
}

/* Services */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; perspective: 1000px; }
.service-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.service-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.service-card:hover::before { transform: scaleX(1); }
.service-card:hover { box-shadow: var(--shadow-md); }
.service-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  transition: background 0.2s ease, color 0.2s ease;
}
.service-card:hover .service-icon { background: var(--accent); color: #fff; }
.service-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.service-card p { color: var(--ink-soft); font-size: 0.95rem; }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.8rem; perspective: 1200px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.project-card:hover { box-shadow: var(--shadow-md); }
.project-image-wrap { overflow: hidden; }
.project-image { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--accent-soft); transition: transform 0.4s ease; }
.project-card:hover .project-image { transform: scale(1.06); }
.project-body { padding: 1.3rem; }
.project-body h3 { font-size: 1.05rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.project-arrow { display: inline-block; transition: transform 0.2s ease; color: var(--accent); }
.project-card:hover .project-arrow { transform: translateX(4px); }
.project-body p { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 1rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.project-tag { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft); background: var(--bg-alt); padding: 0.25rem 0.55rem; border-radius: 5px; }

/* CTA Banner */
.cta-banner {
  position: relative;
  overflow: hidden;
  margin: 0 1.5rem;
  background: var(--ink);
  border-radius: var(--radius-lg);
  color: #fff;
  padding: 3.5rem 2rem;
  text-align: center;
}
.cta-glow {
  position: absolute;
  inset: -40%;
  background: var(--gradient-brand);
  filter: blur(90px);
  opacity: 0.35;
  animation: ctaDrift 12s ease-in-out infinite;
}
@keyframes ctaDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(4%, -3%) rotate(8deg); }
}
.cta-inner { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.cta-banner h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.8rem; }
.cta-banner p { color: #B9BDD1; margin-bottom: 1.8rem; }
.cta-banner .btn-primary { background: var(--accent); }
.cta-banner .btn-primary::before { background: #fff; opacity: 0; }
.cta-banner .btn-primary:hover::before { opacity: 0.15; }
.cta-banner .btn-primary:hover { color: #fff; }

/* Contact */
.contact-lead { color: var(--ink-soft); font-size: 1.05rem; max-width: 50ch; margin-bottom: 2.5rem; }
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: start; }
.contact-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.form-field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; font-family: var(--font-mono); color: var(--ink-soft); }
.form-field input, .form-field select, .form-field textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-note { font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
.hidden-field { position: absolute; left: -9999px; }

.contact-direct { display: flex; flex-direction: column; gap: 1rem; }
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.4rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.contact-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.contact-card-label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.contact-card-value { font-weight: 600; font-size: 1.02rem; }
.social-links { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.3rem; }
.social-links a { font-size: 0.9rem; font-weight: 600; color: var(--accent-ink); border-bottom: 1px solid var(--accent-soft); }
.social-links a:hover { border-color: var(--accent-ink); }

/* ==========================================================
   FOOTER
   ========================================================== */
.footer { border-top: 1px solid var(--line); padding: 2rem 1.5rem; }
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.footer-inner span:first-child { font-family: var(--font-display); font-weight: 600; color: var(--ink); }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; margin-bottom: 1rem; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav.nav-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    padding: 1.2rem 1.5rem 1.6rem;
    border-bottom: 1px solid var(--line);
    gap: 1rem;
  }
  .nav.nav-open .nav-links .nav-cta { margin-left: 0; }
}
