/* =========================================================
   VEYLUNE — PRODUCTS / COLLECTION PAGE
   Visual language: espresso, ivory, warm taupe, editorial.
   ========================================================= */

.products-page {
    min-height: 100vh;
    background: var(--surface, #f7f1e9);
}

/* Collection hero */
.collection-hero {
    padding: 54px 0 42px;
    background:
        radial-gradient(circle at 83% 18%, rgba(255,248,237,.10), transparent 28%),
        linear-gradient(125deg, #130b08 0%, #1b100c 58%, #24150f 100%);
    color: #f6eee4;
    border-bottom: 1px solid rgba(198,176,151,.12);
}

.collection-hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 40px;
}

.collection-copy {
    max-width: 760px;
}

.collection-copy .eyebrow {
    color: rgba(245,234,221,.66);
    letter-spacing: .18em;
}

.collection-copy h1 {
    margin: 12px 0 10px;
    font-family: "Bodoni Moda", Georgia, serif;
    font-weight: 500;
    font-size: clamp(46px, 7vw, 86px);
    line-height: .98;
    letter-spacing: -.025em;
}

.collection-copy p {
    margin: 0;
    max-width: 630px;
    color: rgba(245,234,221,.72);
    font-size: 15px;
    line-height: 1.9;
}

.collection-mark {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 16px 0 2px;
    min-width: 120px;
    opacity: .9;
}

.collection-mark span {
    font-family: "Bodoni Moda", Georgia, serif;
    font-size: 84px;
    line-height: .85;
    font-weight: 400;
}

.collection-mark small {
    font-family: "Bodoni Moda", Georgia, serif;
    font-size: 9px;
    letter-spacing: .32em;
}

/* Toolbar */
.collection-section {
    padding: 26px 0 90px;
}

.collection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(65,48,37,.10);
}

.collection-count {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: #614e40;
    font-size: 13px;
}

.collection-count #results-count {
    color: #1f140f;
    font-family: "Bodoni Moda", Georgia, serif;
    font-size: 20px;
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-control label {
    font-size: 12px;
    color: #7f7063;
}

.sort-control select,
.type-filter-block select {
    min-width: 178px;
    appearance: none;
    padding: 11px 38px 11px 13px;
    border: 1px solid rgba(65,48,37,.12);
    border-radius: 10px;
    background:
        linear-gradient(45deg, transparent 50%, #8d7b6d 50%) calc(100% - 17px) 52% / 6px 6px no-repeat,
        linear-gradient(135deg, #8d7b6d 50%, transparent 50%) calc(100% - 12px) 52% / 6px 6px no-repeat,
        rgba(255,255,255,.45);
    color: #392a21;
    font: inherit;
    font-size: 13px;
    outline: none;
}

/* Filter trigger */
.filter-trigger {
    display: none;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(65,48,37,.12);
    background: rgba(255,255,255,.46);
    border-radius: 10px;
    padding: 10px 13px;
    color: #4c3a2e;
    font: inherit;
    font-size: 13px;
}

.filter-trigger svg {
    width: 18px;
    height: 18px;
}

.filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: #2a1912;
    color: #fff8ee;
    font-size: 10px;
}

/* Main layout */
.collection-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.filters-panel {
    position: sticky;
    top: 18px;
    border: 1px solid rgba(65,48,37,.10);
    background: rgba(255,255,255,.36);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.filters-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 17px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(65,48,37,.09);
}

.filters-head .eyebrow {
    font-size: 10px;
    letter-spacing: .16em;
    color: #917f70;
}

.filters-head h2 {
    margin: 5px 0 0;
    font-size: 20px;
    font-weight: 500;
    color: #251811;
}

.filter-close {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(65,48,37,.12);
    background: transparent;
    color: #544235;
}

.filter-close svg {
    width: 17px;
    height: 17px;
}

.filter-block {
    padding: 18px 0;
    border-bottom: 1px solid rgba(65,48,37,.08);
}

.filter-label {
    display: block;
    margin-bottom: 10px;
    color: #59483b;
    font-size: 12px;
    font-weight: 500;
}

.filter-search {
    position: relative;
}

.filter-search input {
    width: 100%;
    height: 44px;
    padding: 0 39px 0 12px;
    border: 1px solid rgba(65,48,37,.12);
    border-radius: 10px;
    background: rgba(255,255,255,.46);
    color: #2a1c15;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.filter-search input:focus {
    border-color: rgba(65,48,37,.25);
    box-shadow: 0 0 0 3px rgba(65,48,37,.045);
}

.filter-search svg {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: #958476;
    pointer-events: none;
}

.filter-options {
    display: grid;
    gap: 4px;
}

.filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 38px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #79695c;
    font: inherit;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
}

