/* Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
    background: #064e3b;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #059669;
}

/* Selection */
::selection {
    background: #047857;
    color: #fefdf8;
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.8s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.8s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.8s ease forwards;
}

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

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

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

.scroll-reveal.revealed:nth-child(2) {
    transition-delay: 0.15s;
}

.scroll-reveal.revealed:nth-child(3) {
    transition-delay: 0.3s;
}

/* Navbar Styles */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(2, 44, 34, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-text {
    color: #fefdf8;
}

.nav-link {
    color: rgba(254, 253, 248, 0.75);
    position: relative;
}

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

.nav-link:hover {
    color: #fefdf8;
}

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

#navbar.scrolled .nav-text,
#navbar.scrolled .nav-link {
    color: #fefdf8;
}

#navbar.scrolled .nav-link::after {
    background: #34d399;
}

/* Mobile Menu */
.mobile-nav-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

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

#mobileMenu.open .mobile-nav-link:nth-child(1) { transition-delay: 0.1s; }
#mobileMenu.open .mobile-nav-link:nth-child(2) { transition-delay: 0.2s; }
#mobileMenu.open .mobile-nav-link:nth-child(3) { transition-delay: 0.3s; }
#mobileMenu.open .mobile-nav-link:nth-child(4) { transition-delay: 0.4s; }

/* Mobile Menu Button */
#menuBtn.active .nav-icon span:first-child {
    transform: rotate(45deg) translate(3px, 3px);
}

#menuBtn.active .nav-icon span:nth-child(2) {
    opacity: 0;
}

#menuBtn.active .nav-icon span:last-child {
    transform: rotate(-45deg) translate(3px, -3px);
}

/* Select styling */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23047857' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Form focus states */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #047857 !important;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.1);
}

/* Image hover */
.group:hover .group-hover\\:scale-105 {
    transform: scale(1.05);
}

/* Smooth transitions for all interactive elements */
a, button {
    transition: all 0.3s ease;
}

/* Print styles */
@media print {
    #navbar, #mobileMenu {
        display: none;
    }
    
    body {
        color: #000;
        background: #fff;
    }
}

/* 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;
    }
    
    .scroll-reveal {
        opacity: 1;
        transform: none;
    }
}

/* High contrast */
@media (prefers-contrast: high) {
    .nav-link {
        color: #fff;
    }
    
    .text-emerald-800/60 {
        color: #064e3b;
    }
}

/* Landscape mobile */
@media (max-width: 640px) and (orientation: landscape) {
    #hero {
        min-height: 100vh;
    }
    
    .font-serif.text-5xl {
        font-size: 2.5rem;
    }
}

/* Tall mobile */
@media (max-height: 700px) and (orientation: portrait) {
    #hero {
        min-height: 100vh;
    }
}
