/* ============================================================================
   AG PRODUCT POPUP STYLES   (store/popup.css)
   Desktop: a window in the middle.  Phone: a sheet that slides up from the bottom
   with the price + Add button always visible.  Sizes are in rem so it grows
   smoothly on big monitors.
   ============================================================================ */

.pop {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    opacity: 0; transition: opacity .25s ease;
}
.pop.is-open { opacity: 1; }
.pop-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); }

.pop-dialog {
    position: relative;
    width: 100%; max-width: min(62rem, 100%);
    max-height: min(92vh, 92dvh);
    display: flex; flex-direction: column;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden; outline: none;
    transform: translateY(1.2rem) scale(.975);
    transition: transform .35s cubic-bezier(.16, 1, .3, 1), background-color .4s, border-color .4s;
}
.pop.is-open .pop-dialog { transform: none; }

/* ---- top bar: name + price + close ---- */
.pop-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
    padding: 1rem 1rem .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.pop-titles h2 { font-size: 1.2rem; line-height: 1.25; }
.pop-price { margin-top: .1rem; font-size: 1.35rem; font-weight: 800; color: var(--accent-text); display: inline-block; }
.pop-price small { font-size: .7rem; font-weight: 700; color: var(--muted); }
.pop-price s { font-size: .85rem; font-weight: 600; color: var(--faint); }
.save-tag { display: inline-block; padding: .05rem .5rem; border-radius: 1rem; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 900; vertical-align: middle; }
.pop-price.is-pulse { animation: pop-pulse .3s ease; }
.pop-x {
    flex-shrink: 0; width: 2.75rem; height: 2.75rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text);
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pop-x:active { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .pop-x:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } }

/* ---- scrolling middle ---- */
.pop-body {
    flex: 1; min-height: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "media options" "info options";
    gap: 1rem 1.6rem;
    padding: 1.1rem 1.25rem;
}
.pop-media   { grid-area: media; min-width: 0; }
.pop-options { grid-area: options; min-width: 0; }
.pop-info    { grid-area: info; min-width: 0; }

/* ---- pictures (panel follows light/dark; the ◐ button flips it) ---- */
.pop-stage {
    position: relative; height: clamp(11rem, 17vw, 18rem); padding: .6rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--media); border: 1px solid var(--media-border); border-radius: var(--radius);
    overflow: hidden; touch-action: pan-y;
    transition: background-color .35s, border-color .35s;
}
.pop-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; animation: pop-fade .25s ease; }
.stage-btn {
    position: absolute; left: .5rem; top: .5rem; width: 2.2rem; height: 2.2rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--media-border); background: var(--media); color: var(--media-muted);
    font-size: 1.05rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stage-btn:active { color: var(--accent-text); border-color: var(--accent); }
