/*
 * Vildmark add-on field styling.
 *
 * Product Add-ons 8.2.0 renders the 13 groups inside .uw-vm-config in two
 * different markup shapes: image swatches (anchors) for Beklaedningstype,
 * Vaelg indsats og farve and Cover, and native radio/checkbox lists for
 * the rest. product-vildmark.css styles the shared card shell and the
 * group heading; this file is only what sits inside a card.
 *
 * Every selector here is scoped under .uw-vm-config, the configurator
 * root. This template is one product out of 401 and the add-on markup it
 * styles is shared by every product that uses Product Add-ons, so an
 * unscoped rule here would restyle add-ons everywhere.
 *
 * Custom properties (--vm-forest-*, --vm-wood-*, --vm-radius*) come from
 * .uw-vm in product-vildmark.css. .uw-vm-config is always inside .uw-vm,
 * so they are available here without redeclaring them.
 *
 * Selected state follows the existing .uw-vm-thumb recipe exactly (base
 * file, thumbnail strip): a transparent 2px border at rest promoted to
 * var(--vm-forest-700) when chosen, so nothing shifts size on selection.
 * Colour is never the only cue: swatches add a checkmark badge, rows lean
 * on the native control's own filled/empty shape.
 */

/* ---------- Group heading ---------- */

/*
 * .wc-pao-addon-name is either a <label> (checkbox/multi-select groups) or
 * a <legend> (radio and image-swatch groups, which need a fieldset for
 * the option group to be announced correctly). The base file already sets
 * its size, weight, colour and bottom margin; this only adds a divider so
 * the options below read as a distinct block from the heading. Legends
 * are block by default, labels are not, so display is forced to block on
 * both, otherwise the divider would only underline the label's own text
 * instead of spanning the card.
 */
.uw-vm-config .wc-pao-addon-name {
    display: block;
    padding-bottom: .625rem;
    border-bottom: 1px solid var(--vm-wood-100);
}

/* ---------- Image swatch groups (Beklaedningstype, Vaelg indsats og farve, Cover) ---------- */

/*
 * inc/woocommerce.php (site-wide, not owned by this file, not editable
 * from here) injects a <style> block on every product page for a
 * hover/focus zoom-to-inspect effect used across all 400 products (see
 * the transform: scale(2.4) rule further down, left as-is on purpose: it
 * is a real, useful existing feature, letting a shopper see the wood
 * grain or colour up close, not something this pass should quietly drop).
 * That injected block flags a handful of sizing properties high priority,
 * which ordinary specificity cannot beat, so this section matches it in
 * kind on exactly those properties and nothing else, per the operator's
 * decision on this file: the only sanctioned use of !important here is
 * overriding an !important declaration this file does not own. Every
 * !important below names the rule it answers to.
 *
 * product-vildmark.js reads each swatch's title attribute before the
 * plugin's own tooltip script can strip it (confirmed live: it does, on
 * all 22 swatches, diacritics intact) and appends the parsed text as a
 * last child, <span class="uw-vm-swatch-label" aria-hidden="true">. This
 * file only lays that out; the parsing is not its job.
 *
 * :has() picks out only the wraps whose direct children are image-swatch
 * anchors, so this never touches the radio/checkbox wraps below. Relying
 * on structure rather than the per-product addon IDs (wc-pao-addon-7789-0
 * etc.) keeps this working if the admin reorders or edits the groups.
 */
.uw-vm-config .wc-pao-addon-wrap:has(> .wc-pao-addon-image-swatch) {
    display: flex;
    flex-wrap: wrap;
    margin-top: .25rem;
}

.uw-vm-config .wc-pao-addon-image-swatch {
    /* Overrides inc/woocommerce.php's width/height/display: ... !important,
       written for a fixed 84px square. Widened past .uw-vm-thumb's own
       84px-ish sizing on purpose: the longest real label on this product,
       "Akryl - Lys brun marmor +4.999 kr.", needs the extra room to wrap
       to two lines instead of four. Height is auto, not fixed, so the
       label below can add its own height on top of the square image. */
    width: 7rem !important;
    height: auto !important;
    display: flex !important;
    position: relative;
    flex-direction: column;
    box-sizing: border-box;
    text-decoration: none;
    color: var(--vm-wood-800);
    background: var(--vm-wood-50);
    border: 2px solid transparent;
    border-radius: var(--vm-radius-sm);
    overflow: hidden;
    transition: border-color .2s ease;
}

