/* ============================================
   Green Gables Yarn Shop — Custom Styles
   ============================================ */

/* Base */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    overflow-x: hidden;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #ecfdf5;
}
::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

/* Floating Cards Animation */
.floating-card {
    animation: float 4s ease-in-out infinite;
}
.floating-card:nth-child(2) {
    animation-delay: -1s;
}
.floating-card:nth-child(3) {
    animation-delay: -2s;
}
.floating-card:nth-child(4) {
    animation-delay: -3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
}

/* Scroll Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.revealed {
    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; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .floating-card { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
    .animate-bounce { animation: none; }
}

/* Navbar scroll state */
#navbar.scrolled {
    background: rgba(254, 253, 248, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(6, 78, 59, 0.08);
}

#navbar.scrolled .nav-link {
    color: #047857;
}

#navbar.scrolled .nav-link:hover {
    background: #d1fae5;
}

/* Button focus rings */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #34d399;
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* Image loading placeholder */
img {
    background-color: #d1fae5;
}

/* Mobile menu transition */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
#mobile-menu.open {
    max-height: 400px;
    opacity: 1;
    border-top: 1px solid #d1fae5;
}

/* Nav link underline animation */
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #059669;
    border-radius: 999px;
    transition: width 0.2s ease, left 0.2s ease;
}
.nav-link:hover::after {
    width: 60%;
    left: 20%;
}

/* Yarn thread decoration */
.yarn-decoration {
    position: relative;
}
.yarn-decoration::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, #059669);
    transform: translateX(-50%);
}