.filter-option i {
    width: 8px;
    height: 8px;
    border: 1px solid #a59383;
    border-radius: 50%;
}

.filter-option.is-active {
    color: #23160f;
    font-weight: 500;
}

.filter-option.is-active i {
    border-color: #2a1912;
    background: #2a1912;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.65);
}

.price-fields {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
    gap: 8px;
    align-items: end;
}

.price-fields label {
    min-width: 0;
}

.price-fields label > span {
    display: block;
    margin-bottom: 6px;
    color: #958476;
    font-size: 10px;
}

.price-fields input {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(65,48,37,.12);
    border-radius: 9px;
    background: rgba(255,255,255,.46);
    padding: 0 9px;
    color: #2a1c15;
    font: inherit;
    font-size: 12px;
    outline: none;
}

.price-dash {
    padding-bottom: 11px;
    color: #ab9b8e;
    font-size: 12px;
}

.reset-filters {
    width: 100%;
    min-height: 41px;
    margin-top: 16px;
    border: 1px solid rgba(65,48,37,.18);
    border-radius: 10px;
    background: transparent;
    color: #49372c;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.reset-filters:hover {
    background: #27170f;
    color: #fff8ef;
}

.type-filter-block[hidden] {
    display: none;
}

/* Grid */
.products-collection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 26px 17px;
}

.collection-card .product-media {
    aspect-ratio: 1 / 1.10;
    border-radius: 15px;
}

.collection-card .product-title {
    font-size: 18px;
}

.collection-card .product-price {
    font-size: 15px;
}

.collection-card .product-subtitle {
    font-size: 13px;
}

.collection-card .product-meta {
    font-size: 10.5px;
}

.product-status.is-available {
    color: #667052;
}

.product-status.is-unavailable {
    color: #9a7564;
}

.unavailable-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(31,18,12,.86);
    color: #f7ece1;
    font-size: 10px;
    backdrop-filter: blur(8px);
}

/* Loading */
.products-loading {
    padding-top: 1px;
}

.loading-line {
    width: 160px;
    height: 14px;
    margin-bottom: 20px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(78,59,46,.04),
        rgba(78,59,46,.12),
        rgba(78,59,46,.04)
    );
    background-size: 200% 100%;
    animation: veyluneShimmer 1.3s ease-in-out infinite;
}

.loading-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 26px 17px;
}

.loading-grid span {
    aspect-ratio: 1 / 1.22;
    border-radius: 15px;
    background: linear-gradient(
        90deg,
        rgba(78,59,46,.04),
        rgba(78,59,46,.09),
        rgba(78,59,46,.04)
    );
    background-size: 200% 100%;
    animation: veyluneShimmer 1.3s ease-in-out infinite;
}

@keyframes veyluneShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty / error state */
.products-empty[hidden],
.products-loading[hidden],
#product-detail[hidden],
#cart-layout[hidden],
#cart-empty[hidden] {
    display: none !important;
}

.products-empty {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    padding: 50px 20px;
}

.products-empty .eyebrow {
    color: #917f70;
    letter-spacing: .16em;
}

.products-empty h2 {
    margin: 9px 0 7px;
    font-family: "Bodoni Moda", Georgia, serif;
    font-size: clamp(27px, 3vw, 40px);
    font-weight: 500;
    color: #271810;
}

.products-empty p {
    max-width: 450px;
    margin: 0;
    color: #7d6c5d;
    font-size: 13px;
}

