/*
 * Storefront components that can't be built from utilities alone.
 *
 * Kept in its own file for the same reason as forms.css: styles.css is a
 * generated artifact, so anything added there would be lost the next time it is
 * regenerated — and the utilities these need (translate, rotate, negative
 * insets) were never emitted into it in the first place. Load after styles.css.
 */

/* --- Shop page: the "show in-stock only" switch --- */

.shop-switch {
    position: relative;
    display: inline-block;
    flex: none;
    width: 2.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background: var(--border);
    transition: background-color .2s;
}

.shop-switch-knob {
    position: absolute;
    top: .125rem;
    left: .125rem;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    background: var(--background);
    box-shadow: 0 1px 3px rgb(0 0 0 / .25);
    transition: transform .2s;
}

[aria-checked="true"] .shop-switch {
    background: var(--electric);
}

[aria-checked="true"] .shop-switch-knob {
    transform: translateX(1rem);
}

/* --- Add-to-cart toast --- */

/*
 * Pinned to the bottom-right on desktop, and stretched across the bottom on
 * phones where a 22rem card would crowd the viewport. Hidden with visibility
 * rather than display so the slide-and-fade can animate both ways, and so it
 * stays out of the tab order and the a11y tree while it is away.
 */
.cart-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 50;
    visibility: hidden;
    opacity: 0;
    transform: translateY(.75rem);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

.cart-toast.is-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 640px) {
    .cart-toast {
        left: auto;
        right: 1.5rem;
        bottom: 1.5rem;
        width: 22rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-toast {
        transform: none;
        transition: opacity .15s ease, visibility .15s;
    }
}

/* --- Product cards: the FEATURED corner ribbon --- */

/*
 * A 45° banner across the top-left corner. The wrapper clips the overhang so
 * the band stops at the card edge instead of bleeding over the border radius;
 * the card itself is already overflow-hidden, but the image container it sits
 * in is the element that actually needs to do the clipping here.
 */
.product-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 7rem;
    height: 7rem;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
}

.product-ribbon span {
    position: absolute;
    top: 1.35rem;
    left: -2.1rem;
    width: 10rem;
    padding: .3rem 0;
    transform: rotate(-45deg);
    background: var(--navy);
    color: var(--primary-foreground);
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .12em;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgb(0 0 0 / .25);
}

/* --- Product detail: cross-sell placement --- */

/*
 * "These products work well with…" belongs under the gallery, so it lives in
 * the same column wrapper — two blocks in normal flow, which keeps it hard
 * against the image whatever the buy column does.
 *
 * Stacked, though, the buy controls have to come first, so the wrapper drops
 * out of the box tree there and its two children become grid items in their
 * own right, free to be ordered around the buy column.
 */
.product-hero-cross-sell {
    margin-top: 2.5rem;
}

/*
 * The buy column always outruns the gallery, so the gallery is the half that
 * sticks: it holds under the header while the buy controls scroll past, instead
 * of leaving a column of dead space beside them. Sticky is bounded by the grid
 * area, so once the buy column runs out this column scrolls away with it —
 * which is also what brings the bottom of a tall cross-sell into reach.
 */
@media (min-width: 1024px) {
    .product-hero-media {
        position: sticky;
        top: 7rem;
    }
}

@media (max-width: 1023px) {
    .product-hero-media {
        display: contents;
    }

    .product-hero-gallery {
        order: 1;
    }

    .product-hero-buy {
        order: 2;
    }

    .product-hero-cross-sell {
        order: 3;
        margin-top: 0;
    }
}

/* --- Product detail: buying-question accordions --- */

.product-accordions {
    margin-top: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.product-accordion {
    border-top: 1px solid var(--border);
}

.product-accordion-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    font-family: var(--font-display);
    font-size: .9375rem;
    font-weight: 600;
    color: var(--foreground);
    cursor: pointer;
    list-style: none;
    transition: color .15s;
}

