/**
 * Polaroid Dreams - Custom Styles
 * 
 * Design Language: Soft luxury minimalism with subtle surreal curves
 * Palette: Creamy off-white, warm sand, muted coral, soft gold
 * Typography: Playfair Display (display) + Inter (body)
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    /* Colors */
    --color-cream: #FFFEF9;
    --color-sand: #E8DFD0;
    --color-coral: #D4A59A;
    --color-gold: #C9A962;
    --color-gold-dark: #A88B4A;
    --color-warm-gray: #8B8178;
    --color-deep-brown: #4A4039;
    
    /* Polaroid Dimensions */
    --polaroid-width: 320px;
    --polaroid-padding: 16px;
    --polaroid-bottom-padding: 48px;
    
    /* Shadows */
    --shadow-polaroid: 
        0 4px 6px -1px rgba(74, 64, 57, 0.1),
        0 10px 20px -5px rgba(74, 64, 57, 0.15),
        0 25px 50px -12px rgba(74, 64, 57, 0.2);
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Base Styles
   ============================================ */
html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(
        135deg,
        var(--color-cream) 0%,
        #FBF8F1 50%,
        var(--color-sand) 100%
    );
    background-attachment: fixed;
}

/* Subtle texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
}

/* ============================================
   State Sections
   ============================================ */
.state-section {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Drop Zone Styles
   ============================================ */
.drop-zone {
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

/* Animated dashed border */
.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    background: linear-gradient(90deg, var(--color-sand) 50%, transparent 50%),
                linear-gradient(90deg, var(--color-sand) 50%, transparent 50%),
                linear-gradient(0deg, var(--color-sand) 50%, transparent 50%),
                linear-gradient(0deg, var(--color-sand) 50%, transparent 50%);
    background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
    background-size: 12px 2px, 12px 2px, 2px 12px, 2px 12px;
    background-position: 0 0, 100% 100%, 0 100%, 100% 0;
    animation: borderDance 1s infinite linear;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

@keyframes borderDance {
    0% {
        background-position: 0 0, 100% 100%, 0 100%, 100% 0;
    }
    100% {
        background-position: 100% 0, 0 100%, 0 0, 100% 100%;
    }
}

.drop-zone.drag-over {
    border-color: var(--color-coral);
    background-color: rgba(212, 165, 154, 0.1);
    transform: scale(1.02);
}

.drop-zone.drag-over .drop-zone-content {
    opacity: 0.3;
}

.drop-zone.drag-over .drop-zone-active {
    display: flex !important;
}

/* ============================================
   Preview Grid Styles
   ============================================ */
.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(74, 64, 57, 0.1);
    transition: var(--transition-smooth);
}

.preview-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(74, 64, 57, 0.15);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: var(--transition-smooth);
}

.preview-item:hover .remove-btn {
    opacity: 1;
    transform: scale(1);
}

.preview-item .remove-btn:hover {
    background: var(--color-coral);
    color: white;
}

/* ============================================
   Loading Animation
   ============================================ */
.loading-polaroid {
    width: 200px;
    perspective: 1000px;
}

.polaroid-frame {
    background: white;
    padding: 12px 12px 36px 12px;
    border-radius: 2px;
    box-shadow: var(--shadow-polaroid);
    transform: rotate(-3deg);
    animation: polaroidFloat 3s ease-in-out infinite;
}

.polaroid-image {
    width: 176px;
    height: 176px;
    background: linear-gradient(
        135deg,
        var(--color-sand) 0%,
        var(--color-cream) 50%,
        var(--color-sand) 100%
    );
    position: relative;
    overflow: hidden;
}

/* Film Grain Animation */
.film-grain-animation::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.15;
    animation: grainShift 0.5s steps(10) infinite;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 20%); }
    90% { transform: translate(-10%, 10%); }
}

/* Color development animation */
.film-grain-animation::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        rgba(212, 165, 154, 0.3) 0%,
        rgba(201, 169, 98, 0.2) 50%,
        rgba(212, 165, 154, 0.3) 100%
    );
    animation: colorDevelop 3s ease-in-out infinite;
}

@keyframes colorDevelop {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

@keyframes polaroidFloat {
    0%, 100% {
        transform: rotate(-3deg) translateY(0);
    }
    50% {
        transform: rotate(-1deg) translateY(-8px);
    }
}

/* Loading Dots */
.loading-dot {
    animation: loadingPulse 1.4s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Teaser Canvas Styles
   ============================================ */
#teaser-canvas {
    filter: drop-shadow(0 25px 50px rgba(74, 64, 57, 0.25));
}

/* Vignette overlay for canvas */
.teaser-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 50%,
        rgba(74, 64, 57, 0.3) 100%
    );
    pointer-events: none;
}

/* ============================================
   Button Styles
   ============================================ */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
    opacity: 1;
}

/* Shimmer effect on CTA buttons */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ============================================
   Final Image Styles
   ============================================ */
#final-image {
    filter: drop-shadow(0 25px 50px rgba(74, 64, 57, 0.3));
    animation: revealImage 0.8s ease-out;
}

@keyframes revealImage {
    from {
        opacity: 0;
        transform: scale(0.95) rotate(-2deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ============================================
   Polaroid Frame Deckled Edge Effect
   ============================================ */
.polaroid-deckled {
    position: relative;
}

.polaroid-deckled::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: white;
    filter: url(#deckled-edge);
    z-index: -1;
}

/* ============================================
   Turnstile Widget Styling
   ============================================ */
.cf-turnstile {
    display: flex;
    justify-content: center;
}

.cf-turnstile iframe {
    margin: 0 auto;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 640px) {
    .loading-polaroid {
        width: 160px;
    }
    
    .polaroid-frame {
        padding: 10px 10px 30px 10px;
    }
    
    .polaroid-image {
        width: 140px;
        height: 140px;
    }
    
    #preview-grid {
        gap: 0.75rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--color-coral);
    outline-offset: 2px;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-sand);
}

::-webkit-scrollbar-thumb {
    background: var(--color-warm-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-coral);
}

