/* =============================================
   CATALOG PAGE — Luxury Minimal
   ============================================= */

.page-catalog {
    margin-top: var(--header-h);
    min-height: 100vh;
    background: #F7F5F0;
}

.catalog-spacer {
    height: clamp(32px, 5vh, 56px);
}

/* ── Two-column layout — left-aligned ───────── */
.catalog-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    /* Left-anchored: generous left gutter, no centering */
    padding: 0 clamp(16px, 3vw, 40px) clamp(64px, 8vw, 120px) clamp(24px, 4vw, 56px);
    align-items: start;
}

/* =============================================
   SIDEBAR — Vertical Category Nav
   ============================================= */
.catalog-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 28px);
    padding-right: clamp(28px, 3vw, 44px);
    border-right: 1px solid rgba(28, 36, 75, 0.1);
}

/* Nav list */
.cat-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Divider between nav sections */
.cat-nav__divider {
    height: 1px;
    background: rgba(28, 36, 75, 0.08);
    margin: clamp(10px, 1.5vw, 16px) 0;
}

/* ── Standard nav link ──────────────────────── */
.cat-nav__link {
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    font-family: var(--font-nav);
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(28, 36, 75, 0.72);
    padding: 11px 0 11px 14px;
    position: relative;
    transition: color 0.25s ease, padding-left 0.25s ease;
    line-height: 1.4;
    text-decoration: none;
    border-left: 2px solid transparent;
}

.cat-nav__link em {
    font-style: normal;
    color: rgba(201, 169, 110, 0.6);
    transition: color 0.25s ease;
    flex-shrink: 0;
}

/* Featured items (Best Sellers, New Arrivals) */
.cat-nav__item--featured .cat-nav__link {
    font-weight: 500;
    color: rgba(28, 36, 75, 0.88);
    letter-spacing: 0.03em;
}

/* Hover */
.cat-nav__link:hover {
    color: #1C244B;
    padding-left: 18px;
    border-left-color: rgba(201, 169, 110, 0.4);
}

.cat-nav__link:hover em {
    color: rgba(201, 169, 110, 0.9);
}

/* Active */
.cat-nav__link.is-active {
    color: #C9A96E;
    font-weight: 500;
    padding-left: 18px;
    border-left-color: #C9A96E;
}

.cat-nav__link.is-active em {
    color: #C9A96E;
}

/* ── Designer Signature Edits row ───────────── */
.cat-nav__item--parent {
    border: none;
}

.cat-nav__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cat-nav__row .cat-nav__link {
    flex: 1;
    padding-right: 6px;
}

.cat-nav__toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 0 10px 6px;
    color: rgba(28, 36, 75, 0.45);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.cat-nav__toggle svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-nav__toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.cat-nav__toggle:hover { color: #C9A96E; }

/* ── Sub-category list ──────────────────────── */
.cat-nav__sub {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition:
        max-height 0.42s cubic-bezier(0.4, 0, 0.2, 1),
        opacity    0.3s ease;
}

.cat-nav__sub.is-open {
    max-height: 280px;
    opacity: 1;
    margin-bottom: 6px;
}

.cat-nav__sublink {
    display: flex;
    align-items: baseline;
    gap: 0.3em;
    font-family: var(--font-nav);
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: rgba(28, 36, 75, 0.55);
    padding: 9px 0 9px 28px;
    position: relative;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.22s ease, padding-left 0.22s ease, border-color 0.22s ease;
}

.cat-nav__sublink em {
    font-style: normal;
    color: rgba(201, 169, 110, 0.5);
    transition: color 0.22s ease;
}

.cat-nav__sublink::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(201, 169, 110, 0.35);
    transition: background 0.22s ease;
}

.cat-nav__sublink:hover {
    color: #1C244B;
    padding-left: 32px;
    border-left-color: rgba(201, 169, 110, 0.35);
}

.cat-nav__sublink:hover em { color: rgba(201, 169, 110, 0.85); }

.cat-nav__sublink.is-active {
    color: #C9A96E;
    font-weight: 500;
    padding-left: 32px;
    border-left-color: #C9A96E;
}

