/* ============================================================
   Ways to Buy — accordion section
   ============================================================ */

.ways-to-buy.wp-block-ipm-wp-ways-to-buy {
    margin-block-start: 0;
    margin: var(--wp--preset--spacing--50) 0;
    padding: 0;
    position: relative;
    z-index: 30;
}

/* Header row ------------------------------------------------- */

.ways-to-buy__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.ways-to-buy__title {
    font-family: 'The Seasons', the-seasons, serif;
    font-size: 3rem;
    font-style: normal;
    color: #422486;
    margin: 0;
    line-height: 1.15;
    width: 100%;
    text-align: center;
}

.ways-to-buy__all-products {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Source Sans Pro', 'Source Sans 3', sans-serif;
    font-size: 1.5rem;
    color: #6d6d6d;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
    position: absolute;
    right: 0;
}

.ways-to-buy__all-products:hover {
    color: #422486;
}

.ways-to-buy__all-products-arrow {
    font-size: 1.5em;
    line-height: 1;
}

/* Panels container ------------------------------------------- */

.ways-to-buy__panels {
    display: flex;
    flex-direction: row-reverse; /* DOM order is Wear→Accumulate→Buy; row-reverse puts Buy on the left */
    gap: 0.5rem;
    height: 680px;
    align-items: stretch;
}

/* Individual panel ------------------------------------------- */

.ways-to-buy__panel {
    /* border: 3px solid #fff; */
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    /* Delay on close so content fades out before the panel shrinks */
    transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s;
}

/* DOM order: Wear(1), Accumulate(2), Buy(3). row-reverse makes Buy leftmost/dominant. */
.ways-to-buy__panel:nth-child(1) {
    z-index: 25;
}

.ways-to-buy__panel:nth-child(2) {
    z-index: 50;
}
.ways-to-buy__panel:nth-child(3) {
    z-index: 100;
}
.ways-to-buy__panel.is-open {
    flex: 4;
    cursor: default;
    /* No delay on open — expand immediately */
    transition: flex 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.2s;;
}

/* Inner wrapper clips the bg image and overlay */
.ways-to-buy__panel-inner {
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    /* clip-path is applied in the compositor's property tree, so it correctly
       clips composited children (overflow:hidden + border-radius only applies a
       rectangular clip to composited layers — the rounding is ignored). */
    clip-path: inset(0 round 1rem);
}

/* In row-reverse Buy(:last-child) is leftmost — Wear and Accumulate slide under it */
.ways-to-buy__panel:not(:last-child) .ways-to-buy__panel-inner {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    clip-path: inset(0 round 0 1rem 1rem 0);
    padding-left: 1rem;
    /* margin-left: -1rem; */
}

