/**
 * CCMuseum Popup - Frontend Styles
 * Glassmorphism / iOS-inspired design
 */

/* ── Overlay backdrop ── */
.ccm-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
}

.ccm-popup-overlay.ccm-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Popup card (glass frame) ── */
.ccm-popup-card {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.25);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: scale(0.92) translateY(16px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.35s ease;
    line-height: 0;
    overflow: visible;
}

.ccm-popup-visible .ccm-popup-card {
    transform: scale(1) translateY(0);
}

/* ── Image wrapper (clips image corners inside the glass frame) ── */
.ccm-popup-image-wrap {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    position: relative;
}

.ccm-popup-image-wrap img {
    display: block;
    max-width: min(88vw, 800px);
    max-height: 78vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

a.ccm-popup-image-wrap {
    cursor: pointer;
}

a.ccm-popup-image-wrap img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

a.ccm-popup-image-wrap:hover img {
    transform: scale(1.01);
    filter: brightness(1.03);
}

/* ── Close button (glass pill) ── */
.ccm-popup-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    line-height: 1;
}

.ccm-popup-close:hover {
    transform: scale(1.12);
    background: rgba(255, 255, 255, 0.8);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.18),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ccm-popup-close:active {
    transform: scale(0.96);
}

.ccm-popup-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.ccm-popup-close svg {
    width: 14px;
    height: 14px;
    stroke: rgba(0, 0, 0, 0.65);
    stroke-width: 2.5;
    stroke-linecap: round;
    fill: none;
}

.ccm-popup-close:hover svg {
    stroke: rgba(0, 0, 0, 0.85);
}

/* ── Responsive ── */

/* Tablets */
@media (max-width: 1024px) {
    .ccm-popup-card {
        max-width: 88vw;
        padding: 8px;
        border-radius: 18px;
    }

    .ccm-popup-image-wrap {
        border-radius: 11px;
    }

    .ccm-popup-image-wrap img {
        max-width: 86vw;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .ccm-popup-overlay {
        padding: 14px;
    }

    .ccm-popup-card {
        max-width: 96vw;
        max-height: 88vh;
        padding: 6px;
        border-radius: 16px;
    }

    .ccm-popup-image-wrap {
        border-radius: 10px;
    }

    .ccm-popup-image-wrap img {
        max-width: 94vw;
        max-height: 84vh;
    }

    .ccm-popup-close {
        top: -8px;
        right: -8px;
        width: 30px;
        height: 30px;
    }

    .ccm-popup-close svg {
        width: 12px;
        height: 12px;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .ccm-popup-card {
        padding: 5px;
        border-radius: 14px;
    }

    .ccm-popup-image-wrap {
        border-radius: 9px;
    }
}

/* Accessibility – reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ccm-popup-overlay,
    .ccm-popup-card {
        transition: none;
    }

    a.ccm-popup-image-wrap img {
        transition: none;
    }
}
