:root {
  --animation-duration: 200ms; /* Duration for transitions */
  --animation-timing-curve: ease-in-out; /* Timing function for smooth transitions */
  /* Nav-specific theme tokens */
  --nav-ham-stroke: color-mix(in oklab, var(--accent) 72%, black 28%);
  --nav-ham-stroke-dark: color-mix(in oklab, var(--accent) 82%, white 18%);
  --nav-pill-shadow: 0 10px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px rgba(255, 255, 255, 0.18);
  /* Color that GSAP animates between white (over hero) and body text elsewhere */
  --nav-pill-color: var(--text-color);
}

/* Magical straight fade-in animation with glow */
@keyframes magicalStraightAppear {
  0% {
    opacity: 0;
    transform: translateY(-15px) scale(0.92);
    filter: brightness(0.8) blur(2px);
    box-shadow: 0 0 0 rgba(79, 209, 197, 0);
  }
  50% {
    filter: brightness(1.1) blur(0px);
    box-shadow: 0 0 25px rgba(79, 209, 197, 0.4),
      0 0 50px rgba(79, 209, 197, 0.2), inset 0 0 15px rgba(79, 209, 197, 0.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1) blur(0px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1),
      0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

@keyframes magicalGlow {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.1),
      0 0 20px rgba(79, 209, 197, 0.3), 0 0 40px rgba(79, 209, 197, 0.1);
  }
}

/* Magical shimmer effect for pills */
@keyframes magicalShimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes magicalSparkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  20% {
    opacity: 1;
    transform: scale(1) rotate(90deg);
  }
  80% {
    opacity: 1;
    transform: scale(1) rotate(270deg);
  }
}

/* Navigation bar styles */
.nav-bar {
  position: fixed; /* Fixed positioning - stays during scroll */
  top: 20px; /* Distance from the top */
  right: 20px; /* Distance from the right */
  left: 20px; /* Distance from the left */
  display: flex; /* Flexbox layout */
  justify-content: space-between; /* Place items at far ends */
  align-items: center; /* Vertically align the items */
  gap: 15px; /* Space between buttons */
  z-index: 10003; /* Above side panel (10000-10002) */
  padding: 0; /* Remove any padding that might affect positioning */
}

/* Hide entire navbar during intro */
body.intro-active .nav-bar {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s ease;
}

/* Show navbar after intro completes with smooth animation */
body.intro-complete .nav-bar {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  justify-content: space-between; /* Show both hamburger and toggle */
  transition: opacity 0.8s ease 0.3s, visibility 0.8s ease 0.3s,
    transform 0.8s ease 0.3s;
}

/* Ensure hamburger and toggle are visible after intro */
body.intro-complete .hamburger,
body.intro-complete .dark-mode-toggle {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
}

/* Remove any intro-hidden effects after intro completes */
body.intro-complete .hamburger.intro-hidden {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Hamburger styles */
.hamburger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer; /* Pointer cursor on hover */
  opacity: 1;
  visibility: visible;
  transition: opacity 240ms ease, visibility 240ms ease, background 200ms ease,
    border-color 200ms ease, transform 200ms ease;
  /* Same glassmorphism as side panel */
  padding: 0;
  border-radius: 9999px;
  width: 44px;
  height: 44px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.42),
    rgba(255, 255, 255, 0.18)
  );
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1.4)) saturate(160%);
  backdrop-filter: blur(calc(var(--glass-blur) * 1.4)) saturate(160%);
  /* border: 1px solid var(--glass-border); */
  box-shadow: var(--glass-shadow);
}
.hamburger:hover {
  transform: translateY(-1px);
}
.hamburger:active {
  transform: translateY(0);
}
.hamburger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent),
    0 0 18px color-mix(in oklab, var(--accent) 40%, transparent);
}

/* Dark mode hamburger background */
body.dark-mode .hamburger {
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.3),
    rgba(15, 23, 42, 0.14)
  );
}

