/* ============ VARIABLES ============ */
:root {
  --bg: #f8f9ff;
  --bg-alt: #eef0ff;
  --card: #ffffff;
  --text: #1e1b3a;
  --muted: #5f6385;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --accent: #06b6d4;
  --border: #e2e4f5;
  --shadow: 0 10px 30px rgba(79, 70, 229, 0.12);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f1020;
  --bg-alt: #151730;
  --card: #1b1d3a;
  --text: #eef0ff;
  --muted: #a3a7cf;
  --border: #2a2d55;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* ============ BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
h1, h2, h3, h4, .logo, .stat b { font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
.container { width: min(1100px, 92%); margin: 0 auto; }

/* ============ NAVBAR ============ */
.navbar {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
  background: transparent; transition: all 0.3s;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { font-size: 1.6rem; font-weight: 700; }
.logo span { color: var(--primary); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; position: relative; color: var(--muted); transition: color 0.2s; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
  background: var(--primary); transition: width 0.3s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-actions { display: flex; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 1.1rem; color: var(--text);
  transition: transform 0.2s;
}
.icon-btn:hover { transform: scale(1.1); }
.menu-btn { display: none; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block; padding: 12px 28px; border-radius: 50px; font-weight: 600;
  border: 2px solid transparent; cursor: pointer; font-family: inherit; font-size: 0.95rem;
  transition: all 0.3s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(79, 70, 229, 0.45); }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; transform: translateY(-3px); }

/* ============ HERO ============ */
.hero {
  min-height: 100vh; display: flex; align-items: center; padding: 110px 0 60px;
  background:
    radial-gradient(circle at 85% 20%, rgba(124, 58, 237, 0.18), transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(6, 182, 212, 0.15), transparent 40%);
}
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 50px; align-items: center; }
.hello { color: var(--primary); font-weight: 600; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.15; margin: 6px 0; }
.hero h2 { font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 500; color: var(--muted); margin-bottom: 16px; }
.typing { color: var(--primary); font-weight: 600; font-family: "JetBrains Mono", monospace; }
.cursor { color: var(--primary); animation: blink 0.8s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { color: var(--muted); max-width: 520px; margin-bottom: 28px; }
.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.socials { display: flex; gap: 14px; flex-wrap: wrap; }
.socials a {
  padding: 6px 16px; border: 1px solid var(--border); border-radius: 50px;
  font-size: 0.85rem; color: var(--muted); background: var(--card); transition: all 0.2s;
}
.socials a:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }

.hero-photo { position: relative; display: flex; justify-content: center; }
.photo-wrap {
  width: min(320px, 70vw); aspect-ratio: 1; border-radius: 50%; padding: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: var(--shadow); animation: float 5s ease-in-out infinite;
}
.photo-wrap img, .photo-fallback {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--card);
}
.photo-fallback {
  display: none; align-items: center; justify-content: center;
  font-size: 5rem; font-weight: 700; color: var(--primary);
}
.floating-badge {
  position: absolute; padding: 8px 16px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--border); font-family: "JetBrains Mono", monospace;
  font-weight: 600; font-size: 0.85rem; box-shadow: var(--shadow); animation: float 4s ease-in-out infinite;
}
.b1 { top: 8%; left: 6%; color: #e34f26; }
.b2 { bottom: 18%; left: 0; color: #2965f1; animation-delay: 1s; }
.b3 { top: 20%; right: 4%; color: #f0b800; animation-delay: 2s; }
@keyframes float { 50% { transform: translateY(-14px); } }

/* ============ SECTIONS ============ */
.section { padding: 90px 0; }
.section.alt { background-color: color-mix(in srgb, var(--bg-alt) 65%, transparent); }
.section-title { text-align: center; margin-bottom: 50px; }
.section-title span { color: var(--primary); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; font-size: 0.8rem; }
.section-title h3 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-top: 4px; }
.section-title h3::after {
  content: ""; display: block; width: 60px; height: 4px; margin: 10px auto 0;
  border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--accent));
}
.sub-heading { margin: 40px 0 14px; font-size: 1.1rem; }

/* ============ ABOUT ============ */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.about-text p { color: var(--muted); margin-bottom: 14px; }
.about-text strong { color: var(--text); }
.about-text .btn { margin-top: 10px; }
.about-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform 0.3s;
}
.info-card:hover { transform: translateY(-5px); }
.info-card h4 { font-size: 0.8rem; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; }
.info-card p { font-weight: 600; line-height: 1.4; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 60px; }
.stat {
  text-align: center; padding: 24px 10px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
}
.stat b { font-size: 2.2rem; display: block; line-height: 1.2; }
.stat b::after { content: "+"; }
.stat span { font-size: 0.85rem; opacity: 0.9; }

