/* Catalog — collection rail, toolbar, chips, grid, drawer.
   Loads after gemjinnie-redesign.css and owns all collection styles. */

.gj-collection {
    padding: clamp(28px, 4vw, 56px) 0 clamp(48px, 6vw, 80px);
}

.gj-collection__body {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: clamp(24px, 3vw, 48px);
    align-items: start;
}

.gj-collection__body--solo {
    grid-template-columns: minmax(0, 1fr);
}

.gj-collection__main {
    min-width: 0;
}

.gj-collection .row {
    --bs-gutter-x: clamp(16px, 2vw, 28px);
    --bs-gutter-y: clamp(16px, 2vw, 28px);
}

/* Rail */
.gj-rail {
    position: sticky;
    top: calc(var(--gj-nav-h, 0px) + 24px);
    max-height: calc(100vh - var(--gj-nav-h, 0px) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 18px;
    border-right: 1px solid var(--gj-line);
}

.gj-rail__head,
.gj-drawer__bar {
    display: none;
}

.gj-rail__form {
    margin: 0;
}

.gj-rail__group {
    border: 0;
    padding: 0;
    margin: 0 0 18px;
}

.gj-rail__group + .gj-rail__group {
    border-top: 1px solid var(--gj-line);
    padding-top: 18px;
}

.gj-rail__label {
    display: block;
    float: none;
    width: auto;
    margin: 0 0 10px;
    padding: 0;
    font-family: var(--gj-sans);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gj-ink);
}

.gj-rail__opts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gj-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
    color: var(--gj-body);
    cursor: pointer;
}

.gj-opt:hover {
    color: var(--gj-ink);
}

.gj-opt__box {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border-radius: 0;
    accent-color: var(--gj-gold);
}

.gj-opt__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.gj-opt__box:checked ~ .gj-opt__name {
    color: var(--gj-ink);
    font-weight: 500;
}

.gj-opt__count {
    flex: none;
    margin-left: auto;
    font-size: 11px;
    color: var(--gj-muted);
    font-variant-numeric: tabular-nums;
}

.gj-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gj-price__input {
    width: 0;
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--gj-line);
    border-radius: 0;
    background: var(--gj-bg);
    font-family: var(--gj-sans);
    font-size: 13px;
    color: var(--gj-ink);
    -moz-appearance: textfield;
    appearance: textfield;
}

.gj-price__input::-webkit-outer-spin-button,
.gj-price__input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.gj-price__dash {
    color: var(--gj-muted);
    font-size: 12px;
}

.gj-rail__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 4px;
}

.gj-rail__apply {
    flex: 1;
}

.js .gj-rail__apply {
    display: none;
}

.gj-rail__clear {
    font-size: 12px;
    color: var(--gj-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Mobile trigger */
.gj-filters-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
}

.gj-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50%;
    background: var(--gj-gold);
    color: var(--gj-bg);
    font-size: 10px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Toolbar */
.gj-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--gj-line);
}

.gj-toolbar__left,
.gj-toolbar__right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.gj-toolbar__title {
    margin: 0;
    font-family: var(--gj-display);
    font-size: 20px;
    line-height: 1.2;
    color: var(--gj-ink);
}

.gj-count {
    margin: 0;
    font-size: 13px;
    color: var(--gj-muted);
}

.gj-toolbar-note {
    max-width: 250px;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--gj-muted);
}

.gj-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gj-sort__label {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gj-muted);
}

.gj-select {
    max-width: 210px;
    padding: 6px 26px 6px 0;
    border: 0;
    border-bottom: 1px solid var(--gj-line);
    border-radius: 0;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23806132' stroke-width='1.4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    appearance: none;
    font-family: var(--gj-sans);
    font-size: 13px;
    color: var(--gj-ink);
}

.js .gj-sort__go {
    display: none;
}

/* Chips */
.gj-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}

.gj-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--gj-line);
    border-radius: 0;
    font-size: 12px;
    line-height: 1.2;
    color: var(--gj-body);
    text-decoration: none;
}

.gj-chip:hover,
.gj-chip:focus-visible {
    border-color: var(--gj-gold);
    color: var(--gj-ink);
}

.gj-chip__x {
    flex: none;
    opacity: 0.65;
}