.cat-nav__sublink.is-active em { color: #C9A96E; }
.cat-nav__sublink.is-active::before { background: #C9A96E; }

/* =============================================
   MAIN PRODUCT AREA
   ============================================= */
.catalog-main {
    padding-left: clamp(36px, 4vw, 56px);
}

/* ── Category header ────────────────────────── */
.catalog-header {
    padding-bottom: clamp(20px, 2.5vw, 32px);
    margin-bottom: clamp(24px, 3vw, 40px);
}

.catalog-header__meta {
    display: flex;
    align-items: baseline;
    gap: 18px;
    margin-bottom: 20px;
}

.catalog-cat-title {
    font-family: var(--font-deco);
    font-size: clamp(22px, 2.2vw, 38px);
    font-weight: 400;
    color: #1C244B;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.catalog-cat-count {
    font-family: var(--font-nav);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: rgba(28, 36, 75, 0.42);
    text-transform: uppercase;
    white-space: nowrap;
}

.catalog-header__rule {
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(201, 169, 110, 0.5) 0%,
        rgba(28, 36, 75, 0.1) 40%,
        transparent 100%
    );
}

/* ── Catalog sections (PHP-rendered, JS-toggled) ── */
.catalog-section {
    display: none;
}
.catalog-section.is-active {
    display: block;
}

/* ── Product grid — fixed 4 columns ─────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(12px, 1.4vw, 20px);
}

/* ── Infinite scroll sentinel ───────────────── */
.catalog-sentinel {
    grid-column: 1 / -1;
    height: 2px;
    /* invisible trigger zone */
}

/* ── Load-more loading indicator ───────────── */
.catalog-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: clamp(24px, 3vw, 40px) 0;
}

.catalog-loading span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(201, 169, 110, 0.6);
    animation: loadingPulse 1.2s ease-in-out infinite;
}

.catalog-loading span:nth-child(2) { animation-delay: 0.2s; }
.catalog-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* ── Product card ───────────────────────────── */
.product-card {
    background: #fff;
    border: 1px solid rgba(28, 36, 75, 0.06);
    position: relative;
    transition:
        transform  0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        box-shadow 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        border-color 0.32s ease;
    animation: cardReveal 0.5s cubic-bezier(0.33, 0.66, 0.66, 1) both;
}

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(28, 36, 75, 0.10);
    border-color: rgba(201, 169, 110, 0.25);
}

.product-card.is-selected {
    border-color: rgba(201, 169, 110, 0.72);
    box-shadow: 0 10px 30px rgba(28, 36, 75, 0.08);
}

