/**
 * Step-by-step configurator for custom bed linen products.
 * Scoped to products tagged "customfields" — see configurator.js.
 */

/* ------------------------------------------------------ sticky preview */

@media (min-width: 921px) {
    [class*="product_tag-customfields"] .elementor-widget-woocommerce-product-images,
    [class*="product_tag-customfields"] .elementor-widget-woocommerce-product-images .elementor-widget-container {
        height: 100%;
    }

    [class*="product_tag-customfields"].product div.images.woocommerce-product-gallery {
        position: sticky !important;
        top: 60px;
        overflow: hidden;
    }

    body.admin-bar [class*="product_tag-customfields"].product div.images.woocommerce-product-gallery {
        top: 92px;
    }
}

/* ----------------------------------------------------------- scene */
/* Layered preview mirroring the gallery — see configurator.js. */

[class*="product_tag-customfields"] .pc-has-scene .woocommerce-product-gallery__wrapper {
    visibility: hidden;
}

[class*="product_tag-customfields"] .pc-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* the stage origin must stay constant across poses: it is not transitioned,
   so changing it per pose would yank the frame mid-animation */
[class*="product_tag-customfields"] .pc-scene__stage {
    transform-origin: 51.5% 0%;
    transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}

[class*="product_tag-customfields"] .pc-scene__layer {
    position: relative;
}

[class*="product_tag-customfields"] .pc-scene__layer--pillow {
    z-index: 1;
    transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}

[class*="product_tag-customfields"] .pc-scene__layer--duvet {
    z-index: 2;
    clip-path: inset(0 0 0 0);
    transition: transform .7s cubic-bezier(.22, .61, .36, 1), clip-path .7s cubic-bezier(.22, .61, .36, 1);
}

[class*="product_tag-customfields"] .pc-scene__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity .35s ease;
}

[class*="product_tag-customfields"] .pc-scene__img.is-current {
    position: relative;
    opacity: 1;
}

/* poses: tucked overview, zoom on pillow, zoom on duvet */

/* the duvet images carry ~5% baked white margin on top; when tucked it is
   clipped away so the duvet's own top hem forms the edge that crosses the pillow */
[class*="product_tag-customfields"] .pc-scene--overview .pc-scene__layer--duvet {
    transform: translateY(-5.5%); /* was -12% */
    clip-path: inset(5% 0 0 0);
}

/* pillow: fabric is 50% of image width centred at ~51.5%, so 1.6x keeps the
   whole pillow (incl. its soft shadow) inside the frame; the stage origin
   sits at the stage top so the pillow's top edge keeps its overview position */
[class*="product_tag-customfields"] .pc-scene--pillow .pc-scene__stage {
    transform: scale(1.6);
}

/* duvet: the pillow glides up out of the frame while the duvet slides up and
   scales to fill the width — the fabric spans 86% of image width, so 1.15x is
   the largest zoom that does not cut its sides */
[class*="product_tag-customfields"] .pc-scene--duvet .pc-scene__layer--pillow {
    transform: translateY(-120%);
}

[class*="product_tag-customfields"] .pc-scene--duvet .pc-scene__layer--duvet {
    transform: translate(-0.7%, -36.5%) scale(1.15);
    transform-origin: 50% 0;
}

/* magnifying-glass lens on hover (desktop pointers only — see configurator.js);
   size must match lens.size in configurator.js */

[class*="product_tag-customfields"] .pc-scene__lens {
    position: absolute;
    top: 0;
    left: 0;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 5;
    will-change: transform;
}

[class*="product_tag-customfields"] .pc-scene__lens.is-active {
    opacity: 1;
}

[class*="product_tag-customfields"] .pc-scene__zoom {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

/* ------------------------------------------------------------ wizard */

[class*="product_tag-customfields"] .pc-wizard {
    margin-bottom: 2.5em;
}

/* progress */

[class*="product_tag-customfields"] .pc-wizard__progress {
    margin-bottom: 2em;
}

[class*="product_tag-customfields"] .pc-wizard__progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .6em;
}

