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

:root {
  --bg-0: #0f1115;
  --bg-1: #151922;
  --bg-2: #1d2330;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --text-0: #f3f6fc;
  --text-1: #c9d1df;
  --text-2: #96a3b8;
  --line: rgba(255, 255, 255, 0.11);
  --brand: #79b8ff;
  --brand-2: #9bcbff;
  --accent: #ff8f6a;
  --brand-rgb: 121, 184, 255;
  --accent-rgb: 255, 143, 106;
  --on-brand: #0f1115;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --space-section: 96px;
}

body[data-theme="blue"] {
  --bg-0: #0f1115;
  --bg-1: #151922;
  --bg-2: #1d2330;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --text-0: #f3f6fc;
  --text-1: #c9d1df;
  --text-2: #96a3b8;
  --line: rgba(255, 255, 255, 0.11);
  --brand: #79b8ff;
  --brand-2: #9bcbff;
  --accent: #ff8f6a;
  --brand-rgb: 121, 184, 255;
  --accent-rgb: 255, 143, 106;
  --on-brand: #0f1115;
}

body[data-theme="silver"] {
  --bg-0: #101114;
  --bg-1: #17191f;
  --bg-2: #242832;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.09);
  --text-0: #f5f7fb;
  --text-1: #d6dce5;
  --text-2: #aab2c0;
  --line: rgba(255, 255, 255, 0.16);
  --brand: #dbe2ee;
  --brand-2: #f4f7ff;
  --accent: #b4becf;
  --brand-rgb: 219, 226, 238;
  --accent-rgb: 180, 190, 207;
  --on-brand: #11141b;
}

body[data-theme="spotify"] {
  --bg-0: #0a0a0a;
  --bg-1: #111313;
  --bg-2: #171a17;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --text-0: #f2f6f3;
  --text-1: #cad7cf;
  --text-2: #95a89c;
  --line: rgba(255, 255, 255, 0.12);
  --brand: #1ed760;
  --brand-2: #49e37d;
  --accent: #1db954;
  --brand-rgb: 30, 215, 96;
  --accent-rgb: 29, 185, 84;
  --on-brand: #09120c;
}

body[data-theme="verdict"] {
  --bg-0: #111013;
  --bg-1: #181620;
  --bg-2: #241f2e;
  --surface: rgba(248, 238, 214, 0.06);
  --surface-strong: rgba(248, 238, 214, 0.1);
  --text-0: #f7efdc;
  --text-1: #e2d3b1;
  --text-2: #baa984;
  --line: rgba(197, 166, 96, 0.32);
  --brand: #c5a660;
  --brand-2: #e3c98d;
  --accent: #8b6b2f;
  --brand-rgb: 197, 166, 96;
  --accent-rgb: 139, 107, 47;
  --on-brand: #16120a;
}

body[data-theme="marble"] {
  --bg-0: #121417;
  --bg-1: #1a1e24;
  --bg-2: #262d37;
  --surface: rgba(244, 248, 255, 0.06);
  --surface-strong: rgba(244, 248, 255, 0.11);
  --text-0: #eef4ff;
  --text-1: #c9d4e9;
  --text-2: #9aa8c2;
  --line: rgba(193, 210, 235, 0.28);
  --brand: #9eb8dc;
  --brand-2: #c8d8f0;
  --accent: #d2c4a5;
  --brand-rgb: 158, 184, 220;
  --accent-rgb: 210, 196, 165;
  --on-brand: #10151d;
}

body[data-theme="library"] {
  --bg-0: #0f1119;
  --bg-1: #171d2a;
  --bg-2: #242c3d;
  --surface: rgba(245, 230, 198, 0.06);
  --surface-strong: rgba(245, 230, 198, 0.11);
  --text-0: #f2e8d1;
  --text-1: #d8c8a8;
  --text-2: #ae9a78;
  --line: rgba(194, 161, 102, 0.3);
  --brand: #c2a166;
  --brand-2: #dfc089;
  --accent: #7f91b8;
  --brand-rgb: 194, 161, 102;
  --accent-rgb: 127, 145, 184;
  --on-brand: #151009;
}