/* Background image */
.ways-to-buy__panel-bg {
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ways-to-buy__panel.is-open .ways-to-buy__panel-bg {
    transform: scale(1.02);
}

/* Panel header — label badge at top-right */
.ways-to-buy__panel-header {
    padding: 0;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 100;
}

.ways-to-buy__panel-label {
    font-family: 'Source Sans Pro', 'Source Sans 3', sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1;
}

/* Panel footer — category label at bottom */
.ways-to-buy__panel-footer {
    position: absolute;
    bottom: 1.5rem;
    left: 1.25rem;
    right: 1.25rem;
    z-index: 2;
    pointer-events: none;
    z-index: 100;
}

.ways-to-buy__panel-category {
    font-family: 'The Seasons', the-seasons, serif;
    font-size: 2rem;
    font-style: normal;
    color: #fff;
    text-transform: capitalize;
    line-height: 1.2;
    display: block;
    text-align: right;
}

/* Content panel — fade wrapper for text */
.ways-to-buy__panel-content {
    position: absolute;
    inset: 0;
    z-index: 3;
    /* opacity: 0;
    visibility: hidden; */
    transition: filter 0.3s ease 0.25s, opacity 0.2s ease, visibility 0s ease 0.2s;
    pointer-events: none;
}

.ways-to-buy__panel.is-open .ways-to-buy__panel-content {
    opacity: 1;
    visibility: visible;
    transition: filter 0.3s ease 0.25s, opacity 0.3s ease 0.25s, visibility 0s ease 0s;
    pointer-events: auto;
}

/* Text-box: small positioned box — its own box-shadow provides the scrim,
   morphing from a big diffuse blob (closed) to a tight halo (open). Stays
   fixed in size and position throughout, so no JS measurement is needed. */
.ways-to-buy__panel-text-box {
    position: absolute;
    top: 2rem;
    left: 2.5rem;
    width: 500px;
    padding: 1.75rem 2rem;
    background-color: rgba(0,0,0,0.75);
    border: 1px solid rgba(255, 255, 255, 0);
    border-radius: 1rem;
    box-shadow: -48px -48px 50px 600px rgba(0, 0, 0, 0.75);
    transition: box-shadow 1s ease 0.2s, border 1.25s ease 0.5s, filter 0.5s ease 0.25s;
    filter: blur(5px);
}

/* Static comparison variant — no animation. Add/remove this class on
   .ways-to-buy__panel-inner by hand (devtools or a temporary render.php edit)
   to A/B against the pure box-shadow scrim. */
.ways-to-buy__panel-inner.has-backdrop-blur {
    backdrop-filter: blur(6px);
}

.ways-to-buy__panel-content-title {
    font-family: 'The Seasons', the-seasons, serif;
    font-size: 2rem;
    font-style: normal;
    color: #fff;
    margin: 0 0 0.875rem;
    line-height: 1.2;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: bottom center;
    transition: opacity 0.4s ease-out 0.25s, visibility 0s ease-out 0.25s, transform 0.4s ease-out 0.25s;
}

.ways-to-buy__panel-content-body {
    font-family: 'Source Sans Pro', 'Source Sans 3', sans-serif;
    font-size: 1.5rem;
    color: #fff;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: bottom center;
    transition: opacity 0.4s ease-out 0.25s, visibility 0s ease-out 0.25s, transform 0.4s ease-out 0.25s;
}

.ways-to-buy__panel-content-body p {
    margin: 0 0 0.75rem;
}

.ways-to-buy__panel.is-open .ways-to-buy__panel-text-box {
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0);
    transition: box-shadow 1s ease 0.2s, border 0.3s ease 0.2s, filter 0.3s ease 0.25s;
    filter: blur(0);
}

.ways-to-buy__panel-content-body p:last-child {
    margin-bottom: 0;
}

.ways-to-buy__panel-content-list {
    color: #fff;
    font-family: source-sans-3, sans-serif;
    font-size: 1.5rem;
    list-style: disc;
    margin: 0 0 0.75rem;
    padding-left: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: bottom center;
    transition: opacity 0.4s ease-out 0.25s, visibility 0s ease-out 0.25s, transform 0.4s ease-out 0.25s;
}

.ways-to-buy__panel-content-list li {
    margin-bottom: 0.375rem;
}

/* CTA buttons */
.ways-to-buy__panel-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: bottom center;
    transition: opacity 0.4s ease-out 0.25s, visibility 0s ease-out 0.25s, transform 0.4s ease-out 0.25s;
}

.ways-to-buy__panel-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 1000px;
    font-family: 'Source Sans Pro', 'Source Sans 3', sans-serif;
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.ways-to-buy__panel-cta:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.ways-to-buy__panel.is-open .ways-to-buy__panel-text-box .ways-to-buy__panel-content-title,
.ways-to-buy__panel.is-open .ways-to-buy__panel-text-box .ways-to-buy__panel-content-body,
.ways-to-buy__panel.is-open .ways-to-buy__panel-text-box .ways-to-buy__panel-content-list,
.ways-to-buy__panel.is-open .ways-to-buy__panel-text-box .ways-to-buy__panel-ctas {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.5s ease-in 0.5s, visibility 0s ease-in 0.5s, transform 0.5s ease-in 0.5s;
}

