/* ============================================
   Martha Sanchez Luxury Real Estate
   Custom Styles
============================================ */

/* Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Selection Color */
::selection {
    background-color: rgba(13, 148, 136, 0.2);
    color: #0f766e;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Reveal Animations - Progressive Enhancement */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(30px);
        transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                    transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
    
    /* Staggered delays for grid items */
    .reveal:nth-child(1) { transition-delay: 0.1s; }
    .reveal:nth-child(2) { transition-delay: 0.2s; }
    .reveal:nth-child(3) { transition-delay: 0.3s; }
    .reveal:nth-child(4) { transition-delay: 0.4s; }
    .reveal:nth-child(5) { transition-delay: 0.5s; }
    .reveal:nth-child(6) { transition-delay: 0.6s; }
}

/* Navbar Scroll State */
.nav-scrolled .nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.nav-scrolled #nav-logo-text,
.nav-scrolled #nav-subtitle {
    color: #ffffff;
}

/* Navbar Background Transition */
#navbar {
    background: transparent;
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

#navbar.scrolled {
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

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

.mobile-nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: #5eead4;
    transition: width 0.3s ease;
}

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

/* Hero Text Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#hero h1 {
    animation: fadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#hero p {
    animation: fadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
    opacity: 0;
}

#hero .flex-col sm\:flex-row {
    animation: fadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s forwards;
    opacity: 0;
}

/* Button Hover Effects */
a[href="#listings"],
a[href="#contact"]:not([class*="border"]) {
    position: relative;
    overflow: hidden;
}

/* Form Input Focus Effects */
input:focus,
textarea:focus,
select:focus {
    border-bottom-color: #0d9488 !important;
}

input:focus + label,
textarea:focus + label,
select:focus + label {
    color: #0d9488;
}

/* Smooth Image Loading */
img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

/* Back to Top Button */
#back-to-top.visible {
    opacity: 1;
    pointer-events: all;
}

/* Responsive Typography */
@media (max-width: 640px) {
    .font-serif {
        line-height: 1.2;
    }
}

/* Print Styles */
@media print {
    #navbar,
    #back-to-top,
    .reveal {
        display: none !important;
    }
    
    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;
    }
    
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

/* Loading State for Images */
img[loading="lazy"] {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
