/* ============================================
   Mac's Thrifty Store — Custom Styles
   Classic & Elegant | Forest Green + Off-White
   ============================================ */

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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(26, 60, 42, 0.2);
    color: #1a3c2a;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f5f0e8;
}
::-webkit-scrollbar-thumb {
    background: #a8c9b0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #7aad88;
}

/* --- Navbar --- */
#navbar.scrolled {
    background: rgba(15, 39, 25, 0.95);
    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: rgba(235, 228, 214, 0.7);
    transition: width 0.3s ease;
}

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

/* --- Mobile Menu --- */
.mobile-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.3s 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; }

.menu-line {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#menu-btn.active .menu-line:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}
#menu-btn.active .menu-line:nth-child(2) {
    opacity: 0;
}
#menu-btn.active .menu-line:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
    width: 1.25rem;
}

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

.hero-bg.active {
    transform: scale(1);
}

.hero-overlay {
    background-image: linear-gradient(
        to bottom,
        rgba(9, 23, 14, 0.65) 0%,
        rgba(15, 39, 25, 0.55) 40%,
        rgba(15, 39, 25, 0.7) 70%,
        rgba(9, 23, 14, 0.85) 100%
    );
}

/* --- Buttons --- */
.btn-primary {
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.btn-secondary {
    border-radius: 2px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-2px);
}

/* --- Scroll Indicator --- */
@keyframes scrollLine {
    0% {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: top;
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
        transform-origin: top;
    }
    51% {
        transform-origin: bottom;
    }
    100% {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: bottom;
    }
}

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

/* --- Reveal Animations --- */
.reveal-up,
.reveal-left,
.reveal-right {
    opacity: 1;
    transform: none;
    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-up {
    transform: translateY(0);
}

.reveal-left {
    transform: translateX(0);
}

.reveal-right {
    transform: translateX(0);
}

/* These are progressive enhancement — already visible by default.
   JS adds the animated states for users with JS enabled. */
.js .reveal-up {
    transform: translateY(40px);
    opacity: 0;
}

.js .reveal-left {
    transform: translateX(-40px);
    opacity: 0;
}

.js .reveal-right {
    transform: translateX(40px);
    opacity: 0;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .reveal-up,
    .reveal-left,
    .reveal-right {
        transform: none;
        opacity: 1;
    }
    html {
        scroll-behavior: auto;
    }
}

/* --- Back to Top --- */
.back-to-top {
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.3s ease;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    box-shadow: 0 6px 24px rgba(26, 60, 42, 0.4);
}

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

/* --- Form Focus States --- */
input:focus,
textarea:focus {
    outline: none;
}

/* --- Map Container --- */
iframe {
    display: block;
}

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

@media (min-width: 1024px) {
    /* Subtle parallax-like effect on hero on scroll is handled in JS */
}

/* --- Print Styles --- */
@media print {
    #navbar,
    .back-to-top,
    .animate-scroll-line {
        display: none;
    }
    body {
        background: white;
        color: black;
    }
}