/* Toggle button — straddles the right edge of each panel */
.ways-to-buy__panel-toggle {
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 5rem;
    height: 9rem;
    border-top-left-radius: 50rem;
    border-bottom-left-radius: 50rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(30, 16, 61, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.5s ease;
    flex-shrink: 0;
}

/* Open panel: fade the toggle to signal it's already active */
.ways-to-buy__panel.is-open .ways-to-buy__panel-toggle {
    opacity: 0.35;
    cursor: default;
    transform: scale(0.5) translateY(-100%) translateX(50%);
}

.ways-to-buy__panel-toggle:hover {
    background: rgba(66, 36, 134, 0.95);
}

.ways-to-buy :focus {
    outline: none;
    box-shadow: 0 0 8px 3px rgba(255, 255, 255, 0.5);
}

.ways-to-buy__panel-toggle-icon {
    align-items: center;
    display: flex;
    background-color: #fff;
    border-radius: 100%;
    width: 1.75rem;
    height: 1.75rem;
    justify-content: center;
}

.ways-to-buy__panel-toggle-icon svg {
    width: 13px;
    height: 13px;
}

/* Hide the toggle on the last panel (no panel to its right) */
/* .ways-to-buy__panel:last-child .ways-to-buy__panel-toggle {
    display: none;
} */

/* ============================================================
   Editor preview (non-interactive stacked layout)
   ============================================================ */

.ways-to-buy--editor .ways-to-buy__editor-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.ways-to-buy--editor .ways-to-buy__editor-panel {
    background: #1e103d;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    color: #fff;
}

.ways-to-buy--editor .ways-to-buy__editor-panel-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    opacity: 0.75;
}

.ways-to-buy--editor .ways-to-buy__panel-content-title {
    color: #fff;
    font-family: 'The Seasons', the-seasons, serif;
    margin: 0 0 0.5rem;
}

