:root {
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --muted: #a3a3a3;
  --line: #262626;
  --card: #141414;
  --accent: #e5e5e5;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
  overflow-x: hidden;
}

::selection { background: var(--fg); color: var(--bg); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 8px; }

/* ===== Preloader ===== */
#preloader {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s, visibility .5s;
}
#preloader.done { opacity: 0; visibility: hidden; }
.loader-text { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

/* ===== Progress bar ===== */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #555, #fff); z-index: 99;
}

/* ===== Cursor glow ===== */
#cursor-glow {
  position: fixed; width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.05), transparent 65%);
  pointer-events: none; z-index: 1; transform: translate(-50%, -50%);
  transition: opacity .3s;
}

/* ===== Background decor ===== */
.bg-decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .14; }
.blob-1 { width: 480px; height: 480px; background: #fff; top: -120px; left: -120px; animation: drift 18s ease-in-out infinite alternate; }
.blob-2 { width: 380px; height: 380px; background: #777; top: 40%; right: -140px; animation: drift 22s ease-in-out infinite alternate-reverse; }
.blob-3 { width: 320px; height: 320px; background: #444; bottom: -100px; left: 30%; animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(60px, -50px) scale(1.15); }
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px; opacity: .25;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

main, header, footer { position: relative; z-index: 2; }

/* ===== Nav ===== */
header { position: sticky; top: 0; background: rgba(10,10,10,.7); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); z-index: 50; }
nav { max-width: 1080px; margin: auto; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--fg); text-decoration: none; }
.logo .dot { color: var(--muted); }
nav ul { display: flex; gap: 1.75rem; list-style: none; }
nav a { color: var(--muted); text-decoration: none; font-size: .88rem; position: relative; transition: color .2s; }
nav a::after {
  content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px;
  background: var(--fg); transition: width .3s;
}
nav a:hover { color: var(--fg); }
nav a:hover::after { width: 100%; }
#menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: .3rem .6rem; font-size: 1rem; cursor: pointer; }

/* ===== Hero ===== */
#hero {
  min-height: 92vh; max-width: 1080px; margin: auto; padding: 0 1.5rem;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: center; }
.hero-photo { display: flex; justify-content: center; }