.products-empty button {
    margin-top: 20px;
    min-height: 41px;
    padding: 0 18px;
    border: 1px solid rgba(65,48,37,.18);
    border-radius: 10px;
    background: #29170f;
    color: #fff7ef;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* Load more */
.load-more-wrap {
    display: flex;
    justify-content: center;
    padding-top: 34px;
}

.load-more-wrap[hidden] {
    display: none !important;
}

.load-more {
    min-height: 44px;
    min-width: 170px;
    padding: 0 18px;
    border: 1px solid rgba(65,48,37,.18);
    border-radius: 10px;
    background: transparent;
    color: #3c2b21;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.load-more:hover {
    background: #29170f;
    color: #fff7ef;
}

.results-note {
    min-height: 28px;
    margin-top: 18px;
    text-align: center;
    color: #9b8a7c;
    font-size: 11px;
}

/* Mobile overlay */
.filters-overlay {
    display: none;
}

/* Dark theme */
html[data-theme="dark"] .products-page {
    background: #0f0a08;
}

html[data-theme="dark"] .collection-section,
html[data-theme="dark"] .filters-panel {
    color: #efe5da;
}

html[data-theme="dark"] .collection-toolbar {
    border-bottom-color: rgba(245,232,219,.10);
}

html[data-theme="dark"] .collection-count,
html[data-theme="dark"] .sort-control label,
html[data-theme="dark"] .filter-label,
html[data-theme="dark"] .filter-option,
html[data-theme="dark"] .products-empty p,
html[data-theme="dark"] .results-note {
    color: #ae9d8e;
}

html[data-theme="dark"] .collection-count #results-count,
html[data-theme="dark"] .filters-head h2,
html[data-theme="dark"] .filter-option.is-active,
html[data-theme="dark"] .products-empty h2 {
    color: #f3e8dc;
}

html[data-theme="dark"] .sort-control select,
html[data-theme="dark"] .filter-search input,
html[data-theme="dark"] .price-fields input,
html[data-theme="dark"] .filter-trigger {
    color: #eee4da;
    background-color: rgba(255,255,255,.045);
    border-color: rgba(245,232,219,.13);
}

html[data-theme="dark"] .filters-panel {
    background: rgba(255,255,255,.025);
    border-color: rgba(245,232,219,.10);
}

html[data-theme="dark"] .reset-filters,
html[data-theme="dark"] .load-more {
    color: #eee4da;
    border-color: rgba(245,232,219,.14);
}

/* Responsive */
@media (max-width: 1250px) {
    .collection-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 24px;
    }

    .products-collection-grid,
    .loading-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .collection-hero {
        padding: 44px 0 34px;
    }

    .collection-mark {
        min-width: 90px;
    }

    .collection-mark span {
        font-size: 68px;
    }

    .collection-layout {
        display: block;
    }

    .filter-trigger {
        display: inline-flex;
    }

    .sort-control {
        margin-inline-start: auto;
    }

    .filters-panel {
        position: fixed;
        z-index: 120;
        top: 0;
        right: 0;
        width: min(360px, 92vw);
        height: 100dvh;
        overflow-y: auto;
        border-radius: 0;
        transform: translateX(105%);
        transition: transform .28s ease;
        background: #f6efe7;
        padding: 20px;
        box-shadow: -20px 0 55px rgba(31,18,11,.15);
    }

    html[dir="ltr"] .filters-panel {
        right: auto;
        left: 0;
        transform: translateX(-105%);
    }

    .filters-panel.is-open {
        transform: translateX(0);
    }

    .filter-close {
        display: inline-grid;
        place-items: center;
    }

    .filters-overlay.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 110;
        background: rgba(15,9,6,.38);
        backdrop-filter: blur(2px);
    }

    html[data-theme="dark"] .filters-panel {
        background: #15100d;
    }

    .products-collection-grid,
    .loading-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .collection-hero-inner {
        grid-template-columns: 1fr;
    }

    .collection-mark {
        display: none;
    }

    .collection-copy h1 {
        font-size: 58px;
    }

    .collection-toolbar {
        flex-wrap: wrap;
        gap: 11px;
    }

    .sort-control {
        margin-inline-start: 0;
        width: 100%;
        justify-content: space-between;
    }

    .sort-control select {
        min-width: 0;
        flex: 1;
        max-width: 220px;
    }

    .products-collection-grid,
    .loading-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 11px;
    }

    .collection-card .product-title {
        font-size: 15.5px;
    }

    .collection-card .product-price {
        font-size: 13.5px;
    }

    .collection-card .product-subtitle {
        font-size: 11.5px;
    }

    .collection-section {
        padding-bottom: 70px;
    }
}

@media (max-width: 480px) {
    .collection-copy h1 {
        font-size: 50px;
    }

    .collection-copy p {
        font-size: 13px;
    }

    .collection-toolbar {
        align-items: center;
    }

    .collection-count {
        order: 1;
    }

    .filter-trigger {
        order: 2;
        margin-inline-start: auto;
    }

    .sort-control {
        order: 3;
    }
}
