section.product-details.pdp-details {
    display: block;
    max-width: 78rem;
    margin: 0 auto;
    padding: clamp(var(--space-sm), 3vw, var(--space-xl));
    text-align: left;
}

.pdp-hero {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: clamp(var(--space-md), 3vw, var(--space-xl));
    align-items: start;
}

.pdp-hero--compact {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: var(--space-md);
}

.pdp-media {
    min-width: 0;
}

section.pdp-details .product-detail.pdp-image-frame {
    display: block;
    aspect-ratio: 4 / 3;
    margin: 0;
    overflow: hidden;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.pdp-image-link,
.pdp-image-frame img,
.pdp-image-placeholder {
    display: block;
    width: 100%;
    height: 100%;
}

.pdp-image-frame img,
.pdp-thumbnail img {
    object-fit: contain;
}

.pdp-image-placeholder {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--space-sm);
    color: var(--color-text-muted);
}

.pdp-image-placeholder i {
    font-size: var(--text-2xl);
}

.pdp-gallery {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding: var(--space-sm) var(--space-2xs);
    scrollbar-width: thin;
}

.pdp-thumbnail {
    flex: 0 0 auto;
    display: inline-grid;
    width: 4.25rem;
    height: 4.25rem;
    overflow: hidden;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-soft);
}

.pdp-thumbnail img {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.pdp-thumbnail[aria-current="true"] {
    border-color: var(--color-accent-hover);
}

.pdp-image-link:focus-visible,
.pdp-thumbnail:focus-visible,
.pdp-summary a:focus-visible {
    outline: 2px solid var(--color-accent-hover);
    outline-offset: -3px;
}

.pdp-gallery .pdp-thumbnail--video {
    place-content: center;
    justify-items: center;
    gap: var(--space-2xs);
    color: var(--color-text);
    font-size: var(--text-xs);
}

.pdp-video-player {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
    margin: 0;
}

.pdp-video-player video {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--color-surface-soft);
}

.pdp-video-player figcaption {
    max-height: 4em;
    overflow: auto;
    padding: var(--space-xs) var(--space-sm);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
}

.pdp-image-link[hidden],
.pdp-image-placeholder[hidden],
.pdp-video-player[hidden] {
    display: none;
}

@media (min-width: 901px) {
    .pdp-hero--galleryFirst .pdp-media--with-rail {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 7rem;
        grid-template-rows: minmax(0, 1fr);
        gap: var(--space-sm);
    }

    .pdp-hero--galleryFirst .pdp-gallery {
        flex-direction: column;
        height: 0;
        min-height: 100%;
        overflow-y: auto;
        padding: var(--space-2xs);
    }

    .pdp-hero--galleryFirst .pdp-thumbnail {
        flex: none;
        width: 100%;
    }
}

/* Keep the existing seller CSS hooks for the information panel and price. */
.pdp-hero .product-tile.pdp-summary,
body.marketplace-page .pdp-hero .product-tile.pdp-summary {
    display: block;
    min-width: 0;
    overflow: visible;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    box-shadow: none;
}

:where(.pdp-summary).product-tile .product-info,
body.marketplace-page .pdp-summary.product-tile .product-info {
    gap: var(--space-sm);
    min-height: 0;
    padding: clamp(var(--space-md), 2vw, var(--space-lg));
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: none;
}

.pdp-summary .pdp-title {
    margin: 0;
    color: inherit;
    font-size: clamp(var(--text-xl), 3.2vw, var(--text-3xl));
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.pdp-byline,
:where(.pdp-summary).product-tile .price,
.pdp-actions {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-sm);
    color: inherit;
    overflow-wrap: anywhere;
}

.pdp-summary .pdp-byline a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: var(--space-2xs);
}

.pdp-price strong {
    font-size: var(--text-xl);
}

.pdp-facts {
    display: grid;
    gap: var(--space-xs);
    margin: 0;
    padding-block-start: var(--space-sm);
    border-block-start: 1px solid var(--color-border);
    font-size: var(--text-sm);
    text-align: start;
}

.pdp-facts > div {
    display: grid;
    /* The label column never shrinks below its longest word, so "Shipping" stays whole. */
    grid-template-columns: minmax(auto, 2fr) minmax(0, 3fr);
    gap: var(--space-xs) var(--space-sm);
}

.pdp-facts dt,
.pdp-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.pdp-facts dt {
    overflow-wrap: break-word;
    display: grid;
    grid-template-columns: 1em minmax(auto, 1fr);
    gap: var(--space-xs);
    align-items: baseline;
    font-weight: 600;
}

.pdp-rating {
    margin: 0;
    font-size: var(--text-sm);
}

.pdp-actions a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 2.75rem;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: inherit;
}

.pdp-actions a.saved .pdp-action-add,
.pdp-actions a:not(.saved) .pdp-action-remove {
    display: none;
}

.pdp-actions a.saved {
    border-color: var(--color-accent-hover);
    color: var(--color-accent-hover);
}

.pdp-description {
    margin: var(--space-lg) 0 var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    overflow-wrap: anywhere;
}

