/**
 * Product page (plg_system_sibleproduct)
 *
 * Loaded through the web asset manager (media/joomla.asset.json) on J2Store
 * single product pages. Design: Figma "Product Page" (303:679). Values come
 * from the --sf- tokens (plg_system_siblefoundation); raw px values are Figma
 * layout measurements with no variable behind them, and each says where it
 * comes from. Mobile type styles below 48rem, Desktop from 48rem. Breakpoints
 * are Gantry's: 30rem, 48rem, 60rem, 75rem.
 *
 * Order: this stylesheet loads BEFORE the Gantry CSS, so every rule is scoped
 * under body.sible-pdp and wins on specificity, not load order.
 * !important: one use, and Gantry forces it: .text-success in bootstrap5.css is green with !important, and the
 * "Item Added To Cart" message is a .text-success (see the rule).
 *
 * Every value comes from the foundation tokens (--sf-*); the interim bridge variables are gone.
 */

/* ------------------------------------------------------------ page frame */

/*
 * Full bleed dark ground (Figma ground/inverse). Gantry boxes component output
 * in #g-intro > .g-container (75rem) > .g-grid > .g-block > .g-content >
 * .platform-content.container > .row > .col with padding at every level; these
 * rules flatten that chain on product pages only (body.sible-pdp).
 */
body.sible-pdp,
body.sible-pdp #g-page-surround {
    background: var(--sf-color-ground-inverse);
}

body.sible-pdp #g-intro {
    padding: 0;
    background: var(--sf-color-ground-inverse);
    color: var(--sf-color-ink-inverse);
}

body.sible-pdp #g-intro > .g-container {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

body.sible-pdp #g-intro .g-content {
    margin: 0;
    padding: 0;
}

body.sible-pdp #g-intro .platform-content {
    max-width: none;
    margin: 0;
    /* Phones: 31 above the panel (was 32, then 16, then 15 more at the designer's request; the header and the sticky search row sit above it). */
    padding: calc(var(--sf-space-xl) - 1px) var(--sf-space-md) var(--sf-space-4xl);
}

body.sible-pdp #g-intro .platform-content .row {
    margin: 0;
}

body.sible-pdp #g-intro .platform-content .col {
    padding: 0;
}

@media (min-width: 48rem) {
    /* 81 between the header and the panel (Figma has 95; 30 less, then 15 more, at the designer's request). */
    body.sible-pdp #g-intro .platform-content {
        padding: calc(var(--sf-space-4xl) - 15px) var(--sf-space-xl) var(--sf-space-4xl);
    }
}

/* ----------------------------------------------------------- product panel */

/*
 * Figma "Product View" (333:1156): a 1144 wide paper panel, radius-md, with a
 * rough edge (Texture effect). The paper sits on a ::before layer so the edge
 * filter (#sp-paper-edge, emitted by the plugin) does not touch the text.
 * Padding is the Figma measurement: 34 left, 29 right, 36 top and bottom, and
 * 69 between the photos and the details.
 */
body.sible-pdp .j2store-single-product {
    --pdp-pad-y: 36px; /* Figma 303:679, photos top 36, panel bottom 36 */
    --pdp-pad-start: 34px; /* Figma, photos left */
    --pdp-pad-end: 29px; /* Figma, details right */
    --pdp-gap: 69px; /* Figma, photos to details */
    --pdp-details-top: 6px; /* the space above the title and the rest of the details column: Figma has 36 (the title 36 below the top of the photos); 30 less, at the designer's request */
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    max-width: 1144px;
    margin: 0 auto;
    padding: 20px; /* Mobile B homepage side padding; Figma has no phone product frame yet */
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-body);
}

body.sible-pdp .j2store-single-product::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--sf-color-ground-page) url("../../plg_system_siblefoundation/images/paper.webp") center / cover;
    border-radius: var(--sf-radius-md);
    /* brightness: Figma darkens the paper fill (exposure -0.07). */
    filter: url("#sp-paper-edge") brightness(0.95);
}

@media (min-width: 48rem) {
    body.sible-pdp .j2store-single-product {
        padding: var(--pdp-pad-y) var(--pdp-pad-end) var(--pdp-pad-y) var(--pdp-pad-start);
        font: var(--sf-type-desktop-body);
    }
}

/*
 * J2Store's minimal-bs.css clearfix gives every .row an empty ::before and ::after
 * (display: table) at some widths (768 to 991). In a grid or flex row those become
 * items and push the photos into the second column, so they are removed.
 */
body.sible-pdp .j2store-single-product .row::before,
body.sible-pdp .j2store-single-product .row::after {
    content: none;
    display: none;
}

/*
 * Photos and details: one column below 56rem, 545 : 467 from 56rem (Figma).
 * 56rem is not a Gantry breakpoint: it is where the details column reaches about
 * 320px with the panel padding (details = (viewport - 196px) x 0.4615, so 320px at
 * about 889px). At 48rem the column would be 260px, too narrow for the price row,
 * quantity and Add to Cart. Below it the gallery sits on top and the details below.
 */
body.sible-pdp .j2store-single-product > div > .row:first-child {
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-lg);
    margin: 0;
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}

body.sible-pdp .j2store-single-product > div > .row:first-child > [class*="col-"] {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    flex: none;
}

@media (min-width: 56rem) {
    body.sible-pdp .j2store-single-product > div > .row:first-child {
        display: grid;
        grid-template-columns: minmax(0, 545fr) minmax(0, 467fr);
        column-gap: var(--pdp-gap);
        align-items: start;
    }

    /* The details column starts --pdp-details-top (6; Figma 36) below the top of the photos. */
    body.sible-pdp .j2store-single-product > div > .row:first-child > [class*="col-"]:last-child {
        padding-top: var(--pdp-details-top);
    }
}

/* ------------------------------------------------- title, vendor and price */

/*
 * The title never breaks a word. Its size is the Figma 38 (no Mobile style yet, see below) unless its widest word would not
 * fit the room the title has, in which case it is made smaller, down to 16px, until it does. PHP writes the width of
 * the widest word on the title in em (--pdp-title-em, from the title font's measured glyph widths, with a safety
 * margin: Helper/TitleFit); the room is the details column (--pdp-details-w) less the stamps' space at 75rem and up
 * (--pdp-title-reserve) less 16 for the scrollbar and rounding. The page script measures the real words and shrinks
 * the title further only if the estimate was not enough (for example when the web font did not load). Words are
 * only ever broken at spaces and hyphens: overflow-wrap is normal.
 * From 75rem, where the stamps take room beside the title, the size is never below 24 (--pdp-title-floor) for the
 * sake of fitting beside them: if a word is still too wide beside the stamps at 24, the line simply drops below the
 * stamps (the float makes the browser do that) and only a word too wide for the whole column at 24 is made smaller
 * than that, down to 16, so it never overflows.
 */