.pop-counter { position: absolute; right: .5rem; bottom: .5rem; padding: .1rem .55rem; border-radius: .65rem; background: rgba(0, 0, 0, .65); color: #ddd; font-size: .7rem; pointer-events: none; }
.pop-thumbs-row { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.pop-thumbs { flex: 1; display: flex; gap: .4rem; justify-content: center; overflow-x: auto; padding: .2rem; scrollbar-width: none; }
.pop-thumbs::-webkit-scrollbar { display: none; }
.thumb {
    flex-shrink: 0; width: 2.9rem; height: 2.9rem; padding: 0;
    border: 1px solid var(--border-strong); border-radius: .45rem; background: var(--media);
    overflow: hidden; cursor: pointer; opacity: .5; transition: opacity .2s, border-color .2s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-on { opacity: 1; border-color: var(--accent); }
.arrow {
    flex-shrink: 0; width: 2.75rem; height: 2.5rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--accent-text);
    border: 1px solid var(--accent); border-radius: .5rem;
    font-size: 1rem; font-weight: 700; cursor: pointer;
}
.arrow:active { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .arrow:hover { background: var(--accent); color: var(--accent-ink); } }

/* ---- LIVE PREVIEW: their text, their font, one fixed colour ---- */
.pop-preview {
    margin-top: .75rem; padding: .6rem .9rem .9rem;
    background: var(--media); border: 1px dashed var(--accent); border-radius: var(--radius);
    text-align: center; transition: background-color .35s;
}
.pv-top { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; color: var(--media-muted); font-size: .65rem; letter-spacing: 1px; text-transform: uppercase; }
.pv-box { display: flex; align-items: center; justify-content: center; gap: .65rem; min-height: 3rem; }
.pv-text {
    color: var(--preview-ink);
    font-size: 1.7rem; line-height: 1.25; letter-spacing: 0;
    word-break: break-word;
    /* keep every font looking exactly like the real font - no fake bold, no outline, no glow */
    font-weight: 400 !important; font-style: normal; font-synthesis: none;
    text-shadow: none; -webkit-text-stroke: 0; filter: none;
    transition: color .35s;
}
.pv-icon { width: 1.9rem; height: 1.9rem; object-fit: contain; flex-shrink: 0; filter: invert(var(--icon-invert)); transition: filter .35s; }
.pv-glyph { font-size: 1.5rem; color: var(--preview-ink); }

/* ---- options ---- */
.opt { margin-bottom: .9rem; }
.count { margin-top: .2rem; text-align: right; color: var(--faint); font-size: .7rem; }
.warn { margin-top: .4rem; color: var(--danger); font-size: .78rem; font-weight: 700; }

.color-btn {
    width: 100%; min-height: var(--tap); padding: .5rem .9rem;
    display: flex; align-items: center; gap: .75rem; text-align: left;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: border-color .2s;
}
.color-btn.is-open { border-color: var(--accent); }
.color-name { flex: 1; font-size: .95rem; }
.chev { color: var(--faint); transition: transform .25s; }
.color-btn.is-open .chev { transform: rotate(180deg); }

.dot {
    display: block; flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: var(--c); border: 1px solid rgba(128, 128, 128, .6);
}
.swatches {
    display: flex; flex-wrap: wrap; gap: .15rem; margin-top: .5rem; padding: .6rem;
    background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
    animation: pop-fade .25s ease;
}
.swatch {
    position: relative; width: 2.6rem; height: 2.6rem; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 50%; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.swatch .dot { width: 1.9rem; height: 1.9rem; transition: transform .2s, box-shadow .2s; }
.swatch:active .dot { transform: scale(.9); }
.swatch.is-on .dot { box-shadow: 0 0 0 2px var(--inset), 0 0 0 4px var(--accent); }
@media (hover: hover) { .swatch:hover .dot { transform: scale(1.12); } }
.plus {
    position: absolute; top: .2rem; right: .2rem; width: .9rem; height: .9rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--accent); color: var(--accent-ink);
    font: 900 .62rem/1 sans-serif; font-style: normal; pointer-events: none;
}

/* pick-one buttons (shape / finish) */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-btn {
    flex: 1 1 auto; min-height: var(--tap); padding: .4rem .9rem;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-weight: 700; font-size: .88rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: border-color .2s, background-color .2s, color .2s, transform .15s;
}
.seg-btn small { color: var(--faint); font-weight: 600; }
.seg-btn:active { transform: scale(.97); }
.seg-btn.is-on { border-color: var(--accent); background: rgba(21, 253, 0, .12); color: var(--accent-text); }

/* pack sizes (25 / 50 / 100 ...) with the saving shown */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr)); gap: .45rem; }
.tier {
    position: relative; padding: .55rem .3rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .05rem;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: border-color .2s, background-color .2s, transform .15s;
}
.tier strong { font-size: 1.15rem; line-height: 1.1; }
.tier small { color: var(--muted); font-size: .7rem; }
.tier em { margin-top: .15rem; padding: .02rem .45rem; border-radius: .6rem; background: var(--accent); color: var(--accent-ink); font-size: .62rem; font-weight: 900; font-style: normal; }
.tier:active { transform: scale(.96); }
.tier.is-on { border-color: var(--accent); background: rgba(21, 253, 0, .12); box-shadow: 0 0 0 1px var(--accent) inset; }
.save-line { margin-top: .5rem; color: var(--accent-text); font-size: .8rem; font-weight: 700; }

