/* =====================================================================
   Payeshco — Catalog Hub & Product Detail
   Asymmetric Shape Design
   ===================================================================== */

[x-cloak] {
    display: none !important;
}

/* ----- Catalog hero ----- */
.catalog-hero {
    position: relative;
    min-height: clamp(280px, 38vh, 420px);
    display: flex;
    align-items: center;
    padding-block: calc(var(--header-height) + 2rem) 3rem;
    background: var(--c-black);
    overflow: hidden;
}

.catalog-hero::before,
.catalog-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.catalog-hero::before {
    background:
        linear-gradient(125deg, transparent 48%, var(--c-wine-bright) 48.2%, transparent 48.4%),
        linear-gradient(55deg, transparent 62%, rgba(128, 0, 32, 0.55) 62.2%, transparent 62.5%);
    opacity: 0.4;
}

.catalog-hero::after {
    background:
        repeating-linear-gradient(90deg, transparent, transparent 70px, rgba(192, 26, 58, 0.07) 70px, rgba(192, 26, 58, 0.07) 71px),
        repeating-linear-gradient(0deg, transparent, transparent 55px, rgba(192, 26, 58, 0.05) 55px, rgba(192, 26, 58, 0.05) 56px);
    mask-image: linear-gradient(to bottom, #000 15%, transparent 95%);
}

.catalog-hero__inner {
    position: relative;
    z-index: 2;
    max-width: 860px;
}

.catalog-hero__title {
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    font-weight: 900;
    line-height: 1.15;
    color: var(--c-offwhite);
    margin: 0 0 0.75rem;
}

.catalog-hero__lead {
    color: var(--c-text-muted);
    margin: 0;
    max-width: 36rem;
}

/* ----- Catalog layout ----- */
.catalog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
    padding-block: 2rem 4rem;
}

[dir="ltr"] .catalog-layout {
    grid-template-columns: 1fr 280px;
}

.catalog-layout__sidebar {
    order: -1;
}

[dir="ltr"] .catalog-layout__sidebar {
    order: 1;
}

/* ----- Filter sidebar ----- */
.catalog-filter {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    background: var(--c-black-2);
    border: 1px solid var(--c-border);
    padding: 1.2rem;
    clip-path: polygon(0 0, 100% 0, 100% 96%, 88% 100%, 0 100%);
}

[dir="ltr"] .catalog-filter {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 12% 100%, 0 96%);
}

.catalog-filter__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--c-border);
}

.catalog-filter__title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--c-offwhite);
    margin: 0;
}

.catalog-filter__clear {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--c-wine-glow);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.catalog-filter__clear:hover {
    color: #fff;
}

.catalog-filter__count {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    margin-bottom: 1rem;
}

.filter-group {
    border-bottom: 1px solid var(--c-border);
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 0;
    background: none;
    border: none;
    color: var(--c-offwhite);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: start;
}

.filter-group__toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.filter-group__toggle.is-open svg {
    transform: rotate(180deg);
}

.filter-group__body {
    display: none;
    gap: 0.45rem;
    padding-bottom: 0.85rem;
}

.filter-group.is-open .filter-group__body {
    display: grid;
}

.filter-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.84rem;
    color: var(--c-text-muted);
    cursor: pointer;
}

.filter-check input {
    accent-color: var(--c-wine-bright);
    width: 15px;
    height: 15px;
}

.filter-check:hover {
    color: var(--c-offwhite);
}

/* ----- Product grid ----- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.product-grid__empty {
    grid-column: 1 / -1;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--c-text-muted);
    background: var(--c-black-2);
    border: 1px dashed var(--c-border);
    clip-path: polygon(0 0, 100% 0, 98% 100%, 2% 100%);
}

/* ----- Product card ----- */
.product-card {
    background: var(--c-black-2);
    border: 1px solid var(--c-border);
    clip-path: polygon(0 0, 100% 0, 100% 88%, 90% 100%, 0 100%);
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.product-card:nth-child(3n+2) {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 10% 100%, 0 88%);
    margin-block-start: 1rem;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--c-wine-bright);
}

.product-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 92%, 92% 100%, 0 100%);
}

.product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.product-card:hover .product-card__media img {
    transform: scale(1.05);
}

.product-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(128, 0, 32, 0.92) 0%, rgba(90, 0, 24, 0.88) 100%);
    clip-path: polygon(8% 0, 100% 12%, 92% 100%, 0 88%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-card__overlay {
    opacity: 1;
}

.product-card__action {
    display: inline-block;
    padding: 0.55rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--c-black);
    clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
    text-decoration: none;
    transition: background 0.2s ease;
}

.product-card__action:hover {
    background: var(--c-black-2);
    color: #fff;
}

.product-card__action--outline {
    background: transparent;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.product-card__body {
    padding: 1rem 1.1rem 1.2rem;
}

.product-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.product-card__tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-wine-glow);
    padding: 0.2rem 0.45rem;
    border: 1px solid rgba(192, 26, 58, 0.35);
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
}

