/* La Ofrenda - Vibrant Tiered Altar Styles */

:root {
    --flicker-delay: 0s;
    --flicker-duration: 2s;

    /* Vibrant Altar Colors - Premium Dark Mode */
    --altar-tier1: #1a0f2e;
    /* Deep twilight purple */
    --altar-tier2: #881650;
    /* Rich deep magenta */
    --altar-tier3: #c85a17;
    /* Rich marigold orange */
    --altar-shadow: rgba(0, 0, 0, 0.6);
    --altar-glow: rgba(255, 152, 0, 0.15);
}

/* Ensure the app container sits cleanly in the brand layout */
#ofrenda-ritual-app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 1rem 1rem;
    /* Removed top padding */
    text-align: center;
}

@media (min-width: 900px) {
    #ofrenda-ritual-app {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
        align-items: start;
        text-align: left;
    }

    .ofrenda-altar-column {
        position: sticky;
        top: 2rem;
        padding: 2rem;
    }

    .ofrenda-frame {
        max-width: 480px;
    }
}

/* Base ritual steps matching brand styles */
.ritual-step {
    display: none;
    opacity: 0;
    transition: opacity 800ms ease, transform 800ms ease;
    transform: translateY(20px);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    margin: 0 auto 2rem;
    border: 1px solid var(--color-border);
}

.ritual-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Typography matching brand */
.ritual-step h1,
.ritual-step h2 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin-bottom: 1rem;
}

.ritual-step p {
    font-family: var(--font-body);
    color: var(--color-text);
    margin-bottom: 2rem;
}

.ritual-button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

/* The Vibrant Altar Frame (Tiered) */
.ofrenda-altar-column {
    position: relative;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 1rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.altar-audio-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    z-index: 20;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.altar-audio-btn:hover {
    transform: scale(1.1);
}

.ofrenda-frame {
    background: var(--altar-tier1);
    /* Tier 1 - Top/Backdrop */
    border-radius: 16px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 0 80px rgba(0, 0, 0, 0.5);
    padding-top: 100px;
    padding-bottom: 4rem;
    min-height: 520px;
    width: 100%;
    /* Let it fill the container on mobile */
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    /* Contains the background tiers */
}

/* Tier 2 (Middle Shelf - Magenta) */
.ofrenda-frame::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, var(--altar-tier2), #4a0c2b);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    /* Top edge of shelf */
    box-shadow: 0 -15px 30px rgba(0, 0, 0, 0.4);
    z-index: 1;
}

/* Tier 3 (Bottom Shelf - Orange) */
.ofrenda-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 18%;
    background: linear-gradient(to bottom, var(--altar-tier3), #8a3a0b);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.3);
    z-index: 2;
    border-bottom-left-radius: 15px;
    /* Match frame radius - 1px border */
    border-bottom-right-radius: 15px;
}

/* Papel Picado Banner */
.papel-picado-banner {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 80px;
    /* A repeating SVG pattern of colorful perforated paper flags */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50"><path d="M 5 0 L 25 0 L 25 35 Q 15 45 5 35 Z" fill="%23e91e63"/><circle cx="15" cy="15" r="4" fill="white"/><path d="M 35 0 L 55 0 L 55 35 Q 45 45 35 35 Z" fill="%2300bcd4"/><path d="M 45 12 L 50 20 L 40 20 Z" fill="white"/><path d="M 65 0 L 85 0 L 85 35 Q 75 45 65 35 Z" fill="%23ffeb3b"/><rect x="71" y="12" width="8" height="8" fill="white"/></svg>');
    background-size: 120px 60px;
    background-repeat: repeat-x;
    z-index: 3;
    opacity: 0.85;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
}

.ofrenda-name-display {
    position: relative;
    z-index: 10;
    text-align: center;
    color: var(--color-white) !important;
    font-family: var(--font-body);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.8);
    margin-top: -20px;
    /* Pull it slightly up towards the banner */
    margin-bottom: 1rem;
    font-size: 2.8rem;
    font-weight: 400;
    letter-spacing: 2px;
}

/* CSS Marigolds */
.marigold-arch {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 360px;
    z-index: 4;
    pointer-events: none;
}

.marigold-flower {
    width: 55px;
    height: 55px;
    background: radial-gradient(circle, #ffca28 20%, #ff9800 60%, #e65100 100%);
    border-radius: 50%;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    position: absolute;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
}

.marigold-flower::before,
.marigold-flower::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    background: radial-gradient(circle, transparent 30%, rgba(255, 202, 40, 0.8) 70%, transparent 100%);
    border-radius: 50%;
    border: 2px dashed rgba(230, 81, 0, 0.6);
    transform: rotate(45deg);
}

.marigold-flower::after {
    transform: rotate(22.5deg);
    border: 2px dotted rgba(230, 81, 0, 0.8);
}

/* Arch Positions */
.marigold-flower.m-1 {
    top: 40px;
    left: -20px;
}

.marigold-flower.m-2 {
    top: -10px;
    left: 35px;
}

.marigold-flower.m-3 {
    top: -30px;
    left: 132px;
}

/* Center top */
.marigold-flower.m-4 {
    top: -10px;
    right: 35px;
}

.marigold-flower.m-5 {
    top: 40px;
    right: -20px;
}