body[data-mode="light"] {
  --bg-0: #f3ede1;
  --bg-1: #faf5ea;
  --bg-2: #ebe1cf;
  --surface: rgba(32, 24, 10, 0.055);
  --surface-strong: rgba(32, 24, 10, 0.09);
  --text-0: #1f1a14;
  --text-1: #514736;
  --text-2: #7f735f;
  --line: rgba(56, 43, 26, 0.18);
  --on-brand: #fff7e9;
}

body[data-theme="silver"][data-mode="light"] {
  --bg-0: #eef2f7;
  --bg-1: #f7f9fc;
  --bg-2: #dde5ef;
  --surface: rgba(22, 34, 50, 0.055);
  --surface-strong: rgba(22, 34, 50, 0.095);
  --text-0: #1c2736;
  --text-1: #3a4a5f;
  --text-2: #607086;
  --line: rgba(63, 80, 102, 0.26);
  --brand: #5f7694;
  --brand-2: #7f95b0;
  --accent: #7f90a8;
  --brand-rgb: 95, 118, 148;
  --accent-rgb: 127, 144, 168;
  --on-brand: #f7fbff;
}

body, html {
  font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(circle at 12% 8%, rgba(var(--brand-rgb), 0.16), transparent 36%),
    radial-gradient(circle at 84% 84%, rgba(var(--accent-rgb), 0.12), transparent 33%),
    linear-gradient(140deg, var(--bg-1), var(--bg-0) 78%);
  line-height: 1.65;
  scroll-behavior: smooth; /* Smooth scrolling between sections */
}

h1,
h2,
h3,
.logo,
.hero .btn,
.theme-toggle,
.theme-option,
.mode-toggle,
.nav-links li a,
#contact-form button,
.project-number,
.project-meta span,
.project-tech span {
  font-family: "Space Grotesk", "Inter", sans-serif;
}

h1,
h2,
h3 {
  line-height: 1.08;
}

body {
  position: relative;
  overflow-x: hidden;
}

.theme-switcher {
  position: fixed;
  left: 20px;
  bottom: 22px;
  z-index: 1200;
}

.theme-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-0) 90%, transparent);
  color: var(--brand);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.3);
}

.theme-panel {
  width: 188px;
  margin-top: 10px;
  border-radius: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-0) 92%, transparent);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.theme-panel p {
  font-size: 0.76rem;
  color: var(--text-2);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.theme-option {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-0);
  padding: 8px 10px;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-option:hover,
.theme-option.active {
  background: rgba(var(--brand-rgb), 0.16);
  border-color: rgba(var(--brand-rgb), 0.35);
  color: var(--brand);
}

.theme-option:hover {
  transform: translateX(2px);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(70px);
  opacity: 0.22;
}

body::before {
  top: -8rem;
  right: -10rem;
  background: radial-gradient(circle, rgba(var(--brand-rgb), 0.55), rgba(var(--brand-rgb), 0));
}

body::after {
  bottom: -10rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.38), rgba(var(--accent-rgb), 0));
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 60px; /* Spacing for fixed navbar */
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  border-bottom: 1px solid var(--line);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.3s ease;
  backdrop-filter: blur(18px);
}

.navbar nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.navbar.scrolled {
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3); /* Shadow appears after scrolling */
}

.navbar .logo {
  font-size: 1.28rem;
  color: var(--brand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 8px;
}

.mode-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-0) 84%, transparent);
  color: var(--brand);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.mode-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--brand-rgb), 0.45);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}

.mode-toggle.is-spinning {
  transform: rotate(180deg);
}

.mode-icon-wrap {
  position: relative;
  width: 18px;
  height: 18px;
  display: block;
}

.mode-icon-wrap i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: transform 0.36s ease, opacity 0.36s ease;
}

body[data-mode="dark"] .mode-sun {
  opacity: 0;
  transform: rotate(85deg) scale(0.38);
}

body[data-mode="dark"] .mode-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

body[data-mode="light"] .mode-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

body[data-mode="light"] .mode-moon {
  opacity: 0;
  transform: rotate(-85deg) scale(0.38);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-direction: column;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-0);
  border-radius: 99px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-links li a {
  text-decoration: none;
  color: var(--text-0);
  transition: color 0.22s ease, background-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  outline: none;
  letter-spacing: 0.02em;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: var(--brand);
  background: rgba(var(--brand-rgb), 0.14);
  font-weight: 600;
  transform: translateY(-1px);
}