[class*="product_tag-customfields"] .pc-wizard__step-name {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

[class*="product_tag-customfields"] .pc-wizard__step-count {
    font-size: .75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .55;
}

[class*="product_tag-customfields"] .pc-wizard__bar {
    height: 2px;
    background: hsl(0, 0%, 90%);
}

[class*="product_tag-customfields"] .pc-wizard__bar-fill {
    display: block;
    height: 100%;
    width: 0;
    background: hsl(0, 0%, 0%);
    transition: width .45s ease;
}

/* steps */

[class*="product_tag-customfields"] .pc-wizard__step {
    display: none;
}

[class*="product_tag-customfields"] .pc-wizard__step.active {
    display: block;
    animation: pc-wizard-step-in .45s ease both;
}

@keyframes pc-wizard-step-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* the progress bar step name replaces the original section headings */
[class*="product_tag-customfields"] .pc-wizard__step .cpf-type-header .tm-epo-element-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="colour"] .tm-section-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pillow"] .tm-section-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="duvet"] .tm-section-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="colour"] .cpf-type-radio > .tm-epo-element-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="colour"] .tc-element-container > .tm-epo-element-label {
    display: none;
}

/* no required asterisks in the type & size, pillowcase and duvet cover steps */
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="type"] .tm-epo-required,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pillow"] .tm-epo-required,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="duvet"] .tm-epo-required {
    display: none;
}

/* the zipper choice is free — hide its "0 kr." price tag */
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pillow"] .tc-price-wrap {
    display: none;
}

/* the optional packaging config in the summary step is introduced by our own
   prompt, so the section's original heading and long description are hidden */
[class*="product_tag-customfields"] .pc-gift-section .tm-section-label,
[class*="product_tag-customfields"] .pc-gift-section .cpf-type-header,
[class*="product_tag-customfields"] .pc-gift-section .tm-epo-element-label,
[class*="product_tag-customfields"] .pc-gift-section .tm-description {
    display: none;
}

[class*="product_tag-customfields"] .pc-wizard__gift {
    margin-bottom: 2.5em;
}

[class*="product_tag-customfields"] .pc-wizard__gift-prompt {
    font-family: adobe-caslon-pro, serif;
    font-size: 1.15rem;
    line-height: 1.4;
    margin-bottom: 1em;
}

/* the optional gift box is a single toggleable checkbox */
[class*="product_tag-customfields"] .pc-gift-section input.tmcp-field[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border: 1px solid hsl(0, 0%, 0%);
    border-radius: 0;
    background: transparent;
    margin: 0 .5em 0 0;
    padding: 0;
    vertical-align: -2px;
    cursor: pointer;
}

[class*="product_tag-customfields"] .pc-gift-section input.tmcp-field[type="radio"]:checked {
    background: hsl(0, 0%, 0%);
    box-shadow: inset 0 0 0 2.5px hsl(0, 0%, 100%);
}

/* pattern swatches share the colour chooser grid: up to 3 per line at full
   width (1-2 options keep the same size), scaled down to 4 per line when a
   fourth option exists */
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"] .tc-images-container > li.tmcp-field-wrap {
    width: calc((100% - 30px) / 3) !important;
    margin: 0 !important;
}

[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"] .tc-images-container:has(> li.tmcp-field-wrap:nth-child(4)) > li.tmcp-field-wrap {
    width: calc((100% - 45px) / 4) !important;
}

/* the plugin switches a selected image option to a two-column grid to make
   room for its (hidden) clear button; the grid gap then shrinks the swatch.
   Keep the flex layout so selection only adds the border, not a resize */
[class*="product_tag-customfields"] .pc-wizard .tm-has-clearbutton ul.tmcp-ul-wrap li.tmcp-field-wrap.tc-active {
    display: flex;
}

/* simplified pattern configuration: a favourite pattern picker on top, and the
   four real pattern sections collapse to a question + dropdown each */
[class*="product_tag-customfields"] .pc-pattern-fav__label {
    display: block;
    margin-bottom: .6em;
    font-size: .95rem;
    font-weight: 600;
}

[class*="product_tag-customfields"] .pc-pattern-fav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    list-style: none;
    margin: 0 0 1.5em;
    padding: 0;
}

[class*="product_tag-customfields"] .pc-pattern-fav__item {
    position: relative;
    width: calc((100% - 30px) / 3);
    margin: 0;
    cursor: pointer;
}

[class*="product_tag-customfields"] .pc-pattern-fav__list:has(> .pc-pattern-fav__item:nth-child(4)) > .pc-pattern-fav__item {
    width: calc((100% - 45px) / 4);
}

[class*="product_tag-customfields"] .pc-pattern-fav__name {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 .5em;
    color: hsl(0, 0%, 0%);
    font-size: .85rem;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 0 8px hsla(0, 0%, 100%, .9), 0 0 3px hsla(0, 0%, 100%, .9);
    pointer-events: none;
}

[class*="product_tag-customfields"] .pc-pattern-fav__swatch {
    display: block;
    width: 100%;
    height: auto;
}