/* Photo Container - Glassmorphism */
.ofrenda-photo-container {
    width: 240px;
    height: 300px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    z-index: 5;
    /* Above background tiers */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.ofrenda-photo-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, var(--altar-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.ofrenda-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.ofrenda-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-family: var(--font-body);
    font-style: italic;
    gap: 0.5rem;
}

.empty-state-icon {
    font-size: 2rem;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 0.9rem;
    padding: 0 1rem;
    line-height: 1.4;
}

/* Candles */
.candle {
    width: 28px;
    height: 80px;
    background: linear-gradient(to right, #f5f5f5 0%, #e0e0e0 40%, #ffffff 60%, #d4d4d4 100%);
    border-radius: 6px 6px 3px 3px;
    position: absolute;
    bottom: 25px;
    /* Rests on the Orange Tier 3 (bottom) */
    box-shadow: inset -3px -3px 8px rgba(0, 0, 0, 0.2), 0 12px 15px rgba(0, 0, 0, 0.5);
    z-index: 6;
}

.candle::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: #333;
    border-radius: 2px;
}

.candle-left {
    left: 30px;
    transform: none;
    /* Override styles.css */
}

.candle-right {
    right: 30px;
    left: auto;
    /* Override styles.css */
    transform: none;
    /* Override styles.css */
}

.flame {
    width: 18px;
    height: 32px;
    background: radial-gradient(ellipse at bottom, #ffffff 10%, #ffeb3b 40%, #ff9800 80%, transparent 100%);
    border-radius: 50% 50% 20% 20%;
    position: absolute;
    top: -38px;
    left: 5px;
    box-shadow: 0 0 30px 20px rgba(255, 152, 0, 0.4), 0 0 60px 40px rgba(255, 152, 0, 0.15);
    animation: flicker var(--flicker-duration) infinite alternate;
    animation-delay: var(--flicker-delay);
    transform-origin: bottom center;
    opacity: 0 !important;
    visibility: hidden;
    transition: opacity 1.5s ease-in, visibility 1.5s;
    mix-blend-mode: screen;
}

.flame.lit {
    opacity: 1 !important;
    visibility: visible;
}

@keyframes flicker {
    0% {
        transform: scale(1) rotate(-2deg);
        opacity: 0.9;
    }

    20% {
        transform: scale(1.05) rotate(1deg);
        opacity: 1;
    }

    40% {
        transform: scale(0.95) rotate(-1deg);
        opacity: 0.8;
    }

    60% {
        transform: scale(1.02) rotate(2deg);
        opacity: 1;
    }

    80% {
        transform: scale(0.98) rotate(-1.5deg);
        opacity: 0.9;
    }

    100% {
        transform: scale(1) rotate(1deg);
        opacity: 1;
    }
}

/* Interactive Offerings (Click-to-Place) */
.offerings-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 1rem;
    gap: 1rem;
    margin: 2rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.offerings-grid::-webkit-scrollbar {
    height: 8px;
}

.offerings-grid::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 4px;
}

.offering-btn {
    flex: 0 0 auto;
    width: 140px;
    scroll-snap-align: start;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    padding: 1rem 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.offering-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

.offering-btn::before {
    content: attr(data-emoji);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.offering-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-heading);
}

.offering-desc {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* Placed Offerings on the Altar */
.altar-offerings-layer {
    position: absolute;
    bottom: 5%;
    /* Rest on Orange Tier 3 */
    left: 10%;
    right: 10%;
    height: 100px;
    z-index: 6;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    pointer-events: none;
}

.placed-offering {
    font-size: 3.5rem;
    filter: drop-shadow(0 10px 10px var(--altar-shadow));
    z-index: 100;
}

/* Premium Inputs and Forms */
.ritual-step label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-heading);
    font-weight: 600;
    font-family: var(--font-heading);
}

.ritual-step input[type="text"],
.ritual-step textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    background-color: rgba(226, 213, 195, 0.3);
    /* Soft warm background */
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--color-heading);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02);
}

.ritual-step input[type="text"]::placeholder,
.ritual-step textarea::placeholder {
    color: var(--color-muted);
    font-style: italic;
    opacity: 0.7;
}

.ritual-step input[type="text"]:focus,
.ritual-step textarea:focus {
    outline: none;
    background-color: var(--color-white);
    border-color: #C5A059;
    /* Delicate gold ring */
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

/* Custom File Upload Dropzone */
.hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.custom-file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background-color: rgba(226, 213, 195, 0.3);
    /* Soft warm background */
    border: 2px dashed rgba(197, 160, 89, 0.5);
    /* Gold dashed border */
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-file-upload:hover,
.custom-file-upload.drag-active {
    background-color: rgba(226, 213, 195, 0.6);
    border-color: #C5A059;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.upload-text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-muted);
}

/* Dissolve Animation for Step 4 */
.dissolve-text {
    animation: dissolve 3s forwards cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes dissolve {
    0% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scale(1);
    }

    50% {
        opacity: 0.5;
        filter: blur(4px);
        transform: translateY(-15px) scale(1.02);
    }

    100% {
        opacity: 0;
        filter: blur(15px);
        transform: translateY(-40px) scale(1.05);
    }
}

@media (min-width: 900px) {
    .offerings-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        overflow-x: visible;
        padding-bottom: 0;
    }

    .offering-btn {
        width: auto;
    }
}

/* Tooltip styles */
.offering-tooltip-display {
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(226, 213, 195, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid rgba(197, 160, 89, 0.3);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-heading);
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
    font-style: italic;
    opacity: 0.8;
}

.offering-tooltip-display.active {
    background-color: rgba(226, 213, 195, 0.6);
    border-color: #C5A059;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    opacity: 1;
    font-style: normal;
}

/* Gently Remove Button */
.gently-remove-btn {
    display: none;
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-family: var(--font-body);
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 110;
    pointer-events: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gently-remove-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gently-remove-btn.show {
    display: block;
    animation: fadeInBtn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInBtn {
    from {
        opacity: 0;
        transform: translate(-50%, 5px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}