.product-card__title {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.45;
    margin: 0 0 0.35rem;
}

.product-card__title a {
    color: var(--c-offwhite);
    text-decoration: none;
}

.product-card__title a:hover {
    color: var(--c-wine-glow);
}

.product-card__dept {
    font-size: 0.72rem;
    color: var(--c-text-muted);
}

/* ----- Product detail hero ----- */
.product-detail {
    padding-block: calc(var(--header-height) + 1.5rem) 4rem;
    background: var(--c-black);
}

.product-detail__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.product-gallery__main {
    position: relative;
    background: var(--c-black-2);
    border: 1px solid var(--c-border);
    clip-path: polygon(0 4%, 96% 0, 100% 96%, 4% 100%);
    overflow: hidden;
    margin-bottom: 0.8rem;
}

.product-gallery__main img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.product-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.product-gallery__thumb {
    background: var(--c-black-2);
    border: 1px solid var(--c-border);
    padding: 0;
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 85% 100%, 0 100%);
    overflow: hidden;
    opacity: 0.65;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.product-gallery__thumb:nth-child(2) {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 15% 100%, 0 85%);
}

.product-gallery__thumb.is-active,
.product-gallery__thumb:hover {
    opacity: 1;
    border-color: var(--c-wine-bright);
}

.product-gallery__thumb img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.product-info__sku {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--c-wine-glow);
    margin-bottom: 0.5rem;
}

.product-info__title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 900;
    line-height: 1.2;
    color: var(--c-offwhite);
    margin: 0 0 0.75rem;
}

.product-info__status {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--c-offwhite);
    background: rgba(128, 0, 32, 0.35);
    border: 1px solid rgba(192, 26, 58, 0.45);
    clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
}

.product-info__summary {
    color: var(--c-text-muted);
    line-height: 1.8;
    margin: 0 0 1.5rem;
}

.product-info__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ----- Action hub ----- */
.product-action-hub {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    margin-block-start: 2rem;
    background: #000;
    border: 1px solid var(--c-border);
    padding: 1.5rem;
    clip-path: polygon(0 0, 98% 0, 100% 96%, 2% 100%);
}

[dir="ltr"] .product-action-hub {
    clip-path: polygon(2% 0, 100% 0, 98% 100%, 0 96%);
}

.product-action-hub::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    width: 3px;
    height: 100%;
    background: var(--c-wine-bright);
    transform: skewX(-6deg);
}

.product-action-hub__actions {
    display: grid;
    gap: 0.75rem;
}

.product-action-hub .shape-btn--download .download-icon {
    display: inline-block;
    animation: download-bounce 1.6s ease-in-out infinite;
}

@keyframes download-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ----- Technical tabs ----- */
.product-tabs {
    background: var(--c-offwhite);
    color: var(--c-black);
    padding-block: clamp(3rem, 7vw, 5rem);
    clip-path: polygon(0 4%, 52% 0, 100% 3%, 100% 100%, 0 100%);
}

[dir="ltr"] .product-tabs {
    clip-path: polygon(0 3%, 48% 0, 100% 4%, 100% 100%, 0 100%);
}

.product-tabs .section__title {
    color: var(--c-black);
}

.product-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-block: 1.5rem 2rem;
    border-bottom: 2px solid #ddd;
    position: relative;
}

.product-tabs__btn {
    position: relative;
    padding: 0.85rem 1.4rem;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #777;
    cursor: pointer;
    transition: color 0.2s ease;
}

.product-tabs__btn::after {
    content: "";
    position: absolute;
    inset-block-end: -2px;
    inset-inline: 0;
    height: 3px;
    background: var(--c-wine-bright);
    transform: scaleX(0) skewX(-12deg);
    transition: transform 0.25s ease;
}

.product-tabs__btn.is-active {
    color: var(--c-wine);
}

.product-tabs__btn.is-active::after {
    transform: scaleX(1) skewX(-12deg);
}

.product-tabs__panel {
    display: none;
}

.product-tabs__panel.is-active {
    display: block;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e2ddd4;
    clip-path: polygon(0 0, 100% 0, 100% 98%, 98% 100%, 0 100%);
}

.spec-table th,
.spec-table td {
    padding: 0.75rem 1rem;
    text-align: start;
    border-bottom: 1px solid #ece8e0;
    font-size: 0.88rem;
}

.spec-table th {
    width: 35%;
    color: var(--c-wine);
    font-weight: 800;
    background: #faf8f5;
}

.spec-table td {
    color: #444;
}

.product-tabs__text {
    color: #555;
    line-height: 1.85;
    max-width: 720px;
}

.related-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-products .product-card:nth-child(3n+2) {
    margin-block-start: 0;
}

/* ----- Quote modal ----- */
body.modal-open {
    overflow: hidden;
}

.catalog-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    overflow: hidden;
}

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

