/* ===== Custom Styles for Morelos Grocery ===== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Base transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Geometric Background Shapes */
.geo-shape {
    position: absolute;
    pointer-events: none;
}

.circle-1 {
    top: 10%;
    right: 5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(123, 45, 59, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.circle-2 {
    bottom: 15%;
    left: 30%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(235, 143, 117, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 10s ease-in-out infinite reverse;
}

.rect-1 {
    top: 25%;
    left: -5%;
    width: 120px;
    height: 120px;
    background: rgba(123, 45, 59, 0.06);
    border-radius: 24px;
    transform: rotate(45deg);
    animation: spin-slow 20s linear infinite;
}

.triangle-1 {
    bottom: 25%;
    right: 10%;
    width: 0;
    height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 104px solid rgba(235, 143, 117, 0.1);
    animation: float 6s ease-in-out infinite;
}

.dot-grid {
    top: 50%;
    left: 45%;
    width: 200px;
    height: 200px;
    background-image: radial-gradient(circle, rgba(123, 45, 59, 0.1) 1.5px, transparent 1.5px);
    background-size: 20px 20px;
    mask-image: radial-gradient(circle, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle, black 30%, transparent 70%);
    animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(3deg); }
}

@keyframes spin-slow {
    from { transform: rotate(45deg); }
    to { transform: rotate(405deg); }
}

/* Navbar scroll state */
#navbar.scrolled {
    background: rgba(255, 249, 245, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(42, 36, 32, 0.08);
}

#navbar.scrolled .nav-link {
    color: rgba(42, 36, 32, 0.8);
}

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

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

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

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

.mobile-link {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

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

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

/* Scroll reveal animations */
.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; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Product card hover */
.product-card {
    transition: transform 0.4s ease;
}

.product-card:hover {
    transform: translateY(-4px);
}

/* Custom selection */
::selection {
    background: rgba(123, 45, 59, 0.2);
    color: #7B2D3B;
}

/* Image lazy loading fade-in */
img[loading="lazy"] {
    transition: opacity 0.6s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

img[loading="lazy"] {
    opacity: 0;
}

/* Button focus styles */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #7B2D3B;
    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;
    }
}

/* Large screen adjustments */
@media (min-width: 1280px) {
    .hero-title {
        font-size: clamp(3.5rem, 6vw, 6rem);
    }
}

/* Mobile-specific tweaks */
@media (max-width: 767px) {
    .geo-shape {
        display: none;
    }

    .geo-shape.circle-1 {
        display: block;
        width: 200px;
        height: 200px;
        top: 5%;
        right: -5%;
    }
}
