/*
 * Vildmark product template: the "Gennemgå dine valg" review carousel.
 *
 * Section 5.4 of the "Produktside skabelon" wireframe. Every selector here is
 * scoped under .uw-vm-gg, the class inc/product-vildmark-valg.php puts on the
 * section itself, so nothing here can reach the add-on fields the plugin
 * renders above (.wc-pao-*) or leak onto any other product template.
 *
 * Values reuse the custom properties and scale already defined on .uw-vm in
 * product-vildmark.css rather than inventing a second set: --vm-forest-*,
 * --vm-wood-*, --vm-radius*, --vm-shadow, --vm-header-h.
 */

.uw-vm-gg {
    position: relative;
}

/* ---------- Head: intro copy + counter/step buttons ---------- */

.uw-vm-gg-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.uw-vm-gg-intro {
    max-width: 40rem;
    margin: 0;
    flex: 1 1 20rem;
}

.uw-vm-gg-counter {
    display: flex;
    align-items: center;
    gap: .625rem;
    flex: none;
    font-size: .8125rem;
    color: var(--vm-wood-700);
    font-variant-numeric: tabular-nums;
}

.uw-vm-gg-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    flex: none;
    padding: 0;
    border: 1.5px solid var(--vm-wood-200);
    border-radius: 9999px;
    background: #fff;
    color: var(--vm-wood-800);
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.uw-vm-gg-step svg {
    width: 1.125rem;
    height: 1.125rem;
}

.uw-vm-gg-step:hover:not(:disabled) {
    border-color: var(--vm-forest-700);
    color: var(--vm-forest-700);
}

.uw-vm-gg-step:disabled {
    opacity: .4;
    cursor: default;
}

.uw-vm-gg-step:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

/* ---------- Filter chips ---------- */

.uw-vm-gg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.uw-vm-gg-chip {
    flex: none;
    /* a long group name (Round Cube LED group) must wrap inside the phone viewport, not widen the page */
    max-width: 100%;
    white-space: normal;
    text-align: left;
    padding: .5rem .9rem;
    border: 1.5px solid var(--vm-wood-200);
    border-radius: 9999px;
    background: #fff;
    color: var(--vm-wood-700);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.uw-vm-gg-chip:hover {
    border-color: var(--vm-forest-700);
    color: var(--vm-forest-700);
}

.uw-vm-gg-chip.is-active {
    border-color: var(--vm-forest-700);
    background: var(--vm-forest-50);
    color: var(--vm-forest-700);
}

.uw-vm-gg-chip:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

/* ---------- Scroller ---------- */

/*
 * Bleeds the card row to the section's outer edge so the first and last card
 * are not trapped inside .uw-vm-shell's own inset, matching the shell's
 * left/right padding at each breakpoint below (X45: this section is plain,
 * not .uw-vm-cream, so it is the shell's 1rem/.875rem that the bleed has to
 * cancel out, not .uw-vm-cream's wider 1.5rem/1rem).
 */
.uw-vm-gg-viewport {
    position: relative;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.uw-vm-gg-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-padding-left: 1rem;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: .5rem;
    /* The track itself is a keyboard target (arrow keys page the cards), so
       it needs a visible focus state distinct from any one card's. */
    border-radius: var(--vm-radius);
    cursor: grab;
}

.uw-vm-gg-track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.uw-vm-gg-track::-webkit-scrollbar {
    display: none;
}

.uw-vm-gg-track:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .uw-vm-gg-track {
        scroll-behavior: auto;
    }
}

/* Cards hidden by the active filter chip are removed from layout entirely,
   not just visually, so the count and scroll width both reflect the
   filtered set rather than leaving gaps to scroll through. */
.uw-vm-gg-card[hidden] {
    display: none;
}

.uw-vm-gg-fade {
    position: absolute;
    top: 0;
    right: 1rem;
    bottom: .5rem;
    width: 3rem;
    /* Fades to the section's own background. This section is plain (X45),
       i.e. white, not the cream .uw-vm-cream sections carry. */
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff);
    pointer-events: none;
}

/* ---------- Card ---------- */

.uw-vm-gg-card {
    flex: 0 0 15rem;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    background: #fff;
    border-radius: var(--vm-radius-sm);
    overflow: hidden;
    /*
     * Transparent 2px at rest, promoted to var(--vm-forest-700) on selection
     * (X6), same recipe as .uw-vm-thumb.is-active: the border box is already
     * 2px at rest, so turning it visible on selection cannot shift layout.
     */
    border: 2px solid transparent;
}

