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

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

body {
    overflow-x: hidden;
}

::selection {
    background-color: #8a0b1c;
    color: white;
}

/* Loader */
#loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Header transitions */
.header-text {
    color: #1c1917;
}

.header-subtext {
    color: #78716c;
}

.scrolled .header-text {
    color: #4a030b;
}

.scrolled .header-subtext {
    color: #78716c;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #8a0b1c;
    transition: width 0.3s ease;
}

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

/* Hero reveal animations */
.hero-reveal {
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-reveal:nth-child(1) { transition-delay: 0.1s; }
.hero-reveal:nth-child(2) { transition-delay: 0.25s; }
.hero-reveal:nth-child(3) { transition-delay: 0.4s; }
.hero-reveal:nth-child(4) { transition-delay: 0.55s; }
.hero-reveal:nth-child(5) { transition-delay: 0.7s; }

/* Reveal animations for scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    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-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* Service card hover */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #8a0b1c, #ff8f8f);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card:hover::before {
    transform: scaleX(1);
}

/* Mobile menu */
.mobile-nav-link {
    position: relative;
}

/* Back to top button */
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-2px);
}

/* Smooth image loading */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

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

::-webkit-scrollbar-track {
    background: #fafaf9;
}

::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a0b1c;
}

/* Focus styles */
:focus-visible {
    outline: 2px solid #8a0b1c;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* Print styles */
@media print {
    #site-header, #back-to-top, #loader, #menu-toggle {
        display: none !important;
    }
    
    body {
        color: #000;
        background: #fff;
    }
}