section:where(.pdp-details).product-details .extended-description {
    width: 100%;
    max-width: none;
    max-height: none;
    margin: var(--space-md) 0 0;
    border-radius: var(--radius-sm);
    overflow-wrap: anywhere;
}

section.pdp-details .extended-description summary {
    display: list-item;
    cursor: pointer;
    padding: var(--space-md);
    font-weight: bold;
}

section.pdp-details .extended-description[open] summary {
    border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}

section.pdp-details .extended-description-content > h3:first-child {
    display: none;
}

section.pdp-details .extended-description-content > :last-child,
section.pdp-details .extended-description-content > .review:last-child > :last-child {
    margin-block-end: 0;
}

section.pdp-details .extended-description-content :is(img, video) {
    max-width: 100%;
}

@media (max-width: 900px) {
    section.product-details.pdp-details {
        padding-top: 3.25rem;
    }

    /* Give the fixed launcher the same clearance when the announcement comes first. */
    .pdp-page .storefront > .storefront-announcement {
        margin-block-start: 3.25rem;
    }

    .storefront-announcement + section.product-details.pdp-details {
        padding-top: var(--space-md);
    }

    /* Keep the launcher over the header edge instead of covering product details. */
    .pdp-page .floating-tools .sidebar-launcher {
        top: var(--space-xs);
        right: var(--space-xs);
        bottom: auto;
        left: auto;
        padding: var(--space-xs) var(--space-md);
    }

    .pdp-page .floating-tools .sidebar-launcher .cart-count-badge {
        left: auto;
        right: -.35rem;
        top: -.25rem;
    }

    .pdp-page .floating-tools .back-to-top {
        top: auto;
        bottom: var(--space-md);
    }
}

@media (max-width: 700px) {
    .pdp-hero,
    .pdp-hero--compact {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-sm);
    }
}

/*
 * Structured buy box (Phase 4). The well, rules and check mix currentColor, so they follow the
 * form's own text color: dark on the Green purchase panel, and whatever a seller's branding sets
 * on storefronts. The fallback and the embedded host controls share every rule below.
 */
.pdp-buy-box .pdp-buy-well {
    --pdp-buy-rule: color-mix(in srgb, currentColor 24%, transparent);
    --pdp-buy-tint: color-mix(in srgb, currentColor 5%, transparent);
    width: min(100%, 36rem);
    margin: 0 auto var(--space-xl);
    padding: var(--space-xs) clamp(var(--space-sm), 3vw, var(--space-lg)) var(--space-lg);
    border: 1px solid var(--pdp-buy-rule);
    border-radius: var(--radius-lg);
    background-image: linear-gradient(var(--pdp-buy-tint), var(--pdp-buy-tint));
    box-shadow: inset 0 1px 3px color-mix(in srgb, currentColor 14%, transparent);
}

.pdp-buy-box .pdp-buy-step {
    margin: 0;
    padding-block: var(--space-md) 0;
}

/* Steps are numbered by what is shown: a hidden step (display: none) does not count, so a product
   with no options starts at "1. Delivery". The address part continues Delivery and counts only
   when it hosts Delivery's heading, because no method control shows Delivery's own title. */
form.pdp-buy-box {
    counter-reset: pdp-step;
}

.pdp-buy-box .pdp-buy-step:not(.pdp-buy-step--address),
.pdp-buy-box .pdp-buy-step--address[data-pdp-step-enhanced] {
    counter-increment: pdp-step;
}

/* Without the step script the address part names Delivery itself (its own title, numbered) only
   when no method control, pickup notice or scheduler shows Delivery's title in the region. The
   :is() list mirrors the rule below that hides an empty step. Once public/js/pdp-buy-steps.js runs,
   it owns Delivery's heading and the title never shows. */
form.pdp-buy-box:not([data-pdp-steps-enhanced]):not(:has(.pdp-buy-step[data-pdp-step="delivery"]:not(.pdp-buy-step--address) :is(.group, .s-booking-selector .s-booking-header, .flash, .help))) .pdp-buy-step--address {
    counter-increment: pdp-step;
}

form.pdp-buy-box[data-pdp-steps-enhanced] .pdp-buy-step--address > .pdp-buy-step__title,
form.pdp-buy-box:has(.pdp-buy-step[data-pdp-step="delivery"]:not(.pdp-buy-step--address) :is(.group, .s-booking-selector .s-booking-header, .flash, .help)) .pdp-buy-step--address > .pdp-buy-step__title {
    display: none;
}

/* Chrome would name the heading ". Delivery" (it drops counter values from accessible names), so
   the number gets empty alternative text; the first declaration serves browsers without it. */
.pdp-buy-box .pdp-buy-step__title::before,
.pdp-buy-box .pdp-buy-step__name::before {
    content: counter(pdp-step) ". ";
    content: counter(pdp-step) ". " / "";
}

.pdp-buy-box .pdp-buy-step:not(:has(.group, .s-booking-selector .s-booking-header, .flash, .help)) {
    display: none;
}