body.sible-pdp .product-title {
    --pdp-title-size: 38px;
    --pdp-title-reserve: 0px;
    --pdp-title-floor: 16px;
    margin: 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-product-title); /* no Mobile style in Figma yet: Desktop at all widths */
    font-size: min(
        var(--pdp-title-size),
        max(
            calc((var(--pdp-details-w) - var(--pdp-title-reserve) - 16px) / var(--pdp-title-em, 1)),
            min(var(--pdp-title-floor), calc((var(--pdp-details-w) - 16px) / var(--pdp-title-em, 1))),
            16px
        )
    );
    letter-spacing: 0;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
}

/*
 * Phones: Figma has no Mobile Product Title style yet. DERIVED, pending a Figma style:
 * the other mobile headings are about 0.82 of their desktop size (36 to 30, 32 to 26,
 * 24 to 20), so 38 becomes about 31px, scaling down on narrow screens (28px at 320).
 */
@media (max-width: 47.99rem) {
    body.sible-pdp .product-title {
        --pdp-title-size: clamp(1.75rem, 1.4rem + 1.5vw, 1.95rem);
    }
}

/* Figma "Artist": Body, underlined. The vendor name, linked to the storefront. */
body.sible-pdp .sible-vendor {
    margin: 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-body);
}

body.sible-pdp .sible-vendor-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

/* Phones: the vendor name is a 44 high tap target; the negative margins keep the title, name and price spacing about as it was. */
@media (max-width: 47.99rem) {
    body.sible-pdp .sible-vendor {
        margin-block: -8px;
    }

    body.sible-pdp .sible-vendor-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

body.sible-pdp a.sible-vendor-link:hover {
    text-decoration-thickness: 2px;
}

body.sible-pdp a.sible-vendor-link:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-vendor {
        font: var(--sf-type-desktop-body);
    }
}

/*
 * Where the vendor is based (1.4.5, restored at the owner's request; not in Figma): under the vendor name, a pin,
 * "Based in" and the location the vendor set, then the verified tick when it applies. Caption type in ink, the pin
 * in ink secondary, the tick in color/accent/green. A flex box, so beside the floated stamps (below 75rem) it sits
 * in the room left of them, as the name does.
 */
body.sible-pdp .sible-vendor-loc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-2xs) 6px;
    margin: var(--sf-space-2xs) 0 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-caption);
}

body.sible-pdp .sible-vendor-loc__pin {
    display: block;
    flex: none;
    color: var(--sf-color-ink-secondary);
}

body.sible-pdp .sible-verified {
    display: inline-flex;
    align-items: center;
    color: var(--sf-color-accent-green);
}

body.sible-pdp .sible-verified svg {
    display: block;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-vendor-loc {
        font: var(--sf-type-desktop-caption);
    }
}

/* ----------------------------------------------------------------- stamps */

/*
 * The brand pair on every product: Made in Victoria (313:677) and the postage stamp (305:705), not rotated (Figma).
 * From 75rem they sit top right of the details column as in Figma: the postage stamp's right edge on the column's
 * right edge, raised 24 above the column top (Figma 8), 12 below the panel's top edge, Made in Victoria to its left and 9 below the column top, 100 wide each (Figma
 * 117.707, made smaller so the title keeps its room; the placement is the same). They are absolutely placed, so
 * they never move anything; the title wraps around them (see the title rules below). Below 75rem the details column
 * is too narrow for that (it is 323 at 896), so the pair shrinks to 72 and floats right beside the vendor name and
 * the price, under the title: the title keeps the full width, and the vendor name and price wrap beside them.
 * The markup is after the title; both placements work from the same markup.
 */
/* The width of the details column, worked out from the panel as for the photos (--pdp-photo-w): phones, a single
   column from 48rem, 467 : 545 of what is left after the gap from 56rem. The title, the stamps and the rail read it. */
body.sible-pdp .j2store-single-product {
    --pdp-details-w: calc(100vw - 72px);
}

@media (min-width: 48rem) {
    body.sible-pdp .j2store-single-product {
        --pdp-details-w: calc(min(1144px, 100vw - 64px) - 63px);
    }
}

@media (min-width: 56rem) {
    body.sible-pdp .j2store-single-product {
        --pdp-details-w: calc((min(1144px, 100vw - 64px) - 132px) * 467 / 1012);
    }
}

body.sible-pdp .sible-stamps {
    float: right;
    display: flex;
    gap: 10px;
    margin: 0 0 0 12px;
}

/* Each stamp is 19% of the column, between 48 and 72: enough room is left beside them for the vendor name
   and the price to keep their lines (63 at 402, 61 at 896, 72 from 768 where the column is wide). */
body.sible-pdp .sible-stamp {
    display: block;
    width: clamp(48px, calc(var(--pdp-details-w) * 0.19), 72px);
}

body.sible-pdp .sible-stamp img {
    display: block;
    width: 100%;
    height: auto;
}

/*
 * The description is a box that clips its overflow (clamped), so a float next to it would not be wrapped
 * around: the whole box would be squeezed to the space beside the float. It clears the float instead, so if the
 * stamps hang a few pixels below the price the description starts that much lower and keeps its full width.
 */
body.sible-pdp .sible-desc {
    clear: right;
}

@media (min-width: 75rem) {
    body.sible-pdp .j2store-single-product > div > .row:first-child > [class*="col-"]:last-child {
        position: relative;
    }

    body.sible-pdp .sible-stamps {
        float: none;
        display: block;
        margin: 0;
    }

    /* 100 wide (Figma 117.707): the title lines beside them need the room, and a title must never break a word. */
    body.sible-pdp .sible-stamp {
        position: absolute;
        width: 100px;
    }

    body.sible-pdp .sible-stamp--postage {
        top: -24px; /* Figma has it 7.5 above the column top; raised as far as the panel allows: 12 below the panel's top edge (the column starts 36 below it). Nothing is up there to collide with. */
        right: 0;
    }

    body.sible-pdp .sible-stamp--victoria {
        top: 9px; /* Figma: 44.75 against 35.75 */
        right: 124px; /* 24 between the stamps (Figma 30), 100 for the postage stamp */
    }

    /*
     * The title makes room for the stamps by wrapping around them, not by being narrow all the way down: an empty
     * float at its right (the stamps' width and gap, 16 clear) as tall as the stamps reach below the title's top
     * (about 107 with the title 6 below the column top), so only the first three lines or so are shorter and the rest use the full column. The title is
     * sized (see above) so its widest word fits beside the float. The vendor name wraps around the float too when
     * the title is short. With only the postage stamp the float is narrower.
     */
    body.sible-pdp .product-title {
        --pdp-title-reserve: 240px; /* 100 + 24 + 100 + 16 */
        --pdp-title-floor: 24px; /* beside the stamps the title is never made smaller than this (see below) */
    }

    body.sible-pdp .product-title:has(+ .sible-stamps > .sible-stamp--postage:only-child) {
        --pdp-title-reserve: 116px; /* 100 + 16 */
    }

    body.sible-pdp .product-title::before {
        content: "";
        float: right;
        width: var(--pdp-title-reserve);
        height: calc(113px - var(--pdp-details-top)); /* the stamps reach 109 below the column top (Made in Victoria: 9 + 100), plus 4; the title starts --pdp-details-top below it */
    }
}

