/* =============================================
   HavenDrapes — Fabric Swatches Page CSS
   swatches.css
   ============================================= */

/* ===== CSS VARIABLES ===== */
:root {
    --sw-brown: #4a3426;
    --sw-brown-mid: #6b4c37;
    --sw-brown-light: #9b7155;
    --sw-cream: #faf7f3;
    --sw-cream-mid: #f2ede6;
    --sw-white: #ffffff;
    --sw-border: #e6ddd4;
    --sw-text: #2d2118;
    --sw-text-muted: #7a6858;
    --sw-radius: 10px;
    --sw-shadow: 0 2px 16px rgba(74, 52, 38, 0.10);
    --sw-shadow-hover: 0 8px 32px rgba(74, 52, 38, 0.18);
    --sw-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 120px;
    /* approximate, adjust if needed */
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--sw-cream);
    color: var(--sw-text);
}

#swatches-main {
    overflow-x: hidden;
}

/* ===== PAGE LOADING ===== */
#page-loading {
    position: fixed;
    inset: 0;
    background: var(--sw-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--sw-brown);
    z-index: 9999;
}

/* ===== HERO ===== */
.sw-hero {
    position: relative;
    height: clamp(340px, 45vw, 520px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
}

.sw-hero__bg {
    position: absolute;
    inset: 0;
}

.sw-hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.sw-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(20, 10, 5, 0.45) 0%,
            rgba(20, 10, 5, 0.55) 60%,
            rgba(20, 10, 5, 0.35) 100%);
}

.sw-hero__content {
    position: relative;
    z-index: 2;
    color: #fff;
    padding: 0 20px;
}

.sw-hero__title {
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    margin-bottom: 0.35em;
}

.sw-hero__sub {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.9;
    margin-bottom: 1.4em;
    font-style: italic;
}

.sw-hero__perks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8em 2em;
    list-style: none;
    margin-bottom: 1.8em;
    font-size: 0.97rem;
}

.sw-hero__perks li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 100px;
    padding: 0.4em 1.2em;
}

.sw-hero__perks i {
    color: #f5d59a;
}

.sw-hero__cta {
    display: inline-block;
    background: var(--sw-brown);
    color: #fff;
    text-decoration: none;
    padding: 0.75em 2.4em;
    border-radius: 100px;
    font-size: 0.95rem;
    font-family: sans-serif;
    letter-spacing: 0.05em;
    transition: background var(--sw-transition), transform var(--sw-transition);
}

.sw-hero__cta:hover {
    background: var(--sw-brown-mid);
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
}

/* ===== STICKY FILTER BAR ===== */
.sw-filterbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--sw-white);
    border-bottom: 1px solid var(--sw-border);
    box-shadow: 0 2px 8px rgba(74, 52, 38, 0.08);
}

.sw-filterbar__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75em 2em;
    display: flex;
    align-items: center;
    gap: 1.2em;
    flex-wrap: wrap;
}

.sw-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-family: sans-serif;
    font-size: 0.9rem;
    color: var(--sw-text-muted);
}

.sw-filter-group--right {
    margin-left: auto;
    gap: 0.8em;
}

.sw-filter-label {
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    color: var(--sw-text);
}

.sw-select {
    border: 1px solid var(--sw-border);
    border-radius: 6px;
    padding: 0.38em 2em 0.38em 0.85em;
    font-size: 0.9rem;
    font-family: sans-serif;
    color: var(--sw-text);
    background: var(--sw-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a3426' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.7em center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--sw-transition);
}

.sw-select:focus {
    outline: none;
    border-color: var(--sw-brown);
}

/* Toggle */
.sw-toggle-label {
    font-size: 0.88rem;
    color: var(--sw-text-muted);
}

.sw-toggle {
    position: relative;
    width: 46px;
    height: 24px;
    background: var(--sw-brown);
    border: none;
    border-radius: 100px;
    cursor: pointer;
    padding: 0;
    transition: background var(--sw-transition);
}

.sw-toggle__knob {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--sw-transition);
}

.sw-toggle[aria-pressed="true"] .sw-toggle__knob {
    transform: translateX(22px);
}

/* Counter */
.sw-swatch-counter {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-family: sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sw-brown);
}

