/* ============================================================
   Wool & Knot — Premium Storefront CSS
   Modern, elegant, crisp — every detail intentional.
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-content-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden !important;
}

body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative;
    margin: 0;
    padding: 0;
}

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

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

::-webkit-scrollbar-thumb {
    background: #c4917a;
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: #80543D;
}

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
    --brown: #80543D;
    --brown-dark: #5c3825;
    --cream: #FDF7F4;
    --warm: #F7EEEA;
    --warm-mid: #edddd5;
    --text: #3d2314;
    --text-soft: #7a5241;
    --gold: #c4861a;
    --shadow-sm: 0 2px 12px rgba(128, 84, 61, 0.10);
    --shadow-md: 0 8px 30px rgba(128, 84, 61, 0.15);
    --shadow-lg: 0 20px 60px rgba(128, 84, 61, 0.18);
    --radius-card: 20px;
}

/* ── Shop Layout & Cards ────────────────────────────────── */
.category-header {
    text-align: center;
    margin-top: 8rem;
    margin-bottom: 4rem;
    position: relative;
}

.category-header h2 {
    font-size: 2.75rem;
    color: var(--brand-brown);
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.01em;
}

.category-header::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--brand-brown);
    margin: 1.5rem auto 0;
    opacity: 0.3;
}

.product-card {
    background: white;
    border-radius: 1.5rem;
    padding: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 10px 40px rgba(128, 84, 61, 0.05);
    border: 1px solid rgba(128, 84, 61, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Ensures carousel bleed is clipped to radius */
    height: max-content;
    /* Prevents grid stretching which creates excess white space */
    width: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 60px rgba(128, 84, 61, 0.12);
}

.product-card__header {
    padding: 1.5rem 1.5rem 0.5rem;
}

.product-card__footer {
    padding: 0.5rem 1.5rem 1.5rem;
}

.product-card__name {
    font-size: 1.15rem;
    color: var(--brand-text);
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-family: 'Outfit', sans-serif;
}

.product-card__price {
    font-size: 1rem;
    color: var(--brand-brown);
    font-weight: 500;
    opacity: 0.8;
}

.product-card__embed-outer {
    width: 100%;
    margin-top: 0.75rem;
    background: var(--brand-bright);
    position: relative;
    overflow: hidden;
}

.insta-clip-wrapper {
    width: 100%;
    position: relative;
    background: white;
}

.insta-scaler {
    transform-origin: top left;
    width: 326px;
    /* Lock to IG min width */
    height: 700px;
    position: relative;
}

/* ── Navbar ───────────────────────────────────────────────── */
.scrolled-nav {
    background: rgba(253, 247, 244, 0.97) !important;
    box-shadow: 0 1px 0 rgba(128, 84, 61, 0.08), 0 4px 20px rgba(128, 84, 61, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    top: 34px !important;
    /* Stay below the fixed announcement bar */
}

/* ── Announcement Bar ──────────────────────────────────────── */
#announcement-bar {
    height: 34px;
    background: #5c3825;
    color: #FDF7F4;
    display: flex;
    align-items: center;
    overflow-x: hidden;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 10001;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#announcement-text {
    white-space: nowrap;
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
    will-change: transform;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Mobile Layout Refinements */
@media (max-width: 640px) {
    .category-header {
        margin-top: 6rem;
        margin-bottom: 3rem;
    }

    .category-header h2 {
        font-size: 2.25rem;
    }

    .product-card {
        padding: 0 !important;
        margin-bottom: 3.5rem;
    }

    .product-card__header,
    .product-card__footer {
        padding: 1.25rem !important;
    }

    .product-card__name {
        font-size: 1.25rem !important;
    }
}

/* ── SVG Geometric Animations ─────────────────────────────── */
@keyframes treasure-glow {

    0%,
    100% {
        transform: scale(0.95);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* --- Skeleton Base --- */
.skeleton-card {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #ffffff;
    border: 1px solid rgba(128, 84, 61, 0.05);
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: opacity 0.8s ease, visibility 0.8s ease, scale 0.8s ease;
}

.product-card.is-loaded .skeleton-card {
    opacity: 0;
    scale: 0.98;
    visibility: hidden;
}

/* --- Reveal Card Animation --- */
@keyframes reveal-card {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
        filter: blur(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes trace-border {
    0% {
        clip-path: inset(0 100% 100% 0);
        opacity: 0;
    }

    25% {
        clip-path: inset(0 0 100% 0);
        opacity: 1;
    }

    50% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }

    75% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }

    100% {
        clip-path: inset(0 0 0 0);
        opacity: 0;
    }
}

.product-card {
    position: relative;
    background: white;
    border-radius: 1.5rem;
    transition: all 0.5s cubic-bezier(0.2, 1, 0.3, 1);
    isolation: isolate;
    pointer-events: none;
}

/* Elegant glowing border on load */
.product-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid var(--brown);
    border-radius: 1.6rem;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.product-card.is-loaded::after {
    animation: trace-border 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-card.is-loaded {
    box-shadow: 0 15px 45px rgba(128, 84, 61, 0.08);
}

/* Loading state handling */
.product-card-container {
    position: relative;
    min-height: 500px;
}

.product-card__content {
    opacity: 0;
    transform: translateY(10px);
    transition: all 1s cubic-bezier(0.2, 1, 0.3, 1);
    pointer-events: none;
}

.product-card.is-loaded {
    box-shadow: 0 15px 45px rgba(128, 84, 61, 0.08);
    pointer-events: auto;
}

.product-card.is-loaded .product-card__content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@keyframes precision-stitch {
    0% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    25% {
        transform: translate(-15px, 15px) rotate(-10deg);
    }

    50% {
        transform: translate(-25px, 0px) rotate(-5deg);
    }

    75% {
        transform: translate(10px, -10px) rotate(8deg);
    }

    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }
}

@keyframes flow-yarn {
    to {
        stroke-dashoffset: -30;
    }
}

@keyframes hover-flower {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-12px) rotate(1deg);
    }
}

@keyframes rotate-core {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

@keyframes pulse-sparkle {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }

    25% {
        transform: translateY(-15px) scale(1);
        opacity: 1;
    }

    75% {
        transform: translateY(-45px) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-60px) scale(0);
        opacity: 0;
    }
}

.magic-core {
    transform-origin: 400px 550px;
    animation: treasure-glow 4s ease-in-out infinite;
}

.active-hook {
    transform-origin: 475px 235px;
    animation: precision-stitch 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.flowing-thread {
    stroke-dasharray: 10 10;
    animation: flow-yarn 1s linear infinite;
}

.flower-group {
    transform-origin: 400px 300px;
    animation: hover-flower 6s ease-in-out infinite;
}

.flower-core {
    transform-origin: 400px 300px;
    animation: rotate-core 30s linear infinite;
}

.sparkle-geo {
    transform-origin: center;
    animation: pulse-sparkle 4s ease-in-out infinite;
}

.sp-1 {
    animation-delay: 0s;
}

.sp-2 {
    animation-delay: 1.5s;
}

.sp-3 {
    animation-delay: 0.8s;
}

.sp-4 {
    animation-delay: 2.2s;
}

/* ── Hero Refinement ──────────────────────────────────────── */
.hero-svg-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    filter: drop-shadow(0 30px 60px rgba(128, 84, 61, 0.15));
    transition: transform 0.3s ease;
}

@media (max-width: 1024px) {
    .hero-svg-container {
        max-width: 450px;
        margin-top: 2rem;
    }
}

@media (max-width: 640px) {
    .hero-svg-container {
        max-width: 320px;
    }
}

/* ── Loading SVG Overlay Animations ────────────────────────────── */
@keyframes hook-stitch {
    0% {
        transform: translateY(0) rotate(0);
    }

    30% {
        transform: translateY(-15px) rotate(-10deg);
    }

    70% {
        transform: translateY(5px) rotate(5deg);
    }

    100% {
        transform: translateY(0) rotate(0);
    }
}

@keyframes wool-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.02);
        filter: brightness(1.1);
    }
}

