/**
 * Prix Catherine Serre - Modal Stylesheet
 * Scoped and isolated for maximum compatibility
 */

/* Modal Root Overlay */
.pcs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(10, 25, 47, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    padding: 20px;
}

/* Modal Open State */
.pcs-modal-overlay.pcs-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Closing Animation */
.pcs-modal-overlay.pcs-closing {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

/* Modal Container (center stage) */
.pcs-modal-container {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

/* Modal Card with Award Prestige Frame */
.pcs-modal-card {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    pointer-events: auto;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.65),
                0 0 35px rgba(41, 147, 211, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.25);
    transform: scale(0.8) translateY(35px);
    opacity: 0;
    transition: transform 0.55s cubic-bezier(0.34, 1.45, 0.64, 1),
                opacity 0.45s ease-out,
                box-shadow 0.3s ease;
    will-change: transform, opacity;
}

/* Active Card State */
.pcs-modal-overlay.pcs-visible .pcs-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Closing Card State */
.pcs-modal-overlay.pcs-closing .pcs-modal-card {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.28s ease-in, opacity 0.25s ease-in;
}

/* Close Button (Floating Top-Right) */
.pcs-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(14, 43, 71, 0.75);
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    margin: 0;
    outline: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pcs-modal-close:hover,
.pcs-modal-close:focus {
    background: #0e2b47;
    color: #38bdf8 !important;
    border-color: #38bdf8 !important;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.pcs-modal-close svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    pointer-events: none;
    transition: stroke 0.2s ease;
}

/* Content & Image Wrapper */
.pcs-modal-content {
    position: relative;
    width: 100%;
    line-height: 0;
    display: block;
    background: #ffffff;
}

.pcs-modal-link {
    display: block;
    text-decoration: none;
    line-height: 0;
    outline: none;
    cursor: pointer;
}

.pcs-modal-picture {
    display: block;
    width: 100%;
    line-height: 0;
}

.pcs-modal-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 20px;
    margin: 0;
    padding: 0;
    line-height: 0;
    border: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Prestigious Light Sweep / Shimmer Effect on Open */
.pcs-modal-shimmer {
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.15) 70%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}

.pcs-modal-overlay.pcs-visible .pcs-modal-shimmer {
    opacity: 1;
    animation: pcsShimmerSweep 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s 1 forwards;
}

@keyframes pcsShimmerSweep {
    0% {
        left: -120%;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        left: 200%;
        opacity: 0;
    }
}

/* Prevent body scrolling when modal is active */
body.pcs-modal-active {
    overflow: hidden !important;
    touch-action: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .pcs-modal-overlay {
        padding: 12px;
    }

    .pcs-modal-card {
        border-radius: 16px;
        box-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.6),
                    0 0 20px rgba(41, 147, 211, 0.25);
    }

    .pcs-modal-image {
        border-radius: 16px;
        max-height: 80vh;
    }

    .pcs-modal-close {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
    }

    .pcs-modal-close svg {
        width: 17px;
        height: 17px;
    }
}
