/**
 * Pongal Loading Overlay Styles
 * ================================
 * Festive overlay displayed when navigating to Pongal collection pages.
 * Includes animations, confetti effects, and iOS-safe fallbacks.
 *
 * @file pongal-overlay.css
 * @version 1.0.0
 */

/* ============================================
   PONGAL OVERLAY - Base Container
   ============================================ */
.pongal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    background: #fef6f0;
    isolation: isolate;
}

.pongal-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fef6f0 0%, #fff9f3 50%, #fef3eb 100%);
    z-index: 0;
}

/* Disable pseudo-element on iOS for performance */
@supports (-webkit-touch-callout: none) {
    .pongal-overlay::before {
        display: none;
    }
}

.pongal-overlay.active {
    opacity: 1;
}

/* ============================================
   PONGAL CONFETTI CANVAS
   ============================================ */
#pongal-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10002;
    display: none;
}

/* ============================================
   PONGAL CONTENT CONTAINER
   ============================================ */
.pongal-content {
    text-align: center;
    position: relative;
    z-index: 10001;
    max-width: 90%;
    padding: 40px 30px;
    animation: pongal-entrance 0.5s ease-out forwards;
}

/* Disable animation on iOS for stability */
@supports (-webkit-touch-callout: none) {
    .pongal-content {
        animation: none;
        opacity: 1;
    }
}

/* ============================================
   PONGAL BRAND WATERMARK
   ============================================ */
.pongal-brand-watermark {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 10001;
    font-family: var(--font-description, 'Nunito Sans', 'Inter', sans-serif);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--filter-text, #5b3d0f);
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

/* ============================================
   PONGAL CENTERPIECE (Pot + Sugarcane)
   ============================================ */
.pongal-centerpiece {
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(18px, 4vw, 32px);
    margin-bottom: clamp(18px, 4vw, 28px);
}

/* Rice Pot Emoji */
.pongal-rice-pot {
    font-size: clamp(80px, 15vw, 140px);
    margin-bottom: 0;
    animation: pongal-bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 25px rgba(205, 133, 63, 0.15));
}

/* Disable animation on iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-rice-pot {
        animation: none;
        filter: none;
    }
}

/* ============================================
   PONGAL SUGARCANE ELEMENTS
   ============================================ */
.pongal-sugarcane {
    position: relative;
    width: clamp(16px, 3vw, 22px);
    height: clamp(160px, 22vw, 200px);
    background:
        linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(255,255,255,0.15) 30%, rgba(255,255,255,0) 60%, rgba(0,0,0,0.4) 100%),
        repeating-linear-gradient(0deg,
            #3e2723 0px,
            #4a148c 4px,
            #4a148c 24px,
            #7b1fa2 24px,
            #210428 26px,
            #3e2723 28px
        );
    border-radius: 4px;
    box-shadow: 2px 5px 10px rgba(0,0,0,0.3);
    transform-origin: bottom center;
    animation-duration: 3s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    z-index: 1;
}

/* Simplify for iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-sugarcane {
        background: #4a148c;
        box-shadow: none;
        animation: none;
    }
}

.pongal-sugarcane::after {
    display: none;
}

/* Sugarcane Leaves */
.pongal-leaves {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    z-index: -1;
}

.leaf {
    position: absolute;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, #66bb6a 0%, #2e7d32 100%);
    border-radius: 0 100% 0 100%;
    transform-origin: bottom left;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
}

.leaf-left {
    width: clamp(60px, 12vw, 90px);
    height: clamp(15px, 3vw, 22px);
    transform: rotate(-135deg) translate(5px, -5px);
}

.leaf-right {
    width: clamp(60px, 12vw, 90px);
    height: clamp(15px, 3vw, 22px);
    transform: scaleX(-1) rotate(-135deg) translate(5px, -5px);
    left: auto;
    right: 0;
    transform-origin: bottom right;
}