/* Price (Figma Price Large). The stock line beside it is styled under "purchase" (stock dot). */
body.sible-pdp .price-sku-brand-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-sm) var(--sf-space-md);
    margin: 27px 0 0; /* Figma: vendor name bottom to price top is 27 */
    padding: 0;
    border: 0; /* j2store.css draws a rule above and below this row */
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}

body.sible-pdp .price-sku-brand-container > [class*="col-"] {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

body.sible-pdp .product-price-container,
body.sible-pdp .product-price-container .sale-price {
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-price-large);
    letter-spacing: var(--sf-tracking-price-large);
}

/* The "$" comes from J2Store's own price text (the CAD currency symbol, launch plan block 6b), never from CSS. */

/* ---------------------------------------------------------- old look */

/* ------------------------------------------------------------------ photos */

/*
 * Figma "Product Photos" (316:779): a column of photos, 20 apart, radius-md, the first
 * 2468 : 2006 and the others 3 : 2 (cropped to fill), in a 545 : 569 box that scrolls so
 * the next photo peeks out. Helper/Gallery wraps J2Store's images in .sible-gallery and
 * puts each one in a real button that opens the photo viewer. From 56rem the column is
 * the scroll region; below it the first photo sits on top and the others are a swipe strip.
 * One photo is a single image with no scrolling; no photo is a placeholder panel.
 */
body.sible-pdp .sible-gallery {
    --pdp-photo-gap: 20px; /* Figma Product Photos, item spacing */
    /* The width of the photo column, worked out from the panel (see the panel rules above), so a
       photo's height cap can follow it. (container-type: inline-size would do it, but it makes the
       column collapse to nothing in a flex column layout.) */
    --pdp-photo-w: calc(100vw - 72px); /* phones: 16 outside and 20 inside the panel on each side */
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-sm);
    min-width: 0;
}

body.sible-pdp .sible-gallery > * {
    flex: none;
    min-width: 0;
    margin: 0;
    padding: 0;
}

body.sible-pdp .sible-gallery .j2store-mainimage .zoom {
    display: block;
    width: 100%;
}

body.sible-pdp .sible-photo-open {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--sf-radius-md);
    background: none;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
}

/*
 * No cropping. Each photo is shown at its own shape: the server sets width and height from the
 * file (EXIF orientation applied), so the box is the photo's own ratio and nothing shifts when it
 * loads. A tall photo is capped so it cannot dominate: from 56rem the cap is the height of Figma's
 * first photo (443 on a 545 wide column, so the next photo always peeks 106 below it in the scroll
 * box), below 56rem it is the height of the whole 545 : 569 box. A capped photo is shown whole,
 * centred, with the paper showing at its sides (object-fit: contain).
 */
body.sible-pdp .sible-gallery img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: calc(var(--pdp-photo-w) * 569 / 545);
    object-fit: contain;
    border-radius: var(--sf-radius-md);
    background: transparent;
}

/* Photo column width: 48rem up the panel is 1144 at most, with 32 outside it; a single column is the panel
   less its 63 of padding, two columns (56rem up) are 545 : 467 of what is left after the 69 gap. */
@media (min-width: 48rem) {
    body.sible-pdp .sible-gallery {
        --pdp-photo-w: calc(min(1144px, 100vw - 64px) - 63px);
    }
}

@media (min-width: 56rem) {
    body.sible-pdp .sible-gallery {
        --pdp-photo-w: calc((min(1144px, 100vw - 64px) - 132px) * 545 / 1012);
    }
}

/* Keyboard focus: two rings, ink outside and white inside, so it shows on any photo. */
body.sible-pdp .sible-photo-open:focus-visible {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: -3px;
}

body.sible-pdp .sible-photo-open:focus-visible img {
    outline: 3px solid var(--sf-color-ground-page);
    outline-offset: -6px;
}

/* Below 56rem the other photos are a swipe strip under the first. */
body.sible-pdp .sible-gallery .j2store-product-additional-images {
    min-width: 0;
}

body.sible-pdp .sible-gallery .additional-image-list {
    display: flex;
    gap: var(--sf-space-sm);
    margin: 0;
    padding: 0;
    overflow-x: auto;
    list-style: none;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--sf-color-ink-primary) transparent;
}

body.sible-pdp .sible-gallery .additional-image-list > li {
    display: block;
    flex: 0 0 min(72%, 18rem);
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}

/* The swipe strip keeps a fixed 3 : 2 frame, photos shown whole on the paper. */
body.sible-pdp .sible-gallery .additional-image-list img {
    aspect-ratio: 3 / 2;
    max-height: none;
}

body.sible-pdp .sible-gallery .additional-image-list > li:only-child {
    flex-basis: 100%;
}

/* No photo: a panel the size of the first photo. */
body.sible-pdp .sible-photo-none {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 2468 / 2006;
    border-radius: var(--sf-radius-md);
    background: var(--sf-color-line-default);
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-body-italic);
}

@media (min-width: 56rem) {
    body.sible-pdp .sible-gallery {
        gap: var(--pdp-photo-gap);
    }

    /* Several photos: the column scrolls inside a 545 : 569 box (Figma), the next photo peeking. */
    body.sible-pdp .sible-gallery--multi {
        aspect-ratio: 545 / 569;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--sf-color-ink-primary) transparent;
    }

    body.sible-pdp .sible-gallery--multi .additional-image-list {
        flex-direction: column;
        gap: var(--pdp-photo-gap);
        overflow: visible;
        scroll-snap-type: none;
    }

    body.sible-pdp .sible-gallery--multi .additional-image-list > li {
        flex: none;
    }

    /* In the scroll box every photo is capped at Figma's first photo height, and keeps its shape. */
    body.sible-pdp .sible-gallery--multi img,
    body.sible-pdp .sible-gallery--multi .additional-image-list img {
        aspect-ratio: auto;
        max-height: calc(var(--pdp-photo-w) * 443 / 545);
    }

}

/*
 * Gallery fill (media/js/product.js, 56rem up): the gallery follows the height of the details column. The script adds
 * .sible-gallery--fill and, on the photos it reveals, .is-revealed. Photo 1 comes first, then the revealed photos at
 * full width (each whole, at its own shape and the cap above), then the others as 3 : 2 thumbnails four to a row,
 * all in the one list so the order, the tab order and the viewer do not change. No scroll box: nothing is ever cut.
 * Without the script the box above is unchanged. The grid cell is sticky (the script turns it on where it has room to
 * travel): 24px from the top of the window, the same space as between the photos. The header is not sticky from 48rem up
 * (chrome.css makes it so on phones only), so nothing needs clearing.
 * Gantry gives #g-page-surround overflow: hidden, which makes it a scroll container, and a sticky element then sticks to
 * that (which never scrolls) and does not move. overflow: clip clips the same way without being a scroll container (the
 * foundation does the same under 48rem, for the same reason). A browser without clip keeps hidden: no sticky, nothing breaks.
 */