.sw-view-cart-btn {
    background: var(--sw-brown);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: 0.4em 1.2em;
    font-size: 0.88rem;
    font-family: sans-serif;
    cursor: pointer;
    transition: background var(--sw-transition);
}

.sw-view-cart-btn:hover {
    background: var(--sw-brown-mid);
}

/* ===== GRID WRAPPER ===== */
.sw-grid-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3em 2em 5em;
}

/* ===== COLLECTION SECTIONS ===== */
.sw-collection {
    margin-bottom: 4em;
}

.sw-collection__header {
    text-align: center;
    padding: 2.5em 1em 2em;
    border-top: 1px solid var(--sw-border);
}

.sw-collection__name {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 700;
    color: var(--sw-text);
    margin-bottom: 0.5em;
    letter-spacing: 0.01em;
}

.sw-collection__meta {
    font-family: sans-serif;
    font-size: 0.92rem;
    color: var(--sw-text-muted);
    line-height: 1.8;
    margin-bottom: 0.8em;
}

.sw-meta-sep {
    margin: 0 0.4em;
    opacity: 0.5;
}

.sw-collection__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-family: sans-serif;
    font-size: 0.88rem;
    color: var(--sw-brown);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--sw-transition);
}

.sw-collection__link:hover {
    color: var(--sw-brown-mid);
    text-decoration: underline;
}

/* ===== SWATCH GRID ===== */
.sw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5em;
    margin-top: 1.5em;
}

/* ===== SWATCH CARD ===== */
.sw-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
    background: var(--sw-white);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 1em 0.85em 1.1em;
    transition: box-shadow var(--sw-transition), transform var(--sw-transition);
    position: relative;
    cursor: default;
}

.sw-card:hover {
    box-shadow: var(--sw-shadow-hover);
    transform: translateY(-3px);
}

.sw-card.sw-card--selected {
    border-color: var(--sw-brown);
    box-shadow: 0 0 0 2px var(--sw-brown), var(--sw-shadow);
}

.sw-card.sw-card--selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    width: 22px;
    height: 22px;
    background: var(--sw-brown);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
}

/* Swatch image wrapper — zigzag border effect */
.sw-card__img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    /* Pinked / zigzag edge via SVG clip-path */
    clip-path: polygon(0 4%, 4% 0, 8% 4%, 12% 0, 16% 4%, 20% 0, 24% 4%, 28% 0, 32% 4%, 36% 0, 40% 4%, 44% 0, 48% 4%, 52% 0, 56% 4%, 60% 0, 64% 4%, 68% 0, 72% 4%, 76% 0, 80% 4%, 84% 0, 88% 4%, 92% 0, 96% 4%, 100% 0,
            100% 96%, 96% 100%, 92% 96%, 88% 100%, 84% 96%, 80% 100%, 76% 96%, 72% 100%, 68% 96%, 64% 100%, 60% 96%, 56% 100%, 52% 96%, 48% 100%, 44% 96%, 40% 100%, 36% 96%, 32% 100%, 28% 96%, 24% 100%, 20% 96%, 16% 100%, 12% 96%, 8% 100%, 4% 96%, 0 100%);
}

.sw-card__texture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.sw-card:hover .sw-card__texture {
    transform: scale(1.04);
}

/* Room thumbnail full view */
.sw-card__room {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transition: transform 0.4s ease;
}

.sw-card:hover .sw-card__room {
    transform: scale(1.04);
}

/* Badge (e.g. "100% Blackout") */
.sw-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--sw-brown);
    color: #fff;
    font-family: sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    pointer-events: none;
}

.sw-card__code {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: var(--sw-text-muted);
    letter-spacing: 0.04em;
    margin-top: 0.3em;
}

.sw-card__name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--sw-text);
    text-align: center;
    line-height: 1.3;
}

.sw-card__btn {
    margin-top: 0.3em;
    background: var(--sw-white);
    color: var(--sw-brown);
    border: 1px solid var(--sw-brown);
    border-radius: 100px;
    padding: 0.38em 1.2em;
    font-family: sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background var(--sw-transition), color var(--sw-transition), transform var(--sw-transition);
    white-space: nowrap;
}

.sw-card__btn:hover {
    background: var(--sw-brown);
    color: #fff;
    transform: scale(1.04);
}

.sw-card__btn:active {
    transform: scale(0.97);
}