.uw-vm-config .wc-pao-addon-image-swatch img {
    /* Overrides inc/woocommerce.php's width: auto !important, written to
       contain-fit the image inside the fixed 84px square. height stays
       auto to match the injected rule's own value: with width now
       definite (100% of the 7rem tile) and aspect-ratio set, auto height
       is computed from that width, giving a clean square instead of
       shrink-wrapping the image's own intrinsic size. max-width/max-height
       stay 100% too: that cap does not conflict with anything here. */
    width: 100% !important;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    flex: none;
}

/*
 * The plugin's own frontend script removes the title attribute from each
 * swatch once it has read it (for its own tooltip), so nothing here reads
 * title again: labelSwatches() in product-vildmark.js parses data-price
 * into this element's two children before that happens. It stays
 * aria-hidden (set in the JS): each swatch already has an accessible name
 * from its own <img alt="Termotræ +1.999 kr.">, which tipTip never
 * touches (it strips only title), and role="radio" takes its name from
 * content when nothing else names it. This label duplicates that name
 * for sighted users only; without aria-hidden a screen reader would
 * announce the name twice.
 *
 * The name wraps onto as many lines as it needs and is never truncated:
 * the client asked for every option label to be readable in full
 * ("Hele teksten ses ikke på produkt", 2026-11-09), and the old one-line
 * clip cut long oven and door names off at both ends. The label takes a
 * minimum of the old two-row height and grows past it (flex: 1 0 auto),
 * so the tiles in a row still end level: the row stretches every tile to
 * the tallest one and the label absorbs the difference. The price stays
 * on one line of its own.
 */
.uw-vm-config .uw-vm-swatch-label {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
    min-height: 2.75rem;
    box-sizing: border-box;
    padding: .25rem .375rem;
    text-align: center;
    /* Same colour as the tile itself, so the label does not sit in a
       white box inside the beige card (client, 2026-11-23). */
    background: var(--vm-wood-50);
    border-top: 1px solid var(--vm-wood-100);
    overflow: hidden;
}

/* A required group the visitor tried to submit without (product-vildmark.js
   catches the browser's invalid event on the hidden swatch select). */
.uw-vm-config .uw-vm-required-note {
    margin: 0 0 .5rem;
    font-size: .875rem;
    font-weight: 600;
    color: #b42318;
}

.uw-vm-config .wc-pao-addon-container.uw-vm-required-missing .wc-pao-addon-image-swatch:not([data-value=""]) {
    border-color: #b42318;
}

.uw-vm-config .uw-vm-swatch-name,
.uw-vm-config .uw-vm-swatch-price {
    display: block;
    width: 100%;
    min-width: 0;
}

.uw-vm-config .uw-vm-swatch-name {
    white-space: normal;
    overflow-wrap: anywhere;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
}

.uw-vm-config .uw-vm-swatch-price {
    white-space: nowrap;
}

.uw-vm-config .uw-vm-swatch-name {
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--vm-wood-800);
}

.uw-vm-config .uw-vm-swatch-price {
    font-size: .6875rem;
    font-weight: 700;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    color: var(--vm-forest-700);
}

.uw-vm-config .wc-pao-addon-image-swatch:hover .uw-vm-swatch-label {
    background: var(--vm-wood-50);
}

.uw-vm-config .wc-pao-addon-image-swatch.selected .uw-vm-swatch-label,
.uw-vm-config .wc-pao-addon-image-swatch[aria-checked="true"] .uw-vm-swatch-label {
    background: var(--vm-forest-50);
}

.uw-vm-config .wc-pao-addon-image-swatch.selected .uw-vm-swatch-name,
.uw-vm-config .wc-pao-addon-image-swatch[aria-checked="true"] .uw-vm-swatch-name {
    color: var(--vm-wood-900);
}

.uw-vm-config .wc-pao-addon-image-swatch:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

