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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(13, 148, 136, 0.2);
    color: #042f2e;
}

/* Scroll reveal base — content is always visible by default */
.reveal {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Only apply hidden state when JS is active via .revealed class added by JS */
.reveals .reveal {
    opacity: 0;
    transform: translateY(30px);
}

@media (prefers-reduced-motion: no-preference) {
    .reveals .reveal {
        opacity: 0;
        transform: translateY(30px);
    }
    .reveals .reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
    .reveals .reveal:nth-child(2) { transition-delay: 0.1s; }
    .reveals .reveal:nth-child(3) { transition-delay: 0.2s; }
    .reveals .reveal:nth-child(4) { transition-delay: 0.3s; }
}

/* Hero animations — above fold, always visible */
.hero-anim {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: no-preference) {
    .hero-anim {
        opacity: 0;
        transform: translateY(24px);
    }
    .hero-anim.hero-visible {
        opacity: 1;
        transform: translateY(0);
    }
    .hero-anim:nth-child(1) { transition-delay: 0.15s; }
    .hero-anim:nth-child(2) { transition-delay: 0.3s; }
    .hero-anim:nth-child(3) { transition-delay: 0.45s; }
    .hero-anim:nth-child(4) { transition-delay: 0.6s; }
}

/* Navbar scroll state */
.navbar-scrolled {
    background: rgba(4, 47, 46, 0.92) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.navbar-scrolled .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-scrolled .nav-text-light {
    opacity: 1;
}

/* Mobile menu */
#mobile-menu {
    animation: slideDown 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-link {
    position: relative;
}

.mobile-nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    transition: width 0.3s ease;
}

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

/* Image hover effects */
.group img {
    will-change: transform;
}

/* Subtle texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg width='2' height='2' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' fill='%23000'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%23fff'/%3E%3C/svg%3E");
    background-size: 2px 2px;
}

/* Focus styles */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
    border-radius: 4px;
}

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