/* ==========================================================================
   Single product: "Product extra info" accordion
   --------------------------------------------------------------------------
   Markup: includes/woo-product-extra.php (native <details>/<summary>).
   assets/js/product-extra.js only enhances the closing animation and
   guarantees single-open behaviour, so everything below must also work
   without it.

   Toggle animation (no JS): the content wrapper animates `grid-template-rows`
   (0fr -> 1fr); closing is instant. When assets/js/product-extra.js is active
   it adds .is-js to the card and animates the height with jQuery instead
   (slideToggle style), so the grid rules below are switched off there.
   ========================================================================== */

/* Design tokens (adjust per brand if needed) */
:root {
    --primalpath-extra-duration: 340ms;
    --primalpath-extra-ease: cubic-bezier(0.2, 1, 0.3, 1);
    --primalpath-extra-bg: var(--primalpath-card-bg, #F7F6F3);
    --primalpath-extra-title-color: var(--primalpath-title-color, #3B4344);
    --primalpath-extra-text-color: var(--primalpath-excerpt-color, #6F7679);
    --primalpath-extra-divider: rgba(0, 0, 0, 0.09);
    --primalpath-extra-pad-x: 40px;
    --primalpath-extra-pad-y: 34px;
    --primalpath-extra-title-pad-y: 26px;
}

/* Beige card below the add to cart row */
body .primalpath-product-extra {
    box-sizing: border-box;
    margin: 26px 0 50px;
    padding: 34px 34px;
    background-color: var(--primalpath-extra-bg);
    border-radius: 24px;
}

/* Title row (the toggle trigger) */
body .primalpath-product-extra .primalpath-product-extra-item {
    display: block;
}

body .primalpath-product-extra .primalpath-product-extra-title {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: var(--primalpath-extra-title-pad-y) 0;
    cursor: pointer;
    list-style: none; /* hides the native marker */
    outline-offset: 4px;
}

body .primalpath-product-extra .primalpath-product-extra-title::-webkit-details-marker {
    display: none;
}

body .primalpath-product-extra .primalpath-product-extra-title::marker {
    content: '';
}

body .primalpath-product-extra .primalpath-product-extra-item:first-child > .primalpath-product-extra-title {
    padding-top: 0;
}

body .primalpath-product-extra .primalpath-product-extra-item:last-child > .primalpath-product-extra-title {
    padding-bottom: 0;
}

body .primalpath-product-extra .primalpath-product-extra-title:hover .primalpath-product-extra-label {
    opacity: 0.72;
}

body .primalpath-product-extra .primalpath-product-extra-title:focus-visible {
    outline: 2px solid var(--green-600, #1B4A54);
    outline-offset: 4px;
    border-radius: 6px;
}

body .primalpath-product-extra .primalpath-product-extra-label {
    flex: 1;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.3px;
    color: var(--primalpath-extra-title-color);
}

/* Chevron (thin, rotates on open) */
body .primalpath-product-extra .primalpath-product-extra-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    line-height: 0;
    color: var(--primalpath-extra-title-color);
    transition: transform var(--primalpath-extra-duration) var(--primalpath-extra-ease);
}

body .primalpath-product-extra .primalpath-product-extra-icon svg {
    display: block;
    width: 100%;
    height: auto;
}

body .primalpath-product-extra .primalpath-product-extra-item[open] > .primalpath-product-extra-title .primalpath-product-extra-icon {
    transform: rotate(180deg);
}

/* Hairline dividers: above every item except the first, and under an open title */
body .primalpath-product-extra .primalpath-product-extra-item + .primalpath-product-extra-item > .primalpath-product-extra-title {
    border-top: 1px solid var(--primalpath-extra-divider);
}

body .primalpath-product-extra .primalpath-product-extra-item[open] > .primalpath-product-extra-title {
    border-bottom: 1px solid var(--primalpath-extra-divider);
    padding-bottom: 22px;
}

/* Collapsible content (no JS: grid-rows animation). */
body .primalpath-product-extra:not(.is-js) .primalpath-product-extra-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--primalpath-extra-duration) var(--primalpath-extra-ease);
}

body .primalpath-product-extra:not(.is-js) .primalpath-product-extra-item[open] > .primalpath-product-extra-content {
    grid-template-rows: 1fr;
}

/* JS takes over the height there; only the native hiding must stay off once
   the script (which adds .is-js) also owns the [open] attribute. */
body .primalpath-product-extra.is-js > .primalpath-product-extra-item > .primalpath-product-extra-content {
    transition: none;
}

body .primalpath-product-extra .primalpath-product-extra-body {
    min-height: 0;
    overflow: hidden;
    padding-bottom: 26px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--primalpath-extra-text-color);
}

/* WYSIWYG rhythm inside the accordion (ACF already applies `acf_the_content`) */
body .primalpath-product-extra .primalpath-product-extra-body > *:first-child {
    margin-top: 0;
}

body .primalpath-product-extra .primalpath-product-extra-body > *:last-child {
    margin-bottom: 0;
}

body .primalpath-product-extra .primalpath-product-extra-body p {
    margin: 0 0 16px;
}

body .primalpath-product-extra .primalpath-product-extra-body ul,
body .primalpath-product-extra .primalpath-product-extra-body ol {
    margin: 0 0 16px;
    padding-left: 22px;
}

body .primalpath-product-extra .primalpath-product-extra-body li {
    margin-bottom: 6px;
}

body .primalpath-product-extra .primalpath-product-extra-body h3,
body .primalpath-product-extra .primalpath-product-extra-body h4,
body .primalpath-product-extra .primalpath-product-extra-body h5,
body .primalpath-product-extra .primalpath-product-extra-body h6 {
    margin: 26px 0 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    color: var(--primalpath-extra-title-color);
}

body .primalpath-product-extra .primalpath-product-extra-body strong,
body .primalpath-product-extra .primalpath-product-extra-body b {
    font-weight: 600;
    color: var(--primalpath-extra-title-color);
}

body .primalpath-product-extra .primalpath-product-extra-body a {
    color: var(--green-600, #1B4A54);
    text-decoration: underline;
}

/* ==========================================================================
   Reduced motion + responsive
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    body .primalpath-product-extra .primalpath-product-extra-content,
    body .primalpath-product-extra .primalpath-product-extra-icon {
        transition: none;
    }
}

@media only screen and (max-width: 690px) {
    body .primalpath-product-extra {
        --primalpath-extra-pad-x: 20px;
        --primalpath-extra-pad-y: 24px;
        --primalpath-extra-title-pad-y: 22px;
        border-radius: 14px;
    }

    body .primalpath-product-extra .primalpath-product-extra-label {
        font-size: 20px;
    }

    body .primalpath-product-extra .primalpath-product-extra-body {
        font-size: 14px;
    }
}


