*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    overflow-x: hidden;
}

/* Scroll reveal animations — progressive enhancement only */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(32px);
        transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
    
    .reveal:nth-child(2) { transition-delay: 0.1s; }
    .reveal:nth-child(3) { transition-delay: 0.2s; }
    .reveal:nth-child(4) { transition-delay: 0.3s; }
}

/* Navbar scroll state */
#navbar.scrolled {
    background: rgba(31, 8, 31, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(217, 119, 6, 0.1);
}

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

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

#mobile-menu.open .mobile-link {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

#mobile-menu.open .mobile-link:nth-child(1) { animation-delay: 0.05s; }
#mobile-menu.open .mobile-link:nth-child(2) { animation-delay: 0.1s; }
#mobile-menu.open .mobile-link:nth-child(3) { animation-delay: 0.15s; }
#mobile-menu.open .mobile-link:nth-child(4) { animation-delay: 0.2s; }
#mobile-menu.open .mobile-link:nth-child(5) { animation-delay: 0.25s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hamburger animation */
.menu-toggle.active .menu-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

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

.menu-toggle.active .menu-line:nth-child(3) {
    width: 20px;
    transform: rotate(-45deg) translate(4px, -4px);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #632f63;
}

/* Selection color */
::selection {
    background: rgba(217, 119, 6, 0.3);
    color: #faf5fa;
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Image loading placeholder */
img {
    background: linear-gradient(135deg, #360f36 0%, #1f081f 100%);
}

/* Smooth image fade-in */
img {
    transition: opacity 0.4s ease;
}

img[data-loaded="true"] {
    opacity: 1;
}

img:not([data-loaded]) {
    opacity: 0;
}

/* Nav link underline animation */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #fbbf24;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover::after {
    width: 100%;
}

/* Input autofill styling */
input:-webkit-autofill,
textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #1f081f inset !important;
    -webkit-text-fill-color: #faf5fa !important;
}