/* ============ TIMELINE ============ */
.timeline { position: relative; max-width: 760px; margin: 0 auto; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--primary), var(--accent)); border-radius: 3px;
}
.timeline-item { position: relative; margin-bottom: 30px; }
.dot {
  position: absolute; left: -30px; top: 24px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--bg-alt); border: 4px solid var(--primary);
}
.tl-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.tl-date {
  display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent); padding: 2px 12px; border-radius: 50px;
}
.tl-card h4 { margin: 8px 0 0; font-size: 1.15rem; }
.tl-sub { color: var(--primary-2); font-weight: 500; font-size: 0.9rem; }
.tl-card p:last-child { color: var(--muted); font-size: 0.92rem; margin-top: 6px; }

/* ============ SKILLS ============ */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 40px; }
.skill-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.bar { height: 10px; background: var(--border); border-radius: 10px; overflow: hidden; }
.fill {
  height: 100%; width: 0; border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tags span {
  padding: 6px 16px; border-radius: 50px; background: var(--card);
  border: 1px solid var(--border); font-size: 0.88rem; font-weight: 500;
  transition: all 0.2s;
}
.tags span:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.tags.small span { font-size: 0.75rem; padding: 2px 12px; }

/* ============ PROJECTS ============ */
.filters { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 36px; }
.filter {
  padding: 8px 22px; border-radius: 50px; border: 1px solid var(--border); background: var(--card);
  color: var(--muted); font-family: inherit; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.filter:hover { color: var(--primary); border-color: var(--primary); }
.filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.project {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s, opacity 0.3s;
}
.project:hover { transform: translateY(-8px); }
.project.hide { display: none; }
.thumb { height: 150px; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; }
.t1 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.t2 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.t3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.t4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.project-body { padding: 20px; }
.project-body h4 { margin-bottom: 4px; }
.project-body p { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.links { display: flex; gap: 16px; margin-top: 14px; }
.links a { color: var(--primary); font-weight: 600; font-size: 0.9rem; }
.links a:hover { text-decoration: underline; }
.note { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 28px; font-style: italic; }

/* ============ CERTIFICATES ============ */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.cert {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 22px; text-align: center; box-shadow: var(--shadow); transition: transform 0.3s;
}
.cert:hover { transform: translateY(-6px); }
.cert-icon { font-size: 2.6rem; }
.cert h4 { margin: 8px 0 2px; }
.cert p { color: var(--muted); font-size: 0.88rem; }

/* ============ CONTACT ============ */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 40px; align-items: start; }
.contact-info p { color: var(--muted); margin-bottom: 20px; }
.contact-info li { margin-bottom: 12px; font-weight: 500; }
.contact-info a:hover { color: var(--primary); }
.contact-form {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.contact-form label { display: grid; gap: 6px; font-weight: 500; font-size: 0.9rem; }
.contact-form input, .contact-form textarea {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.95rem; resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}
.form-msg { font-size: 0.88rem; min-height: 1.2em; }
.form-msg.error { color: #ef4444; }
.form-msg.ok { color: #10b981; }

/* ============ FOOTER ============ */
.footer { text-align: center; padding: 26px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }

.to-top {
  position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 1.2rem; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(20px);
  transition: all 0.3s; z-index: 90;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* ============ REVEAL ANIMATION ============ */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s, transform 0.7s; }
.reveal.visible { opacity: 1; transform: none; }

/* ============ BACKGROUND ANIMATION ============ */
#bgCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
main, .footer { position: relative; z-index: 1; }

.hero, .section { position: relative; overflow: hidden; }
.hero > .container, .section > .container { position: relative; z-index: 2; }

/* Gelembung gradien yang melayang di setiap section */
.hero::before, .hero::after,
.section::before, .section::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(70px); opacity: 0.35;
}
.hero::before, .section::before {
  width: 340px; height: 340px; top: -90px; left: -90px;
  background: radial-gradient(circle, var(--primary), transparent 70%);
  animation: drift1 14s ease-in-out infinite;
}
.hero::after, .section::after {
  width: 300px; height: 300px; bottom: -90px; right: -70px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  animation: drift2 17s ease-in-out infinite;
}
.section.alt::before {
  left: auto; right: -90px; top: auto; bottom: -90px;
  background: radial-gradient(circle, var(--primary-2), transparent 70%);
}
.section.alt::after {
  right: auto; left: -70px; bottom: auto; top: -70px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
}
[data-theme="dark"] .hero::before, [data-theme="dark"] .hero::after,
[data-theme="dark"] .section::before, [data-theme="dark"] .section::after { opacity: 0.28; }

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(90px, 70px) scale(1.25); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-90px, -60px) scale(1.2); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav-links {
    position: absolute; top: 70px; left: 0; width: 100%; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height 0.4s;
  }
  .nav-links.open { max-height: 420px; }
  .nav-links a { padding: 14px 6%; border-top: 1px solid var(--border); }
  .nav-links a::after { display: none; }

  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-photo { order: -1; }
  .hero-desc { margin-inline: auto; }
  .hero-buttons, .socials { justify-content: center; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