[class*="product_tag-customfields"] .pc-pattern-fav__item.is-selected .pc-pattern-fav__swatch {
    outline: 2px solid hsl(0, 0%, 0%);
    outline-offset: -1px;
}

[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"] .pc-pattern-override .tm-section-label,
[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"] .pc-pattern-override .tmcp-ul-wrap {
    display: none !important;
}

/* a colour with a single pattern makes the override dropdowns pointless —
   show a subtle note with a way back to the colour step instead */
[class*="product_tag-customfields"] .pc-pattern-single-note {
    display: none;
    margin-top: 2em;
    font-size: .9rem;
}

[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"].pc-pattern-single .pc-pattern-single-note {
    display: block;
}

[class*="product_tag-customfields"] .pc-wizard__step[data-step-key="pattern"].pc-pattern-single .pc-pattern-override__field {
    display: none;
}

[class*="product_tag-customfields"] .pc-pattern-single-note__text {
    display: block;
    margin-bottom: .9em;
    line-height: 1.4;
}

[class*="product_tag-customfields"] .pc-pattern-single-note__btn {
    appearance: none;
    border: 1px solid hsl(0, 0%, 0%);
    background: transparent;
    color: hsl(0, 0%, 0%);
    height: auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: .45em 1.4em !important;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .25s ease, color .25s ease;
}

[class*="product_tag-customfields"] .pc-pattern-single-note__btn:hover {
    background: hsl(0, 0%, 0%);
    color: hsl(0, 0%, 100%);
}

[class*="product_tag-customfields"] .pc-pattern-override__field {
    margin: 2em 0 0;
}

[class*="product_tag-customfields"] .pc-pattern-override__label {
    display: block;
    margin-bottom: .6em;
    font-size: .95rem;
    font-weight: 600;
}

[class*="product_tag-customfields"] .pc-pattern-override__select {
    width: 100%;
    max-width: 100%;
}

/* navigation: a slim back/next row above the progress bar, a full-width next
   button below the step content, and the summary step's large back button */

[class*="product_tag-customfields"] .pc-wizard__nav {
    display: flex;
    align-items: center;
    gap: 1em;
    width: 100%;
}

[class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__back,
[class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__next {
    appearance: none;
    border: 1px solid hsl(0, 0%, 0%);
    background: transparent;
    color: hsl(0, 0%, 0%);
    /* the theme's form.cart button rule forces height:60px/padding:10px */
    height: auto !important;
    padding: .55em 2em !important;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, opacity .25s ease;
}

[class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__back:hover,
[class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__next:hover {
    background: hsl(0, 0%, 0%);
    color: hsl(0, 0%, 100%);
}

/* top row: compact buttons at the edges, mirroring the progress meta row
   (step name left, step counter right) */
[class*="product_tag-customfields"] .pc-wizard__nav--top {
    margin: 0 0 1.5em;
}

[class*="product_tag-customfields"] .pc-wizard__nav--top .pc-wizard__back,
[class*="product_tag-customfields"] .pc-wizard__nav--top .pc-wizard__next {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 7.5em;
    margin: 0 !important;
    text-align: center;
}

[class*="product_tag-customfields"] .pc-wizard__nav--top .pc-wizard__next {
    margin: 0 0 0 auto !important;
}

/* bottom row: next only, full width (the theme's add-to-cart widget forces
   width:500px and a left margin on buttons inside form.cart) */
[class*="product_tag-customfields"] .pc-wizard__nav--bottom {
    flex-direction: column;
    align-items: stretch;
    gap: .75em;
    margin-top: 1.5em;
}

[class*="product_tag-customfields"] .pc-wizard__nav--bottom .pc-wizard__next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 60px;
    margin: 0 !important;
}

/* the "View cart" link shown after a successful add sits inside the button,
   aligned right, while "Add to cart" stays centered. The height matches the
   button (60px) so the whole strip is clickable; the extra bottom padding
   lifts the text a little above the button's vertical center */
[class*="product_tag-customfields"] .pc-addtocart-wrap {
    position: relative;
    display: flow-root;
}

[class*="product_tag-customfields"] .pc-addtocart-wrap .added_to_cart.wc-forward {
    position: absolute;
    top: 0;
    right: 6px;
    height: 60px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0 14px 16px;
    background: transparent;
    color: hsl(0, 0%, 0%);
    font-size: .8rem;
}

[class*="product_tag-customfields"] .pc-wizard__error-msg {
    color: hsl(0, 65%, 40%);
    font-size: .85rem;
}

[class*="product_tag-customfields"] .pc-wizard__field-error {
    outline: 1px solid hsl(0, 65%, 40%);
    outline-offset: 4px;
}

/* summary step */

[class*="product_tag-customfields"] .pc-wizard__step--summary .quantity {
    margin-bottom: 1em;
}

[class*="product_tag-customfields"] .pc-wizard__step--summary .single_add_to_cart_button {
    width: 100% !important;
    max-width: 100%;
    margin-inline-start: 0 !important;
}

[class*="product_tag-customfields"] .pc-wizard__step--summary .quantity .pc-qty-btn {
    cursor: pointer;
    user-select: none;
}

/* the floated quantity/add-to-cart row must not overflow the step box */
[class*="product_tag-customfields"] .pc-wizard__step--summary::after {
    content: '';
    display: block;
    clear: both;
}

/* info content below the configurator */

[class*="product_tag-customfields"] .pc-after-config {
    border-top: 1px solid hsl(0, 0%, 90%);
    margin-top: 3em;
    padding-top: 2.5em;
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 920px) {
    [class*="product_tag-customfields"] .pc-wizard__nav {
        flex-wrap: wrap;
    }

    [class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__back,
    [class*="product_tag-customfields"] .pc-wizard__nav .pc-wizard__next {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ------------------------------------------------- mini cart flyout */
/* Simplified cart preview for customized bed linen — markup is added
   server-side only while the mini cart renders (see functions.php), so
   these rules never touch the main cart page. */

.woocommerce-mini-cart .elementor-menu-cart__product:has(.pc-mini-thumb) {
    grid-template-columns: 110px 1fr;
}

.woocommerce-mini-cart .elementor-menu-cart__product-image {
    width: 110px;
}

.woocommerce-mini-cart .pc-mini-thumb {
    display: block;
    float: none !important;
    width: 100%;
    margin: 0 0 8px;
}

.woocommerce-mini-cart .pc-mini-thumb img {
    float: none !important;
    display: block;
    box-shadow: none !important;
}

.woocommerce-mini-cart .pc-mini-thumb__pillow {
    width: 100%;
    margin: 0 auto;
}

.woocommerce-mini-cart .pc-mini-thumb__duvet {
    width: 100%;
    margin-top: -11%;
}

.woocommerce-mini-cart .pc-mini-qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid hsl(0, 0%, 85%);
    margin-top: 8px;
    color: #1e1e1e;
}

.woocommerce-mini-cart .pc-mini-qty__btn {
    width: 30px;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1e1e1e;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.woocommerce-mini-cart .pc-mini-qty__btn:hover {
    background: hsl(0, 0%, 95%);
}

.woocommerce-mini-cart .pc-mini-qty__val {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    border-left: 1px solid hsl(0, 0%, 85%);
    border-right: 1px solid hsl(0, 0%, 85%);
    font-size: 13px;
}

.woocommerce-mini-cart .tm-cart-edit-options {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 22px;
    border: 1px solid currentColor;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}

.woocommerce-mini-cart .pc-mini-qty__btn:disabled {
    opacity: .35;
    cursor: default;
}

.woocommerce-mini-cart .pc-mini-qty__btn:disabled:hover {
    background: transparent;
}

/* questions and remarks are bold for scannability */
[class*="product_tag-customfields"] .pc-wizard .tm-epo-element-label {
    font-weight: 600;
}

/* swatch names are always shown inside the square instead of in a hover
   bubble (the plugin's floating tooltip is suppressed in configurator.js).
   Scoped to image swatches only, so text radios and checkboxes keep their
   inline layout */
[class*="product_tag-customfields"] .pc-wizard .tmhexcolorimage-li-nowh .tc-label-wrap {
    position: relative;
}

[class*="product_tag-customfields"] .pc-wizard .tmhexcolorimage-li-nowh .tc-label.radio-image-label,
[class*="product_tag-customfields"] .pc-wizard .tmhexcolorimage-li-nowh .tc-label.radio-image-label:hover {
    position: absolute;
    visibility: visible;
    opacity: 1;
    transform: none;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 .5em;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: hsl(0, 0%, 0%);
    font-size: .85rem;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 0 8px hsla(0, 0%, 100%, .9), 0 0 3px hsla(0, 0%, 100%, .9);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[class*="product_tag-customfields"] .pc-wizard .tmhexcolorimage-li-nowh .tc-label.radio-image-label::before,
[class*="product_tag-customfields"] .pc-wizard .tmhexcolorimage-li-nowh .tc-label.radio-image-label::after {
    display: none;
}
