/* ===== Base & Utilities ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  overflow-x: hidden;
}

::selection {
  background: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

/* ===== Scroll Reveal (Progressive Enhancement) ===== */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .reveal.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Stagger children */
  .reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .reveal-stagger.revealed > *:nth-child(1) { transition-delay: 0.05s; }
  .reveal-stagger.revealed > *:nth-child(2) { transition-delay: 0.1s; }
  .reveal-stagger.revealed > *:nth-child(3) { transition-delay: 0.15s; }
  .reveal-stagger.revealed > *:nth-child(4) { transition-delay: 0.2s; }
  .reveal-stagger.revealed > *:nth-child(5) { transition-delay: 0.25s; }
  .reveal-stagger.revealed > *:nth-child(6) { transition-delay: 0.3s; }
}

/* ===== Floating Card Animations ===== */
@keyframes float-1 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

@keyframes float-2 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-1deg); }
}

@keyframes float-3 {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.floating-card-1 {
  animation: float-1 5s ease-in-out infinite;
}

.floating-card-2 {
  animation: float-2 6s ease-in-out infinite;
  animation-delay: -1.5s;
}

.floating-card-3 {
  animation: float-3 4.5s ease-in-out infinite;
  animation-delay: -0.8s;
}

/* ===== Navbar Scroll State ===== */
#navbar.scrolled {
  background: rgba(26, 10, 46, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(251, 191, 36, 0.05);
}

#navbar.scrolled .menu-line {
  background: #fbbf24;
}

/* ===== Mobile Menu ===== */
#mobile-menu.open {
  max-height: 400px;
}

#menu-toggle.active .menu-line:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

#menu-toggle.active .menu-line:nth-child(2) {
  opacity: 0;
}

#menu-toggle.active .menu-line:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* ===== Smooth Scroll Offset ===== */
[id] {
  scroll-margin-top: 80px;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a0a2e;
}

::-webkit-scrollbar-thumb {
  background: #581c87;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #7e22ce;
}

/* ===== Focus Styles ===== */
a:focus-visible, button:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Image Loading ===== */
img {
  image-rendering: -webkit-optimize-contrast;
}

/* ===== Selection on dark backgrounds ===== */
.bg-plum-950 ::selection,
.bg-plum-900 ::selection {
  background: rgba(251, 191, 36, 0.25);
}