/* --- Animasi muncul foto: slide-up + fade --- */
@keyframes photoUp {
  from { opacity: 0; transform: translateY(70px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-photo { opacity: 0; animation: photoUp 1s cubic-bezier(.2,.6,.2,1) .9s forwards; }

/* --- Foto Profil 3D (Mouse Move Tilt) --- */
#photo-3d {
  width: min(300px, 72vw); aspect-ratio: 1;
  perspective: 900px;
}
#photo-3d img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2,.6,.2,1), box-shadow .5s;
  will-change: transform;
  user-select: none;
  background: var(--card);
}
#photo-3d.tilting img { transition: box-shadow .5s; }
#photo-3d.tilting img:hover { box-shadow: 0 34px 80px rgba(0,0,0,.65); }
.photo-shine {
  position: absolute; inset: 0; border-radius: 24px; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.18) 0%, transparent 40%);
  transform: translateZ(40px);
  opacity: 0; transition: opacity .4s;
}
#photo-3d { position: relative; }
#photo-3d.tilting .photo-shine { opacity: 1; }
/* layer dekoratif agar efek 3D terasa dalam */
#photo-3d::after {
  content: 'gf.';
  position: absolute; inset: auto -14px -14px auto;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .5rem .8rem;
  transform: translateZ(60px);
}
.hero-sub { color: var(--muted); letter-spacing: .2em; text-transform: uppercase; font-size: .78rem; }
#hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(3rem, 9vw, 6rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.05;
}
.grad-text {
  background: linear-gradient(120deg, #fff 20%, #888 60%, #fff 90%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 4s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
#hero h2 { font-family: 'Space Grotesk', sans-serif; font-size: clamp(1.05rem, 2.6vw, 1.5rem); font-weight: 500; color: var(--fg); min-height: 2.2em; }
.caret { animation: blink .8s step-end infinite; color: var(--muted); font-weight: 300; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { color: var(--muted); max-width: 46ch; margin-top: .75rem; }
.hero-actions { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

/* ===== Equalizer (hobi musik) ===== */
.equalizer { display: flex; align-items: flex-end; gap: 5px; height: 28px; margin-top: 3rem; }
.equalizer span {
  width: 4px; background: var(--muted); border-radius: 3px;
  animation: eq 1s ease-in-out infinite;
}
.equalizer span:nth-child(1) { height: 40%; animation-duration: .9s; }
.equalizer span:nth-child(2) { height: 90%; animation-duration: 1.2s; animation-delay: .1s; }
.equalizer span:nth-child(3) { height: 60%; animation-duration: .8s; animation-delay: .2s; }
.equalizer span:nth-child(4) { height: 100%; animation-duration: 1.1s; animation-delay: .05s; }
.equalizer span:nth-child(5) { height: 50%; animation-duration: 1s; animation-delay: .3s; }
@keyframes eq { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

.btn {
  font-family: inherit; font-size: .92rem; font-weight: 600;
  border-radius: 999px; padding: .95rem 2rem; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: .5rem;
  transition: transform .25s cubic-bezier(.2,.6,.2,1), box-shadow .25s, background .25s, color .25s;
  border: 1px solid transparent;
}
.btn-solid { background: var(--fg); color: var(--bg); }
.btn-solid:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 30px rgba(255,255,255,.15); }
.btn-solid:hover .btn-arrow { transform: translateX(5px); }
.btn-arrow { display: inline-block; transition: transform .25s; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); transform: translateY(-3px); }

/* ===== Fade-in up (hero) ===== */
.fade-item { opacity: 0; animation: fadeUp .9s cubic-bezier(.2,.6,.2,1) forwards; }
.fade-item:nth-child(1) { animation-delay: .15s; }
.fade-item:nth-child(2) { animation-delay: .3s; }
.fade-item:nth-child(3) { animation-delay: .45s; }
.fade-item:nth-child(4) { animation-delay: .6s; }
.fade-item:nth-child(5) { animation-delay: .75s; }
.fade-item:nth-child(6) { animation-delay: .9s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Scroll hint ===== */
.scroll-hint { display: flex; flex-direction: column; align-items: center; gap: .4rem; color: var(--muted); margin-top: 4rem; }
.mouse { width: 24px; height: 38px; border: 1.5px solid var(--muted); border-radius: 14px; display: flex; justify-content: center; padding-top: 7px; }
.wheel { width: 3px; height: 8px; background: var(--muted); border-radius: 3px; animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }
.scroll-hint small { letter-spacing: .25em; text-transform: uppercase; font-size: .65rem; }

/* ===== Marquee ===== */
.marquee { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; padding: 1.1rem 0; background: var(--card); }
.marquee-track { display: flex; white-space: nowrap; animation: scroll 22s linear infinite; }
.marquee-track span { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
@keyframes scroll { to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ===== Sections ===== */
section { max-width: 1080px; margin: auto; padding: 6.5rem 1.5rem; }
.section-label { color: var(--muted); font-size: .78rem; letter-spacing: .25em; text-transform: uppercase; margin-bottom: .75rem; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: 3rem; }
.section-title em { font-style: normal; color: transparent; -webkit-text-stroke: 1px var(--muted); }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center; }
.about-grid p { color: var(--muted); font-size: 1.05rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; transition: transform .3s, border-color .3s;
}
.stat:hover { transform: translateY(-5px); border-color: #444; }
.stat strong { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; display: block; }
.stat span { color: var(--muted); font-size: .8rem; }

.about-grid p strong { color: var(--fg); font-weight: 600; }

/* ===== My Projects (Glassmorphism) ===== */
.glass-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem;
}
.glass-card {
  position: relative; overflow: hidden;
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 2.25rem;
  transition: transform .35s cubic-bezier(.2,.6,.2,1), border-color .35s, box-shadow .35s, background .35s;
}
.glass-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.08), transparent 45%);
  opacity: 0; transition: opacity .35s; pointer-events: none;
}
.glass-card:hover::before { opacity: 1; }
.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.07);
  box-shadow: 0 24px 48px rgba(0,0,0,.45);
}
.glass-icon {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 1.4rem; margin-bottom: 1.25rem;
  transition: transform .3s;
}
.glass-card:hover .glass-icon { transform: scale(1.1) rotate(-6deg); }
.glass-card h4 { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; margin-bottom: .5rem; }
.glass-card p { color: var(--muted); font-size: .92rem; }
.glass-link {
  display: inline-block; margin-top: 1.5rem;
  font-size: .88rem; font-weight: 600; color: var(--fg); text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.4); padding-bottom: 2px;
  transition: border-color .25s, letter-spacing .25s;
}
.glass-link:hover { border-color: var(--fg); letter-spacing: .03em; }

