@import url('https://fonts.googleapis.com/css2?family=Silkscreen&display=swap');

/* --- Variable Warna Global --- */
:root {
  /* Tema Gelap (AMOLED) sebagai lalai */
  --text-color: #ffffff;
  --text-color-rgb: 255, 255, 255;
  --bg-color: #000000;
  --header-bg: rgba(20, 20, 20, 0.4); /* 60% transparent */
  --card-bg: rgba(25, 25, 25, 0.4); /* 60% transparent */
  --button-bg: #007aff; /* Apple Blue */
  --button-hover: #005ecb;
  --accent-color: #007aff;
  --card-shadow: rgba(0, 0, 0, 0.4);
  --border-color: rgba(255, 255, 255, 0.2);
}

/* --- Definisi Tema Cerah (iCloud Style) --- */
:root.light-theme {
  --text-color: #333333;
  --text-color-rgb: 51, 51, 51;
  --bg-color: #f5f5f7; /* Latar belakang kelabu lembut iCloud */
  --header-bg: rgba(245, 245, 247, 0.4); /* 60% transparent */
  --card-bg: rgba(255, 255, 255, 0.4); /* 60% transparent */
  --button-bg: #007aff;
  --button-hover: #005ecb;
  --accent-color: #007aff;
  --card-shadow: rgba(0, 0, 0, 0.1);
  --border-color: rgba(0, 0, 0, 0.1);
}

/* --- Gaya Asas (Body & Text) --- */
body {
  background-image: url("image/background-1.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* Latar belakang kekal semasa skrol */
  color: var(--text-color);
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  transition: background-color 0.5s, color 0.5s;
  background-color: var(--bg-color); /* Fallback dan untuk tema */
  font-weight: bold;
}

/* Memastikan warna teks konsisten */
h1,
h2,
h3,
p,
nav,
a {
  color: var(--text-color);
}

/* --- Header & Navigasi (iCloud Style) --- */
header {
  background-color: var(--header-bg);
  backdrop-filter: blur(15px); /* Efek kabur lebih kuat */
  -webkit-backdrop-filter: blur(15px);
  padding: 15px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color); /* Garisan halus di bawah */
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: padding 0.4s ease, background-color 0.4s ease;
}

header.scrolled {
  padding: 8px 5%;
  background-color: rgba(0, 0, 0, 0.85);
}

:root.light-theme header.scrolled {
  background-color: rgba(245, 245, 247, 0.9);
}

header.scrolled h1 {
  font-size: 1.2em;
}

header.scrolled nav a {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.header-content h1 {
  transition: font-size 0.4s ease;
}

header nav a {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 30px;
}

nav {
  display: flex;
  gap: 10px;
}

/* === Unified Liquid Glass Button Style === */
button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
}

.nav-button,
.theme-button,
.cta-button,
.page-nav-button,
.glass-button {
  position: relative; /* Needed for pseudo-element positioning */
  overflow: hidden; /* Clips the liquid fill effect */
  padding: 12px 25px;
  border-radius: 25px;
  border: 1px solid var(--border-color);
  background-color: rgba(var(--text-color-rgb), 0.05); /* Match background color dynamicly */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: bold;
  text-decoration: none;
  color: var(--text-color) !important;
  transition: color 0.4s ease, background-color 0.4s ease, transform 0.1s ease;
  z-index: 0; /* Establish stacking context */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transform-style: preserve-3d;
  will-change: transform;
}

/* Span inside button for text, to keep it above the pseudo-element */
.nav-button span,
.theme-button span,
.cta-button span,
.page-nav-button span,
.glass-button span {
    position: relative;
    z-index: 2;
}

/* The Liquid Fill Element */
.nav-button::before,
.theme-button::before,
.cta-button::before,
.page-nav-button::before,
.glass-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  padding-bottom: 150%;
  border-radius: 50%;
  background-color: var(--accent-color);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: 1; /* Sit between the button background and the text span */
}

/* The Hover & Active Effect */
.nav-button:hover::before,
.theme-button:hover::before,
.cta-button:hover::before,
.page-nav-button:hover::before,
.glass-button:hover::before,
.nav-button:active::before,
.theme-button:active::before,
.cta-button:active::before,
.page-nav-button:active::before,
.glass-button:active::before {
  transform: translate(-50%, -50%) scale(1);
}

