  *, *::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;
  }

  /* Scroll reveal animations */
  .scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  /* Navbar scroll state */
  #navbar.scrolled {
    background: rgba(45, 13, 28, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(179, 66, 126, 0.15);
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.3);
  }

  #navbar.scrolled .font-serif {
    color: #fff !important;
  }

  /* Mobile menu transitions */
  #mobile-menu.open {
    opacity: 1 !important;
    pointer-events: all !important;
  }

  /* Custom selection color */
  ::selection {
    background: rgba(251, 191, 36, 0.3);
    color: #faf0f6;
  }

  /* Focus styles */
  *:focus-visible {
    outline: 2px solid rgba(251, 191, 36, 0.6);
    outline-offset: 2px;
  }

  /* Smooth image loading */
  img {
    image-rendering: auto;
    loading: lazy;
  }

  /* Subtle scrollbar */
  ::-webkit-scrollbar {
    width: 8px;
  }
  ::-webkit-scrollbar-track {
    background: #2d0d1c;
  }
  ::-webkit-scrollbar-thumb {
    background: #7e2752;
    border-radius: 4px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #993064;
  }

  /* Prevent flash of unstyled content */
  .font-serif, .font-sans {
    opacity: 1;
  }

  @media (max-width: 767px) {
    .font-serif {
      word-spacing: -0.02em;
    }
  }
