@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ===================== ROOT THEME ===================== */
:root {
  --bg: #0a0a0c;
  --glass: rgba(255,255,255,0.06);
  --text: #f3f4f6;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --gradient: linear-gradient(135deg, var(--purple), var(--cyan));
  --blur: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,0.6);
  --radius: 16px;
  --transition: all 0.3s ease;
  --border: 1px solid rgba(128,128,128,0.22);
  --border-accent: 1px solid rgba(168,85,247,0.45);
  --border-subtle: 1px solid rgba(128,128,128,0.1);
}

/* ===================== RESET ===================== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  font-family: 'Space Grotesk', sans-serif;
  cursor: none !important;
}

html, body {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ===================== CURSOR ===================== */
.cursor {
  width: 12px; height: 12px;
  border-radius: 50%;
  position: fixed;
  background: var(--cyan);
  pointer-events: none;
  mix-blend-mode: difference;
  z-index: 99999;
  top: 0; left: 0;
  will-change: transform;
}

.cursor-trail {
  width: 30px; height: 30px;
  border-radius: 50%;
  position: fixed;
  border: 2px solid var(--purple);
  pointer-events: none;
  z-index: 99998;
  opacity: 0.5;
  top: 0; left: 0;
  will-change: transform;
}

/* ===================== 3D CANVAS (sub-pages) ===================== */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* All page content must sit above the canvas */
.navbar      { position: fixed; z-index: 1000; }
.page-content { position: relative; z-index: 1; }

/* ===================== INDEX hero 3D ===================== */
#hero-3d-container {
  position: fixed; inset: 0; z-index: 0;
}
#three-fallback, #spline-viewer-placeholder {
  position: absolute; width: 100%; height: 100%; top: 0; left: 0;
}
/* Index content must be above hero canvas */
.hero, .section, header.navbar, footer, #topBtn {
  position: relative; z-index: 1;
}