/* ===== Skills ===== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.skill {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem 1.75rem; transition: transform .2s ease-out, border-color .3s, box-shadow .3s;
  will-change: transform;
}
.skill:hover { border-color: #444; box-shadow: 0 20px 40px rgba(0,0,0,.4); }
.skill-icon { font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; display: inline-block; margin-bottom: 1rem; transition: transform .3s; }
.skill:hover .skill-icon { transform: scale(1.2) rotate(-8deg); }
.skill h4 { font-size: 1.05rem; margin-bottom: .4rem; }
.skill p { color: var(--muted); font-size: .88rem; }

/* ===== Projects ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2.25rem; position: relative; overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.6,.2,1), box-shadow .35s, border-color .35s;
  opacity: 0; transform: translateY(30px);
}
.card.visible { opacity: 1; transform: translateY(0); transition: opacity .6s, transform .6s; }
.card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.06), transparent 40%);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card:hover { transform: translateY(-8px) scale(1.03); border-color: #444; box-shadow: 0 24px 48px rgba(0,0,0,.5); }
.card h4 { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; margin-bottom: .5rem; }
.card p { color: var(--muted); font-size: .92rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.tags span { font-size: .72rem; border: 1px solid var(--line); border-radius: 999px; padding: .28rem .75rem; color: var(--muted); transition: background .2s, color .2s; }
.card:hover .tags span { border-color: #444; }
.card-link { display: inline-block; margin-top: 1.4rem; font-size: .85rem; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--fg); padding-bottom: 2px; }
/* ===== Project grid (glassmorphism card di #projects) ===== */
#projects .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
#projects .glass-card { height: 100%; display: flex; flex-direction: column; }
#projects .glass-link { margin-top: auto; }

.empty-state {
  grid-column: 1 / -1; text-align: center; border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 4.5rem 2rem; color: var(--muted);
}
.empty-state .icon { font-size: 2.2rem; display: block; margin-bottom: .75rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.empty-state strong { color: var(--fg); display: block; margin-bottom: .25rem; }

/* ===== Contact ===== */
#contact-form { display: grid; gap: 1.5rem; max-width: 520px; }
.field { position: relative; }
input, textarea {
  font-family: inherit; font-size: .95rem; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.1rem 1.1rem .7rem; color: var(--fg);
  transition: border-color .25s, box-shadow .25s; resize: vertical;
}
textarea { padding-top: 1.4rem; }
input:focus, textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
label {
  position: absolute; left: 1.1rem; top: .85rem; color: var(--muted);
  font-size: .9rem; pointer-events: none; transition: all .2s;
}
input:focus + label, input:not(:placeholder-shown) + label,
textarea:focus + label, textarea:not(:placeholder-shown) + label {
  top: .35rem; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase;
}
#form-status { font-size: .88rem; color: var(--muted); min-height: 1.4em; }
#form-status.error { color: #f87171; }
#form-status.success { color: #4ade80; }

.telegram {
  display: inline-flex; align-items: center; gap: .65rem;
  color: var(--fg); text-decoration: none; font-size: .92rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: .85rem 1.7rem;
  transition: background .25s, color .25s, transform .25s, border-color .25s;
}
.socials .telegram { margin-top: 2.75rem; }
.telegram.github { margin-left: 0; }
.telegram:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); transform: translateY(-3px); }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--line); padding: 2.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; max-width: 1080px; margin: auto; color: var(--muted); font-size: .84rem; }
#to-top {
  color: var(--fg); text-decoration: none; border: 1px solid var(--line);
  border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center;
  transition: transform .25s, background .25s, color .25s;
}
#to-top:hover { background: var(--fg); color: var(--bg); transform: translateY(-4px); }

/* ===== Floating Music Player ===== */
#music-btn {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(20,20,20,.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--fg); font-size: 1.05rem;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  transition: transform .25s cubic-bezier(.2,.6,.2,1), background .25s, border-color .25s, box-shadow .25s;
}
#music-btn:hover { transform: translateY(-4px) scale(1.06); border-color: rgba(255,255,255,.3); }
#music-btn:active { transform: scale(.95); }
#music-btn.playing {
  border-color: rgba(255,255,255,.35);
  box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 0 24px rgba(255,255,255,.12);
}
#music-btn .icon-pause { font-size: .8rem; letter-spacing: 2px; }
#music-btn::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15); opacity: 0; pointer-events: none;
}
#music-btn.playing::before { animation: ripple 2s ease-out infinite; }
@keyframes ripple {
  0% { transform: scale(.9); opacity: .8; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ===== Reveal on scroll ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s cubic-bezier(.2,.6,.2,1), transform .7s cubic-bezier(.2,.6,.2,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  nav ul {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 1.25rem 1.5rem; gap: 1rem; display: none;
  }
  nav ul.open { display: flex; animation: fadeUp .3s ease; }
  #menu-btn { display: block; }
  .about-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 1rem; }
  .hero-wrap { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
  #photo-3d { width: min(220px, 60vw); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fade-item, .reveal, .card, .hero-photo { opacity: 1; transform: none; }
}

/* ===== Socials ===== */
.socials { display: flex; flex-wrap: wrap; gap: 1rem; }