.uw-vm-gg-card.is-selected {
    border-color: var(--vm-forest-700);
}

.uw-vm-gg-media {
    aspect-ratio: 4 / 3;
    background: var(--vm-wood-50);
    /* The photo fills the 4:3 box from the outside. In flow, a tall or square
       source photo pushed the box to its own height (236 x 236) and the cards
       in one group rendered at different sizes. */
    position: relative;
    overflow: hidden;
}

.uw-vm-gg-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Options with no photo (most of them: 10 of the 13 add-on groups carry no
   imagery at all). A blank box reads as a broken image, so this is a
   deliberate second card face: a tinted tile naming the group the option
   belongs to, built from the same icon every such card reuses. */
.uw-vm-gg-media-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: var(--vm-forest-50);
    color: var(--vm-forest-700);
    text-align: center;
    padding: .75rem;
}

.uw-vm-gg-media-icon span {
    font-size: .75rem;
    font-weight: 600;
    color: var(--vm-wood-700);
    overflow-wrap: anywhere;
}

.uw-vm-gg-icon {
    width: 2rem;
    height: 2rem;
}

.uw-vm-gg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    /* Card padding matches .wc-pao-addon-container (X8): 1.25rem 1.5rem
       desktop, 1rem .875rem below 768px, applied to the text half of the
       card since the image half bleeds edge to edge above it. */
    padding: 1.25rem 1.5rem;
}

.uw-vm-gg-name {
    margin: 0;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--vm-wood-900);
}

.uw-vm-gg-reason {
    margin: 0;
    font-size: .75rem;
    line-height: 1.5;
    color: var(--vm-wood-700);
}

.uw-vm-gg-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: auto;
    padding-top: .5rem;
}

.uw-vm-gg-price {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--vm-forest-700);
    font-variant-numeric: tabular-nums;
}

.uw-vm-gg-price-free {
    font-weight: 500;
    color: var(--vm-wood-700);
}

/*
 * The button itself is .uw-vm-btn plus .uw-vm-btn-ghost / .uw-vm-btn-primary
 * (X15): product-vildmark-valg.js swaps those two classes on select/deselect,
 * this only overrides the size, scoped under the section root (X16, X17),
 * following the precedent .uw-vm-bar .uw-vm-btn already sets.
 */
.uw-vm-gg .uw-vm-btn {
    flex: none;
    padding: .4rem .85rem;
    font-size: .75rem;
}

@media (max-width: 767px) {
    /* X18: 2.75rem minimum touch target below 768px. */
    .uw-vm-gg .uw-vm-btn {
        min-height: 2.75rem;
        padding: .5rem 1rem;
    }
}

/* ---------- Progress ---------- */

.uw-vm-gg-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: .25rem;
}

.uw-vm-gg-progress-track {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--vm-wood-200);
    overflow: hidden;
}

.uw-vm-gg-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: var(--vm-forest-700);
    transition: width .2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .uw-vm-gg-progress-fill {
        transition: none;
    }
}

.uw-vm-gg-hint {
    flex: none;
    font-size: .75rem;
    color: var(--vm-wood-700);
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
    .uw-vm-gg-viewport {
        margin: 0 -.875rem;
        padding: 0 .875rem;
    }

    .uw-vm-gg-track {
        scroll-padding-left: .875rem;
    }

    .uw-vm-gg-fade {
        right: .875rem;
    }

    .uw-vm-gg-head {
        align-items: flex-start;
    }

    .uw-vm-gg-hint {
        display: none;
    }
}

/* ---------- Quantity cards (Nakkepude, Knagerække med 3 knager) ---------- */

/* The -/+ stepper that takes the place of the Tilføj pill on a quantity
   add-on's card; product-vildmark-valg.js keeps it in step with the
   configurator's own stepper through the one real input both drive. */
.uw-vm-gg-qty {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: .25rem;
}

.uw-vm-gg-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 2px solid var(--vm-forest-700);
    border-radius: 999px;
    background: #fff;
    color: var(--vm-forest-700);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.uw-vm-gg-qty-btn:hover:not(:disabled) {
    background: var(--vm-forest-700);
    color: #fff;
}

.uw-vm-gg-qty-btn:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

.uw-vm-gg-qty-btn:disabled {
    border-color: var(--vm-wood-300);
    color: var(--vm-wood-300);
    cursor: default;
}

.uw-vm-gg-qty-value {
    min-width: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--vm-wood-900);
}