@media (min-width: 56rem) {
    body.sible-pdp .sible-gallery--multi.sible-gallery--fill {
        aspect-ratio: auto;
        overflow: visible;
    }

    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--sf-space-sm);
        overflow: visible;
    }

    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li {
        flex: 0 0 calc((100% - 3 * var(--sf-space-sm)) / 4);
    }

    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li:not(.is-revealed) img {
        aspect-ratio: 3 / 2;
        max-height: none;
    }

    /* Revealed: 20 below each one (the row gap is 12), none under the last. */
    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li.is-revealed {
        flex-basis: 100%;
        margin-bottom: calc(var(--pdp-photo-gap) - var(--sf-space-sm));
    }

    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li.is-revealed:last-child {
        margin-bottom: 0;
    }

    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li.is-new {
        animation: sible-photo-in 0.15s ease-out;
    }

    /* J2Store gives the main photo a 10px bottom margin (invisible in the old scroll box): it would make the first gap 30. */
    body.sible-pdp .sible-gallery--fill .j2store-mainimage img {
        margin-bottom: 0;
    }

    body.sible-pdp #g-page-surround {
        overflow: clip;
    }

    body.sible-pdp .sible-gallery-cell {
        position: sticky;
        top: var(--sf-space-lg);
        align-self: start;
    }
}

@keyframes sible-photo-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    body.sible-pdp .sible-gallery--multi.sible-gallery--fill .additional-image-list > li.is-new {
        animation: none;
    }
}

/* ------------------------------------------------------------ photo viewer */

/*
 * A modal <dialog> opened by the script (media/js/product.js). The dialog itself fills
 * the screen, so its background is a token colour and the ::backdrop stays clear.
 * Figma has no viewer: derived from the foundation tokens, pending designer approval.
 */
html.sible-lightbox-open {
    overflow: hidden;
}

dialog.sible-lightbox {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: var(--sf-space-md);
    border: 0;
    background: color-mix(in srgb, var(--sf-color-ground-inverse) 94%, transparent);
    color: var(--sf-color-ink-inverse);
}

dialog.sible-lightbox::backdrop {
    background: transparent;
}

dialog.sible-lightbox[open] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--sf-space-sm);
}

dialog.sible-lightbox [hidden] {
    display: none;
}

.sible-lightbox__fig {
    grid-row: 2;
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    margin: 0;
}

.sible-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--sf-radius-md);
    object-fit: contain;
}

.sible-lightbox__close {
    grid-row: 1;
    grid-column: 3;
    justify-self: end;
}

.sible-lightbox__prev {
    grid-row: 2;
    grid-column: 1;
}

.sible-lightbox__next {
    grid-row: 2;
    grid-column: 3;
}

.sible-lightbox__count {
    grid-row: 3;
    grid-column: 1 / -1;
    margin: 0;
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: var(--sf-tracking-label-mono);
    text-align: center;
}

.sible-lightbox__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--sf-color-line-strong);
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-ground-nav);
    color: var(--sf-color-ink-inverse);
    font: 400 28px/1 var(--sf-font-display);
    cursor: pointer;
}

.sible-lightbox__btn:hover:not(:disabled) {
    background: var(--sf-color-accent-green);
}

.sible-lightbox__btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.sible-lightbox__btn:focus-visible {
    outline: 2px solid var(--sf-color-ink-inverse);
    outline-offset: 2px;
}

/* Phones: the arrows move under the photo so it keeps the width. */
@media (max-width: 47.99rem) {
    .sible-lightbox__fig {
        grid-column: 1 / -1;
    }

    .sible-lightbox__prev {
        grid-row: 3;
        grid-column: 1;
    }

    .sible-lightbox__next {
        grid-row: 3;
        grid-column: 3;
    }

    .sible-lightbox__count {
        grid-column: 2;
    }
}

/* -------------------------------------------------------------- description */

/*
 * Figma "Description (Clamped)" (320:681): Product Description style, 229 tall on a 20px font,
 * that is 11.45em, with a mask fade (DEV NOTE 320:683: #000 65% to transparent 100%). The script
 * adds .is-clamped only when the text is taller than that, and a real Read More button. Without
 * the script the full text shows. A description is plain text, which the server turns into
 * paragraphs, emoji headings and bullet lists, or HTML, which keeps its own paragraphs and lists.
 */
body.sible-pdp .sible-desc {
    margin: 21px 0 0; /* Figma: price bottom to description top is 21 */
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-product-description);
    letter-spacing: var(--sf-tracking-product-description);
    overflow-wrap: break-word;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-desc {
        font: var(--sf-type-desktop-product-description);
        letter-spacing: var(--sf-tracking-product-description);
    }
}

@media (prefers-reduced-motion: no-preference) {
    body.sible-pdp .sible-desc {
        transition: max-height 0.4s ease;
    }
}

body.sible-pdp .sible-desc.is-clamped:not(.is-open) {
    max-height: 11.45em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 65%, transparent 100%);
}

/* While the script animates the height the text must not spill out. */
body.sible-pdp .sible-desc[style*="max-height"] {
    overflow: hidden;
}

body.sible-pdp .sible-desc p,
body.sible-pdp .sible-desc ul,
body.sible-pdp .sible-desc ol {
    margin: 0 0 0.8em;
}

body.sible-pdp .sible-desc > :last-child {
    margin-bottom: 0;
}

body.sible-pdp .sible-desc ul,
body.sible-pdp .sible-desc ol {
    padding: 0 0 0 1.1em;
}

body.sible-pdp .sible-desc li {
    margin: 0 0 0.25em;
}

body.sible-pdp .sible-desc li::marker {
    color: var(--sf-color-line-strong);
}

body.sible-pdp .sible-desc a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Emoji heading lines ("MEASUREMENTS & DETAILS"): mono label, the emoji kept as decoration. */
body.sible-pdp .sible-desc__h {
    margin: 1.1em 0 0.35em;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-label-mono);
    font-style: normal;
    letter-spacing: var(--sf-tracking-label-mono);
}

body.sible-pdp .sible-desc > div > .sible-desc__h:first-child {
    margin-top: 0;
}

body.sible-pdp .sible-desc__emoji {
    font-style: normal;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-desc__h {
        font: var(--sf-type-desktop-label-mono);
        letter-spacing: var(--sf-tracking-label-mono);
    }
}

body.sible-pdp .sible-desc .product-ldesc {
    margin-top: 0.8em;
}

/* Figma "+ Read More...": Courier Prime 20, line/strong, 8% tracking. A real button. */
body.sible-pdp .sible-readmore {
    display: inline-block;
    margin: 0;
    padding: 0.35em 0;
    border: 0;
    border-radius: var(--sf-radius-sm);
    background: none;
    color: var(--sf-color-line-strong);
    font: 400 20px/1.3 var(--sf-font-mono); /* Figma 318:783 (no text style behind it) */
    letter-spacing: 0.08em;
    text-align: left;
    cursor: pointer;
}

/* Phones: every tap target is at least 44 high. */
@media (max-width: 47.99rem) {
    body.sible-pdp .sible-readmore {
        min-height: 44px;
    }
}

body.sible-pdp .sible-readmore:hover {
    color: var(--sf-color-ink-primary);
}

body.sible-pdp .sible-readmore:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

/* --------------------------------------------------------------- purchase */

/*
 * Figma "Purchase Block" (394:948): Button / Primary, then the fulfilment note 12 below it, 24 below
 * the description. The cart form, its classes, the submit input and .j2store-notifications stay as
 * J2Store has them.
 */
