/* ===== Base & Typography ===== */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

::selection {
    background: rgba(232, 115, 74, 0.3);
    color: #f7f7f8;
}

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

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

    .reveal-item:nth-child(2) { transition-delay: 0.1s; }
    .reveal-item:nth-child(3) { transition-delay: 0.2s; }
    .reveal-item:nth-child(4) { transition-delay: 0.3s; }
    .reveal-item:nth-child(5) { transition-delay: 0.4s; }
}

/* ===== Scroll Line Animation ===== */
@keyframes scrollLine {
    0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scaleY(1); transform-origin: top; opacity: 0; }
}

.animate-scroll-line {
    animation: scrollLine 1.8s ease-in-out infinite;
}

/* ===== Navbar Transition ===== */
#navbar.scrolled {
    background: rgba(15, 15, 24, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

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

/* ===== Mobile Menu Animation ===== */
#mobile-menu.open {
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    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) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ===== Back to Top ===== */
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ===== Image Hover Effects ===== */
.rounded-2xl.overflow-hidden img {
    will-change: transform;
}

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

::-webkit-scrollbar-track {
    background: #0f0f18;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #5c5c74;
}

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

/* ===== Responsive adjustments ===== */
@media (max-width: 640px) {
    .font-serif {
        line-height: 1.15;
    }
}