/* Text color change on hover & active */
.nav-button:hover,
.theme-button:hover,
.cta-button:hover,
.page-nav-button:hover,
.glass-button:hover,
.nav-button:active,
.theme-button:active,
.cta-button:active,
.page-nav-button:active,
.glass-button:active {
  color: #ffffff !important;
}

/* Remove default background on hover & active to let the liquid fill show */
.nav-button:hover,
.theme-button:hover,
.cta-button:hover,
.page-nav-button:hover,
.glass-button:hover,
.nav-button:active,
.theme-button:active,
.cta-button:active,
.page-nav-button:active,
.glass-button:active {
    background-color: transparent;
}

.nothing-font {
  font-family: 'Silkscreen', cursive !important;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(0, 255, 157, 0.2) !important;
}

.nothing-font h3 {
  color: #00FF9D !important; /* Classic Retro/OLED Green */
  text-shadow: 2px 2px 0px #000;
}

.nothing-font:hover {
  animation: pixel-flicker 0.3s infinite;
  border-color: #00FF9D !important;
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.3), inset 0 0 10px rgba(0, 255, 157, 0.2);
  background-color: rgba(0, 255, 157, 0.05);
}

/* Enhanced 8-bit Glitch Effect */
.nothing-font:hover h3 {
  animation: pixel-glitch 0.2s steps(2) infinite;
  text-shadow: 3px 0 #ff00ff, -3px 0 #00ffff;
}

/* Smoother but still Pixelated Progress Bar */
.nothing-font .project-progress-bar {
  background: repeating-linear-gradient(
    -45deg,
    #00FF9D,
    #00FF9D 15px,
    #00d181 15px,
    #00d181 30px
  );
  background-size: 42.42px 42.42px; /* Calculated for smooth diagonal tiling */
  animation: pixel-load-smooth 1s linear infinite;
  color: #000;
  text-shadow: none;
  font-size: 0.8em;
}

@keyframes pixel-flicker {
  0% { opacity: 1; }
  25% { opacity: 0.98; }
  50% { opacity: 1; }
  75% { opacity: 0.99; }
  100% { opacity: 1; }
}

@keyframes pixel-glitch {
  0% { transform: translate(1px, 1px); }
  25% { transform: translate(-1px, -1px); }
  50% { transform: translate(-1px, 1px); }
  75% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

@keyframes pixel-load-smooth {
  from { background-position: 0 0; }
  to { background-position: 42.42px 0; }
}

/* --- Main Content & Typography --- */
.content-container {
  padding: 30px 5%;
  max-width: 1200px;
  margin: auto;
}

.content-container p,
.project-card p {
  font-size: 1.1em;
  line-height: 1.8;
  text-align: left; /* Tukar ke jajaran kiri untuk kebolehbacaan */
}

/* Kekalkan teks pengenalan di tengah */
.intro-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.intro-section p,
.intro-section h2 {
  text-align: center;
  margin-bottom: 0;
}

.intro-section p {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); /* Tambah bayang untuk kebolehbacaan */
}

h2 {
  margin-top: 0;
  padding-bottom: 10px;
  margin-bottom: 25px;
  font-size: 2.5em; /* Lebih besar dan menonjol */
  font-weight: 600;
  text-align: center; /* Pusatkan semua tajuk seksyen */
  border-bottom: none; /* Buang garisan bawah */
}

/* --- Portfolio Specific Styles (Grid & Cards) --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.project-card {
  background-color: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 25px;
  border-radius: 18px; /* Sudut lebih bulat seperti iOS/macOS */
  box-shadow: 0 5px 15px var(--card-shadow);
  border: 1px solid var(--border-color);
  transition: box-shadow 0.3s ease, opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translateY(30px);
  transform-style: preserve-3d;
  will-change: transform;
}

.project-card.visible {
  opacity: 1; /* Fade in */
  transform: translateY(0); /* Swipe up */
}

.project-card:hover {
  box-shadow: 0 8px 25px var(--card-shadow); /* Hanya bayangan yang berubah */
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  /* Properti untuk animasi baru */
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.gallery-item.visible {
  opacity: 1;
  transform: scale(1);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block; /* Menghilangkan ruang kosong di bawah gambar */
}

.tech-tag {
  display: inline-block;
  background-color: rgba(128, 128, 128, 0.1); /* Lebih telus */
  color: var(--text-color);
  font-size: 0.8em;
  padding: 5px 12px;
  border-radius: 15px; /* Bentuk pil */
  margin-right: 5px;
  margin-top: 10px;
  border: 1px solid var(--border-color);
}

/* --- Social Page Styles --- */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.social-link-card {
  background-color: var(--card-bg);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 5px 15px var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: var(--text-color);
  font-size: 1.5em;
  font-weight: bold;
}

.social-link-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--card-shadow);
}