.product-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.product-select-btn {
    position: absolute;
    z-index: 5;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(28, 36, 75, 0.16);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1C244B;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(28, 36, 75, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.product-select-btn:hover,
.product-select-btn[aria-pressed="true"] {
    background: #1C244B;
    border-color: #1C244B;
    color: #F7F5F0;
    transform: translateY(-1px);
}

.product-select-btn[aria-pressed="true"] {
    background: #C9A96E;
    border-color: #C9A96E;
    color: #1C244B;
}

.product-select-btn__icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.product-select-btn__text {
    position: relative;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.product-select-btn[aria-pressed="true"]::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1C244B;
    box-shadow: 0 0 0 2px #fff;
}

.product-select-btn[aria-pressed="true"]::before {
    content: '';
    position: absolute;
    z-index: 1;
    right: 2px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 1px 1px 0;
    transform: rotate(45deg);
}

/* ── Product thumb: hover flip (front → back) ── */
.product-thumb {
    aspect-ratio: 3/4;
    overflow: hidden;
    position: relative;
}

/* Placeholder (no WC image) */
.product-thumb__ph {
    width: 100%;
    height: 100%;
    background: #E8E4DC;
    transition: transform 0.48s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card:hover .product-thumb__ph {
    transform: scale(1.04);
}

/* Front image (default visible) */
.product-thumb__front {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
    transition: opacity 0.42s ease, transform 0.42s ease;
    transform: scale(1);
    opacity: 1;
    z-index: 2;
}

/* Back image (hidden until hover) */
.product-thumb__back {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
    transition: opacity 0.42s ease, transform 0.42s ease;
    transform: scale(1.04);
    opacity: 0;
    z-index: 1;
}

/* On hover: cross-fade front out, back in */
.product-thumb.has-flip:hover .product-thumb__front {
    opacity: 0;
    transform: scale(1.04);
}

.product-thumb.has-flip:hover .product-thumb__back {
    opacity: 1;
    transform: scale(1);
}

/* Cards without back image: simple zoom (position stays absolute from base rule) */
.product-card:hover .product-thumb:not(.has-flip) .product-thumb__front {
    transform: scale(1.04);
}

/* ── New card entry animation ───────────────── */
.product-card.card-entering {
    animation: cardReveal 0.5s cubic-bezier(0.33, 0.66, 0.66, 1) both;
}

/* Product info */
.product-info {
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(28, 36, 75, 0.05);
}

.product-name {
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 500;
    color: #1C244B;
    line-height: 1.45;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.product-cta {
    display: block;
    text-align: center;
    background: #1C244B;
    color: #F7F5F0;
    font-family: var(--font-nav);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 10px;
    transition: background 0.22s ease, color 0.22s ease;
}

.product-cta:hover {
    background: #C9A96E;
    color: #1C244B;
}

.catalog-inquiry-tray {
    position: fixed;
    z-index: 60;
    left: clamp(16px, 3vw, 40px);
    right: clamp(16px, 3vw, 40px);
    bottom: 18px;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto minmax(220px, auto);
    gap: 14px;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(28, 36, 75, 0.12);
    box-shadow: 0 18px 48px rgba(28, 36, 75, 0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.catalog-inquiry-tray.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.catalog-inquiry-tray__summary {
    min-width: 0;
}

.catalog-inquiry-tray__count {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-nav);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1C244B;
}

.catalog-inquiry-tray__summary p {
    margin: 0;
    max-width: 680px;
    color: rgba(28, 36, 75, 0.68);
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.55;
}

.catalog-inquiry-tray__toggle,
.catalog-inquiry-back,
.catalog-inquiry-clear,
.catalog-inquiry-send,
.catalog-inquiry-item__remove {
    border: 1px solid rgba(28, 36, 75, 0.18);
    background: transparent;
    color: #1C244B;
    cursor: pointer;
    font-family: var(--font-nav);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 11px 14px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.catalog-inquiry-tray__toggle:hover,
.catalog-inquiry-back:hover,
.catalog-inquiry-clear:hover,
.catalog-inquiry-item__remove:hover {
    border-color: #C9A96E;
    color: #C9A96E;
}

.catalog-inquiry-tray__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.catalog-inquiry-send {
    background: #1C244B;
    border-color: #1C244B;
    color: #F7F5F0;
    min-width: 188px;
}

.catalog-inquiry-send:hover {
    background: #C9A96E;
    border-color: #C9A96E;
    color: #1C244B;
}

.catalog-inquiry-tray__panel {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(28, 36, 75, 0.08);
    padding-top: 14px;
}

.catalog-inquiry-back {
    margin-bottom: 12px;
    padding-left: 12px;
    padding-right: 12px;
}

.catalog-inquiry-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 260px;
    overflow: auto;
}

.catalog-inquiry-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(28, 36, 75, 0.08);
    background: #F7F5F0;
}

.catalog-inquiry-item__copy {
    min-width: 0;
}

.catalog-inquiry-item__copy strong,
.catalog-inquiry-item__copy span,
.catalog-inquiry-item__qty span {
    display: block;
}

.catalog-inquiry-item__copy strong {
    color: #1C244B;
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.35;
}

.catalog-inquiry-item__copy span,
.catalog-inquiry-item__qty span {
    margin-top: 3px;
    color: rgba(28, 36, 75, 0.52);
    font-family: var(--font-nav);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.catalog-inquiry-item__qty input {
    width: 100%;
    margin-top: 5px;
    border: 1px solid rgba(28, 36, 75, 0.14);
    background: #fff;
    color: #1C244B;
    font-family: var(--font-body);
    font-size: 12px;
    padding: 9px 10px;
}

.catalog-inquiry-item__qty input:focus {
    border-color: #C9A96E;
    outline: none;
}

.catalog-inquiry-item__remove {
    padding: 9px 10px;
    font-size: 9px;
}

/* Empty state */
.catalog-empty {
    padding: 80px 0;
    color: rgba(28, 36, 75, 0.45);
    font-size: 14px;
    font-family: var(--font-nav);
    letter-spacing: 0.05em;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
    .catalog-layout {
        grid-template-columns: 1fr;
        padding: 0 clamp(16px, 3vw, 32px) clamp(48px, 8vw, 80px);
    }
    .catalog-sidebar {
        position: static;
        border-right: none;
        border-bottom: 1px solid rgba(28, 36, 75, 0.1);
        padding-right: 0;
        padding-bottom: 24px;
        margin-bottom: 24px;
    }
    .cat-nav__list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
    .cat-nav__divider { display: none; }
    .cat-nav__link,
    .cat-nav__sublink {
        padding: 7px 13px;
        border: 1px solid rgba(28, 36, 75, 0.1);
        border-left: 2px solid transparent;
        white-space: nowrap;
        font-size: 11px;
    }
    .cat-nav__link.is-active,
    .cat-nav__sublink.is-active { border-color: #C9A96E; }
    .cat-nav__item--parent { width: 100%; }
    .catalog-main { padding-left: 0; }
    .products-grid { grid-template-columns: repeat(3, 1fr); }
    /* Sentinel spans all columns on mobile too */
    .catalog-sentinel { grid-column: 1 / -1; }
    .catalog-inquiry-tray {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .catalog-inquiry-tray__actions {
        justify-content: stretch;
    }
    .catalog-inquiry-clear,
    .catalog-inquiry-send,
    .catalog-inquiry-back,
    .catalog-inquiry-tray__toggle {
        width: 100%;
    }
    .catalog-inquiry-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-select-btn {
        top: 8px;
        left: 8px;
        width: 32px;
        height: 32px;
    }
    .product-select-btn__icon {
        width: 16px;
        height: 16px;
    }
    .catalog-inquiry-tray {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 12px;
    }
    .catalog-inquiry-tray__summary p {
        font-size: 11px;
    }
    .catalog-inquiry-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
