/* ==========================================================================
   Products browse page (routes categories.all /categories, products.browse /products)
   Mobile: category photo rail (left) + product grid (right), both scrolling between the
   site header and a bottom bar of price ranges (replaces the site bottom nav here).
   Desktop: sticky category sidebar, price pills above a 4-column grid.
   Brand tokens come from gentora-brand.css.
   ========================================================================== */
.gjcat {
    --gjcat-rail-w: 27%;
    --gjcat-line: var(--brand-border, #E9E2D8);
    --gjcat-tint: #FBE9EE;                 /* soft pink selected state */
    --gjcat-accent: var(--brand-primary, #6E2433);
    --gjcat-ink: var(--brand-ink, #1F1A17);
    background: #fff;
    color: var(--gjcat-ink);
}
.gjcat a { text-decoration: none !important; }
.gjcat a:focus-visible, .gjcat button:focus-visible { outline: 2px solid var(--gjcat-accent); outline-offset: 2px; }
.gjcat-title {                              /* visible on desktop, screen-reader only on mobile */
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.gjcat-body {
    display: grid;
    grid-template-columns: var(--gjcat-rail-w) minmax(0, 1fr);
    height: calc(100dvh - var(--gjcat-top, 64px) - var(--gjcat-bottom, 78px));
}

/* ---------- Category rail ---------- */
.gjcat-rail {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    background: #fff;
    box-shadow: 2px 0 8px rgba(31, 26, 23, .08);
    position: relative;
    z-index: 1;
    padding: 4px 0 24px;
}
.gjcat-rail::-webkit-scrollbar { display: none; }
.gjcat-rail-item {
    display: block;
    position: relative;
    padding: 10px 12px 10px 10px;
    transition: background-color .15s ease;
}
.gjcat-rail-item::after {                   /* accent bar on the right edge */
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 3px;
    background: transparent;
}
.gjcat-rail-item.is-active { background: var(--gjcat-tint); }
.gjcat-rail-item.is-active::after { background: var(--gjcat-accent); }
.gjcat-rail-img {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    background: var(--brand-gold-soft, #F3EBDD);
}
.gjcat-rail-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.gjcat-rail-img::after {                    /* gradient so the label stays readable on any photo */
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 55%;
    background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
    pointer-events: none;
}
.gjcat-rail-initials { font-family: var(--brand-font-serif); font-size: 20px; color: var(--brand-gold-text, #84632F); }
.gjcat-rail-img img + .gjcat-rail-initials { display: none; }
.gjcat-rail-name {
    position: absolute;
    left: 4px; right: 4px; bottom: 6px;
    z-index: 1;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ---------- Products panel ---------- */
.gjcat-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px 28px 14px;
    outline: none;
}
.gjcat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 4px;
    font-family: var(--brand-font-sans);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gjcat-ink);
}
.gjcat-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gjcat-head::after { content: ''; flex: 1; min-width: 16px; height: 1px; background: #D9D4CE; }
.gjcat-meta { font-size: 12px; color: var(--brand-muted, #6F655C); margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.gjcat-viewall { color: var(--gjcat-accent) !important; font-weight: 600; margin-left: auto; white-space: nowrap; }

/* sub-category chips */
.gjcat-chips { list-style: none; margin: 0 -12px 12px 0; padding: 0 12px 4px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.gjcat-chips::-webkit-scrollbar { display: none; }
.gjcat-chips li { flex: 0 0 auto; }
.gjcat-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid #E5DED6; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--gjcat-ink) !important; background: #fff; white-space: nowrap; }
.gjcat-chip:hover { border-color: var(--gjcat-accent); color: var(--gjcat-accent) !important; }

/* product grid — shared gj_product_card, compacted for the narrow panel */
.gjcat-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
}
.gjcat-grid-item { min-width: 0; }
@media (max-width: 991.98px) {
    .gjcat-grid .gj-card-body { padding-left: 0; padding-right: 0; }
    .gjcat-grid .gj-card-title { font-size: 12.5px; line-height: 1.3; }
    .gjcat-grid .gj-card-price-now { font-size: 13.5px; }
    .gjcat-grid .gj-card-price-was { font-size: 11.5px; }
    .gjcat-grid .gj-card-btn { min-height: 36px; font-size: 12px; padding: 0 6px; }
    .gjcat-grid .gj-card-wish { transform: scale(.85); transform-origin: top right; }
}

/* load more */
.gjcat-more {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 46px; margin-top: 18px;
    border: 1px solid var(--gjcat-accent); border-radius: 10px; background: #fff;
    color: var(--gjcat-accent); font-weight: 600; font-size: 14px; cursor: pointer;
}
.gjcat-more:hover { background: var(--gjcat-tint); }
.gjcat-more-spin { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: gjcatSpin .7s linear infinite; }
.gjcat-more.is-loading .gjcat-more-spin { display: inline-block; }
@keyframes gjcatSpin { to { transform: rotate(360deg); } }

/* Empty states */
.gjcat-empty { text-align: center; padding: 40px 12px; color: var(--brand-muted, #6F655C); }
.gjcat-empty-page { padding: 80px 16px; }
.gjcat-empty-btn { display: inline-block; margin-top: 10px; padding: 10px 18px; border-radius: 8px; background: var(--gjcat-accent); color: #fff !important; font-weight: 600; }

/* ---------- Price range bar ---------- */
.gjcat-pricebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid var(--gjcat-line);
    box-shadow: 0 -4px 14px rgba(31, 26, 23, .06);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.gjcat-ptabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.gjcat-ptabs::-webkit-scrollbar { display: none; }
.gjcat-ptab {
    flex: 1 0 86px;
    max-width: 128px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 62px;
    padding: 6px 8px;
    border-radius: 16px;
    color: var(--brand-muted, #6F655C) !important;
    transition: background-color .15s ease, color .15s ease;
}
.gjcat-ptab.is-active { background: var(--gjcat-tint); color: var(--gjcat-accent) !important; }
.gjcat-ptab-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.gjcat-ptab-icon svg { width: 26px; height: 26px; }
.gjcat-ptab-label { font-size: 12.5px; font-weight: 600; line-height: 1.15; text-align: center; white-space: nowrap; }
.gjcat-ptab-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* skeleton while a panel loads */
.gjcat-sk-title, .gjcat-sk-card { background: linear-gradient(90deg, #f3efe9 25%, #faf7f2 50%, #f3efe9 75%); background-size: 200% 100%; animation: gjcatShimmer 1.2s infinite; border-radius: 10px; }
.gjcat-sk-title { height: 20px; width: 55%; margin-bottom: 18px; }
.gjcat-sk-card { aspect-ratio: 3 / 4.6; }
@keyframes gjcatShimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    .gjcat-sk-title, .gjcat-sk-card, .gjcat-more-spin { animation: none; }
    .gjcat-rail-item, .gjcat-ptab { transition: none; }
}

/* Mobile: the page is the two panes + price bar — hide the site footer and bottom nav here */
@media (max-width: 991.98px) {
    body:has(.gjcat) .gentora-footer,
    body:has(.gjcat) .giva-mobile-nav-bar { display: none !important; }
    body:has(.gjcat), body:has(.gjcat) .aiz-main-wrapper { padding-bottom: 0 !important; }
    html:has(.gjcat), body:has(.gjcat) { overflow: hidden; height: 100%; }
}
@media (max-width: 359.98px) {
    .gjcat-head { font-size: 15px; }
    .gjcat-ptab { flex-basis: 78px; }
}

/* ---------- Desktop ---------- */
@media (min-width: 992px) {
    .gjcat {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        grid-template-rows: auto auto 1fr;
        grid-template-areas: "rail title" "rail prices" "rail panel";
        column-gap: 28px;
        max-width: 1280px;
        margin: 24px auto 56px;
        padding: 0 16px;
    }
    .gjcat-title {
        grid-area: title;
        position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal;
        font-family: var(--brand-font-serif); font-size: 28px; font-weight: 600; margin: 0 0 12px;
    }
    .gjcat-body { display: contents; }
    .gjcat-rail {
        grid-area: rail;
        position: sticky;
        top: 96px;
        align-self: start;
        max-height: calc(100vh - 120px);
        border: 1px solid var(--gjcat-line);
        border-radius: 12px;
        box-shadow: none;
        padding: 8px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-content: start;
    }
    .gjcat-rail-item { padding: 6px; border-radius: 10px; }
    .gjcat-rail-item::after { top: 8px; bottom: 8px; border-radius: 3px; }
    .gjcat-pricebar {
        grid-area: prices;
        position: static;
        box-shadow: none;
        border-top: 0;
        padding: 0 0 14px;
        margin-bottom: 18px;
        border-bottom: 1px solid var(--gjcat-line);
        background: transparent;
    }
    .gjcat-ptabs { flex-wrap: wrap; overflow: visible; gap: 8px; }
    .gjcat-ptab {
        flex: 0 0 auto; max-width: none; min-height: 40px;
        flex-direction: row; gap: 8px; padding: 0 16px;
        border: 1px solid #E5DED6; border-radius: 999px;
    }
    .gjcat-ptab:hover { border-color: var(--gjcat-accent); color: var(--gjcat-accent) !important; }
    .gjcat-ptab.is-active { border-color: var(--gjcat-accent); }
    .gjcat-ptab-icon, .gjcat-ptab-icon svg { width: 18px; height: 18px; }
    .gjcat-ptab-label { font-size: 13.5px; }
    .gjcat-panel { grid-area: panel; overflow: visible; padding: 0; }
    .gjcat-head { font-size: 20px; }
    .gjcat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 18px; }
    .gjcat-more { max-width: 320px; margin: 28px auto 0; }
}