body.sible-pdp .j2store-addtocart-form {
    display: flex;
    flex-direction: column;
    margin: 24px 0 0; /* Figma: Read More bottom to purchase block is 24 */
}

/*
 * Stock (1.4.5, restored at the owner's request; not in Figma): J2Store's own stock line ("1 In Stock",
 * "Out of Stock") beside the price, after a dot: color/accent/green in stock, color/accent/badge (red) sold
 * out. J2Store rewrites this line when a variant is picked, so the dot is drawn here, not in the markup. A
 * product that does not track stock has no stock line, so nothing shows.
 */
body.sible-pdp .product-stock-container {
    display: flex;
    align-items: center;
    margin: 0;
}

body.sible-pdp .product-stock-container .instock,
body.sible-pdp .product-stock-container .outofstock {
    display: inline-flex;
    align-items: center;
    gap: var(--sf-space-xs);
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: 0;
}

body.sible-pdp .product-stock-container .instock::before,
body.sible-pdp .product-stock-container .outofstock::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sf-color-accent-green);
}

body.sible-pdp .product-stock-container .outofstock::before {
    background: var(--sf-color-accent-badge);
}

body.sible-pdp .j2store-add-to-cart {
    order: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-sm);
    margin: 0;
}

body.sible-pdp .cart-action-complete {
    order: 3;
}

body.sible-pdp .j2store-notifications {
    order: 4;
}

/* Button / Primary: Default; Hover darkens to Ink (Figma 394:925). Label is Button Label 24 SemiBold. */
body.sible-pdp input.j2store-cart-button {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    box-sizing: border-box;
    min-height: 49px; /* Figma 394:949 */
    padding: 10px 36px;
    border: 0;
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-accent-green);
    box-shadow: none;
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-desktop-button-label);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
    body.sible-pdp input.j2store-cart-button {
        transition: background-color 0.2s ease;
    }
}

body.sible-pdp input.j2store-cart-button:hover {
    background: var(--sf-color-ink-primary);
}

/* Adding: J2Store disables the button and changes its label while the request runs. Derived, no Figma state. */
body.sible-pdp input.j2store-cart-button:disabled {
    background: var(--sf-color-line-strong);
    cursor: progress;
}

body.sible-pdp input.j2store-cart-button:focus-visible,
body.sible-pdp .j2store-checkout-link:focus-visible {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
    box-shadow: none;
}

/* Sold Out (Figma Button / Primary, State=Sold Out): the disabled button J2Store prints for a sold out product. */
body.sible-pdp .j2store-addtocart-form .outofstock,
body.sible-pdp input.j2store_button_no_stock {
    -webkit-appearance: none;
    appearance: none;
    align-self: flex-start; /* the form is a flex column: do not stretch the pill */
    order: 1;
    border: 0;
    box-shadow: none;
    opacity: 1; /* Bootstrap fades a disabled button; Sold Out has its own colours */
    cursor: default;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 49px;
    padding: 10px 36px;
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-line-default);
    color: var(--sf-color-line-strong);
    font: var(--sf-type-desktop-button-label);
}

/*
 * No shipping (1.5.0, at the owner's request; not in Figma): the checkout could offer no shipping for this item
 * (Sibleproduct::cannotShip). Add to Cart is disabled and greyed out like Sold Out, and J2Store's stock line gives
 * way to a grey dot line saying why (Details::noShipping, a separate element in the price row, so J2Store rewriting
 * its stock line on a variant change cannot bring the green dot back).
 */
body.sible-pdp .sible-noship input.j2store-cart-button,
body.sible-pdp .sible-noship input.j2store-cart-button:hover,
body.sible-pdp .sible-noship input.j2store-cart-button:disabled {
    background: var(--sf-color-line-default);
    color: var(--sf-color-line-strong);
    opacity: 1;
    cursor: not-allowed;
}

body.sible-pdp .sible-noship .product-stock-container {
    display: none;
}

body.sible-pdp .sible-noship-line {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: flex-start;
    gap: var(--sf-space-xs);
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: 0;
}

/* The dot sits on the first line when the message wraps on a phone. */
body.sible-pdp .sible-noship-line::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: .3em;
    margin-top: calc((1lh - 10px) / 2);
    border-radius: 50%;
    background: var(--sf-color-ink-secondary);
}

/* Quantity: a pill (a stepper once the script has added the buttons). A one of a kind product has no control. */
body.sible-pdp .product-qty {
    flex: 0 0 auto;
}

body.sible-pdp .product-qty input[name="product_qty"] {
    box-sizing: border-box;
    width: 5.5rem;
    height: 49px;
    padding: 0 12px;
    border: 1px solid var(--sf-color-line-strong);
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-ground-page);
    box-shadow: none;
    color: var(--sf-color-ink-primary);
    font: 400 20px/1 var(--sf-font-mono);
    text-align: center;
}

body.sible-pdp .product-qty input[name="product_qty"]:focus-visible {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

/* The stepper (added by the script): the pill belongs to the wrapper, the input sits inside it. */
body.sible-pdp .product-qty.sible-qty {
    display: inline-flex;
    align-items: stretch;
    box-sizing: border-box;
    height: 49px;
    border: 1px solid var(--sf-color-line-strong);
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-ground-page);
}

body.sible-pdp .product-qty.sible-qty:focus-within {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

body.sible-pdp .product-qty.sible-qty input[name="product_qty"] {
    width: 3.25rem;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
}

body.sible-pdp .product-qty.sible-qty input[name="product_qty"]:focus-visible {
    outline: 0;
}

body.sible-pdp .product-qty.sible-qty input::-webkit-outer-spin-button,
body.sible-pdp .product-qty.sible-qty input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

body.sible-pdp .sible-qty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--sf-radius-pill);
    background: none;
    color: var(--sf-color-ink-primary);
    font: 400 28px/1 var(--sf-font-display);
    cursor: pointer;
}

body.sible-pdp .sible-qty__btn > span {
    padding-bottom: 3px; /* the glyphs sit low in the line box; centre them */
}

body.sible-pdp .sible-qty__btn:hover {
    background: var(--sf-color-ground-cream);
}

body.sible-pdp .sible-qty__btn:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: -4px;
}

/* One of a kind: no quantity control. The input stays in the form (display none still submits it). */
body.sible-pdp .sible-stock--one .product-qty,
body.sible-pdp .sible-stock--one .product-qty.sible-qty {
    display: none;
}

/* "Item Added To Cart" and its Checkout link: derived, no Figma state. Shown by J2Store after adding. */
body.sible-pdp .cart-action-complete .text-success {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.4em;
    margin: 12px 0 0;
    padding: 10px 16px;
    border-radius: var(--sf-radius-md);
    background: var(--sf-color-ground-cream);
    color: var(--sf-color-ink-primary) !important; /* !important: Gantry's bootstrap5.css forces .text-success green with it */
    font: var(--sf-type-mobile-body);
}

body.sible-pdp .j2store-checkout-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

body.sible-pdp .j2store-checkout-link:hover {
    text-decoration-thickness: 2px;
}