.leaf-top {
    width: clamp(40px, 8vw, 60px);
    height: clamp(12px, 2.5vw, 18px);
    transform: rotate(-90deg) translate(0, -50%);
    left: 50%;
    bottom: 5px;
    z-index: -1;
    background: linear-gradient(135deg, #81c784 0%, #388e3c 100%);
}

/* Sugarcane Animation Variants */
.pongal-sugarcane-left {
    animation-name: sugarcane-sway-left;
    margin-right: -5px;
}

.pongal-sugarcane-right {
    animation-name: sugarcane-sway-right;
    margin-left: -5px;
    animation-delay: -1.5s;
}

/* Disable sugarcane sway on iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-sugarcane-left,
    .pongal-sugarcane-right {
        animation: none;
    }
}

/* ============================================
   PONGAL TEXT STYLES
   ============================================ */
.pongal-title {
    font-family: 'Noto Sans Tamil', 'Georgia', serif;
    font-size: clamp(32px, 7vw, 56px);
    font-weight: 700;
    background: linear-gradient(130deg, #e79d66 0%, #e47aa7 35%, #b494f3 65%, #e8c879 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: 0.5px;
    animation: pongal-title-glow 1s ease-in-out 0.3s both;
    text-shadow: 0 15px 30px rgba(131, 81, 96, 0.28);
}

/* Simplify text on iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-title {
        animation: none;
        color: #e79d66;
        -webkit-text-fill-color: #e79d66;
        text-shadow: none;
    }
}

.pongal-subtitle {
    font-family: 'Georgia', serif;
    font-size: clamp(18px, 4vw, 26px);
    color: #a0826d;
    margin-bottom: 20px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 1px;
    animation: pongal-subtitle-fade 0.8s ease-out 0.5s both;
}

/* Disable animation on iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-subtitle {
        animation: none;
        opacity: 1;
    }
}

.pongal-message {
    font-family: 'Noto Sans Tamil', 'Georgia', serif;
    font-size: clamp(16px, 3.5vw, 20px);
    font-weight: 400;
    color: #8b7355;
    line-height: 1.8;
    animation: pongal-message-fade 1s ease-out 0.7s both;
}

/* Disable animation on iOS */
@supports (-webkit-touch-callout: none) {
    .pongal-message {
        animation: none;
        opacity: 1;
    }
}

.pongal-small {
    display: block;
    font-size: clamp(12px, 2.5vw, 14px);
    color: #b89968;
    margin-top: 12px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 300;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* ============================================
   PONGAL ANIMATIONS
   ============================================ */
@keyframes pongal-entrance {
    0% {
        transform: translateY(30px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes pongal-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-15px) scale(1.05);
    }
}

@keyframes sugarcane-sway-left {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(-4deg); }
}

@keyframes sugarcane-sway-right {
    0%, 100% { transform: rotate(8deg); }
    50% { transform: rotate(4deg); }
}

@keyframes pongal-title-glow {
    0% {
        opacity: 0;
        transform: translateY(-10px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes pongal-subtitle-fade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pongal-message-fade {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* ============================================
   iOS SAFARI SPECIFIC FIXES
   ============================================ */
@supports (-webkit-touch-callout: none) {
    .pongal-overlay.ios-mode * {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        will-change: auto !important;
    }

    .pongal-overlay.ios-mode {
        background: #fef6f0 !important;
    }

    .pongal-overlay.ios-mode::before {
        display: none !important;
    }

    .ios-mode .pongal-sugarcane {
        background: #4a148c !important;
        animation: none !important;
    }

    .ios-mode .pongal-rice-pot {
        animation: none !important;
        filter: none !important;
    }

    .ios-mode .pongal-title,
    .ios-mode .pongal-subtitle,
    .ios-mode .pongal-message {
        animation: none !important;
        filter: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .pongal-content {
        padding: 30px 20px;
    }

    .pongal-rice-pot {
        margin-bottom: 15px;
    }

    .pongal-title {
        margin-bottom: 6px;
    }

    .pongal-subtitle {
        margin-bottom: 15px;
    }
}