/*
 * Collapse inc/woocommerce.php's zoom once the pointer has left a swatch
 * that merely holds focus from being clicked.
 *
 * That injected rule scales on :hover, :focus AND :focus-visible. The
 * hover half is the zoom-to-inspect feature and is kept. The :focus half
 * is the problem: a mouse click leaves focus on the swatch, so it stayed
 * at scale(2.4) with the pointer nowhere near it. A 7rem tile on a 7.5rem
 * pitch becomes ~269px wide, which is wider than its own column, so the
 * inflated swatch sat on top of the neighbour on each side and took their
 * clicks. Selecting one option made the two beside it unselectable.
 *
 * :focus-visible is excluded so keyboard focus keeps the zoom, and :hover
 * is excluded so the pointer's own zoom is untouched. Chrome does not
 * match :focus-visible on a mouse-clicked anchor, so this is exactly the
 * click-then-move-away case and nothing else. No !important is needed:
 * the injected rule does not flag transform, and this selector is more
 * specific.
 */
.uw-vm-config .wc-pao-addon-image-swatch:focus:not(:focus-visible):not(:hover) {
    transform: none;
    z-index: auto;
    box-shadow: none;
}

/*
 * Phones and other touch screens: no zoom-to-inspect at all (client review 2026-11-14, point 50).
 * A tap focuses the swatch, and inc/woocommerce.php scales a focused swatch to 2.4x, which covered
 * the neighbouring options and the page. Hover-capable screens wider than a phone keep the zoom.
 * (hover: none) catches touch devices of any width, max-width catches a narrow desktop window.
 */
@media (hover: none), (max-width: 767px) {
    .uw-vm-config .wc-pao-addon-image-swatch:hover,
    .uw-vm-config .wc-pao-addon-image-swatch:focus,
    .uw-vm-config .wc-pao-addon-image-swatch:focus-visible {
        transform: none;
        z-index: auto;
        box-shadow: none;
    }
}

.uw-vm-config .wc-pao-addon-image-swatch.selected,
.uw-vm-config .wc-pao-addon-image-swatch[aria-checked="true"] {
    border-color: var(--vm-forest-700);
}

/* Small checkmark badge on the selected tile, echoing the included-items
   check mark used elsewhere on this page (.uw-vm-check). This is the
   non-colour cue: the border-colour change alone is still just colour. */
.uw-vm-config .wc-pao-addon-image-swatch.selected::before,
.uw-vm-config .wc-pao-addon-image-swatch[aria-checked="true"]::before {
    content: '\2713';
    position: absolute;
    top: .375rem;
    right: .375rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6875rem;
    line-height: 1;
    color: #fff;
    background: var(--vm-forest-700);
    border: 2px solid #fff;
    border-radius: 9999px;
}

/* The plugin's own "no image" placeholder for "Ingen" already reads as a
   distinct icon rather than a broken image; the dashed border here
   confirms it as an explicit choice, not a stray thumbnail. */
.uw-vm-config .wc-pao-addon-image-swatch[data-value=""] {
    border-style: dashed;
}

/*
 * Kept even though every swatch now carries its own visible label: this
 * line is a fast, fixed-position confirmation of the current pick, worth
 * having in a group of twelve swatches (Vaelg indsats og farve) where the
 * selected tile itself could be anywhere in the grid.
 * The plugin writes the selected swatch's name and price into this
 * element as real text on selection. It sits empty until a choice
 * changes it, so it stays hidden until then.
 *
 * flex-basis: 100% forces this onto a line of its own: it is a sibling of
 * the swatch anchors inside the same flex-wrap row (see the wrap rule
 * above), and without this it was free to tuck in next to the last
 * swatch instead of sitting below the whole grid.
 */
.uw-vm-config .wc-pao-addon-image-swatch-selected-swatch {
    display: block;
    flex-basis: 100%;
    margin-top: 1rem;
    padding: .75rem 1rem;
    font-size: .875rem;
    color: var(--vm-wood-900);
    background: var(--vm-forest-50);
    border: 1px solid var(--vm-forest-100);
    border-radius: var(--vm-radius-sm);
}

.uw-vm-config .wc-pao-addon-image-swatch-selected-swatch:empty {
    display: none;
}

.uw-vm-config .wc-pao-addon-image-swatch-selected-swatch::before {
    content: 'Valgt: ';
    font-weight: 500;
    color: var(--vm-wood-700);
}

.uw-vm-config .wc-pao-addon-image-swatch-selected-swatch .wc-pao-addon-image-swatch-price {
    font-weight: 600;
}