/* Floating Social Links */
.floating-social {
  position: fixed;
  top: 50%; /* Align vertically centered */
  right: 20px; /* Keep clear of the hero image/background */
  transform: translateY(-50%); /* Exact vertical centering */
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 999;
  padding: 14px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-0) 78%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.social-toggle {
  display: none;
}

.floating-social a {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--text-0);
  text-decoration: none;
  transition: color 0.22s ease, transform 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
  background: rgba(var(--brand-rgb), 0.08);
}

body[data-mode="light"] .floating-social a {
  background: rgba(0, 0, 0, 0.07);
}

.floating-social a:hover {
  color: var(--brand);
  transform: translateX(-4px) scale(1.08);
  background: rgba(var(--brand-rgb), 0.14);
  box-shadow: 0 10px 18px rgba(var(--brand-rgb), 0.16);
}

/* Hero Section */
.hero {
  text-align: center;
  min-height: 100vh;
  padding: 132px 20px 108px;
  background:
    radial-gradient(circle at top, rgba(var(--brand-rgb), 0.18), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(var(--accent-rgb), 0.11), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  display: flex;
  flex-direction: column; /* Stack elements vertically */
  align-items: center; /* Center-align all elements */
  gap: 24px; /* Space between elements */
  position: relative;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.2;
  pointer-events: none;
}

.hero::before {
  top: 10%;
  left: 8%;
  background: rgba(var(--brand-rgb), 0.45);
}

.hero::after {
  bottom: 8%;
  right: 10%;
  background: rgba(var(--accent-rgb), 0.25);
}

.profile-image img {
  width: 138px;
  height: 138px;
  border-radius: 50%; /* Makes the image circular */
  border: 4px solid var(--brand);
  box-shadow: 0 16px 36px rgba(8, 11, 18, 0.58);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.profile-image img:hover {
  transform: scale(1.06);
}

.hero-content {
  display: flex;
  flex-direction: column; /* Stack the text content */
  align-items: center;
  gap: 14px;
  max-width: 40rem;
}

.hero-text {
  font-size: clamp(2.6rem, 5vw, 4.3rem);
  line-height: 1.08;
  color: var(--brand);
  opacity: 0; /* Start hidden */
  animation: slide-in 1s ease-in-out forwards; /* Slide below photo */
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  letter-spacing: -0.03em;
}

.hero-subtext {
  font-size: 0.92rem;
  color: var(--text-1);
  opacity: 0; /* Start hidden */
  animation: slide-in 1.5s ease-in-out forwards; /* Staggered animation for text */
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-0) 70%, transparent);
  backdrop-filter: blur(12px);
}

.hero .btn {
  display: inline-block;
  background-color: var(--brand);
  color: var(--on-brand);
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0;
  animation: slide-in 1.8s ease-in-out forwards;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, letter-spacing 0.22s ease;
  box-shadow: 0 10px 24px rgba(121, 184, 255, 0.24);
}

.hero .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(121, 184, 255, 0.28);
  background-color: var(--brand-2);
  letter-spacing: 0.01em;
}

.hero .btn.blob {
  animation: blobMorph 1.5s ease-in-out forwards;
}

@keyframes blobMorph {
  0% {
    border-radius: 12px;
    transform: scale(1);
    background-color: var(--brand);
  }
  25% {
    border-radius: 40% 60% 50% 30% / 30% 50% 60% 40%;
    transform: scale(1.1) rotate(5deg);
    background-color: var(--brand-2);
  }
  50% {
    border-radius: 60% 30% 40% 70% / 50% 40% 30% 60%;
    transform: scale(0.95) rotate(-5deg);
    background-color: var(--accent);
  }
  75% {
    border-radius: 50% 60% 30% 40% / 40% 30% 60% 50%;
    transform: scale(1.05) rotate(3deg);
    background-color: var(--brand-2);
  }
  100% {
    border-radius: 12px;
    transform: scale(1);
    background-color: var(--brand);
  }
}


/* Keyframe Animations for Slide-In Text */
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(20px); /* Start slightly below */
  }
  to {
    opacity: 1;
    transform: translateY(0); /* Slide in to natural position */
  }
}


/* About Section */
#about {
  padding: var(--space-section) 20px;
  background: linear-gradient(180deg, rgba(21, 25, 34, 0.82), rgba(15, 17, 21, 0.9));
}

