/* ─────────────────────────────────────────────────
   Polaroid Stacking Preloader — Darkroom Edition
   ───────────────────────────────────────────────── */

#polaroid-preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0e0d0b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Amber vignette — classic darkroom safelight glow at bottom */
#polaroid-preloader::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 40% at 50% 110%, rgba(200, 132, 42, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse at center, transparent 40%, rgba(8, 6, 4, 0.8) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Film grain */
#polaroid-preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://ayfilms.uk/images/grain.gif');
    opacity: 0.05;
    pointer-events: none;
    z-index: 2;
}

/* Preloader counter strip across the top — film data */
.preloader-filmdata {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 3;
}

.preloader-filmdata span {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 8px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(200, 132, 42, 0.5);
}

.preloader-filmdata .fd-sep {
    width: 1px;
    height: 10px;
    background: rgba(200, 132, 42, 0.2);
}

/* ─── Stage ─── */

.polaroid-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    z-index: 3;
}

.polaroid-stack {
    position: relative;
    width: 280px;
    height: 340px;
}

/* ─── Individual Polaroid Card ─── */

.polaroid-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
    will-change: transform, opacity;
}

.polaroid-inner {
    width: 100%;
    height: 100%;
    /* Classic Kodak/Fuji paper white with slight warmth */
    background: #f5f2ec;
    border-radius: 3px;
    padding: 12px 12px 48px;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.35),
        0 30px 70px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Worn paper corners / aging */
.polaroid-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 5% 5%, rgba(0, 0, 0, 0.07) 0%, transparent 25%),
        radial-gradient(ellipse at 95% 5%, rgba(0, 0, 0, 0.05) 0%, transparent 20%),
        radial-gradient(ellipse at 5% 95%, rgba(0, 0, 0, 0.06) 0%, transparent 20%),
        radial-gradient(ellipse at 95% 95%, rgba(0, 0, 0, 0.05) 0%, transparent 20%);
    pointer-events: none;
    z-index: 3;
}

/* Glossy gelatin surface shine */
.polaroid-inner::after {
    content: '';
    position: absolute;
    top: -80%;
    left: -30%;
    width: 160%;
    height: 100%;
    background: linear-gradient(128deg,
            transparent 40%,
            rgba(255, 255, 255, 0.04) 43%,
            rgba(255, 255, 255, 0.10) 46%,
            rgba(255, 255, 255, 0.04) 49%,
            transparent 52%);
    pointer-events: none;
    z-index: 4;
}

/* ─── Photo area ─── */

.polaroid-photo {
    flex: 1;
    border-radius: 1px;
    overflow: hidden;
    position: relative;
    background: #c8c4bc;
}

.polaroid-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Slight film look */
    filter: saturate(0.9) contrast(1.05) brightness(0.98);
}

/* ─── Polaroid footer / caption strip ─── */

.polaroid-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.polaroid-label {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 7.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #888;
    font-style: italic;
}

.polaroid-counter {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 7.5px;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: #aaa;
}

/* ─── Branding below the stack ─── */

.preloader-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
}

.preloader-logo {
    width: 110px;
    height: auto;
    filter: brightness(0) invert(1);
    opacity: 0.35;
}

.preloader-tagline {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 7px;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: rgba(200, 132, 42, 0.4);
}

/* ─── Responsive ─── */

@media (max-width: 480px) {
    .polaroid-stack {
        width: 220px;
        height: 270px;
    }

    .polaroid-inner {
        padding: 10px 10px 40px;
    }

    .polaroid-footer {
        height: 40px;
        padding: 0 10px;
    }

    .preloader-logo {
        width: 85px;
    }

    .polaroid-floating {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .polaroid-stack {
        width: 320px;
        height: 390px;
    }

    .polaroid-inner {
        padding: 14px 14px 56px;
    }

    .polaroid-footer {
        height: 56px;
    }

    .preloader-logo {
        width: 130px;
    }
}

/* ─── Floating Polaroid State (after spread) ─── */

.polaroid-floating {
    pointer-events: none;
    will-change: transform;
    /* Slightly desaturated + dark — look like prints drying in a darkroom */
    filter: blur(1px) saturate(0.6) brightness(0.85);
}

.polaroid-floating .polaroid-inner {
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 12px 40px rgba(0, 0, 0, 0.2);
}

.polaroid-floating .polaroid-photo img {
    filter: saturate(0.6) contrast(1.08) brightness(0.9);
}

@media (max-width: 900px) {
    .polaroid-floating {
        opacity: 0.2 !important;
    }
}