/* ==========================================
   VARIABLES & CSS RESET (Default: Light Mode)
   ========================================== */
:root {
  /* Default: Light Mode (Soft, Clean, & Minimalist) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --border-color: rgba(13, 148, 136, 0.2);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  --header-bg: rgba(248, 250, 252, 0.85);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables (Aktif saat body punya kelas .dark-mode) */
body.dark-mode {
  --bg-primary: #121619;
  --bg-secondary: #1a2024;
  --bg-card: #22282e;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #5eead4;
  --accent-hover: #2dd4bf;
  --border-color: rgba(94, 234, 212, 0.15);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(18, 22, 25, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}
/* ==========================================
   NAVIGATION BAR (Rapi di Kanan Atas)
   ========================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

header.scrolled {
  padding: 5px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; /* Menjadikan nav sebagai acuan posisi */
}

.logo a {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
}

/* Grup Menu & Switch di Kanan */
nav ul {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-left: auto; /* Mendorong menu ke arah kanan */
  margin-right: 1.5rem;
}

/* Styling Switch Box di Navbar (Diletakkan sebelum menu / di kanan atas) */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  order: 3; /* Mengatur urutan posisi agar pas di sebelah kanan */
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--accent);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--bg-card);
  border-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

nav ul li a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
  padding-bottom: 4px;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--accent);
}

nav ul li a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: var(--transition);
}

nav ul li a:hover::after,
nav ul li a.active::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--accent);
}

/* Penyesuaian Responsif untuk HP / Mobile */
@media (max-width: 992px) {
  .theme-switch-wrapper {
    margin-left: auto;
    margin-right: 1rem;
  }

  .menu-toggle {
    display: block;
  }

  nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s ease-in-out;
  }

  nav ul.active {
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

/* ==========================================
   MAIN LAYOUT & SECTIONS
   ========================================== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: 7rem 0 4rem 0;
  border-bottom: 1px solid var(--border-color);
}

h2 {
  font-size: 2.5rem;
  margin-bottom: 3rem;
  text-align: center;
  position: relative;
  font-weight: 700;
}

h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* ==========================================
   HOME / HERO SECTION
   ========================================== */
#home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
  padding-top: 8rem;
}

#home > div:first-child {
  flex: 1;
}

#home > div:first-child p:first-child {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

#home h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

#home h2 {
  font-size: 1.5rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1.5rem;
  text-align: left;
}

#home h2::after {
  display: none;
}

#home > div:first-child p:nth-of-type(2) {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  max-width: 540px;
}

#home a[href="#projects"],
#home a[href="#contact"],
#home a[download] {
  display: inline-block;
  padding: 0.75rem 1.8rem;
  border-radius: 6px;
  font-weight: 600;
  margin-right: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

#home a[href="#projects"],
#home a[href="#contact"] {
  background-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--border-color);
}

#home a[href="#projects"]:hover,
#home a[href="#contact"]:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

#home a[download] {
  background-color: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

#home a[download]:hover {
  background-color: var(--border-color);
  transform: translateY(-2px);
}

#home > div:last-child {
  flex: 1;
  display: flex;
  justify-content: center;
}

#home img {
  width: 340px;
  height: 340px;
  object-fit: cover;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  box-shadow: var(--shadow);
  border: 2px solid var(--border-color);
}

/* ==========================================
   ABOUT, SKILLS, EXPERIENCE, PROJECTS, ETC.
   ========================================== */
#about > div,
#skills > div,
#experience article,
#projects article,
#education article,
#certificates article {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  border-radius: 12px;
  transition: var(--transition);
}

#about > div,
#skills,
#projects,
#education,
#certificates {
  display: grid;
  gap: 2rem;
}

#about > div {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  padding: 2.5rem;
}

#skills {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

#skills > div {
  padding: 2rem;
}

#skills > div:hover,
#projects article:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

#skills h3,
#experience article > p:nth-of-type(1),
#education h3,
#certificates h3 {
  color: var(--accent);
}

#experience article {
  padding: 2.5rem;
  margin-bottom: 2rem;
}

#projects {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#projects article {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#projects img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

#projects h3 {
  margin: 1.5rem 1.5rem 0.5rem 1.5rem;
}

#projects p {
  padding: 0 1.5rem;
  color: var(--text-muted);
}

#projects article a {
  display: inline-block;
  margin: 1.5rem;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--border-color);
  color: var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

#projects article a:hover {
  background-color: var(--accent);
  color: #ffffff;
}

#education,
#certificates {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#education article,
#certificates article {
  padding: 2rem;
}

#contact {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

#contact ul {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
}

#contact ul li a {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: var(--shadow);
}

#contact ul li a:hover {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

footer {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
}

/* Responsive */
@media (max-width: 992px) {
  #home {
    flex-direction: column-reverse;
    text-align: center;
    padding-top: 10rem;
  }
  .menu-toggle {
    display: block;
  }
  nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s ease-in-out;
  }
  nav ul.active {
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

/* ==========================================
   CERTIFICATES IMAGE STYLING (Contain Mode)
   ========================================== */
#certificates article {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

#certificates article:hover {
  border-color: var(--accent);
}

/* Mengatur ukuran kotak gambar sertifikat agar proporsional */
#certificates img {
  width: 100%;
  height: 200px; /* Atur tinggi kotak gambar (bisa diubah sesuai selera) */
  object-fit: contain; /* Menampilkan gambar secara utuh tanpa terpotong */
  object-position: center; /* Posisi gambar di tengah */
  background-color: var(
    --bg-card
  ); /* Warna latar belakang jika rasio gambar tidak penuh */
  border-radius: 8px;
  padding: 10px; /* Memberikan sedikit jarak di dalam kotak */
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

#certificates h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

#certificates p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

#certificates a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
}

#certificates a:hover {
  text-decoration: underline;
}