#about h2 {
  font-size: 2rem;
  color: var(--brand);
  text-align: center;
  margin-bottom: 40px;
}

.about-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap; /* Wrap content on smaller screens */
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

.about-text {
  flex: 1;
  max-width: 500px;

  /* Initial state for animation */
  opacity: 0; /* Start hidden */
  transform: translateY(30px); /* Start slightly below the final position */
  animation: fade-in-up 0.8s ease-in-out forwards; /* Applies the animation */
}

/* Animation for paragraphs inside the about-text */
.about-text p {
  color: var(--text-1);
  font-size: 1rem;
  line-height: 1.72;
  margin-bottom: 16px;
}

/* Animation for Highlights Header */
.about-text .highlights h3 {
  font-size: 1.2rem;
  color: var(--brand);
  margin-top: 16px;
  margin-bottom: 12px;

  /* Apply the same animation */
  opacity: 0;
  transform: translateY(20px);
  animation: fade-in-up 1s ease-in-out forwards;
  animation-delay: 0.3s; /* Staggered effect */
}

/* Highlights List */
.about-text .highlights ul {
  list-style: none;
  padding: 0;
}

.about-text .highlights ul li {
  margin-bottom: 8px;
  font-size: 0.98rem;
  color: #cfcfcf;
  display: flex;
  align-items: center;

  /* Staggered animation for list items */
  opacity: 0;
  transform: translateY(20px);
  animation: fade-in-up 1s ease-in-out forwards;
}

.about-text .highlights ul li:nth-child(1) {
  animation-delay: 0.5s;
}

.about-text .highlights ul li:nth-child(2) {
  animation-delay: 0.6s;
}

.about-text .highlights ul li:nth-child(3) {
  animation-delay: 0.7s;
}

.about-text .highlights ul li i {
  color: var(--brand);
  margin-right: 10px;
}

/* About Photo Hover Effect */
.about-photo img {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease-in-out;
}

.about-photo img:hover {
  transform: scale(1.05); /* Slight zoom */
}

/* FADE-IN-UP Keyframes Animation */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px); /* Start below */
  }
  to {
    opacity: 1;
    transform: translateY(0); /* Move to the final position */
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .about-container {
    flex-direction: column; /* Stack the text and image vertically */
    gap: 20px;
  }

  .about-text {
    text-align: center;
  }
}

/* Skills Section - Updated for Dock-Like Magnify Effect */
#skills {
  padding: var(--space-section) 20px;
}

#skills h2 {
  font-size: 2rem;
  color: var(--brand);
  text-align: center;
  margin-bottom: 40px;
}

.skills {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 14px;
  overflow-x: auto; /* Allow horizontal scrolling */
  padding: 24px 10px;
  scroll-behavior: smooth;
}

.skills::-webkit-scrollbar {
  height: 8px; /* Add a horizontal scrollbar */
}

.skills::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 4px;
}

.skill {
  background: var(--surface);
  padding: 14px;
  border-radius: 50%;
  width: 102px;
  height: 102px;
  flex: 0 0 auto;
  position: relative;
  transform: scale(1);
  transform-origin: center bottom;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.08s linear, box-shadow 0.14s ease-out, opacity 0.14s ease-out, border-color 0.14s ease-out;
  will-change: transform;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  text-align: center;
  backdrop-filter: blur(14px);
}

.flip-card,
.card-front {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.skill:hover {
  z-index: 10; /* Ensures it appears above the neighbors */
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  border-color: rgba(var(--brand-rgb), 0.38);
}

.skill i {
  font-size: 2rem;
  color: var(--brand);
}

.skill p {
  font-size: 0.72rem;
  color: var(--text-0);
  margin-top: 5px;
  line-height: 1;
  max-width: 100%;
  white-space: nowrap;
}

.skills:hover .skill:not(:hover) {
  opacity: 1;
}

@media (max-width: 1024px) {
  .skills {
    align-items: flex-end;
    gap: 12px;
    padding: 20px 8px;
  }

  .skill {
    width: 96px;
    height: 96px;
    padding: 12px;
  }

  .skill i {
    font-size: 1.88rem;
  }

  .skill p {
    font-size: 0.7rem;
  }

  .skills:hover .skill:not(:hover) {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .skills {
    align-items: flex-end;
    gap: 12px;
    padding: 20px 6px;
  }

  .skill {
    width: 90px;
    height: 90px;
    padding: 10px;
  }

  .skill i {
    font-size: 1.58rem;
  }

  .skill p {
    font-size: 0.62rem;
    margin-top: 3px;
    line-height: 1;
  }
}

@media (max-width: 520px) {
  .skills {
    justify-content: flex-start;
    padding-left: 4px;
  }
}

/* Projects Section */
#projects {
  padding: var(--space-section) 20px;
}

#projects h2 {
  font-size: 2rem;
  color: var(--brand);
  text-align: center;
  margin-bottom: 24px;
}