.catalog-modal__box {
    position: relative;
    width: min(100%, 520px);
    height: auto;
    max-height: none;
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: var(--c-black-2);
    border: 1px solid var(--c-border);
    padding: 0;
    clip-path: polygon(0 0, 100% 0, 100% 96%, 92% 100%, 0 100%);
    box-shadow: 0 24px 60px -20px rgba(128, 0, 32, 0.45);
}

.catalog-modal__box::-webkit-scrollbar {
    display: none;
}

[dir="ltr"] .catalog-modal__box {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 8% 100%, 0 96%);
}

.catalog-modal__box::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: linear-gradient(var(--c-wine-bright), var(--c-wine));
    transform: skewY(-6deg);
}

.catalog-modal__dismiss {
    position: absolute;
    inset-block-start: 0.85rem;
    inset-inline-end: 0.85rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 100%, 0 100%);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.catalog-modal__dismiss:hover {
    color: #fff;
    border-color: var(--c-wine-bright);
    background: rgba(128, 0, 32, 0.25);
}

.catalog-modal__dismiss svg {
    width: 16px;
    height: 16px;
}

.catalog-modal__head {
    padding: 1.35rem 1.4rem 0.85rem;
    padding-inline-end: 2.75rem;
    border-bottom: 1px solid var(--c-border);
    background: linear-gradient(135deg, rgba(128, 0, 32, 0.12) 0%, transparent 60%);
}

.catalog-modal__eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-wine-glow);
    margin-bottom: 0.35rem;
}

.catalog-modal__title {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--c-offwhite);
    margin: 0 0 0.55rem;
    line-height: 1.25;
}

.catalog-modal__meta {
    display: grid;
    gap: 0.35rem;
}

.catalog-modal__sku {
    display: inline-block;
    width: fit-content;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--c-wine-glow);
    border: 1px solid rgba(192, 26, 58, 0.35);
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
}

.catalog-modal__product {
    font-size: 0.84rem;
    color: var(--c-text-muted);
    line-height: 1.6;
}

.catalog-modal__alert {
    margin: 0.75rem 1.4rem 0;
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    line-height: 1.55;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 98% 100%, 0 100%);
}

.catalog-modal__alert[hidden] {
    display: none !important;
}

.catalog-modal__alert--error {
    background: rgba(128, 0, 32, 0.22);
    border: 1px solid rgba(192, 26, 58, 0.45);
    color: #ffd6de;
}

.catalog-modal__alert--success {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--c-offwhite);
}

.catalog-modal__form {
    padding: 1rem 1.4rem 1.35rem;
}

.catalog-modal__form.is-success .catalog-modal__actions {
    opacity: 0.45;
    pointer-events: none;
}

.catalog-modal__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.65rem;
}

.catalog-modal__field.has-error input,
.catalog-modal__field.has-error textarea {
    border-color: var(--c-wine-bright);
    box-shadow: 0 0 0 1px rgba(192, 26, 58, 0.25);
}

.catalog-modal__label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-wine-glow);
}

.catalog-modal__required {
    font-style: normal;
    color: var(--c-wine-bright);
}

.catalog-modal__field input,
.catalog-modal__field textarea {
    width: 100%;
    padding: 0.62rem 0.9rem;
    background: var(--c-black);
    border: 1px solid var(--c-border);
    color: var(--c-offwhite);
    font-family: inherit;
    font-size: 0.88rem;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 98% 100%, 0 100%);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.catalog-modal__field textarea {
    resize: none;
    min-height: 72px;
}

.catalog-modal__field input::placeholder,
.catalog-modal__field textarea::placeholder {
    color: #6a6970;
}

.catalog-modal__field input:focus,
.catalog-modal__field textarea:focus {
    outline: none;
    border-color: var(--c-wine-bright);
}

.catalog-modal__error {
    font-size: 0.78rem;
    color: #ffb3c0;
    line-height: 1.5;
    padding-inline-start: 0.15rem;
}

.catalog-modal__error[hidden] {
    display: none !important;
}

.catalog-modal__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-block-start: 0.85rem;
    padding-block-start: 0;
}

.catalog-modal__close {
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.15rem;
    transition: color 0.2s ease;
}

.catalog-modal__close:hover {
    color: var(--c-offwhite);
}

/* ----- Responsive ----- */
@media (max-width: 1024px) {
    .catalog-layout,
    [dir="ltr"] .catalog-layout {
        grid-template-columns: 1fr;
    }

    .catalog-layout__sidebar,
    [dir="ltr"] .catalog-layout__sidebar {
        order: 0;
    }

    .catalog-filter {
        position: static;
    }

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

    .product-detail__grid {
        grid-template-columns: 1fr;
    }

    .product-action-hub {
        position: static;
    }

    .related-products {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .product-grid,
    .related-products {
        grid-template-columns: 1fr;
    }

    .product-card:nth-child(3n+2) {
        margin-block-start: 0;
    }
}