/* Hamburger icon styles */
.hamburger i {
  font-size: 24px; /* Adjust size */
  color: black; /* Icon color */
  margin: 0 5px; /* Spacing between icons */
  transition: all 0.3s ease; /* Smooth transition for icon styles */
}
.ham {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 400ms;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  overflow: visible;
}
.ham1 {
  overflow: visible;
  transform: translate3d(0, 0, 0); /* Forces GPU acceleration */
  will-change: transform; /* Optimizes animation */
}
.hamRotate.active {
  transform: rotate(45deg);
}
.hamRotate180.active {
  transform: rotate(180deg);
}
.line {
  fill: none;
  transition: stroke-dasharray 400ms, stroke-dashoffset 400ms;
  /* White hamburger lines */
  stroke: #ffffff;
  stroke-width: 4.25;
  stroke-linecap: round;
  shape-rendering: geometricPrecision; /* Fix Safari distortion */
}
/* Safari-Specific Fix */
.ham1 .top {
  stroke-dasharray: 39 139;
}
.ham1 .bottom {
  stroke-dasharray: 39 180;
}
.ham1.active .top {
  stroke-dashoffset: -98px;
}
.ham1.active .bottom {
  stroke-dashoffset: -138px;
}
body.dark-mode .line {
  stroke: #ffffff;
}
@supports (-webkit-touch-callout: none) {
  .ham1 {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
  }
}

/* Hamburger intro-hidden class no longer needed since entire navbar is hidden */
/* Keeping for backward compatibility but not actively used */
.hamburger.intro-hidden {
  display: none;
}

/* iOS-Style Liquid Glass Sidebar - 4 Completely Separate Bubbles */
.side-panel {
  position: fixed;
  top: 90px; /* Below navbar */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0; /* Hidden by default */
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    visibility 0.4s ease;
  color: var(--text-color);
  overflow: visible;
  z-index: 10002;
  pointer-events: none; /* Disabled until open */

  /* Container must be completely invisible - no background whatsoever */
  width: auto;
  height: auto;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  /* Ensure it doesn't create any visual layer */
  mix-blend-mode: normal;
}

/* Dark mode sidebar */
body.dark-mode .side-panel {
  color: var(--text-color-dark); /* Dark mode text color */
}

/* iOS Completely Separate Glass Pills - Invisible Container */
.side-panel ul {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  gap: 40px; /* Even larger gap to ensure complete separation */
  list-style: none;
  /* Completely invisible container - no visual properties */
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  /* Ensure container creates no visual layer */
  position: relative;
  /* Force container to be completely transparent */
  opacity: 1;
  width: fit-content;
  height: fit-content;
}
/* Individual Completely Separate Glass Bubble */
.side-panel ul li {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  background: none !important; /* Force completely no background */
  border: none !important; /* Force no list item border */
  box-shadow: none !important; /* Force no list item shadow */
  border-radius: 0 !important; /* Force no list item border radius */
  backdrop-filter: none !important; /* Force no backdrop filter on container */

  /* Ensure each list item creates no visual layer */
  isolation: isolate;
  z-index: 1; /* Ensure proper stacking */

  /* Simple initial state - straight and aligned */
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  filter: blur(0px);
  animation: none; /* Default state, no animation */
}

/* Remove any pseudo-elements that might create separators */
.side-panel ul li::before,
.side-panel ul li::after {
  display: none !important;
}

/* iOS Completely Separate Glass Pill */
.side-panel ul li a {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-color);
  position: relative;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 28px; /* Keep wider padding */
  min-width: 120px; /* Slightly smaller to emphasize separation */
  height: 52px; /* Keep taller height */
  border-radius: 26px; /* Full pill border radius */
  cursor: pointer;
  gap: 8px;
  border: none !important; /* Force no borders */
  outline: none; /* No outline */
  margin: 0 20px; /* Increased margin for more separation */

  /* Anchor is transparent; glass is provided by ::before pseudo */
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  /* Individual pill shadows - completely isolated */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);

  /* Smooth transitions for all interactions */
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Ensure no connecting elements and proper stacking */
  overflow: hidden;
  isolation: isolate;
  /* Create new stacking context for proper backdrop-filter */
  transform: translateZ(0);
}

