:root {
  --bg: #060608;
  --bg-2: #0b0b11;
  --text: #f4f4f7;
  --muted: #9b9bad;
  --faint: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --grad: linear-gradient(90deg, #ff5e9a, #a855f7 55%, #5b8cff);
  --grad-soft: linear-gradient(135deg, #ff5e9a, #a855f7, #5b8cff);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; }

/* ---------- Ambient background ---------- */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: radial-gradient(120% 120% at 50% -10%, #11111a, var(--bg) 60%); }
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.5;
  animation: drift 18s ease-in-out infinite alternate;
}
.glow-1 { width: 540px; height: 540px; top: -160px; left: -120px; background: #ff5e9a; opacity: .28; }
.glow-2 { width: 620px; height: 620px; top: 20%; right: -200px; background: #5b8cff; opacity: .26; animation-delay: -6s; }
.glow-3 { width: 480px; height: 480px; bottom: -160px; left: 30%; background: #a855f7; opacity: .24; animation-delay: -12s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 60px) scale(1.12); }
}
.bg-noise {
  position: absolute; inset: 0; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Navbar ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 18px clamp(20px, 5vw, 56px);
  transition: background .3s ease, backdrop-filter .3s ease, padding .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(8, 8, 12, 0.6);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding-top: 12px; padding-bottom: 12px;
}
.brand { font-family: "Syne", sans-serif; font-weight: 800; font-size: 1.4rem; text-decoration: none; letter-spacing: -.02em; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { margin-left: auto; display: flex; gap: 28px; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem;
  position: relative; transition: color .2s ease;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 0;
  background: var(--grad); transition: width .25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }
.nav-cta { font-size: .9rem; padding: 9px 18px; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* ---------- Pills / buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: .98rem;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .25s ease, opacity .2s ease;
}
.pill span { transition: transform .2s ease; }
.pill:hover span { transform: translateX(4px); }
.pill-grad { background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(168, 85, 247, .35); }
.pill-grad:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(168, 85, 247, .5); }
.pill-ghost { background: rgba(255,255,255,.04); color: var(--text); border-color: var(--line); }
.pill-ghost:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.3); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 120px 20px 0;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; max-width: 900px; }
.status {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .85rem; color: var(--muted); font-weight: 500;
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.03); margin-bottom: 30px;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #38e08a; box-shadow: 0 0 0 0 rgba(56,224,138,.6); animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(56,224,138,.5); } 100% { box-shadow: 0 0 0 10px rgba(56,224,138,0); } }

/* Avatar */
.avatar-stage { position: relative; width: 230px; margin-bottom: 8px; }
#avatar { width: 100%; height: auto; display: block; position: relative; z-index: 2; filter: drop-shadow(0 20px 36px rgba(0,0,0,.5)); }
.avatar-halo {
  position: absolute; inset: -14% -14% 6%; z-index: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(168,85,247,.5), rgba(91,140,255,.18) 50%, transparent 70%);
  filter: blur(14px); animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.08); opacity: 1; } }
#head { transform-box: fill-box; transform-origin: 50% 90%; transition: transform .18s ease-out; }
.lid { transition: transform .08s ease; }
.pupil, .glint { transition: transform .18s ease-out; }
#mouth { transition: d .3s ease; }

.emoji { position: absolute; font-size: 1.7rem; z-index: 3; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); animation: float 5s ease-in-out infinite; }
.e1 { top: 2%; left: -8%; animation-delay: 0s; }
.e2 { top: 30%; right: -14%; font-size: 2rem; animation-delay: -1.5s; }
.e3 { bottom: 6%; left: -16%; animation-delay: -3s; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(6deg); } }

.hero-title { margin: 8px 0 0; font-family: "Syne", sans-serif; font-weight: 800; line-height: .92; letter-spacing: -.03em; }
.hero-title .line { display: block; }
.hero-title .line:first-child { font-size: clamp(1.6rem, 5vw, 2.6rem); color: var(--muted); letter-spacing: .04em; font-weight: 700; }
.hero-title .grad {
  font-size: clamp(4.5rem, 18vw, 11rem);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 540px; color: var(--muted); font-size: 1.08rem; margin: 22px 0 30px; }
.hero-sub strong { color: var(--text); }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* Marquee */
.marquee { position: absolute; bottom: 0; left: 0; width: 100%; overflow: hidden; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015); }
.marquee-track { display: flex; width: max-content; animation: scroll-x 26s linear infinite; }
.marquee-track span { font-family: "Syne", sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: .12em; color: var(--muted); white-space: nowrap; padding-right: 24px; }
@keyframes scroll-x { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(90px, 14vw, 160px) clamp(20px, 5vw, 56px); }
.kicker { font-family: "Space Grotesk", sans-serif; color: #a855f7; letter-spacing: .1em; font-size: .9rem; margin: 0 0 14px; text-transform: uppercase; }
.section-title { font-family: "Syne", sans-serif; font-weight: 800; line-height: .95; letter-spacing: -.03em; font-size: clamp(2.6rem, 9vw, 6rem); margin: 0 0 36px; }

/* About */
.about-text { font-size: clamp(1.2rem, 2.4vw, 1.7rem); line-height: 1.5; max-width: 820px; color: #d7d7e2; font-weight: 500; }
.about-text em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 64px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.02); }
.stat .num { font-family: "Syne", sans-serif; font-weight: 800; font-size: clamp(2.4rem, 5vw, 3.4rem); line-height: 1; }
.stat .num::after { content: "+"; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: .95rem; }

