/* =============================================
   MG LUXURY PRELOADER — Core Styles
   ============================================= */

/* Overlay */
.mglp-preloader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mglp-preloader-overlay.mglp-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mglp-preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Tagline */
.mglp-tagline {
    font-family: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 40px;
    opacity: 0;
    animation: mglpFadeInUp 0.8s ease forwards;
    animation-delay: 1.2s;
}

@keyframes mglpFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 0.7;
        transform: translateY(0);
    }
}


/* =============================================
   STYLE 1: BARBADOS SHORELINE DRAW
   ============================================= */

.mglp-shoreline-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.mglp-shoreline-svg {
    width: 160px;
    height: 260px;
}

/* The stroke-drawing animation */
.mglp-shoreline-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: mglpDrawShoreline var(--mglp-duration, 2.5s) cubic-bezier(0.4, 0, 0.2, 1) forwards;
    filter: drop-shadow(0 0 6px var(--mglp-accent, #c9a96e));
}

@keyframes mglpDrawShoreline {
    0% {
        stroke-dashoffset: 2000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Shimmer fill after outline completes */
.mglp-shoreline-fill {
    opacity: 0;
    animation: mglpShimmerFill 1s ease forwards;
    animation-delay: var(--mglp-duration, 2.5s);
}

@keyframes mglpShimmerFill {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 0.12;
    }
    100% {
        opacity: 0.08;
    }
}

/* Pulsing shimmer on the fill */
.mglp-shoreline-fill.mglp-shimmer {
    animation: mglpShimmerPulse 1.5s ease-in-out infinite alternate;
}

@keyframes mglpShimmerPulse {
    from { opacity: 0.05; }
    to   { opacity: 0.15; }
}

/* Pin marker animation */
.mglp-map-pin {
    opacity: 0;
    animation: mglpPinDrop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: calc(var(--mglp-duration, 2.5s) + 0.3s);
    transform-origin: 150px 264px;
}

@keyframes mglpPinDrop {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(2px) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Logo below map */
.mglp-shoreline-logo {
    width: 120px;
    height: auto;
    margin-top: 25px;
    opacity: 0;
    animation: mglpFadeInUp 0.8s ease forwards;
    animation-delay: calc(var(--mglp-duration, 2.5s) + 0.5s);
}


/* =============================================
   STYLE 2: GOLDEN KEY TURN
   ============================================= */

.mglp-key-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.mglp-key-svg {
    width: 120px;
    height: 240px;
}

/* Key group — slides in, then rotates */
.mglp-key-group {
    transform-origin: 100px 160px;
    animation:
        mglpKeySlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards,
        mglpKeyTurn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0s, calc(var(--mglp-duration, 2.5s) * 0.5);
    opacity: 0;
}

@keyframes mglpKeySlideIn {
    0% {
        opacity: 0;
        transform: translateY(-40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mglpKeyTurn {
    0% {
        transform: rotate(0deg);
    }
    40% {
        transform: rotate(-15deg);
    }
    100% {
        transform: rotate(90deg);
    }
}

/* Keyhole plate subtle pulse */
.mglp-keyhole-plate {
    animation: mglpKeyholePulse 2s ease-in-out infinite alternate;
}

@keyframes mglpKeyholePulse {
    from { opacity: 0.2; }
    to   { opacity: 0.4; }
}

/* Lock mechanism lines radiate out on unlock */
.mglp-lock-lines {
    opacity: 0;
    animation: mglpLockBurst 0.6s ease forwards;
    animation-delay: calc(var(--mglp-duration, 2.5s) * 0.5 + 0.4s);
}

@keyframes mglpLockBurst {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.5;
        transform: scale(1);
    }
}

/* "Unlocking..." text */
.mglp-key-text {
    font-family: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
    font-size: 14px;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 30px;
    opacity: 0;
    animation: mglpFadeInUp 0.6s ease forwards;
    animation-delay: 0.6s;
}

/* Animated dots */
.mglp-key-dot {
    animation: mglpDotPulse 1.4s ease-in-out infinite;
}
.mglp-key-dot:nth-child(2) { animation-delay: 0.2s; }
.mglp-key-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes mglpDotPulse {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Door opening effect on the overlay itself */
.mglp-preloader-overlay.mglp-door-open {
    clip-path: inset(0 50% 0 50%);
    transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.mglp-preloader-overlay.mglp-door-open.mglp-opened {
    clip-path: inset(0 0% 0 0%);
}

/* For the key style: split-door exit */
.mglp-preloader-overlay[data-style="key"].mglp-exit {
    animation: mglpDoorSplit 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mglpDoorSplit {
    0% {
        clip-path: inset(0 0 0 0);
    }
    100% {
        clip-path: inset(0 50% 0 50%);
    }
}

/* For shoreline: elegant fade */
.mglp-preloader-overlay[data-style="shoreline"].mglp-exit {
    animation: mglpShorelineFade 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mglpShorelineFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}


/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 600px) {
    .mglp-shoreline-svg {
        width: 120px;
        height: 200px;
    }
    .mglp-key-svg {
        width: 90px;
        height: 180px;
    }
    .mglp-tagline {
        font-size: 11px;
        letter-spacing: 2px;
    }
    .mglp-shoreline-logo {
        width: 90px;
    }
}
