/*
 * ck-peek-v1.css — the full-screen product image viewer.
 *
 * A shopper taps the gallery picture and the whole screen becomes the picture: black
 * behind it, one image at a time, slid sideways with the thumb, a counter so they know
 * how many there are, and the two things they came for (cart and order) inside the same
 * screen so they never have to leave the photo to buy.
 *
 * Scrolling is the browser's own snap track, not scripted drag math: on a phone that is
 * what gives real momentum, and the counter is read back from the scroll position
 * instead of guessed.
 *
 * A new filename, never a query string: the edge holds a CSS URL for seven days.
 */

/* The gallery picture is now a door, so it has to look like one and still sit in the
   same box it sat in before: the button fills the slide and the image keeps its own
   contain rules. */
.ck-peek-trigger {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

.ck-peek {
    position: fixed;
    inset: 0;
    z-index: 100020;
    display: flex;
    flex-direction: column;
    background: #000;
    color: #fff;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Clock band first, then the three controls: close on the left, the count in the
   middle, save on the right. */
.ck-peek-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(var(--ck-top-inset, 0px) + 8px) 10px 6px;
}

.ck-peek-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

.ck-peek-btn:disabled {
    opacity: 0.45;
}

.ck-peek-count {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.02em;
}

.ck-peek-stage {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.ck-peek-track {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ck-peek-track::-webkit-scrollbar {
    display: none;
}

.ck-peek-slide {
    display: flex;
    flex: 0 0 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.ck-peek-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* The name of the thing, then the ask. Same two doors the page itself uses, so a tap
   here means exactly what a tap down the page means. */
.ck-peek-foot {
    padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
}

.ck-peek-title {
    margin: 0 0 10px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.94);
}

.ck-peek-asks {
    display: flex;
    gap: 10px;
}

.ck-peek-ask {
    display: flex;
    flex: 1 1 0;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
}

.ck-peek-ask--cart {
    border: 1px solid rgba(255, 255, 255, 0.65);
    background: transparent;
    color: #fff;
}

.ck-peek-ask--order {
    border: 1px solid transparent;
    background: var(--color-brand-600, #e31e24);
    color: #fff;
}

.ck-peek-ask:disabled {
    opacity: 0.5;
}

/* The viewer only ever repeats what the page's own ordering block said back, so the
   line that carries it has nowhere to push the buttons. */
.ck-peek-note {
    min-height: 18px;
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 18px;
    color: rgba(255, 255, 255, 0.78);
}

/* While the picture is on screen the page behind it must not scroll. */
html.ck-peek-lock,
html.ck-peek-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}

@media (min-width: 768px) {
    .ck-peek-bar {
        padding-left: 22px;
        padding-right: 22px;
    }

    .ck-peek-foot {
        padding-left: 22px;
        padding-right: 22px;
    }

    .ck-peek-asks {
        max-width: 560px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ck-peek-track {
        scroll-behavior: auto;
    }
}
