/* Big card preview for the deck builders (js/card-hover-preview.js). */

.chp-pop {
    position: fixed;
    z-index: 2500;
    left: 0;
    top: 0;
    height: min(440px, calc(100vh - 100px));
    aspect-ratio: 5 / 7;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    border-radius: 14px;
    background: #0e0c09;
    box-shadow:
        0 0 0 1px rgba(255, 191, 0, 0.45),
        0 0 28px rgba(255, 191, 0, 0.22),
        0 24px 60px rgba(0, 0, 0, 0.75);
}

.chp-pop.is-visible {
    visibility: visible;
    animation: chpIn 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards;
}

.chp-pop img,
.chp-overlay img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    border-radius: 14px;
}

@keyframes chpIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* Touch: long-press opens the card full-screen */
.chp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.chp-overlay.is-visible {
    display: flex;
    animation: chpFade 0.18s ease-out;
}

.chp-overlay img {
    width: auto;
    height: auto;
    max-width: min(92vw, 420px);
    max-height: 82vh;
    box-shadow: 0 0 0 1px rgba(255, 191, 0, 0.45), 0 0 40px rgba(255, 191, 0, 0.25);
    animation: chpIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes chpFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Keep the long-press for the preview, not the browser's save-image menu */
[data-preview],
[data-preview] img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (prefers-reduced-motion: reduce) {
    .chp-pop.is-visible { animation: none; opacity: 1; }
    .chp-overlay.is-visible, .chp-overlay img { animation: none; }
}