.projects-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transition: none;
  perspective: 1600px;
}

.project-card {
  background: var(--surface-strong);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  min-height: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  transition: box-shadow 0.24s ease, border-color 0.24s ease, background-color 0.24s ease;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --card-lift: 0px;
  --card-scale: 1;
  --card-offset-x: 0px;
  --card-offset-y: 0px;
  backdrop-filter: blur(14px);
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-number {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.12em;
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-card:hover {
  transform: translate3d(var(--card-offset-x), var(--card-offset-y), 0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(var(--card-lift)) scale(var(--card-scale));
  box-shadow: 0 26px 48px rgba(0, 0, 0, 0.22);
  border-color: rgba(var(--brand-rgb), 0.42);
}

.project-card:hover::before {
  opacity: 0;
}

.project-card img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 15px;
  transition: transform 0.32s ease, opacity 0.32s ease, filter 0.32s ease;
}

.project-card img:hover {
  transform: scale(1.06) translateY(-2px);
  opacity: 0.96;
  filter: saturate(1.05);
}

.project-card h3 {
  font-size: 1.18rem;
  color: var(--brand);
  line-height: 1.25;
}

.project-card p {
  color: var(--text-1);
  margin-bottom: 2px;
  font-size: 0.95rem;
}

.project-meta {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.project-meta span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface);
}

.project-impact {
  font-size: 0.9rem;
  color: var(--text-0);
  font-weight: 600;
}

.project-tech {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
}

.project-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.project-stats div {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-stats strong {
  font-size: 1.1rem;
  color: var(--text-0);
}

.project-stats span {
  font-size: 0.8rem;
  color: var(--text-2);
}

.project-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 4px;
}

.project-tech span {
  font-size: 0.73rem;
  color: var(--brand);
  background: rgba(var(--brand-rgb), 0.12);
  border: 1px solid rgba(var(--brand-rgb), 0.22);
  border-radius: 999px;
  padding: 4px 8px;
}

.project-link {
  align-self: flex-start;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(var(--brand-rgb), 0.12);
  border: 1px solid rgba(var(--brand-rgb), 0.24);
  box-shadow: 0 8px 16px rgba(var(--brand-rgb), 0.08);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.project-link-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-0);
}

.project-card a {
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
}

.project-card a:hover {
  color: var(--brand-2);
  background: rgba(var(--brand-rgb), 0.18);
  transform: translateY(-2px);
}

.project-card:hover .project-card-top {
  transform: translateY(-2px);
}

.project-card:hover .project-body {
  transform: translateY(-1px);
}

.project-card:hover .project-meta span:nth-child(1),
.project-card:hover .project-tech span:nth-child(1),
.project-card:hover .project-stats div:nth-child(1) {
  transform: translateY(-2px);
}

.project-card:hover .project-meta span:nth-child(2),
.project-card:hover .project-tech span:nth-child(2),
.project-card:hover .project-stats div:nth-child(2) {
  transform: translateY(-4px);
}

.project-card:hover .project-actions {
  transform: translateY(-2px);
}

.project-card:hover .project-link {
  box-shadow: 0 12px 20px rgba(var(--brand-rgb), 0.14);
}

.project-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 22px rgba(var(--brand-rgb), 0.18);
}



/* Contact Section */
#contact {
  padding: var(--space-section) 20px;
  background: linear-gradient(180deg, rgba(15, 17, 21, 0.9), rgba(21, 25, 34, 0.84));
}

#contact h2 {
  font-size: 2rem;
  color: var(--brand);
  text-align: center;
  margin-bottom: 20px;
}

#contact-form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface-strong);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#contact-form input,
#contact-form textarea {
  background: color-mix(in srgb, var(--bg-0) 84%, transparent);
  border: 1px solid var(--line);
  padding: 12px;
  font-size: 1rem;
  color: var(--text-0);
  border-radius: 10px;
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