.gj-chips__clear {
    margin-left: 2px;
    font-size: 12px;
    color: var(--gj-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Load more + empty */
.gj-loadmore {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: clamp(28px, 4vw, 48px) 0 0;
}

.gj-loadmore .btn-normal {
    min-width: 190px;
}

.gj-loadmore__spinner {
    display: inline-block;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--gj-line);
    border-top-color: var(--gj-gold);
    border-radius: 50%;
    animation: gj-spin 0.8s linear infinite;
}

.gj-loadmore__spinner[hidden] {
    display: none;
}

.gj-loadmore .btn-normal[aria-disabled="true"] {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes gj-spin {
    to { transform: rotate(360deg); }
}

.gj-loadmore__error {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--gj-muted);
    text-align: center;
}

.gj-empty {
    padding: clamp(48px, 8vw, 96px) 16px;
    text-align: center;
}

.gj-empty img {
    width: 56px;
    height: auto;
    margin: 0 auto 18px;
    opacity: 0.7;
}

.gj-empty h3 {
    margin: 0 0 10px;
    font-family: var(--gj-display);
    font-size: clamp(22px, 2.4vw, 30px);
    color: var(--gj-ink);
}

.gj-empty p {
    max-width: 460px;
    margin: 0 auto 18px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gj-body);
}

/* Editorial intro */
.gj-editorial {
    position: relative;
    margin: 0 0 26px;
}

.js .gj-editorial.is-collapsed .gj-editorial__body {
    max-height: 15rem;
    overflow: hidden;
}

.js .gj-editorial.is-collapsed::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 30px;
    left: 0;
    height: 56px;
    background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--gj-bg));
    pointer-events: none;
}

.gj-editorial__more {
    display: none;
    margin-top: 8px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    font-family: var(--gj-sans);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--gj-gold);
    cursor: pointer;
}

.js .gj-editorial__more {
    display: inline-flex;
}

.gj-editorial__more[hidden] {
    display: none;
}

/* Drawer */
.gj-drawer__scrim {
    position: fixed;
    inset: 0;
    z-index: 1044;
    background: rgb(78 53 30 / 0.38);
}

.gj-drawer__scrim[hidden] {
    display: none;
}

body.gj-drawer-open {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .gj-collection__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .gj-collection__main {
        display: flex;
        flex-direction: column;
    }

    .gj-editorial {
        order: 90;
        margin-top: 40px;
    }

    /* No-JS: the rail is a normal block above the grid. */
    .gj-rail {
        position: static;
        max-height: none;
        overflow: visible;
        margin: 0 0 22px;
        padding: 0 0 18px;
        border-right: 0;
        border-bottom: 1px solid var(--gj-line);
    }

    /* With JS: the same node becomes the drawer. */
    .js .gj-filters-btn {
        display: inline-flex;
    }

    .js .gj-rail {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1045;
        width: min(88vw, 360px);
        max-height: none;
        margin: 0;
        padding: 0 18px calc(76px + env(safe-area-inset-bottom));
        border-right: 1px solid var(--gj-line);
        border-bottom: 0;
        background: var(--gj-bg);
        box-shadow: 0 0 48px rgb(78 53 30 / 0.18);
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.28s var(--gj-ease);
    }

    .js .gj-rail.is-open {
        transform: none;
        visibility: visible;
    }

    .js .gj-rail__head {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 0;
        border-bottom: 1px solid var(--gj-line);
        background: var(--gj-bg);
    }

    .gj-rail__title {
        font-family: var(--gj-display);
        font-size: 20px;
        color: var(--gj-ink);
    }

    .gj-rail__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid var(--gj-line);
        background: transparent;
        color: var(--gj-ink);
    }

    .gj-rail__groups {
        padding-top: 6px;
    }

    .js .gj-drawer__bar {
        position: sticky;
        bottom: 0;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--gj-line);
        background: var(--gj-bg);
    }

    .gj-drawer__clear {
        flex: none;
        font-size: 12px;
        color: var(--gj-gold);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .gj-drawer__apply {
        flex: 1;
    }

    .gj-toolbar__title {
        display: none;
    }

    .gj-toolbar-note {
        display: none;
    }

    .gj-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .gj-chips::-webkit-scrollbar {
        display: none;
    }

    .gj-chips > li {
        scroll-snap-align: start;
    }

    .gj-chip {
        white-space: nowrap;
    }
}

@media (min-width: 992px) {
    .gj-filters-btn,
    .gj-drawer__bar,
    .gj-rail__head,
    .gj-drawer__scrim {
        display: none !important;
    }
}

/* Focus + motion */
body.gj-redesign .gj-collection :is(a, button, input, select, summary):focus-visible {
    outline: 2px solid var(--gj-gold) !important;
    outline-offset: 2px !important;
}

@media (max-width: 359.98px) {
    .gj-drawer__bar {
        gap: 10px;
    }

    .gj-drawer__clear {
        font-size: 11px;
    }

    .gj-drawer__apply {
        padding-inline: 10px;
        font-size: 12px;
    }

    .gj-price {
        gap: 6px;
    }

    .gj-price__input {
        padding-inline: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gj-rail,
    .gj-chip,
    .gj-loadmore__spinner {
        transition: none !important;
        animation: none !important;
    }
}
