/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    overflow-x: hidden;
}

::selection {
    background: rgba(212, 160, 23, 0.3);
    color: #faf0ff;
}

/* ===== HERO ANIMATIONS (above the fold — always visible) ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes floatDelayed {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-25px, 25px) scale(1.03); }
    66% { transform: translate(15px, -15px) scale(0.97); }
}

@keyframes pulseSlow {
    0%, 100% { opacity: 0.2; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.3; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes scrollLine {
    0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scaleY(1); transform-origin: top; opacity: 0; }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spinSlowReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Apply hero animations */
.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-float {
    animation: float 20s ease-in-out infinite;
}

.animate-float-delayed {
    animation: floatDelayed 25s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulseSlow 15s ease-in-out infinite;
}

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

.animate-spin-slow {
    animation: spinSlow 30s linear infinite;
}

.animate-spin-slow-reverse {
    animation: spinSlowReverse 25s linear infinite;
}

/* ===== NAVIGATION ===== */
#site-header {
    transition: background-color 0.5s ease, backdrop-filter 0.5s ease, box-shadow 0.5s ease;
}

#site-header.scrolled {
    background-color: rgba(26, 10, 46, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(212, 160, 23, 0.1), 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fbbf24, transparent);
    transition: width 0.3s ease, left 0.3s ease;
}

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

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

#mobile-menu.closed {
    opacity: 0;
    pointer-events: none;
}

.mobile-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

#mobile-menu.open .mobile-link {
    opacity: 1;
    transform: translateY(0);
}

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

/* Hamburger animation */
#bar1.open {
    transform: rotate(45deg) translate(5px, 5px);
}

#bar2.open {
    opacity: 0;
}

#bar3.open {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== SECTION ANIMATIONS (below the fold — progressive enhancement) ===== */
@media (prefers-reduced-motion: no-preference) {
    .heritage-content,
    .heritage-image,
    .offering-card,
    .gallery-item,
    .visit-card,
    .visit-map {
        opacity: 0;
        transform: translateY(40px);
        transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .heritage-content.visible,
    .heritage-image.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .offering-card.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .offering-card:nth-child(1).visible { transition-delay: 0.1s; }
    .offering-card:nth-child(2).visible { transition-delay: 0.2s; }
    .offering-card:nth-child(3).visible { transition-delay: 0.3s; }

    .gallery-item.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .gallery-item:nth-child(1).visible { transition-delay: 0.05s; }
    .gallery-item:nth-child(2).visible { transition-delay: 0.1s; }
    .gallery-item:nth-child(3).visible { transition-delay: 0.15s; }
    .gallery-item:nth-child(4).visible { transition-delay: 0.2s; }
    .gallery-item:nth-child(5).visible { transition-delay: 0.25s; }

    .visit-card.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .visit-card:nth-child(1).visible { transition-delay: 0.1s; }
    .visit-card:nth-child(2).visible { transition-delay: 0.2s; }
    .visit-card:nth-child(3).visible { transition-delay: 0.3s; }

    .visit-map.visible {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Always-visible fallback for reduced motion or no-JS */
@media (prefers-reduced-motion: reduce) {
    .heritage-content,
    .heritage-image,
    .offering-card,
    .gallery-item,
    .visit-card,
    .visit-map {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ===== GOLDEN RATIO IMAGE RATIO ===== */
.hero-orb {
    will-change: transform;
}

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

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

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4c1d95, #7e22ce);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7e22ce, #9333ea);
}

/* ===== RESPONSIVE TWEAKS ===== */
@media (max-width: 767px) {
    #hero h1 {
        font-size: 2.75rem;
    }

    .font-serif.text-4xl {
        font-size: 2.25rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    #hero h1 {
        font-size: 4rem;
    }
}