/* Custom style for the space-gray card */
.space-gray-card {
  background-color: #4a4a4a; /* Space Gray color */
  color: #ffffff; /* Ensure text is white for readability */
}

.space-gray-card h3,
.space-gray-card p,
.space-gray-card .tech-tag {
  color: #ffffff; /* Ensure all text elements within the card are white */
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 768px) {
  body {
    background-attachment: scroll; /* Fix for iOS rendering bugs */
  }

  header {
    flex-direction: column;
    padding: 10px;
    align-items: center;
  }

  .header-content {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
  }

  .header-content h1 {
    font-size: 1.5em;
    margin: 0;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
  }

  .nav-button {
    padding: 8px 15px;
    font-size: 0.9em;
  }

  .theme-button {
    margin-top: 10px;
  }

  .content-container {
    padding: 15px;
  }

  h2 {
    font-size: 1.8em;
  }

  .project-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
  }
}

/* Ensure project cards are visible if JS is disabled or not yet loaded */
.no-js .project-card,
.no-js .gallery-item {
  opacity: 1 !important;
  transform: none !important;
}

/* --- Web Development Skills Section --- */
#skills-section {
    padding: 30px 5%;
    max-width: 1200px;
    margin: auto;
    margin-top: 50px;
}

#skills-section h2 {
    text-align: center;
    margin-bottom: 30px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.skill-item {
    background-color: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 5px 15px var(--card-shadow);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: box-shadow 0.3s ease, opacity 0.5s ease, transform 0.5s ease;
    opacity: 0;
    transform: translateY(30px);
}

.skill-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.skill-item h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.progress-bar-container {
    background-color: rgba(255, 255, 255, 0.15); /* More transparent for glassmorphism */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px;
    height: 25px;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background-color: var(--accent-color);
    width: 0; /* Initial width for animation */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center; /* Changed from flex-end to center */
    font-weight: bold;
    color: white; /* Ensure text is visible */
    border-radius: 10px;
    transition: width 0.8s ease-out; /* Slower and different ease for visual effect */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* --- Project Card Specific Progress Bars --- */
.project-progress-container {
    background-color: rgba(255, 255, 255, 0.15); /* More transparent for glassmorphism */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px;
    height: 25px;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.project-progress-bar {
    background-color: #00FF9D; /* Changed to new color */
    width: 0; /* Initial width for animation */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000000; /* Changed to black for better visibility */
    /* font-size: 0.9em; REMOVED to match skill bar */
    border-radius: 10px; /* Matched skill bar */
    transition: width 0.8s ease-out;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2); /* Matched skill bar */
}

/* --- Project Link Wrapper --- */
.project-link-wrapper {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

/* --- Page Transition Animations --- */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

body.slide-in {
  animation: slide-in 0.5s forwards;
}

body.slide-out {
  animation: slide-out 0.5s forwards;
}

/* --- Social Button Pulsing Ring Effect on Hover --- */
.social-button {
    position: relative;
    padding: 12px 25px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-weight: bold;
    text-decoration: none;
    color: var(--text-color) !important;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    z-index: 1;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.1s ease, background-color 0.4s ease;
}

/* The text content */
.social-button > span:first-of-type {
    position: relative;
    z-index: 2;
}

/* The ripple rings */
.social-button .ripple-ring {
    position: absolute;
    top: -2px; /* Offset for border */
    left: -2px; /* Offset for border */
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border: 3px solid rgba(255, 255, 255, 0.7); /* Thicker border, higher opacity */
    border-radius: 25px; /* Match button shape */
    transform: scale(0.8);
    opacity: 0;
    /* Animation will be applied on hover */
}

/* On hover, trigger the animation */
.social-button:hover .ripple-ring {
    animation: pulse-ring 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite; /* Longer duration */
}

/* Stagger the animations */
.social-button:hover .ripple-ring:nth-of-type(2) {
    animation-delay: 0s;
}

.social-button:hover .ripple-ring:nth-of-type(3) {
    animation-delay: 0.75s; /* Adjusted delay for longer animation */
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 1; /* Start with full opacity */
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}