/* Add magical glow animation when side panel is open */
.side-panel.open ul li a {
  animation: none;
}
.side-panel.open ul li a::before {
  animation: magicalGlow 2s ease-in-out infinite;
}

/* Pill glass layer (clipped to pill shape) */
.side-panel ul li a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(36px) saturate(220%);
  backdrop-filter: blur(36px) saturate(220%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* Add magical shimmer when menu opens */
.side-panel.open ul li a::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 45%,
    rgba(79, 209, 197, 0.4) 50%,
    rgba(255, 255, 255, 0.3) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: magicalShimmer 0.8s ease-in-out;
  animation-delay: 0.1s;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Icon in horizontal pill layout */ /* Icon in horizontal pill layout */
.side-panel ul li a i {
  font-size: 16px;
  opacity: 0.95;
  transition: all 0.3s ease;
  flex-shrink: 0;
  /* High contrast text with shadow for readability on any background */
  color: var(--nav-pill-color);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.3));
  position: relative;
  z-index: 1;
}

.side-panel ul li a span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  opacity: 0.95;
  white-space: nowrap;
  /* High contrast text with shadow for readability on any background */
  color: var(--nav-pill-color);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.3));
  position: relative;
  z-index: 1;
}

/* Dark mode text */
body.dark-mode .side-panel ul li a i,
body.dark-mode .side-panel ul li a span {
  color: var(--text-color-dark);
}
/* Dark Mode Separate Glass Pills */
body.dark-mode .side-panel ul li a {
  color: var(--text-color-dark);

  /* Enhanced dark mode glass effect - properly blur video background */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.02) 100%
  );
  border: none !important; /* Force no borders */

  /* Enhanced backdrop filter for dark mode */
  backdrop-filter: blur(25px) saturate(200%) brightness(0.9);
  -webkit-backdrop-filter: blur(25px) saturate(200%) brightness(0.9);

  /* Individual dark mode shadows */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
/* Individual Pill Hover Effects */
.side-panel ul li a:hover {
  transform: translateY(-3px) scale(1.02);
}