@keyframes fiber-float {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        transform: translate(10px, -15px);
        opacity: 0;
    }
}

@keyframes loop-draw {
    0% {
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        stroke-dasharray: 100;
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

@keyframes load-text-glow {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(128, 84, 61, 0.3);
    }
}

#loading-overlay.loaded {
    opacity: 0;
    visibility: hidden;
}

.hook-action-v2 {
    transform-origin: 100px 100px;
    animation: hook-stitch 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.wool-ball-group {
    transform-origin: 100px 150px;
    animation: wool-pulse 2s ease-in-out infinite;
}

.fiber {
    opacity: 0;
}

.fiber-1 {
    animation: fiber-float 3s ease-in-out infinite 0s;
}

.fiber-2 {
    animation: fiber-float 4s ease-in-out infinite 1s;
}

.fiber-3 {
    animation: fiber-float 3.5s ease-in-out infinite 2s;
}

#yarn-loop-base,
#yarn-loop-braid {
    animation: loop-draw 2s ease-in-out forwards infinite;
}

.loader-glow {
    animation: wool-pulse 2s ease-in-out infinite;
}

.stitching-text-v2 {
    animation: load-text-glow 2s ease-in-out infinite;
}

/* ── Crochet Background Threads ──────────────────────────── */
.wool-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: radial-gradient(circle at center, transparent 0%, rgba(128, 84, 61, 0.02) 100%);
    z-index: -1;
}

.crochet-thread-1,
.crochet-thread-2 {
    position: fixed;
    width: 2px;
    height: 100vh;
    background: linear-gradient(to bottom, transparent, rgba(128, 84, 61, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

.crochet-thread-1 {
    left: 10%;
    animation: thread-drift 15s linear infinite;
}

.crochet-thread-2 {
    right: 15%;
    animation: thread-drift 20s linear infinite reverse;
}

@keyframes thread-drift {
    0% {
        transform: translateY(-100vh) rotate(5deg);
    }

    100% {
        transform: translateY(100vh) rotate(-5deg);
    }
}

/* ── Modern Staggered Scroll Animations ──────────────────────── */
.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.2, 1, 0.3, 1);
    will-change: transform, opacity;
}

.scroll-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }

.blur-in {
    filter: blur(10px);
    opacity: 0;
    transform: translateY(20px);
    transition: filter 1.2s ease, opacity 1s ease, transform 1s ease;
}

.blur-in.is-visible {
    filter: blur(0);
    opacity: 1;
    transform: translateY(0);
}

/* ── Final Mobile Reflow Block ──────────────────────────── */
@media (max-width: 768px) {
    html, body {
        width: 100% !important;
        overflow-x: hidden !important;
        position: relative;
    }

    /* Hide Horizontal Overflow Globally */
    * { 
        max-width: 100vw !important; 
    }
    
    .max-w-7xl, .max-w-6xl, .max-w-4xl, .container {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Fix the grid issue - Force single column and narrow gaps */
    .grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
        width: 100% !important;
        align-items: center !important;
    }

    .product-card {
        width: 100% !important;
        max-width: 340px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    #navbar {
        top: 0 !important;
    }
    
    #announcement-bar {
        display: none !important;
    }
}