/* Fulfilment note (Figma 394:951): Courier Prime 15, line/strong, no tracking, 12 under the button. */
body.sible-pdp .sible-fulfil {
    margin: 12px 0 0;
    color: var(--sf-color-line-strong);
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: 0;
}

/* Each segment stays in one piece: the line breaks at the space between segments, never inside one. The dot
   follows each segment but the last, so a wrapped line never starts with one. */
body.sible-pdp .sible-fulfil span {
    white-space: nowrap;
}

body.sible-pdp .sible-fulfil span:not(:last-child)::after {
    content: " \00b7";
}

/* The price is the price before delivery: one line says where delivery is chosen. Same type as the fulfilment line. */
body.sible-pdp .sible-checkout-note {
    margin: 4px 0 0;
    color: var(--sf-color-line-strong);
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: 0;
}

/* A quotable product has no fulfilment line: the quote script marks the button it changes. */
body.sible-pdp .j2store-single-product:has([data-sq-quote-link]) .sible-fulfil,
body.sible-pdp .j2store-single-product:has([data-sq-quote-link]) .sible-checkout-note {
    display: none;
}

/* The price block's own items share one baseline. */
body.sible-pdp .product-price-container {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.5em;
}

/*
 * "from" before the price of a quotable product (1.4.6). plg_system_siblequotable's script puts it as the first
 * child of the first element with "price" in its class, which here is the whole price row (.price-sku-brand-
 * container, a Bootstrap .row that makes every child 100% wide), so it used to sit on a line of its own at 0.7em.
 * Here it stays on the price line, in the price's typeface at 20 (the price is 24), with a word space before the
 * price, and the row lines its items up on their text baseline. The script sets font-size and letter-spacing
 * inline, hence !important on those two. Product page only: listing cards keep the script's own styling.
 */
body.sible-pdp .price-sku-brand-container:has(> .sq-from-prefix) {
    align-items: baseline;
}

body.sible-pdp .price-sku-brand-container > .sq-from-prefix {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin: 0 calc(0.4em - var(--sf-space-md)) 0 0; /* the row's 16 gap becomes a word space */
    padding: 0;
    color: var(--sf-color-ink-primary);
    font-family: var(--sf-font-mono);
    font-weight: 400;
    font-size: 20px !important;
    line-height: 1.2;
    letter-spacing: 0 !important;
}

/* ------------------------------------------------------------------ reviews */

/*
 * Figma "Past Reviews" (333:1155): paper cards 370 x 207 (radius-md, rough edge, exposure -0.11 so the paper is a
 * little darker than the panel), 16 apart, 48 below the product panel. In a card: the name (Review Name) top left, the
 * five stars (Rating Component, Display, 134 x 22.3) top right, the date (Review Meta, line/strong) under the name,
 * the text (Review Body) 5 below the date; 20 above, 27 at the sides, and the card is at least 207 tall and grows
 * with its text (nothing is clipped); cards in a row are as tall as the tallest. No avatar, no title, no average.
 * Three across from 75rem (370 each at 1440), two from 48rem, one below: three at 896 would leave 266 per card, too
 * narrow for the name beside the stars.
 */
body.sible-pdp .sible-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip-path: inset(50%);
    white-space: nowrap;
}

body.sible-pdp .sible-reviews {
    max-width: 1144px;
    margin: var(--sf-space-2xl) auto 0; /* Figma: 48 between the panel and the reviews */
}

body.sible-pdp .sible-review-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sf-space-md); /* Figma: 15.93 between cards */
    align-items: stretch;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-review-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 75rem) {
    body.sible-pdp .sible-review-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

body.sible-pdp .sible-review,
body.sible-pdp .sible-noreviews {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    color: var(--sf-color-ink-primary);
}

body.sible-pdp .sible-review::before,
body.sible-pdp .sible-noreviews::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--sf-color-ground-page) url("../../plg_system_siblefoundation/images/paper.webp") center / cover;
    border-radius: var(--sf-radius-md);
    /* brightness: Figma darkens the paper fill (exposure -0.11 is 2^-0.11). */
    filter: url("#sp-paper-edge") brightness(0.927);
}

body.sible-pdp .sible-review {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    column-gap: var(--sf-space-sm);
    min-height: 207px; /* Figma 327:1113 */
    padding: 20px 27px 40px; /* Figma: name at 20, text ends 40 above the bottom, 27 at the sides */
}

body.sible-pdp .sible-review__name {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-review-name);
    letter-spacing: var(--sf-tracking-review-name);
    overflow-wrap: anywhere;
}

body.sible-pdp .sible-review__date {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--sf-color-line-strong);
    font: var(--sf-type-mobile-review-meta);
    letter-spacing: var(--sf-tracking-review-meta);
}

body.sible-pdp .sible-review__body {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 5px 0 0; /* Figma: date bottom to text top is 5 */
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-review-body);
    letter-spacing: var(--sf-tracking-review-body);
    overflow-wrap: break-word;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-review__name {
        font: var(--sf-type-desktop-review-name);
        letter-spacing: var(--sf-tracking-review-name);
    }

    body.sible-pdp .sible-review__date {
        font: var(--sf-type-desktop-review-meta);
        letter-spacing: var(--sf-tracking-review-meta);
    }

    body.sible-pdp .sible-review__body {
        font: var(--sf-type-desktop-review-body);
        letter-spacing: var(--sf-tracking-review-body);
    }
}

/*
 * Rating Component, Type=Display (326:812): five stars 22.33 with 5.58 between, as the instance is scaled in the
 * card (134 wide; the component is 40 stars 10 apart). A star is the symbol #sp-star: on is accent green with a green
 * stroke, off is cream with a line/strong stroke. The name for assistive technology is on the wrapper.
 */
body.sible-pdp .sible-rating {
    display: inline-flex;
    gap: 5.58px;
    align-self: start;
    grid-column: 2;
    grid-row: 1;
    margin-top: 3px; /* Figma: the stars start at 23, the name at 20 */
}

body.sible-pdp .sible-star {
    display: block;
    flex: none;
    width: 22.33px;
    height: 22.33px;
}

body.sible-pdp .sible-star.is-on {
    fill: var(--sf-color-accent-green);
    stroke: var(--sf-color-accent-green);
}

body.sible-pdp .sible-star.is-off {
    fill: var(--sf-color-ground-cream);
    stroke: var(--sf-color-line-strong);
}

/* More than three reviews: the script folds the list behind a button (without it, all show and there is no button). */
body.sible-pdp .sible-review-list.is-folded > .sible-review:nth-child(n + 4) {
    display: none;
}

/* Derived, no Figma frame: an outlined pill on the dark ground, like Read More it is a real button. */
body.sible-pdp .sible-showall {
    display: block;
    box-sizing: border-box;
    min-height: 49px;
    margin: var(--sf-space-lg) auto 0;
    padding: 10px 28px;
    border: 1px solid var(--sf-color-ground-cream);
    border-radius: var(--sf-radius-pill);
    background: none;
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-desktop-body-emphasis);
    cursor: pointer;
}

body.sible-pdp .sible-showall:hover {
    background: var(--sf-color-ground-cream);
    color: var(--sf-color-ink-primary);
}