.uw-vm-config .wc-pao-addon-image-swatch-selected-swatch .wc-pao-addon-price {
    margin-left: .25rem;
    font-weight: 700;
    color: var(--vm-forest-700);
}

/* ---------- Radio and checkbox groups (the other ten) ---------- */

/*
 * Both input types share one markup shape here: .wc-pao-addon-wrap holds
 * one plain <div> per option, each wrapping an <input> and a sibling
 * <label for="...">. The :has() guard above already claims the swatch
 * wraps; the child selector below (> div) would not match them anyway,
 * since those hold anchors and a select, never a div.
 */
.uw-vm-config .wc-pao-addon-wrap:not(:has(> .wc-pao-addon-image-swatch)) {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    margin-top: .25rem;
}

.uw-vm-config .wc-pao-addon-wrap > div {
    display: flex;
    align-items: flex-start;
    box-sizing: border-box;
    gap: .75rem;
    padding: .85rem 1rem;
    background: var(--vm-wood-50);
    border: 2px solid transparent;
    border-radius: var(--vm-radius-sm);
    transition: border-color .2s ease, background-color .2s ease;
}

.uw-vm-config .wc-pao-addon-wrap > div:hover {
    background: var(--vm-wood-100);
}

.uw-vm-config .wc-pao-addon-wrap > div:has(input:checked) {
    background: var(--vm-forest-50);
    border-color: var(--vm-forest-700);
}

.uw-vm-config .wc-pao-addon-wrap > div:has(input:focus-visible) {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

/* The automatic "Ingen" choice, hidden by hideRedundantNone() in
   product-vildmark.js on every group that already offers a real option at no
   cost. See the comment there for why it is conditional. The swatch rule
   needs !important because urbanwild_pao_image_swatch_tweaks() in
   inc/woocommerce.php pins display on .wc-pao-addon-image-swatch with
   !important on every product page. */
.uw-vm-config .wc-pao-addon-wrap > div.uw-vm-none-hidden {
    display: none;
}

.uw-vm-config .wc-pao-addon-image-swatch.uw-vm-none-hidden {
    display: none !important;
}

/* Sized up from the browser default and aligned to the first line of the
   label, not the vertical centre of it, so a two-line option name does
   not pull the control down with it. */
.uw-vm-config .wc-pao-addon-wrap > div input[type="radio"],
.uw-vm-config .wc-pao-addon-wrap > div input[type="checkbox"] {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    margin: .15rem 0 0;
    accent-color: var(--vm-forest-700);
    cursor: pointer;
}

/* Belt and braces: the row above already gets an outline when the input
   inside it is keyboard-focused, but the input keeps its own indicator
   too, in case it is ever reached or styled outside that row context. */
.uw-vm-config .wc-pao-addon-wrap > div input:focus-visible {
    outline: 2px solid var(--vm-forest-700);
    outline-offset: 2px;
}

/*
 * The label is the actual click target for the row's text and price:
 * flex:1 grows it to fill the remaining row width, so clicking anywhere
 * across that space toggles the input via its `for` attribute, without
 * the outer <div> needing any click handling of its own.
 *
 * Scoped through .uw-vm-form as well as .uw-vm-config: the plugin's own
 * frontend.css sets this label to display: inline through a three-class
 * selector (.woocommerce .wc-pao-addon .wc-pao-addon-wrap label), which
 * otherwise outranks a two-class selector and silently keeps the label
 * inline no matter what display this rule asks for.
 */
.uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .75rem;
    font-size: .9375rem;
    line-height: 1.4;
    color: var(--vm-wood-800);
    cursor: pointer;
}

/*
 * The plugin renders the price as "(+1.999 kr.)" inside the label text,
 * and CSS cannot pull it out into its own column without touching the
 * markup. margin-left: auto is the closest a stylesheet can get: it pins
 * the price to the row's right edge whether it shares the line with the
 * option name or, for the longer names, wraps onto a line of its own.
 */
.uw-vm-config .wc-pao-addon-wrap > div .wc-pao-addon-price {
    flex: none;
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--vm-forest-700);
}

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