.side-panel ul li a:hover::before {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.12),
    0 0 25px color-mix(in oklab, var(--accent, #4fd1c5) 12%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.side-panel ul li a:hover i {
  opacity: 1;
  color: var(--accent, #4fd1c5);
  transform: scale(1.1);
}

.side-panel ul li a:hover span {
  opacity: 1;
  color: var(--accent, #4fd1c5);
}

/* Dark Mode Hover */
body.dark-mode .side-panel ul li a:hover::before {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 25px color-mix(in oklab, var(--accent, #4fd1c5) 15%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Focus styles for accessibility - Individual Pills */
.side-panel ul li a:focus-visible {
  outline: none;
  transform: translateY(-3px) scale(1.02);
}
.side-panel ul li a:focus-visible::before {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px
      color-mix(in oklab, var(--accent, #4fd1c5) 40%, transparent),
    0 0 25px color-mix(in oklab, var(--accent, #4fd1c5) 30%, transparent),
    0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Active navigation state */
.side-panel ul li a.nav-active,
.side-panel ul li.active a {
  transform: translateY(-2px) scale(1.02);
}

.side-panel ul li a.nav-active::before,
.side-panel ul li.active a::before {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px
      color-mix(in oklab, var(--accent, #4fd1c5) 50%, transparent),
    0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.side-panel ul li a.nav-active i,
.side-panel ul li.active a i {
  color: var(--accent, #4fd1c5);
}

/* Admin link - aligned with main navigation */
.side-panel ul li.admin-link {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.side-panel ul li.admin-link a {
  opacity: 1;
  font-size: inherit;
}

.side-panel ul li.admin-link a i {
  color: inherit;
  font-size: inherit;
}

/* Mobile: Stronger glass blur - MERGED WITH LAYOUT BELOW */

/* Open the sidebar with magical simultaneous animations */
.side-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Smooth simultaneous appearance - all pills appear together */
.side-panel.open ul li {
  opacity: 1;
  transform: scale(1) rotate(0deg) translateY(0);
  filter: blur(0px);
  /* Simple, smooth transition for all pills simultaneously */
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Layout - Full Screen Vertical Stack with Stronger Blur */
@media (max-width: 1024px) {
  /* Full-screen backdrop */
  .side-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.15) !important;
    backdrop-filter: blur(12px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(140%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
    z-index: 10002 !important;
  }

  .side-panel.open {
    transform: none !important;
  }

  /* Vertical pill stack */
  .side-panel ul {
    flex-direction: column !important;
    gap: 20px !important;
    padding: 40px 30px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    width: auto !important;
    max-width: 320px !important;
    justify-content: center !important;
  }

  /* Stronger glass blur on mobile pills */
  .side-panel ul li a::before {
    background: rgba(255, 255, 255, 0.16) !important;
    -webkit-backdrop-filter: blur(54px) saturate(220%) !important;
    backdrop-filter: blur(54px) saturate(220%) !important;
  }

  /* Keep hover effects but maintain mobile blur */
  .side-panel ul li a:hover::before {
    background: rgba(255, 255, 255, 0.2) !important;
    -webkit-backdrop-filter: blur(54px) saturate(220%) !important;
    backdrop-filter: blur(54px) saturate(220%) !important;
  }

  .side-panel ul li a {
    min-width: 260px;
    width: 260px;
    height: 64px;
    border-radius: 32px;
    font-size: 16px;
    font-weight: 600;
    padding: 18px 32px;
    border: none !important;
    flex: 0 0 auto;
    margin: 0;
    justify-content: center;
    gap: 12px;

    /* Keep transparent - blur via ::before */
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;

    /* Soft shadows for depth */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.08);

    isolation: isolate;
  }

  .side-panel ul li a i {
    font-size: 20px;
    margin-right: 0;
  }

  .side-panel ul li a span {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
  }

  body.dark-mode .side-panel ul li a {
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: none !important;

    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Dark mode backdrop - keep darker */
  body.dark-mode .side-panel {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(16px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(150%) !important;
  }

  /* Dark mode pills - stronger blur */
  body.dark-mode .side-panel ul li a {
    backdrop-filter: blur(34px) saturate(220%) brightness(0.9) !important;
    -webkit-backdrop-filter: blur(34px) saturate(220%) brightness(0.9) !important;
  }

  body.dark-mode .side-panel ul li a:hover::before {
    background: rgba(255, 255, 255, 0.16) !important;
  }
}

/* Desktop Enhancement - Separate Premium Pills */
@media (min-width: 1025px) {
  .side-panel ul {
    gap: 24px; /* Larger gap on desktop */
  }

  .side-panel ul li a {
    min-width: 180px; /* Even wider on desktop */
    padding: 16px 32px; /* More generous padding */
  }

  .side-panel ul li a:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.12),
      0 0 40px color-mix(in oklab, var(--accent, #4fd1c5) 15%, transparent),
      inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Mobile touch interactions */
  .side-panel ul li a:active {
    transform: scale(0.98);
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.45) 0%,
      rgba(255, 255, 255, 0.25) 50%,
      rgba(255, 255, 255, 0.15) 100%
    );
  }
}

/* Ensure absolutely no visual connections between pills */
.side-panel ul li + li {
  border-left: none !important;
  margin-left: 0;
}

.side-panel ul li + li::before {
  display: none !important;
}

.side-panel ul li a:active {
  transform: translateY(0);
}

/* Reduced motion: instant appearance with no animations */
@media (prefers-reduced-motion: reduce) {
  .side-panel ul li {
    animation: none !important;
    transition: none !important;
  }

  .side-panel.open ul li {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .side-panel ul li a {
    transition: none !important;
  }

  .side-panel ul li a:hover {
    transform: none !important;
  }
}