#contact-form input:focus,
#contact-form textarea:focus {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--bg-0) 76%, transparent);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.12);
}

#contact-form button {
  background-color: var(--brand);
  color: var(--on-brand);
  padding: 11px 20px;
  font-size: 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease, letter-spacing 0.22s ease;
  box-shadow: 0 10px 22px rgba(121, 184, 255, 0.2);
}

#contact-form button:hover {
  background-color: var(--brand-2);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(121, 184, 255, 0.26);
  letter-spacing: 0.01em;
}

section h2 {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.98rem;
}

section h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 54px;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(var(--brand-rgb), 0.25), var(--brand), rgba(var(--brand-rgb), 0.25), transparent);
}

section {
  scroll-margin-top: 90px;
}

/* Reveal-on-scroll utility */
.reveal-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

#contact-form:focus-within {
  border-color: rgba(var(--brand-rgb), 0.35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24), 0 0 0 2px rgba(var(--brand-rgb), 0.14);
}

#contact-form input,
#contact-form textarea,
#contact-form button {
  outline: none;
}

#contact-form input:focus-visible,
#contact-form textarea:focus-visible,
#contact-form button:focus-visible,
.nav-toggle:focus-visible,
.mode-toggle:focus-visible,
.theme-toggle:focus-visible,
.theme-option:focus-visible {
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.28);
}

#contact-form button.is-sending {
  background-color: color-mix(in srgb, var(--brand) 72%, white 28%);
  pointer-events: none;
  opacity: 0.9;
}

