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

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

body {
    margin: 0;
    min-height: 100vh;
}

::selection {
    background-color: rgba(15, 118, 110, 0.2);
    color: inherit;
}

/* Loader */
#page-loader {
    transition: opacity 0.6s ease;
}

#page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Header */
#site-header {
    transition: background-color 0.5s ease, backdrop-filter 0.5s ease;
}

#site-header.scrolled {
    background-color: rgba(4, 47, 46, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-link {
    position: relative;
}

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

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

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

#mobile-menu.open .mobile-nav-link {
    animation: slideIn 0.4s ease forwards;
    opacity: 0;
}

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

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

/* Hero */
.hero-img {
    transition: transform 8s ease;
}

.hero-reveal {
    opacity: 0;
    transform: translateY(30px);
    animation: heroReveal 0.8s ease forwards;
}

.hero-reveal:nth-child(2) { animation-delay: 0.2s; }
.hero-reveal:nth-child(3) { animation-delay: 0.4s; }
.hero-reveal:nth-child(4) { animation-delay: 0.6s; }

@keyframes heroReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll reveals */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    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; }

/* Scroll to top */
#scroll-top.visible {
    opacity: 1;
    pointer-events: all;
    translate: 0 0;
}

/* Focus styles */
:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.6);
    outline-offset: 2px;
}

/* Mobile menu button animation */
#mobile-menu-btn[aria-expanded="true"] .menu-line:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

#mobile-menu-btn[aria-expanded="true"] .menu-line:nth-child(2) {
    opacity: 0;
}

#mobile-menu-btn[aria-expanded="true"] .menu-line:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Form focus states */
input:focus,
textarea:focus {
    border-color: #0d9488 !important;
    box-shadow: 0 0 0 1px #0d9488 !important;
}

/* Image placeholder fallback */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 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;
    }

    .hero-reveal {
        opacity: 1;
        transform: none;
    }
}
