/* ==========================================================================
   MikoComputers — UI enhancements
   --------------------------------------------------------------------------
   Deliberately PLAIN CSS, served as a static file rather than compiled through
   Tailwind/Vite. Two reasons:
     1. The storefront ships a purged Tailwind bundle, and the ad landing page
        compiles Tailwind at runtime from the CDN. Hand-written CSS behaves
        identically on both, with no build step and no risk of a purge dropping
        a class that only appears on one of them.
     2. It means the existing compiled bundle is never rebuilt or replaced, so
        nothing already on the site can regress.

   Contents: WhatsApp ripple, full-screen image zoom, compact product-card
   badges, and small-screen (320px) layout fixes.
   ========================================================================== */

/* ==========================================================================
   1. Floating WhatsApp button — ripple rings
   ========================================================================== */

.wa-fab {
    position: fixed;
    isolation: isolate;
}

/* Rings are separate elements so the button keeps its own hover transform. */
.wa-fab__ring {
    position: absolute;
    inset: 0;
    z-index: -1;
    border: 2px solid #25d366;
    border-radius: 9999px;
    pointer-events: none;
    animation: wa-ring 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.wa-fab__ring--delayed {
    animation-delay: 1.2s;
}

@keyframes wa-ring {
    0% {
        transform: scale(0.92);
        opacity: 0.7;
    }
    70%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-fab__ring {
        animation: none;
        opacity: 0;
    }
}

/* ==========================================================================
   2. Full-screen image zoom / lightbox
   ========================================================================== */

.mz {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
    user-select: none;
    -webkit-user-select: none;
}

.mz__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
}

.mz__stage[data-zoomed='1'] {
    cursor: grab;
}

.mz__stage[data-dragging='1'] {
    cursor: grabbing;
}

.mz__img {
    max-height: 92vh;
    max-width: 96vw;
    object-fit: contain;
    will-change: transform;
    -webkit-user-drag: none;
}

.mz__img--animated {
    transition: transform 0.2s ease;
}

/* Controls */
.mz__btn {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}

.mz__btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mz__btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mz__btn--close {
    top: 0.75rem;
    right: 0.75rem;
}

.mz__btn--prev {
    top: 50%;
    left: 0.5rem;
    transform: translateY(-50%);
}

.mz__btn--next {
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
}

@media (min-width: 640px) {
    .mz__btn--prev {
        left: 1rem;
    }
    .mz__btn--next {
        right: 1rem;
    }
}

.mz__counter {
    position: absolute;
    top: 1rem;
    left: 50%;
    z-index: 10;
    transform: translateX(-50%);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    pointer-events: none;
}

.mz__toolbar {
    position: absolute;
    inset-inline: 0;
    bottom: 1rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
}

.mz__zoombar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    backdrop-filter: blur(6px);
}

.mz__zoombtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
}

.mz__zoombtn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mz__zoombtn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mz__level {
    min-width: 3.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

.mz__reset {
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
}

.mz__reset:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mz__hint {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.6);
}

/* The "tap to zoom" affordance sitting on a gallery image. */
.zoom-trigger {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    cursor: zoom-in;
}

.zoom-badge {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #fff;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 9999px;
    opacity: 0.75;
    transition: opacity 0.2s;
    pointer-events: none;
}

.zoom-trigger:hover .zoom-badge {
    opacity: 1;
}

/* ==========================================================================
   3. Product-card badges — compact so they never cover the product photo
   ========================================================================== */

.pc-badges {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    /* Leave room for the wishlist heart in the opposite corner. */
    max-width: calc(100% - 3rem);
}

.pc-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.3125rem;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
}

/* Below 400px only the two highest-priority badges are worth the space. */
@media (max-width: 400px) {
    .pc-badge--overflow {
        display: none;
    }
}

@media (min-width: 640px) {
    .pc-badges {
        top: 0.5rem;
        left: 0.5rem;
    }
    .pc-badge {
        padding: 0.1875rem 0.5rem;
        font-size: 10px;
        border-radius: 0.5rem;
    }
}

.pc-badge--sale {
    background: #ef4444;
}
.pc-badge--new {
    background: var(--pc-brand, #0582ca);
}
.pc-badge--best {
    background: #0f172a;
}

/* ==========================================================================
   4. Small-screen (320px) fixes
   ========================================================================== */

/* The wishlist heart was hover-only, which meant it was invisible — and so
   unreachable — on every phone. It is now always visible on small screens, and
   only desktop (>=1024px, where a real cursor exists) hides it until hover.
   Width-based on purpose: (hover: hover) is unreliable on hybrid/touch laptops. */
/* Position lives here, not in Tailwind utilities: the storefront ships a purged
   bundle that does not contain `right-2` / `sm:right-3`, so relying on them left
   the button unpositioned. Plain CSS can't be purged out from under us. */
.pc-wish {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 1 !important;
}

@media (min-width: 640px) {
    .pc-wish {
        top: 0.75rem;
        right: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .pc-wish:not(.pc-wish--active) {
        opacity: 0 !important;
    }
    .group:hover .pc-wish {
        opacity: 1 !important;
    }
}

/* Product page: keep the buy row from cramping at 320px — the qty stepper and
   wishlist share the top line, Add to Cart gets a full-width line of its own. */
@media (max-width: 480px) {
    .buy-row {
        row-gap: 0.75rem;
    }
    .buy-row__qty {
        order: 1;
    }
    .buy-row__wish {
        order: 2;
        margin-left: auto;
    }
    .buy-row__add {
        order: 3;
        width: 100%;
        flex: 0 0 100%;
    }
}

/* Ad landing page: corner badges shrink so they can't collide or swamp the
   hero image on a narrow phone. */
@media (max-width: 400px) {
    .lp-badge {
        padding: 0.125rem 0.5rem !important;
        font-size: 10px !important;
    }
    .lp-sticky__cta {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }
    .lp-header__brand {
        font-size: 0.875rem;
    }
}

.lp-sticky__cta {
    flex-shrink: 0;
    white-space: nowrap;
}

.lp-header__brand {
    min-width: 0;
}

.lp-header__brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Nothing on either page may cause a horizontal scrollbar on a 320px screen. */
html,
body {
    overflow-x: clip;
    max-width: 100%;
}