.sw-card__btn.sw-card__btn--added {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.sw-card__btn--loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ===== HOW IT WORKS ===== */
.sw-how {
    background: var(--sw-white);
    border-top: 1px solid var(--sw-border);
    padding: 4em 2em;
}

.sw-how__inner {
    max-width: 1100px;
    margin: 0 auto;
}

.sw-how__title {
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-bottom: 2.5em;
    color: var(--sw-text);
}

.sw-how__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2em;
    list-style: none;
    counter-reset: step;
}

.sw-how__step {
    text-align: center;
    padding: 1.5em 1em;
    position: relative;
    counter-increment: step;
}

.sw-how__step::before {
    content: counter(step);
    position: absolute;
    top: -0.5em;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    background: var(--sw-brown);
    color: #fff;
    border-radius: 50%;
    font-family: sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sw-how__icon {
    width: 64px;
    height: 64px;
    background: var(--sw-cream-mid);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1em auto 0.8em;
    font-size: 1.5rem;
    color: var(--sw-brown);
}

.sw-how__step h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.4em;
    color: var(--sw-text);
}

.sw-how__step p {
    font-family: sans-serif;
    font-size: 0.9rem;
    color: var(--sw-text-muted);
    line-height: 1.6;
}

/* ===== FLOATING SWATCH BAR ===== */
.sw-float-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: var(--sw-brown);
    color: #fff;
    border-radius: 100px;
    padding: 0.75em 1.5em;
    display: flex;
    align-items: center;
    gap: 0.8em;
    box-shadow: 0 4px 24px rgba(74, 52, 38, 0.4);
    font-family: sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    animation: swFloatIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sw-float-bar[hidden] {
    display: none !important;
}

@keyframes swFloatIn {
    from {
        transform: translateX(-50%) translateY(60px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.sw-float-bar__link {
    color: #f5d59a;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.sw-float-bar__link:hover {
    color: #fff;
}

.sw-float-bar__close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 0.2em;
    transition: color 0.15s;
}

.sw-float-bar__close:hover {
    color: #fff;
}

/* ===== LIMIT MODAL ===== */
.sw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 15, 5, 0.6);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    animation: swFadeIn 0.2s ease;
}

.sw-modal-overlay[hidden] {
    display: none !important;
}

@keyframes swFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sw-modal {
    background: var(--sw-white);
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    padding: 2.5em 2em;
    text-align: center;
    box-shadow: 0 12px 48px rgba(74, 52, 38, 0.25);
    animation: swSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes swSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sw-modal__icon {
    font-size: 2.5rem;
    color: var(--sw-brown);
    margin-bottom: 0.5em;
    display: block;
}

.sw-modal h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75em;
    color: var(--sw-text);
}

.sw-modal p {
    font-family: sans-serif;
    font-size: 0.92rem;
    color: var(--sw-text-muted);
    line-height: 1.6;
    margin-bottom: 1.5em;
}

.sw-modal__btn {
    background: var(--sw-brown);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: 0.65em 2em;
    font-family: sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--sw-transition);
}

.sw-modal__btn:hover {
    background: var(--sw-brown-mid);
}

.sw-modal__btn--secondary {
    background: transparent;
    color: var(--sw-brown);
    border: 1px solid var(--sw-brown);
}

.sw-modal__btn--secondary:hover {
    background: var(--sw-cream-mid);
    color: var(--sw-brown);
}

.sw-modal__actions {
    display: flex;
    gap: 0.75em;
    justify-content: center;
    flex-wrap: wrap;
}

.sw-modal__btn {
    text-decoration: none;
}

/* ===== HIDDEN UTILITY ===== */
.sw-hidden {
    display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sw-filterbar__inner {
        padding: 0.6em 1em;
        gap: 0.7em;
    }

    .sw-filter-group--right {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .sw-grid-wrapper {
        padding: 2em 1em 4em;
    }

    .sw-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 1em;
    }

    .sw-how__steps {
        grid-template-columns: 1fr 1fr;
    }

    .sw-float-bar {
        bottom: 16px;
        font-size: 0.85rem;
        padding: 0.6em 1.2em;
    }
}

@media (max-width: 480px) {
    .sw-hero__perks {
        flex-direction: column;
        gap: 0.5em;
    }

    .sw-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sw-how__steps {
        grid-template-columns: 1fr;
    }
}