/* ==================== THEME VARIABLES ==================== */
:root {
  --bg-base: #f9fafb;
  --bg-section-solid: rgba(255, 255, 255, 0.75);
  --bg-card: #ffffff;
  --bg-navbar: rgba(255, 255, 255, 0.85);
  --bg-sidebar: rgba(255, 255, 255, 0.95);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-sidebar: rgba(0, 0, 0, 0.07);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.07);
  --toggle-bg: #d1d5db;
}

html.dark {
  --bg-base: #0f172a;
  --bg-section-solid: rgba(15, 23, 42, 0.8);
  --bg-card: #1e293b;
  --bg-navbar: rgba(15, 23, 42, 0.85);
  --bg-sidebar: rgba(15, 23, 42, 0.97);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.07);
  --border-sidebar: rgba(255, 255, 255, 0.06);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --toggle-bg: #475569;
}

/* ==================== BASE ==================== */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* ==================== STAR CANVAS BG ==================== */
#star-canvas {
  background-color: var(--bg-base);
  transition: background-color 0.3s ease;
}

/* ==================== NAVBAR ==================== */
#main-nav {
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#nav-brand {
  color: var(--text-primary);
}

/* ==================== NAV LINKS (Desktop underline effect) ==================== */
.nav-link {
  position: relative;
  display: inline-block;
  padding-bottom: 4px;
  color: var(--text-secondary);
  transition: color 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  font-weight: 500;
}

/* ==================== MOBILE NAV LINKS (Sidebar underline effect) ==================== */
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition:
    color 0.25s ease,
    background-color 0.2s ease;
  width: 100%;
}

/* Underline lives on the inner span, so it only covers the text width */
.mobile-nav-link .nav-text {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

.mobile-nav-link .nav-text::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.mobile-nav-link:hover .nav-text::after,
.mobile-nav-link.active .nav-text::after {
  transform: scaleX(1);
  transform-origin: left;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--text-primary);
  background-color: var(--border-color);
}

/* ==================== SIDEBAR ==================== */
#mobile-sidebar {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
}

.sidebar-divider {
  border-color: var(--border-sidebar);
}

.sidebar-label {
  color: var(--text-muted);
}

.sidebar-appearance-text {
  color: var(--text-secondary);
}

.sidebar-toggle-label {
  color: var(--text-primary);
}

/* ==================== SECTIONS ==================== */
.section-solid {
  position: relative;
  z-index: 10;
  background: var(--bg-section-solid);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

/* ==================== CARDS ==================== */
.card {
  background-color: var(--bg-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

html.dark .card:hover {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* ==================== SKILL TAGS ==================== */
.skill-tag {
  background-color: var(--bg-base);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* ==================== INPUTS ==================== */
.form-input {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle-track {
  background-color: var(--toggle-bg);
  transition: background-color 0.2s ease;
}

html.dark .toggle-track {
  background-color: var(--toggle-bg);
}

/* ==================== SECTION TEXT ==================== */
.section-title {
  color: var(--text-primary);
}

.section-body {
  color: var(--text-secondary);
}

/* ==================== CURSOR TRAIL ==================== */
.cursor-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 1rem;
  user-select: none;
  transform: translate(-50%, -50%);
  animation: particle-fade 0.9s ease-out forwards;
  line-height: 1;
}

@keyframes particle-fade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 40px)) scale(0.3) rotate(180deg);
  }
}

/* Glowing dot cursor */
#cursor-glow {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(147, 197, 253, 0.9),
    rgba(99, 102, 241, 0.5)
  );
  box-shadow: 0 0 10px 4px rgba(147, 197, 253, 0.4);
  transform: translate(-50%, -50%);
  transition:
    width 0.15s ease,
    height 0.15s ease,
    opacity 0.15s ease;
  mix-blend-mode: screen;
}

html:not(.dark) #cursor-glow {
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.7),
    rgba(59, 130, 246, 0.4)
  );
  box-shadow: 0 0 10px 4px rgba(99, 102, 241, 0.3);
  mix-blend-mode: multiply;
}

/* ==================== FLOATING CELESTIAL OBJECTS ==================== */
.celestial-obj {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  line-height: 1;
  will-change: transform, opacity;
  transition: opacity 0.5s ease;
}

@keyframes float-1 {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  30% {
    transform: translateY(-18px) rotate(6deg);
  }
  60% {
    transform: translateY(-8px) rotate(-4deg);
  }
  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

@keyframes float-2 {
  0% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  40% {
    transform: translateY(-24px) rotate(-8deg) scale(1.05);
  }
  100% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
}

@keyframes float-3 {
  0% {
    transform: translateY(0px) translateX(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-12px) translateX(8px) rotate(5deg);
  }
  75% {
    transform: translateY(-20px) translateX(-6px) rotate(-5deg);
  }
  100% {
    transform: translateY(0px) translateX(0px) rotate(0deg);
  }
}

@keyframes orbit-slow {
  0% {
    transform: rotate(0deg) translateX(12px) rotate(0deg);
  }
  100% {
    transform: rotate(360deg) translateX(12px) rotate(-360deg);
  }
}

@keyframes drift-across {
  0% {
    transform: translateX(0) translateY(0) rotate(-10deg);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  95% {
    opacity: 0.6;
  }
  100% {
    transform: translateX(110vw) translateY(-60px) rotate(10deg);
    opacity: 0;
  }
}