.ways-to-buy--editor .ways-to-buy__panel-content-body {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

.ways-to-buy--editor .ways-to-buy__panel-ctas {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ways-to-buy--editor .ways-to-buy__panel-cta {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 1000px;
    color: #fff;
    font-size: 0.875rem;
}

/* ============================================================
   Mobile — panels stack bottom-to-top using column-reverse
   ============================================================ */

@media (max-width: 821px) {
    .ways-to-buy__header {
        margin: 0 0 0.5rem 0;
        /* Offsets the scrollIntoView() target in render.php so the fixed
           mobile header doesn't cover it. */
        scroll-margin-top: 100px;
    }

    .ways-to-buy__title {
        margin: 0;
        text-align: left;
    }

    .ways-to-buy__all-products {
        font-size: 1.5rem;
    }

    .ways-to-buy__panels {
        flex-direction: column; /* DOM order Wear→Accumulate→Buy gives correct top-to-bottom order */
        height: auto;
        gap: 0;
    }

    /* Restore z-index for column: Wear(:first-child) on top, Buy(:last-child) on bottom */
    .ways-to-buy__panel:nth-child(1) { z-index: 100; }
    .ways-to-buy__panel:nth-child(3) { z-index: 25; }

    /* Closed panel: short collapsed height */
    .ways-to-buy__panel {
        border: 1px solid rgba(255, 255, 255, 0.5);
        flex: 0 0 50px;
        cursor: pointer;
        transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s;
    }

    /* Wear(:first-child) is at the top — reset desktop :not(:last-child) left-edge overlap */
    .ways-to-buy__panel:first-child .ways-to-buy__panel-inner {
        border-radius: 1rem;
        clip-path: inset(0 round 1rem);
        padding-left: 0;
        margin-left: 0;
    }

    /* Accumulate and Buy slide up under the panel above them */
    .ways-to-buy__panel:not(:first-child) .ways-to-buy__panel-inner {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 1rem;
        border-bottom-right-radius: 1rem;
        clip-path: inset(0 round 0 0 1rem 1rem);
        padding-left: 0;
        /* padding-top: 1.5rem; */
        margin-left: 0;
        /* margin-top: -1.5rem; */
    }

    /* Open panel: expands to fit content */
    .ways-to-buy__panel.is-open {
        flex: 0 0 510px;
        cursor: default;
        transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* On mobile the toggle sits at the top-left, rotated 90° */
    .ways-to-buy__panel-toggle {
        left: 2rem;
        right: 0;
        top: 1px;
        transform: translateY(-35%) rotate(270deg) scale(0.65);
    }

    /* Hide the toggle on the open panel — no accidental taps over the content */
    .ways-to-buy__panel.is-open .ways-to-buy__panel-toggle {
        visibility: hidden;
        opacity: 0;
        transform: translateY(-35%) rotate(270deg) scale(0.65);
        transition: transform 0 ease 0, opacity 0.65s ease 0.3s, visibility 0s ease 0;
    }

    /* Always show the toggle on closed panels (even last-child) */
    .ways-to-buy__panel:not(.is-open):last-child .ways-to-buy__panel-toggle {
        visibility: visible;
        opacity: 1;
        transform: translateY(-35%) rotate(270deg) scale(0.65);
        transition: transform 0 ease 0, opacity 0.65s ease 0.3s, visibility 0s ease 0;
    }

    /* Label badge: top-right with a dark pill background on mobile */
    /* .ways-to-buy__panel-header {
        top: auto;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        top: 50%;
        transform: translate(-50%, -50%);
    } */

    .ways-to-buy__panel.is-open .ways-to-buy__panel-header {
        /* top: 1rem; */
        left: auto;
        right: 1rem;
        transform: none;
    }

    .ways-to-buy__panel-label {
        display: inline-block;
        padding: 0.2em 0.75em;
        font-size: 0.85rem;
        position: absolute;
        top: 0.5rem;
        right: 0;
        transition: border 0.3s ease, background 0.3s ease;
    }

    .ways-to-buy__panel:first-child .ways-to-buy__panel-label {
        /* top: 0.5rem; */
        margin: 0;
    }

    .ways-to-buy__panel.is-open .ways-to-buy__panel-label {
        background: rgba(30, 16, 61, 0.8);
        border: 0.05rem solid rgba(255, 255, 255, 0.4);
        border-radius: 70px;
        transition: border 0.3s ease, background 0.3s ease;
    } 

    /* .ways-to-buy__panel:first-child .ways-to-buy__panel-label {
        top: 0;
    } */

    .ways-to-buy__panel-content-list {
        font-size: 1rem;
    }

    /* Footer category label: only visible when open on mobile */
    .ways-to-buy__panel-footer {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        opacity: 0;
    }

    .ways-to-buy__panel.is-open .ways-to-buy__panel-footer {
        opacity: 1;
    }

    .ways-to-buy__panel-category {
        font-size: 1.5rem;
        text-align: left;
    }

    /* Text-box: full width on mobile, box-shadow scaled down for the narrower panel */
    .ways-to-buy__panel-text-box {
        top: 4rem;
        left: 1rem;
        width: calc(100% - 3rem);
        max-width: 38rem;
        padding: 1.5rem;
        box-shadow: -32px -32px 16px 140px rgba(0, 0, 0, 0.75);
    }

    .ways-to-buy__panel.is-open .ways-to-buy__panel-text-box {
        box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0);
    }

    .ways-to-buy__panel-content-title {
        font-size: 2rem;
        margin: 0;
    }

    .ways-to-buy__panel-content-body {
        font-size: 1.5rem;
        line-height: 1.45;
        margin: 0.5rem 0;
    }

    .ways-to-buy__panel-content-list {
        margin: 0.5rem 0;
        font-size: 1.5rem;
        line-height: 1.45;
    }

    .ways-to-buy__panel-cta {
        font-size: 1.5rem;
        line-height: 1.45;
        padding: 0.5rem 1.125rem;
    }
}

@media (max-width: 500px) {
    .ways-to-buy__panel-text-box {
        width: calc(100% - 4rem);
    }
}