@media (max-width: 980px) {
  .navbar {
    padding: 9px 14px;
  }

  .nav-links {
    gap: 4px;
  }

  .nav-links li a {
    padding: 6px 8px;
    font-size: 0.88rem;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding-right: 122px;
  }

  .mode-toggle {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
  }

  .mode-toggle.is-spinning {
    transform: translateY(-50%) rotate(180deg);
  }

  .nav-toggle {
    display: inline-flex;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
  }

  .nav-links {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    width: min(88vw, 320px);
    height: 100vh;
    margin-left: 0;
    padding: 82px 16px 20px;
    border-radius: 24px 0 0 24px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-0) 84%, #000 16%);
    flex-direction: column;
    align-items: stretch;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1100;
    overflow-y: auto;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.28);
  }

  .nav-open .nav-links {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 1050;
  }

  .nav-open .nav-backdrop {
    display: block;
  }

  .nav-links li a {
    display: block;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
  }

  .theme-switcher {
    left: 12px;
    bottom: 78px;
  }

  .theme-panel {
    width: 170px;
  }

  .hero {
    min-height: auto;
    background: color-mix(in srgb, var(--bg-0) 92%, #000 8%);
  }

  .floating-social {
    top: auto;
    right: 12px;
    left: auto;
    bottom: 78px;
    transform: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    color: var(--text-0);
    border-radius: 999px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .floating-social a {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }

  .social-toggle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-0) 90%, transparent);
    color: var(--brand);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(16px);
    position: relative;
    z-index: 2;
  }

  .social-toggle i {
    font-size: 1rem;
    transition: transform 0.28s ease;
  }

  .floating-social a {
    position: absolute;
    right: 0;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 18px, 0) scale(0.55);
    transition: transform 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.22s ease;
  }

  .floating-social.is-open a {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .floating-social.is-open a:nth-of-type(1) {
    right: 58px;
    bottom: 8px;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .floating-social.is-open a:nth-of-type(2) {
    right: 42px;
    bottom: 56px;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .floating-social.is-open a:nth-of-type(3) {
    right: 0;
    bottom: 96px;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .floating-social.is-open a:nth-of-type(1) {
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
  }

  .floating-social.is-open a:nth-of-type(2) {
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
  }

  .floating-social.is-open a:nth-of-type(3) {
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
  }

  .floating-social.is-open .social-toggle i {
    transform: rotate(90deg) scale(1.05);
  }

  .hero-text {
    font-size: clamp(2.2rem, 10vw, 3.4rem);
  }

  .hero-subtext {
    font-size: 0.86rem;
    padding: 7px 14px;
  }

  .about-container,
  .projects-container,
  #contact-form {
    border-radius: 16px;
  }

  .projects-container {
    position: relative;
    display: block;
    width: min(92vw, 360px);
    height: 470px;
    margin: 0 auto 120px;
    padding: 0;
    perspective: 1600px;
    overflow: visible;
  }

  .project-card {
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
    padding: 18px;
    gap: 12px;
    transform-origin: bottom center;
    transform: translate3d(calc(var(--stack-x, 0px) + var(--drag-x, 0px)), calc(var(--stack-y, 0px) + var(--drag-y, 0px)), 0) rotate(calc(var(--stack-rotate, 0deg) + var(--drag-rotate, 0deg))) scale(calc(var(--stack-scale, 1) * var(--drag-scale, 1)));
    opacity: var(--stack-opacity, 1);
    z-index: var(--stack-z, 1);
    transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    pointer-events: auto;
    will-change: transform;
  }

  .project-card::after {
    content: "Swipe to peek";
    position: absolute;
    left: 16px;
    bottom: 16px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-0) 76%, transparent);
    color: var(--text-1);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
  }

  .projects-stack-mobile:not(.projects-stack-open) .project-card:nth-child(1)::after {
    opacity: 1;
    transform: translateY(0);
    animation: peekPulse 1.8s ease-in-out infinite;
  }

  .projects-stack-mobile .project-card.is-stack-active::after {
    opacity: 1;
  }

  @keyframes peekPulse {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-2px);
    }
  }

  .project-card h3 {
    font-size: 1.35rem;
  }

  .projects-stack-mobile .project-card {
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
  }

  .projects-stack-mobile .project-card:nth-child(1) {
    --stack-x: 0px;
    --stack-y: 0px;
    --stack-rotate: -2deg;
    --stack-scale: 1;
    --stack-opacity: 1;
  }

  .projects-stack-mobile .project-card:nth-child(2) {
    --stack-x: 12px;
    --stack-y: 12px;
    --stack-rotate: 8deg;
    --stack-scale: 0.96;
    --stack-opacity: 0.98;
  }

  .projects-stack-open .project-card:nth-child(1) {
    --stack-x: -18px;
    --stack-y: -10px;
    --stack-rotate: -12deg;
    --stack-scale: 0.96;
  }

  .projects-stack-open .project-card:nth-child(2) {
    --stack-x: 18px;
    --stack-y: 6px;
    --stack-rotate: 12deg;
    --stack-scale: 1;
  }

  .project-stack-toggle {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: 102px;
    height: 102px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background:
      radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.16), transparent 42%),
      color-mix(in srgb, var(--bg-0) 88%, transparent);
    color: var(--brand);
    display: none;
    place-items: center;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(18px);
    z-index: 1180;
    cursor: pointer;
    transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
    overflow: hidden;
    will-change: transform;
  }

  .project-stack-toggle::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px solid rgba(var(--brand-rgb), 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }

  .project-stack-toggle::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb), 0.16), transparent 70%);
    opacity: 0.8;
  }

  .project-stack-toggle:hover {
    transform: translateX(-50%) scale(1.06) rotate(-2deg);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.3);
  }

  .project-stack-toggle i {
    position: absolute;
    font-size: 1.45rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .project-stack-open-icon {
    opacity: 1;
    transform: scale(1) translateY(-1px);
  }

  .project-stack-close-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.55);
  }

  .projects-stack-open .project-stack-open-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.55);
  }

  .projects-stack-open .project-stack-close-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }

  .projects-stack-open .project-stack-toggle {
    transform: translateX(-50%) rotate(180deg) scale(1.04);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.3);
  }

  .project-stack-toggle {
    display: grid;
  }

  .projects-stack-mobile .project-card:nth-child(1),
  .projects-stack-mobile .project-card:nth-child(2) {
    cursor: pointer;
  }

  .project-stats {
    grid-template-columns: 1fr;
  }

  .project-actions {
    flex-direction: column;
  }

  .project-link {
    width: 100%;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Footer */
footer {
  padding: 20px;
  background-color: #12161f;
  text-align: center;
  border-top: 1px solid var(--line);
}

footer p {
  color: #cfcfcf;
}

footer .social-icons a {
  color: var(--text-0);
  text-decoration: none;
  font-size: 1.5rem;
  transition: color 0.3s;
}

footer .social-icons a:hover {
  color: var(--brand);
}