body.sible-pdp .sible-showall:focus-visible {
    outline: 3px solid var(--sf-color-ink-inverse);
    outline-offset: 3px;
}

/* Empty state, derived (no Figma frame): one card the width of the row, in the card's own text style. */
body.sible-pdp .sible-noreviews {
    margin: 0;
    padding: 20px 27px;
    font: var(--sf-type-mobile-review-body);
    letter-spacing: var(--sf-tracking-review-body);
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-noreviews {
        font: var(--sf-type-desktop-review-body);
        letter-spacing: var(--sf-tracking-review-body);
    }
}

body.sible-pdp .sible-noreviews__link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

body.sible-pdp .sible-noreviews__link:hover {
    text-decoration-thickness: 2px;
}

body.sible-pdp .sible-noreviews__link:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

/*
 * The review form (Figma 333:1154, 780 wide), in its own row under the reviews. A paper card (the panel's paper, not
 * darkened like the review cards): "Review this piece" (Heading Section) with a rule under it the width of the words,
 * "Posting as {name}" as plain Body text 10 below, the five star input (Rating Component, Type=Input: stars 36 wide,
 * 9 apart) 10 below that, the text box (white at 70%, radius 10, 175 tall) 10 below the stars and Button / Primary
 * 12 below the box, right aligned. Left padding 71 and right 92 as in the frame. The frame leaves 7 under the button,
 * which is cramped, so the bottom is 24 (derived). No avatar. Under 48rem the padding is 20 and the button fills the width.
 * Derived, no Figma state: focus rings, the error and confirmation messages, the busy button and the Shuffle button
 * (the variables hold no error colour, so errors are told apart by weight and a bar, not by colour).
 */
body.sible-pdp .sible-review-form-section {
    max-width: 780px;
    margin: var(--sf-space-2xl) auto 0;
}

body.sible-pdp .sible-review-form-wrap {
    margin: 0;
}

body.sible-pdp .sible-review-form,
body.sible-pdp .sible-login-note {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    color: var(--sf-color-ink-primary);
}

body.sible-pdp .sible-review-form::before,
body.sible-pdp .sible-login-note::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--sf-color-ground-page) url("../../plg_system_siblefoundation/images/paper.webp") center / cover;
    border-radius: var(--sf-radius-md);
    filter: url("#sp-paper-edge");
}

body.sible-pdp .sible-review-form {
    padding: 28px 20px 24px;
}

body.sible-pdp .sible-form-title {
    margin: 0;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-heading-section);
    line-height: 1.3; /* Figma 130% */
}

body.sible-pdp .sible-form-title span {
    display: inline-block;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sf-color-ink-primary);
}

body.sible-pdp .sible-posting {
    margin: 10px 0 0;
    font: var(--sf-type-mobile-body);
}

/* Shuffle: a small text button beside the name (added by the script; without it the assigned name stands). */
body.sible-pdp .sible-shuffle {
    display: inline-block;
    min-height: 32px;
    margin: -3px 0 -3px 4px; /* the button is 32 tall for a touch target; the negative margins keep the line at the 29 of the text */
    padding: 4px 8px;
    border: 0;
    border-radius: var(--sf-radius-sm);
    background: none;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-caption);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

body.sible-pdp .sible-shuffle:hover {
    text-decoration-thickness: 2px;
}

/* Phones: 44 high; the negative margins still keep the line at the height of the text. */
@media (max-width: 47.99rem) {
    body.sible-pdp .sible-shuffle {
        min-height: 44px;
        margin-top: -9px;
        margin-bottom: -9px;
    }
}

body.sible-pdp .sible-shuffle[aria-disabled="true"] {
    color: var(--sf-color-line-strong);
    cursor: progress;
}

body.sible-pdp .sible-shuffle:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: 2px;
}

/* Star input: native radios (the arrow keys move and select) hidden but focusable, each with a label holding the star. */
body.sible-pdp .sible-rate {
    min-width: 0;
    margin: 10px 0 0;
    padding: 0;
    border: 0;
}

body.sible-pdp .sible-rate__stars {
    position: relative;
    display: flex;
    width: max-content;
    gap: 1px; /* labels are 44 wide for a touch target; the stars inside are 36, 9 apart as in Figma */
    margin: -4px 0 -4px -4px; /* so the stars themselves sit where Figma puts them and the row is 36 tall */
}

body.sible-pdp .sible-rate input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip-path: inset(50%);
}

body.sible-pdp .sible-rate label {
    margin: 0; /* the theme gives labels a bottom margin */
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
}

body.sible-pdp .sible-rate__star {
    display: block;
    width: 36px;
    height: 36px;
    fill: var(--sf-color-ground-cream);
    stroke: var(--sf-color-line-strong);
}

/* The chosen score: its star and every star before it. */
body.sible-pdp .sible-rate input:checked + label .sible-rate__star,
body.sible-pdp .sible-rate label:has(~ input:checked) .sible-rate__star {
    fill: var(--sf-color-accent-green);
    stroke: var(--sf-color-accent-green);
}

/* Pointing at a star previews that score at 60% (Figma: "filled stars at 60% preview the hovered/selected score"). */
body.sible-pdp .sible-rate__stars:has(label:hover) .sible-rate__star {
    fill: var(--sf-color-ground-cream);
    stroke: var(--sf-color-line-strong);
    opacity: 1;
}

body.sible-pdp .sible-rate__stars:has(label:hover) label:hover .sible-rate__star,
body.sible-pdp .sible-rate__stars:has(label:hover) label:has(~ label:hover) .sible-rate__star {
    fill: var(--sf-color-accent-green);
    stroke: var(--sf-color-accent-green);
    opacity: 0.6;
}

body.sible-pdp .sible-rate input:focus-visible + label {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 0;
}

body.sible-pdp .sible-field {
    margin: 10px 0 0;
}

body.sible-pdp .sible-textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 160px;
    margin: 0;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 10px; /* Figma 332:1153; no radius variable at 10 */
    background: color-mix(in srgb, var(--sf-color-ground-page) 70%, transparent);
    box-shadow: none;
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-review-body);
    letter-spacing: var(--sf-tracking-review-body);
    resize: vertical;
}

body.sible-pdp .sible-textarea:focus {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 2px;
    box-shadow: none;
}

body.sible-pdp .sible-textarea[aria-invalid="true"] {
    border-color: var(--sf-color-ink-primary);
}

body.sible-pdp .sible-field-error {
    margin: var(--sf-space-xs) 0 0;
    padding-left: 10px;
    border-left: 3px solid var(--sf-color-ink-primary);
    font: var(--sf-type-desktop-caption);
    font-weight: 600;
}

body.sible-pdp .sible-field-error[hidden],
body.sible-pdp .sible-form-count[hidden] {
    display: none;
}

body.sible-pdp .sible-form-count {
    margin: var(--sf-space-2xs) 0 0;
    color: var(--sf-color-line-strong);
    font: var(--sf-type-desktop-caption);
    text-align: right;
}

body.sible-pdp .sible-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sf-space-sm);
    margin: 12px 0 0; /* Figma: the box ends 12 above the button */
}