.pdp-buy-box .pdp-buy-step__title,
.pdp-buy-box .pdp-buy-step__heading {
    margin: 0 0 var(--space-md);
    padding: 0 0 var(--space-xs);
    font-size: var(--text-lg);
    color: inherit;
    border-bottom: 1px solid var(--pdp-buy-rule);
}

/* The guest intro ("Or buy now with guest checkout") and its group keep no bottom margin, so a
   collapsed or hidden address part leaves no blank band above Your details. Where the address
   continues Delivery without a heading, it carries the space after the intro itself; where it shows
   Delivery's heading, it is spaced like any other step. */
form.pdp-buy-box:not(.pdp-buy-box--cart-only) .s-add-to-cart-help {
    margin-bottom: 0;
}

form.pdp-buy-box[data-pdp-steps-enhanced] .pdp-buy-step--address:not([data-pdp-step-enhanced]),
form.pdp-buy-box:not([data-pdp-steps-enhanced]):has(.pdp-buy-step[data-pdp-step="delivery"]:not(.pdp-buy-step--address) :is(.group, .s-booking-selector .s-booking-header, .flash, .help)) .pdp-buy-step--address {
    margin-top: var(--space-2xl);
    padding-top: 0;
}

/* Shipping details stay one column at every width. */
.pdp-buy-box .split {
    display: block;
}

.pdp-buy-box .pdp-buy-total {
    width: min(100%, 25rem);
    margin: var(--space-md) auto var(--space-lg);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--pdp-buy-rule);
}

.pdp-buy-box .pdp-buy-total__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2xs) var(--space-md);
    padding-block: var(--space-3xs);
}

.pdp-buy-box .pdp-buy-total__value {
    font-variant-numeric: tabular-nums;
}

/* Step headings once public/js/pdp-buy-steps.js enhances them: a disclosure button per step. The
   generated heading is an h3 like the title it replaces, so it keeps the site's heading styles. */
.pdp-buy-box .pdp-buy-step[data-pdp-step-enhanced] > .pdp-buy-step__title {
    display: none;
}

.pdp-buy-box .pdp-buy-step__toggle {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    margin: 0;
    padding: var(--space-3xs) 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    font: inherit;
    line-height: var(--leading-tight, 1.25);
    text-align: inherit;
    cursor: pointer;
}

.pdp-buy-box .pdp-buy-step__toggle:hover .pdp-buy-step__name {
    text-decoration: underline;
    text-underline-offset: .2em;
}

.pdp-buy-box .pdp-buy-step__toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.pdp-buy-box .pdp-buy-step__check {
    display: none;
    place-items: center;
    /* Scales the circle and its tick together, a little smaller than the heading text (bk, 2026-11-25). */
    font-size: .8em;
    width: 1.2em;
    height: 1.2em;
    margin-right: var(--space-xs);
    border: 2px solid currentColor;
    border-radius: 50%;
    vertical-align: middle;
}

.pdp-buy-box .pdp-buy-step__check::before {
    content: '';
    width: .28em;
    height: .55em;
    margin-top: -.12em;
    border: solid currentColor;
    border-width: 0 .13em .13em 0;
    transform: rotate(45deg);
}

.pdp-buy-box .pdp-buy-step__toggle[data-complete] .pdp-buy-step__check {
    display: inline-grid;
}

.pdp-buy-box .pdp-buy-step__summary {
    display: block;
    margin-top: var(--space-3xs);
    font-size: var(--text-base);
    font-weight: normal;
    overflow-wrap: anywhere;
}

.pdp-buy-box .pdp-buy-step__action {
    display: inline-block;
    margin-top: var(--space-3xs);
    font-size: var(--text-sm);
    font-weight: normal;
    text-decoration: underline;
    text-underline-offset: .2em;
}

/* Expanded steps show a small chevron; collapsed steps show their summary and Edit. */
.pdp-buy-box .pdp-buy-step__toggle[aria-expanded="true"] .pdp-buy-step__name::after {
    content: '';
    display: inline-block;
    width: .4em;
    height: .4em;
    margin-left: var(--space-xs);
    border: solid currentColor;
    border-width: .12em .12em 0 0;
    transform: translateY(-.05em) rotate(-45deg);
}

.pdp-buy-box .pdp-buy-step__toggle[aria-expanded="true"] :is(.pdp-buy-step__summary, .pdp-buy-step__action) {
    display: none;
}

/* Collapsing only hides: every control stays in the form, enabled and in place, so it still posts. */
.pdp-buy-box .pdp-buy-step[data-pdp-collapsed="primary"] > :not(.pdp-buy-step__heading),
.pdp-buy-box [data-pdp-collapsed="part"] {
    display: none;
}

.pdp-buy-box .pdp-buy-step[data-pdp-collapsed="primary"] > .pdp-buy-step__heading {
    margin-bottom: 0;
}

/* A collapsed step's heading rule already separates it from the summary below. */
.pdp-buy-box .pdp-buy-step[data-pdp-collapsed="primary"] + .pdp-buy-total {
    border-top: 0;
}

.pdp-buy-box .pdp-buy-step__sr,
.pdp-buy-box .pdp-buy-step__live {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 700px) {
    form.pdp-buy-box {
        padding-inline: var(--space-sm);
    }
}