/* Safari still needs the vendor pseudo-element to drop the disclosure triangle. */
.product-accordion-summary::-webkit-details-marker {
    display: none;
}

.product-accordion-summary:hover {
    color: var(--electric);
}

.product-accordion-summary::after {
    content: "+";
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1;
    color: var(--muted-foreground);
    transition: transform .2s;
}

.product-accordion[open] .product-accordion-summary::after {
    transform: rotate(45deg);
}

.product-accordion-body {
    padding-bottom: 1.125rem;
    font-size: .9375rem;
}

.product-accordion-link {
    display: inline-block;
    margin-top: .625rem;
    font-size: .8125rem;
    color: var(--electric);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- Product detail: the "?" badge on the Injectable Pen tile --- */

.product-help-anchor {
    position: relative;
}

/* The tile is the wrapper's only other child, and it has to fill it. */
.product-help-anchor > button:not(.product-help-badge) {
    width: 100%;
}

.product-help-badge {
    position: absolute;
    top: -.5rem;
    right: -.375rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 2px solid var(--background);
    border-radius: 9999px;
    background: var(--navy);
    color: var(--primary-foreground);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgb(0 0 0 / .25);
    transition: background-color .15s;
}

.product-help-badge:hover {
    background: var(--electric);
}

/* --- Product detail: the explainer drawer the "?" opens --- */

.product-drawer {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.product-drawer[hidden] {
    display: none;
}

.product-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(8 14 32 / .5);
    opacity: 0;
    transition: opacity .3s ease;
}

.product-drawer.is-open .product-drawer-backdrop {
    opacity: 1;
}

/*
 * A side sheet on desktop and a bottom sheet on phones, where 440px of panel
 * would be the whole screen anyway.
 */
.product-drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(27.5rem, 92vw);
    background: var(--background);
    box-shadow: 0 10px 40px rgb(8 14 32 / .35);
    transform: translateX(105%);
    transition: transform .32s cubic-bezier(.32, .72, .28, 1);
}

@media (max-width: 767px) {
    .product-drawer-panel {
        top: auto;
        left: 0;
        width: auto;
        max-height: 84vh;
        border-radius: 1.125rem 1.125rem 0 0;
        transform: translateY(105%);
    }
}

.product-drawer.is-open .product-drawer-panel {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .product-drawer-backdrop,
    .product-drawer-panel {
        transition-duration: .01ms;
    }
}

.product-drawer-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1.125rem 1.375rem;
    border-bottom: 1px solid var(--border);
}

.product-drawer-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--foreground);
}

.product-drawer-close {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: var(--surface-2);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color .15s;
}

.product-drawer-close:hover {
    background: var(--border);
}

.product-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem 1.375rem 1.875rem;
}

.product-drawer-body h4 {
    margin: 1.375rem 0 .5rem;
    font-family: var(--font-display);
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--foreground);
}

.product-drawer-body h4:first-child {
    margin-top: 0;
}

.product-drawer-body p,
.product-drawer-body li {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--muted-foreground);
}

/* Preflight strips paragraph margins, so put back only the ones this pane needs. */
.product-drawer-body p + p,
.product-drawer-body table + p {
    margin-top: .75rem;
}

.product-drawer-body ol {
    margin: .375rem 0;
    padding-left: 1.125rem;
    list-style: decimal;
}

.product-drawer-body ol li {
    margin-bottom: .5rem;
}

.product-drawer-body ol li b {
    color: var(--foreground);
}

.product-drawer-table {
    width: 100%;
    margin: .5rem 0 .25rem;
    border-collapse: collapse;
    font-size: .8125rem;
}

.product-drawer-table th {
    padding: .4375rem .5rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-size: .6875rem;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.product-drawer-table td {
    padding: .5rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

.product-drawer-note {
    margin-top: 1.25rem;
    padding: .75rem .875rem;
    border: 1px solid var(--border);
    border-radius: .625rem;
    background: var(--surface-2);
    font-size: .75rem;
    line-height: 1.6;
    color: var(--muted-foreground);
}