@media (max-width: 767px) {
    /* Overrides the same injected width: ... !important as the base rule
       above. Narrower than the 7rem desktop tile, so three still fit
       across a 390px phone instead of two; height stays auto from the
       base rule, unchanged here, so the label wraps onto as many lines
       as the name needs. */
    .uw-vm-config .wc-pao-addon-image-swatch {
        width: 5.5rem !important;
    }

    .uw-vm-config .wc-pao-addon-wrap > div {
        min-height: 2.75rem;
        padding: .75rem .85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .uw-vm-config .wc-pao-addon-image-swatch,
    .uw-vm-config .wc-pao-addon-wrap > div {
        transition: none;
    }
}

/* ---------- Mobile field groups (collapsed row + swipe open) ---------- */

/*
 * Below 768px every one of the 13 add-on groups used to render fully open
 * and stacked, which is what put the page past 15000px tall on a phone.
 * Wireframe direction 1d instead shows one closed row per group (name on
 * the left, current choice on the right, a chevron) that opens on tap, its
 * options then running as a horizontal swipe strip rather than a stack.
 *
 * product-vildmark.js wraps each .wc-pao-addon-container in a native
 * <details class="uw-vm-field-group"> at runtime, with a <summary> stating
 * the group's name and current choice. Everything about the open state,
 * keyboard toggling and screen reader announcement comes from the browser's
 * own <details> behaviour; this file is only what makes the wrapper a
 * no-op above 768px, so the JS never has to know the current viewport
 * width itself and a resize back to desktop can never leave a group
 * visually stuck closed.
 *
 * The horizontal scroller reuses the "Gennemgå dine valg" review carousel's
 * own recipe (product-vildmark-valg.css's .uw-vm-gg-track and its
 * accompanying drag/keyboard handling in product-vildmark-valg.js, mirrored
 * here in product-vildmark.js's enableSwipeScroll()) rather than a second,
 * different scrolling behaviour: flex row, native x-scroll, snap, momentum
 * on iOS, no visible scrollbar, drag on mouse only since touch already
 * scrolls on its own.
 */

.uw-vm-config .uw-vm-field-group {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.uw-vm-config .uw-vm-field-summary {
    display: none;
}

/*
 * Desktop does not force a closed <details> open through CSS here: tested
 * live and confirmed a closed <details>'s hidden content sits behind
 * Chromium's own user agent shadow tree, which no light-DOM selector can
 * reach (overriding display and content-visibility on the group and on the
 * wrapped .wc-pao-addon-container both left the group's own box at zero
 * height, even though the container measured its full height in
 * isolation). product-vildmark.js instead sets each <details>' own open
 * property from matchMedia('(min-width: 768px)'), open on desktop, closed
 * on mobile, and keeps it in sync on any resize across that boundary, so
 * the group is genuinely open on desktop rather than only styled to look
 * that way.
 */

@media (max-width: 767px) {
    .uw-vm-config .uw-vm-field-group {
        margin-bottom: .75rem;
        background: #fff;
        border: 1px solid var(--vm-wood-100);
        border-radius: var(--vm-radius-sm);
        overflow: hidden;
    }

    .uw-vm-config .uw-vm-field-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        min-height: 2.75rem;
        padding: .85rem .875rem;
        font-size: .9375rem;
        font-weight: 600;
        color: var(--vm-wood-900);
        cursor: pointer;
        list-style: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* The browser's own disclosure triangle: this row draws its own
       chevron on the value instead (below), covering both engines'
       marker selector so neither Firefox's ::marker nor Chrome/Safari's
       ::-webkit-details-marker leaves a second, native one beside it. */
    .uw-vm-config .uw-vm-field-summary::marker,
    .uw-vm-config .uw-vm-field-summary::-webkit-details-marker {
        display: none;
        content: '';
    }

    /* Group name and chosen value wrap rather than truncate: the client
       wants every label readable in full (2026-11-09), and a long name
       such as "Skorstensfejer-godkendt installation" or a long oven name
       was cut off with an ellipsis on a phone. */
    .uw-vm-config .uw-vm-field-summary-name {
        flex: 1 1 auto;
        min-width: 0;
        overflow-wrap: break-word;
    }

    .uw-vm-config .uw-vm-field-summary-value {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: .375rem;
        max-width: 55%;
        min-width: 0;
        text-align: right;
        overflow-wrap: break-word;
        font-weight: 500;
        color: var(--vm-forest-700);
    }

    /* Rotated open via the [open] attribute the browser itself toggles on
       .uw-vm-field-group; nothing here needs a JS-set class to track it. */
    .uw-vm-config .uw-vm-field-summary-value::after {
        content: '';
        flex: none;
        width: .5rem;
        height: .5rem;
        margin-left: .125rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform .2s ease;
    }

    .uw-vm-field-group[open] .uw-vm-field-summary-value::after {
        transform: rotate(-135deg);
    }

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

    /*
     * The wrapped container becomes the open panel: its own desktop card
     * chrome (border, background, outer margin) would double up with the
     * wrapper's now that .uw-vm-field-group carries it instead (above), so
     * it is switched off here in favour of one divider between the summary
     * row and the options.
     */
    .uw-vm-config .uw-vm-field-group > .wc-pao-addon-container {
        margin: 0;
        padding: 0 .875rem .875rem;
        background: transparent;
        border: 0;
        border-top: 1px solid var(--vm-wood-100);
        border-radius: 0;
    }

    /*
     * The container's own heading (.wc-pao-addon-name, a <legend> or
     * <label> depending on group type) is already restated by the summary
     * row above it. Visually hidden rather than display:none, the same
     * clip-rect recipe as .uw-vm-sr in product-vildmark.css, because a
     * radio/checkbox group's fieldset takes its accessible name from this
     * legend: removing it from the accessibility tree, not just from view,
     * would leave that group nameless for anyone tabbing straight into the
     * open content past the summary.
     */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        padding: 0;
        margin: 0;
        border: 0;
    }

    /*
     * One scrolling behaviour for both group shapes (image swatch and
     * radio/checkbox), matched on the :has()/:not(:has()) pair so each
     * selector's specificity stays a strict superset of the corresponding
     * base rule above (display: flex, flex-wrap: wrap or column) rather
     * than depending on source order to win the cascade.
     *
     * overflow-x/overflow-y carry !important for the same reason the
     * swatch width/height do near the top of this file: inc/woocommerce.php's
     * injected block also sets `.wc-pao-addon-wrap, .wc-pao-fieldset,
     * .wc-pao-addon-container { overflow: visible !important; }` (confirmed
     * live, via the matched-styles list: display/flex-wrap/flex-direction
     * from this same rule already won without it, only overflow did not),
     * so this answers that one declaration in kind, nothing more.
     */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap:has(> .wc-pao-addon-image-swatch),
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap:not(:has(> .wc-pao-addon-image-swatch)) {
        display: flex;
        flex-wrap: nowrap;
        flex-direction: row;
        align-items: stretch;
        gap: .625rem;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: .25rem;
        border-radius: var(--vm-radius-sm);
    }

    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap::-webkit-scrollbar {
        display: none;
    }

    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap:focus-visible {
        outline: 2px solid var(--vm-forest-700);
        outline-offset: 2px;
    }

    /* flex: none over the swatch's own default shrink-to-fit, so the row
       scrolls at each swatch's intrinsic 5.5rem instead of squeezing them
       to stay inside the viewport. */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap > .wc-pao-addon-image-swatch {
        flex: none;
        scroll-snap-align: start;
    }

    /* Radio/checkbox option rows: a fixed card width instead of the
       desktop full-width row, so several sit side by side in the scroller. */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap:not(:has(> .wc-pao-addon-image-swatch)) > div {
        flex: 0 0 14rem;
        scroll-snap-align: start;
    }

    /*
     * Restates "Valgt: <name>" beside the swatch grid, which the summary
     * row above now already says. Kept in the DOM (the plugin still writes
     * to it, and desktop still shows it) but hidden here rather than
     * turned into an odd, unsized item inside the horizontal scroller.
     */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-image-swatch-selected-swatch {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .uw-vm-config .uw-vm-field-summary-value::after {
        transition: none;
    }
}

/* ---------- Checkbox and radio options with an image ---------- */

/*
 * A checkbox or radio group whose options carry an image (the vildmarksbad
 * Tilbehør, sauna Tilbehør, Strøm, sauna Lys):
 * inc/wc-pao-option-images.php puts the image in front of the label text as
 * img.uw-pao-checkbox-img and marks the label .uw-pao-checkbox-label. Desktop keeps the full-width option row with a
 * square thumbnail at its left; the phone scroller turns each row into a
 * card with the picture on top, like the image swatch tiles above.
 *
 * Specificity: these out-rank both the row label rule above and
 * pao-checkbox-image.css (which is not enqueued on this template anyway).
 */
.uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label.uw-pao-checkbox-label {
    align-items: center;
}

.uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label.uw-pao-checkbox-label .uw-pao-checkbox-img {
    display: block;
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    max-width: none;
    object-fit: cover;
    border-radius: var(--vm-radius-sm);
    background: #fff;
}

@media (max-width: 767px) {
    .uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label.uw-pao-checkbox-label {
        flex-direction: column;
        align-items: flex-start;
    }

    .uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label.uw-pao-checkbox-label .uw-pao-checkbox-img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .uw-vm-config .uw-vm-form .wc-pao-addon-wrap > div label.uw-pao-checkbox-label .wc-pao-addon-price {
        margin-left: 0;
    }
}

/* ---------- Quantity steppers in Tilbehør ---------- */

/*
 * Nakkepude and Knagerække med 3 knager (operator request 2026-11-09): a row
 * in the Tilbehør list with a -/+ stepper, built by mountQtySteppers() in
 * product-vildmark.js. The row is a plain <div> in the same wrap, so it
 * already takes the option row look from `.wc-pao-addon-wrap > div` above;
 * these rules only lay out its text and stepper. The plugin's own number
 * input stays in its hidden container (.uw-vm-qty-source) as the field the
 * stepper writes to.
 */
.uw-vm-config .wc-pao-addon-container.uw-vm-qty-source {
    display: none !important;
}

.uw-vm-config .wc-pao-addon-wrap > div.uw-vm-qty {
    align-items: center;
}

.uw-vm-config .wc-pao-addon-wrap > div.uw-vm-qty.is-active {
    background: var(--vm-forest-50);
    border-color: var(--vm-forest-700);
}

.uw-vm-config .uw-vm-qty-text {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .75rem;
    min-width: 0;
    font-size: .9375rem;
    line-height: 1.4;
    color: var(--vm-wood-800);
}

.uw-vm-config .uw-vm-qty-name {
    overflow-wrap: break-word;
}

.uw-vm-config .uw-vm-qty-price {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--vm-forest-700);
}

.uw-vm-config .uw-vm-qty-stepper {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: .25rem;
}

.uw-vm-config .uw-vm-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    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-config .uw-vm-qty-btn:hover:not(:disabled) {
    background: var(--vm-forest-700);
    color: #fff;
}

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

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

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

/* A stepper row with the option's image (inc/wc-pao-option-images.php):
   the same square thumbnail as a checkbox option row. */
.uw-vm-config .wc-pao-addon-wrap > div.uw-vm-qty > .uw-pao-checkbox-img {
    display: block;
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    max-width: none;
    object-fit: cover;
    border-radius: var(--vm-radius-sm);
    background: #fff;
}

/* A quantity add-on on a product without a Tilbehør group keeps its own
   group; the stepper replaces the plugin's bare number box there too. */
.uw-vm-config .uw-vm-qty-own > input.wc-pao-addon-input-multiplier {
    display: none;
}

@media (max-width: 767px) {
    /* In the mobile swipe strip the row is a 14rem card: name and price on
       top, the stepper underneath, so the buttons keep a full tap size. */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap > div.uw-vm-qty {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    .uw-vm-config .uw-vm-qty-btn {
        width: 2.75rem;
        height: 2.75rem;
    }

    .uw-vm-config .uw-vm-qty-stepper {
        justify-content: flex-end;
    }

    /* Picture on top of the card, like a checkbox option card. */
    .uw-vm-config .uw-vm-field-group .wc-pao-addon-wrap > div.uw-vm-qty > .uw-pao-checkbox-img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

/*
 * The plugin's own subtotal list (#product-addons-total) duplicated the
 * "Dine valg" panel on every device size, so it is never shown on this
 * template. It stays in the DOM on purpose: product-vildmark.js reads the
 * live grand total from it (pluginTotal()) and watches it with a
 * MutationObserver to re-render the panel, and the plugin's own JS keeps
 * writing into it. display: none keeps both working and also takes the
 * duplicate out of the accessibility tree.
 */
.uw-vm-config #product-addons-total {
    display: none !important;
}