/* Projects */
.project-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.project {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 24px;
  padding: 30px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; position: relative; transition: padding .3s ease, background .3s ease;
}
.project::before {
  content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 0;
  background: var(--grad); opacity: .08; transition: width .35s ease; z-index: -1;
}
.project:hover { padding-left: 28px; padding-right: 28px; }
.project:hover::before { width: 100%; }
.p-num { font-family: "Syne", sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--muted); transition: color .3s ease; }
.project:hover .p-num { color: #ff5e9a; }
.p-main h3 { margin: 0; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: clamp(1.5rem, 3.5vw, 2.4rem); letter-spacing: -.02em; transition: transform .3s ease; }
.p-main p { margin: 2px 0 0; color: var(--muted); font-size: .98rem; }
.project:hover .p-main h3 { transform: translateX(6px); }
.p-tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.p-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--text); white-space: nowrap; }
.p-link span { transition: transform .25s ease; }
.p-link:hover span { transform: translate(3px, -3px); }

/* floating hover preview */
.hover-preview {
  position: fixed; top: 0; left: 0; width: 260px; height: 180px; border-radius: 16px;
  pointer-events: none; z-index: 40; opacity: 0; transform: translate(-50%, -50%) scale(.85);
  transition: opacity .25s ease, transform .25s ease; box-shadow: 0 20px 50px rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.15); overflow: hidden;
}
.hover-preview.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.hover-preview::after { content: attr(data-label); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: "Syne", sans-serif; font-weight: 800; font-size: 1.4rem; color: rgba(255,255,255,.92); letter-spacing: .02em; }

/* Contact */
.contact-email { display: inline-block; font-family: "Syne", sans-serif; font-weight: 700; font-size: clamp(1.4rem, 5vw, 2.6rem); text-decoration: none; margin-bottom: 48px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; transition: opacity .2s ease; }
.contact-email:hover { opacity: .8; }
.contact-form { display: grid; gap: 20px; max-width: 680px; }
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  width: 100%; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; color: var(--text); font-family: inherit; font-size: 1rem; resize: vertical;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input::placeholder, .field textarea::placeholder { color: #6a6a7c; }
.field input:focus, .field textarea:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168,85,247,.22); background: rgba(255,255,255,.05); }
.field input.invalid, .field textarea.invalid { border-color: #ff6b6b; }
.error { color: #ff8a8a; font-size: .8rem; min-height: 1em; }
.submit-btn { justify-self: start; border: 0; margin-top: 4px; }
.form-status { font-size: .98rem; margin: 6px 0 0; }
.form-status.ok { color: #38e08a; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: clamp(70px, 12vw, 140px) clamp(20px, 5vw, 56px) 40px; max-width: var(--maxw); margin: 0 auto; }
.footer-cta { margin-bottom: 80px; }
.footer-big {
  display: inline-block; font-family: "Syne", sans-serif; font-weight: 800; line-height: .9;
  font-size: clamp(3rem, 13vw, 9rem); letter-spacing: -.03em; text-decoration: none;
  transition: opacity .2s ease;
}
.footer-big .footer-arrow { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; transition: transform .3s ease; }
.footer-big:hover { opacity: .85; }
.footer-big:hover .footer-arrow { transform: translate(10px, -10px); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-top: 32px; border-top: 1px solid var(--line); }
.socials { display: flex; gap: 24px; }
.socials a { text-decoration: none; color: var(--muted); font-weight: 600; transition: color .2s ease; }
.socials a:hover { color: var(--text); }
.copyright { color: var(--muted); font-size: .88rem; margin: 0; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Avatar animation states ---------- */
@keyframes wave {
  0%,100% { transform: rotate(0deg); }
  15% { transform: rotate(-18deg); } 30% { transform: rotate(8deg); }
  45% { transform: rotate(-18deg); } 60% { transform: rotate(8deg); } 75% { transform: rotate(-12deg); }
}
#avatar.waving #wavingArm { transform-box: fill-box; transform-origin: 90% 90%; animation: wave 1.1s ease-in-out; }
@keyframes floatZ { 0% { opacity: 0; transform: translate(0,0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(8px,-22px) scale(1.1); } }
#avatar.sleeping #zzz { opacity: 1; }
#avatar.sleeping .z { transform-box: fill-box; animation: floatZ 2.4s ease-in-out infinite; }
#avatar.sleeping .z2 { animation-delay: .5s; }
#avatar.sleeping .z3 { animation-delay: 1s; }
@keyframes snooze { 0%,100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(-6deg) translateY(4px); } }
#avatar.sleeping #head { animation: snooze 3.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  #head, .lid, .pupil, .glint { transition: none; }
  .bg-glow, .avatar-halo, .emoji, .marquee-track, .status .dot,
  #avatar.waving #wavingArm, #avatar.sleeping .z, #avatar.sleeping #head { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-links.open {
    display: flex; flex-direction: column; gap: 18px; position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(8,8,12,.96); backdrop-filter: blur(14px); padding: 24px clamp(20px,5vw,56px); border-bottom: 1px solid var(--line);
  }
  .project { grid-template-columns: auto 1fr; row-gap: 6px; }
  .p-tag { grid-column: 2; justify-self: start; }
  .p-link { grid-column: 1 / -1; }
  .contact-form .row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .hover-preview { display: none; }
}