/* "buy more, save more" ladder (tap a step to jump to that quantity) */
.vol { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.3rem, 1fr)); gap: .4rem; }
.vol-chip {
    display: flex; flex-direction: column; align-items: center; gap: .02rem; padding: .5rem .25rem .45rem;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent;
    transition: border-color .2s, background-color .2s, transform .15s;
}
.vol-chip strong { font-size: 1rem; line-height: 1.1; }
.vol-chip small { color: var(--accent-text); font-size: .68rem; font-weight: 800; }
.vol-each { color: var(--muted); font-size: .66rem; }
.vol-chip:active { transform: scale(.96); }
.vol-chip.is-on { border-color: var(--accent); background: rgba(21, 253, 0, .12); box-shadow: 0 0 0 1px var(--accent) inset; }
.vol-chip.is-quote { border-style: dashed; justify-content: center; }
.vol-chip.is-quote small { color: var(--muted); }
@media (hover: hover) { .vol-chip:hover { border-color: var(--accent); } }

.art-later { padding: .8rem .9rem; background: var(--inset); border: 1px dashed var(--accent); border-radius: var(--radius-sm); }
.art-later p { font-size: .84rem; color: var(--muted); }
.art-later strong { color: var(--text); }

.link { margin: 0; padding: .5rem; }

.link {
    display: inline-block; margin-top: .35rem; padding: .5rem 0;
    background: none; border: 0; color: var(--blue);
    font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---- description / details ---- */
.pop-desc { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.pop-more { margin-top: .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--inset); }
.pop-more summary {
    min-height: var(--tap); padding: 0 .9rem; display: flex; align-items: center; justify-content: space-between;
    list-style: none; cursor: pointer; color: var(--accent-text);
    font-size: .72rem; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
}
.pop-more summary::-webkit-details-marker { display: none; }
.pop-more summary::after { content: '+'; font-size: 1.2rem; }
.pop-more[open] summary::after { content: '–'; }
.pop-more > *:not(summary) { margin: 0 .9rem .9rem; }
.pop-features { font-size: .82rem; color: var(--muted); }
.pop-features li { margin-bottom: .25rem; }
.pop-bulk { margin-top: .75rem; }
.pop-bulk .label { margin-bottom: .5rem; }
.pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { padding: .25rem .65rem; border-radius: 1rem; font-size: .72rem; background: rgba(21, 253, 0, .08); border: 1px solid rgba(21, 253, 0, .35); }
.pill strong { color: var(--accent-text); }
.note { margin-top: .4rem; color: var(--faint); font-size: .72rem; font-style: italic; }

/* ---- bottom bar: quantity + add ---- */
.pop-foot {
    display: flex; align-items: center; gap: .65rem;
    padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border); background: var(--surface);
}
.qty { flex-shrink: 0; display: flex; border: 1px solid var(--border-strong); border-radius: .65rem; overflow: hidden; background: var(--surface-2); }
.qty button { width: 2.65rem; min-height: var(--tap); border: 0; background: none; font-size: 1.3rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.qty button:active { background: var(--accent); color: var(--accent-ink); }
.qty input {
    width: 3rem; border: 0; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong);
    background: transparent; color: var(--text); text-align: center; font: inherit; font-size: 1rem; -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pop-add { flex: 1; justify-content: space-between; gap: .65rem; padding: .75rem 1.1rem; font-size: .92rem; }
.pop-add span { white-space: nowrap; }
.pop-add strong { font-size: 1.05rem; }

/* ---- phones: bottom sheet ---- */
@media (max-width: 760px) {
    .pop { align-items: flex-end; padding: 0; }
    .pop-dialog {
        max-width: none; max-height: 94vh; max-height: 94dvh;
        border-radius: 1.4rem 1.4rem 0 0; border-bottom: 0;
        transform: translateY(2.5rem);
    }
    .pop-head { padding: .85rem .6rem .6rem 1rem; }
    .pop-titles h2 { font-size: 1.05rem; }
    .pop-body {
        grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
        grid-template-areas: "media" "options" "info";
        gap: .4rem; padding: .9rem 1rem;
    }
    .pop-stage { height: 9.5rem; }
    .thumb { width: 2.5rem; height: 2.5rem; }
    .pv-text { font-size: 1.45rem; }
    .pop-options { margin-top: .4rem; }
    .pop-add { padding: .75rem .9rem; font-size: .85rem; }
    .qty button { width: 2.4rem; }
    .qty input { width: 2.5rem; }
}

@keyframes pop-fade  { from { opacity: .2; } to { opacity: 1; } }
@keyframes pop-pulse { 0% { transform: scale(1); } 45% { transform: scale(1.1); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pop, .pop-dialog { transition: none; } }