body.sible-pdp .sible-form-msg {
    flex: 1 1 14rem;
    min-width: 0;
    font: var(--sf-type-desktop-caption);
}

body.sible-pdp .sible-form-msg:empty {
    display: none;
}

body.sible-pdp .sible-form-msg.is-error {
    padding-left: 10px;
    border-left: 3px solid var(--sf-color-ink-primary);
    font-weight: 600;
}

/* Button / Primary (the same as the add to cart button): Default, Hover to Ink; busy is derived. */
body.sible-pdp .sible-submit {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    min-width: 217px; /* Figma 394:946 */
    min-height: 49px;
    margin-left: auto;
    padding: 10px 36px;
    border: 0;
    border-radius: var(--sf-radius-pill);
    background: var(--sf-color-accent-green);
    box-shadow: none;
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-desktop-button-label);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

body.sible-pdp .sible-submit:hover {
    background: var(--sf-color-ink-primary);
    transform: none;
}

body.sible-pdp .sible-submit[aria-disabled="true"] {
    background: var(--sf-color-line-strong);
    cursor: progress;
}

body.sible-pdp .sible-submit:focus-visible {
    outline: 3px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
    body.sible-pdp .sible-submit {
        transition: background-color 0.2s ease;
    }
}

@media (min-width: 30rem) {
    body.sible-pdp .sible-submit {
        width: auto;
    }
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-review-form {
        padding: 43px 92px 24px 71px;
    }

    body.sible-pdp .sible-form-title {
        font: var(--sf-type-desktop-heading-section);
        line-height: 1.3;
    }

    body.sible-pdp .sible-posting {
        font: var(--sf-type-desktop-body);
    }

    body.sible-pdp .sible-textarea {
        min-height: 175px; /* Figma */
        font: var(--sf-type-desktop-review-body);
        letter-spacing: var(--sf-tracking-review-body);
    }
}

body.sible-pdp .sible-hp{position:absolute;left:-9999px;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}

body.sible-pdp .sible-login-note {
    margin: 0;
    padding: 20px 27px;
    font: var(--sf-type-mobile-review-body);
    letter-spacing: var(--sf-tracking-review-body);
}

body.sible-pdp .sible-login-note a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/*
 * The rail (Figma "Section / Explore" 373:837 with Item Card 238:189 and Scroll Arrow 373:836): the heading
 * (Heading Section, cream on the dark ground) 24 above a row of cards that scrolls sideways. A card is one link:
 * the photo (263 x 350 on a desktop card, 175 x 226 on a phone card), then the title (up to two lines, then an
 * ellipsis) with the price (Label Mono) at its right, then the vendor's name (Body); on a phone the title has its own
 * line and the vendor's name and the price share the next. Cards in the row are as tall as the tallest (the row
 * stretches them) and the text sits at the top, so the vendor's name hugs the title. The photo scales 5% on hover
 * (not at all when the visitor prefers reduced motion). The frame, the row (snapping, the 8px focus ring inset, smooth
 * scrolling) and the arrow buttons are the foundation's shared rail (plg_system_siblefoundation rail.css and rail.js);
 * this page only sets its gap and where the arrows sit.
 */
body.sible-pdp .sible-rail {
    max-width: 1144px;
    margin: var(--sf-space-2xl) auto 0;
}

body.sible-pdp .sible-rail__title {
    margin: 0 0 var(--sf-space-lg);
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-mobile-heading-section);
}

/* The arrows are centred on the photo of a desktop card (Figma 373:836: 39 x 39 over the 350 tall photo). */
body.sible-pdp .sible-rail__frame {
    --sf-rail-gap: var(--sf-space-md);
    --sf-rail-arrow-top: calc((350px - 39px) / 2);
}

body.sible-pdp .sible-rail-card-item {
    display: flex;
    flex: 0 0 175px;
    margin: 0;
    padding: 0;
}

body.sible-pdp .sible-rail-card {
    display: grid;
    flex: 1 1 auto;
    grid-template-areas:
        "media media"
        "title title"
        "vendor price";
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto 1fr;
    align-content: start;
    min-width: 0;
    color: var(--sf-color-ink-inverse);
    text-decoration: none;
}

body.sible-pdp .sible-rail-card:focus-visible {
    outline: 3px solid var(--sf-color-ink-inverse);
    outline-offset: 4px;
}

body.sible-pdp .sible-rail-card__media {
    display: block;
    grid-area: media;
    aspect-ratio: 175 / 226;
    overflow: hidden;
    background: var(--sf-color-line-default);
}

body.sible-pdp .sible-rail-card__media img,
body.sible-pdp .sible-rail-card__noimg {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

@media (prefers-reduced-motion: no-preference) {
    body.sible-pdp .sible-rail-card__media img {
        transition: transform 0.3s ease;
    }

    body.sible-pdp .sible-rail-card:hover .sible-rail-card__media img {
        transform: scale(1.05);
    }
}

body.sible-pdp .sible-rail-card__title {
    display: -webkit-box;
    grid-area: title;
    margin: 9px 3px 0;
    overflow: hidden;
    font: var(--sf-type-mobile-body);
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

body.sible-pdp .sible-rail-card__vendor {
    grid-area: vendor;
    min-width: 0;
    margin: 3px 3px 0;
    overflow: hidden;
    font: var(--sf-type-mobile-caption);
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.sible-pdp .sible-rail-card__price {
    grid-area: price;
    margin: 3px 3px 0 0;
    font: var(--sf-type-mobile-label-mono);
    white-space: nowrap;
}

@media (min-width: 48rem) {
    body.sible-pdp .sible-rail__title {
        font: var(--sf-type-desktop-heading-section);
    }

    body.sible-pdp .sible-rail__frame {
        --sf-rail-gap: 43.67px; /* Figma item spacing */
    }

    body.sible-pdp .sible-rail-card-item {
        flex-basis: 263px;
    }

    body.sible-pdp .sible-rail-card {
        grid-template-areas:
            "media media"
            "title price"
            "vendor vendor";
        grid-template-rows: auto auto 1fr;
    }

    body.sible-pdp .sible-rail-card__media {
        aspect-ratio: 263 / 350;
    }

    body.sible-pdp .sible-rail-card__title {
        margin: 6px 0 0 6px; /* Figma Info: 6 above and at the left */
        font: var(--sf-type-desktop-title);
    }

    body.sible-pdp .sible-rail-card__price {
        margin: 6px 0 0 12px;
        font: var(--sf-type-desktop-label-mono);
    }

    body.sible-pdp .sible-rail-card__vendor {
        margin: 0 0 0 6px;
        font: var(--sf-type-desktop-body);
    }
}

/* Scroll Arrow (Figma 373:836): over the ends of the row (the shared rail's own place for them) up to 80rem, from there
   outside the row as in the frame. */
@media (min-width: 80rem) {
    body.sible-pdp .sible-rail__frame {
        --sf-rail-arrow-x: -47px;
    }
}

@media (prefers-reduced-motion:reduce){
body.sible-pdp .j2store-product-main-image,body.sible-pdp .j2store-cart-button,
body.sible-pdp .sible-submit{transition:none;}
}