/* ===================== LOADER ===================== */
#loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  z-index: 999999;
}
.loader-logo {
  font-size: 3rem; font-weight: bold;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.loader-bar {
  width: 200px; height: 2px;
  margin-top: 20px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.loader-bar::after {
  content: ""; display: block;
  width: 50%; height: 100%;
  background: var(--gradient);
  animation: loadbar 1.5s infinite;
}
@keyframes loadbar {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ===================== NAVBAR ===================== */
.navbar {
  top: 0; width: 100%;
  padding: 18px 40px;
  display: flex; justify-content: space-between; align-items: center;
  backdrop-filter: blur(var(--blur));
  background: rgba(10,10,12,0.7);
  border-bottom: var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo-box {
  padding: 6px 10px; border-radius: 8px;
  background: var(--gradient); color: black; font-weight: 700;
}
.navbar ul { display: flex; list-style: none; gap: 20px; }
.navbar a { text-decoration: none; color: var(--text); opacity: 0.8; transition: var(--transition); }
.navbar a:hover { opacity: 1; color: var(--cyan); }

/* ===================== DROPDOWN ===================== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 12px); left: 0;
  min-width: 160px; display: flex; flex-direction: column;
  padding: 10px;
  background: rgba(10,10,16,0.95);
  backdrop-filter: blur(20px);
  border: var(--border); border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(168,85,247,0.12);
  list-style: none; z-index: 2000;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}
.dropdown-menu.active {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0) scale(1);
}
.dropdown-menu li { width: 100%; }
.dropdown-menu li a {
  display: block; width: 100%;
  padding: 12px 16px; border-radius: 12px;
  text-decoration: none; color: var(--text);
  transition: all 0.25s;
}
.dropdown-menu li a:hover {
  background: rgba(168,85,247,0.15);
  color: var(--purple); transform: translateX(6px);
}

/* ===================== HERO ===================== */
.hero { height: 100vh; display: flex; align-items: center; padding: 0 10%; }
.hero-content { max-width: 600px; }
.glow-title { font-size: clamp(2rem,5vw,3.5rem); }
.glow-title span {
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.role-text { margin-top: 10px; font-size: 1.2rem; opacity: 0.8; min-height: 1.8em; }
.tagline { margin-top: 20px; opacity: 0.7; }

.btn {
  display: inline-block; padding: 12px 20px;
  border-radius: 12px; margin-right: 10px;
  text-decoration: none; transition: var(--transition);
  border: var(--border);
}
.btn.primary { background: var(--gradient); color: black; font-weight: 600; border: none; }
.btn.secondary { background: var(--glass); backdrop-filter: blur(var(--blur)); color: var(--text); }
.btn:hover { transform: translateY(-3px); }

.socials { margin-top: 20px; display: flex; gap: 15px; opacity: 0.7; }
.socials a { color: var(--text); text-decoration: none; transition: var(--transition); }
.socials a:hover { color: var(--cyan); opacity: 1; }

.scroll-indicator {
  margin-top: 40px; width: 20px; height: 35px;
  border: 2px solid var(--cyan); border-radius: 20px; position: relative;
}
.scroll-indicator span {
  position: absolute; width: 4px; height: 4px;
  background: var(--cyan); border-radius: 50%;
  left: 50%; transform: translateX(-50%);
  top: 5px; animation: scrolldot 1.5s infinite;
}
@keyframes scrolldot {
  0%   { top: 5px; opacity: 1; }
  100% { top: 20px; opacity: 0; }
}

/* ===================== SECTIONS ===================== */
.section { padding: 120px 10%; }
.section h2 { font-size: 2rem; margin-bottom: 40px; }
.glass {
  background: var(--glass); backdrop-filter: blur(var(--blur));
  border-radius: var(--radius); border: var(--border);
}

/* ===================== ABOUT ===================== */
.about-container { display: flex; gap: 60px; align-items: center; }
.about-text { flex: 1; line-height: 1.8; opacity: 0.85; }
.about-text p + p { margin-top: 16px; }
.about-visual { flex: 0 0 auto; display: flex; justify-content: center; align-items: center; }
.profile-img-wrapper { position: relative; width: 220px; height: 220px; }
.profile-img {
  width: 220px; height: 220px; border-radius: 20px;
  object-fit: cover; border: var(--border-accent);
  box-shadow: 0 0 40px rgba(168,85,247,0.2);
}
.avatar-box {
  width: 220px; height: 220px; border-radius: 20px;
  background: var(--gradient); display: flex;
  align-items: center; justify-content: center;
  font-size: 2rem; font-weight: bold; color: black;
  border: var(--border-accent);
}

/* ===================== CARD GRID — ZOOM POPUP + DIM SIBLINGS ===================== */
.grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 20px;
}

/* When ANY card in the grid is hovered, dim ALL cards */
.grid:has(.project-card:hover) .project-card,
.grid:has(.blog-card:hover) .blog-card {
  opacity: 0.45;
  filter: brightness(0.55);
  transform: scale(0.97);
}

/* Then un-dim and zoom the hovered one */
.grid:has(.project-card:hover) .project-card:hover,
.grid:has(.blog-card:hover) .blog-card:hover {
  opacity: 1;
  filter: brightness(1);
  transform: scale(1.04);
  z-index: 10;
  box-shadow: 0 8px 40px rgba(168,85,247,0.35), 0 0 0 1px rgba(168,85,247,0.3);
  border: var(--border-accent);
}

/* ===================== PROJECT CARDS ===================== */
.project-card {
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  border: var(--border);
  transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease,
              box-shadow 0.35s ease, border 0.35s ease;
  transform-style: preserve-3d;
  overflow: hidden;
  position: relative;
}

.project-img-placeholder {
  width: 100%; height: 160px;
  background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(6,182,212,0.12));
  display: flex; align-items: center; justify-content: center;
  border-bottom: var(--border);
  font-size: 0.85rem; opacity: 0.7;
  color: var(--cyan); font-weight: 500; letter-spacing: 0.05em;
}

.project-card img { width: 100%; height: 160px; object-fit: cover; }
.project-card h3, .project-card p, .project-tags { padding: 0 20px; }
.project-card h3 { margin-top: 18px; margin-bottom: 8px; font-size: 1.05rem; }
.project-card p  { font-size: 0.9rem; opacity: 0.7; line-height: 1.5; padding-bottom: 16px; }
.project-tags    { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 20px; }
.ptag {
  font-size: 0.72rem; padding: 4px 10px; border-radius: 8px;
  background: rgba(6,182,212,0.08); color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.25);
}

/* ===================== SKILLS ===================== */
.skills-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.skill {
  padding: 10px 15px; border-radius: 10px;
  background: var(--glass); backdrop-filter: blur(var(--blur));
  border: var(--border); transition: var(--transition);
}
.skill:hover { background: var(--gradient); color: black; border-color: transparent; }

.progress-bars { display: flex; flex-direction: column; gap: 16px; }
.bar-label { display: flex; justify-content: space-between; font-size: 0.85rem; opacity: 0.8; margin-bottom: 6px; }
.bar-track { width: 100%; height: 6px; border-radius: 10px; background: rgba(128,128,128,0.15); overflow: hidden; border: var(--border-subtle); }
.bar-fill  { height: 100%; border-radius: 10px; background: var(--gradient); }

/* ===================== CERT PREVIEW ===================== */
.cert-preview-grid { display: flex; flex-direction: column; gap: 14px; }
.cert-preview-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: var(--border); transition: var(--transition);
}
.cert-preview-card:hover { border: var(--border-accent); transform: translateX(6px); }
.cert-icon { font-size: 1.8rem; flex-shrink: 0; }
.cert-preview-card strong { font-size: 0.95rem; }
.cert-preview-card p { font-size: 0.8rem; opacity: 0.6; margin-top: 2px; }

/* ===================== CONTACT ===================== */
form { display: flex; flex-direction: column; gap: 15px; max-width: 500px; }
input, textarea {
  padding: 14px; border-radius: 10px;
  border: var(--border); background: var(--glass);
  color: var(--text); outline: none; font-size: 0.95rem;
  transition: border 0.3s;
}
input:focus, textarea:focus { border: var(--border-accent); }
textarea { min-height: 130px; resize: vertical; }

/* ===================== FOOTER ===================== */
footer { text-align: center; padding: 40px; opacity: 0.6; border-top: var(--border-subtle); }

/* ===================== BACK TO TOP ===================== */
#topBtn {
  position: fixed; bottom: 20px; right: 20px;
  padding: 10px 15px; border-radius: 10px;
  background: var(--gradient); border: none;
  display: none; color: black; font-weight: 700; z-index: 500;
}

/* ===================== LIGHT MODE ===================== */
body.light-mode {
  --bg: #f0f0f5; --glass: rgba(255,255,255,0.65);
  --text: #0a0a0c;
  --border: 1px solid rgba(0,0,0,0.13);
  --border-accent: 1px solid rgba(168,85,247,0.5);
  --border-subtle: 1px solid rgba(0,0,0,0.07);
}
body.light-mode .navbar { background: rgba(240,240,245,0.85); }
body.light-mode .dropdown-menu { background: rgba(245,245,250,0.98); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 0 5%; }
}
@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .about-container { flex-direction: column; text-align: center; }
  .about-visual { order: -1; }
  .navbar ul { display: none; }
  .hero { text-align: center; }
  .hero-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; }
  .btn { margin-right: 0; }
  /* Disable zoom effect on mobile (touch has no hover) */
  .grid:has(.project-card:hover) .project-card,
  .grid:has(.blog-card:hover) .blog-card { opacity: 1; filter: none; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
