/* Candle Effect CSS */

/* Container fits to parent (.hero-section) */
.candle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d0907;
    perspective: 400px;
    z-index: 1;
    /* Above background-image, below content */
}

/* Ensure hero section content is above */
.hero-section .container {
    position: relative;
    z-index: 10;
}

:root {
    --flame-x: 50%;
    --flame-y: 43.5%;
}

.candle-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://ritualkiev.com.ua/wp-content/uploads/2026/02/candle.webp');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: 1;
    filter: brightness(0.9) contrast(1.1);
}

.flame-patch {
    position: absolute;
    left: var(--flame-x);
    top: var(--flame-y);
    width: 60px;
    height: 140px;
    transform: translate(-50%, -100%);
    background: #20150e;
    box-shadow: 0 0 30px 20px #20150e;
    border-radius: 50%;
    filter: blur(15px);
    z-index: 2;
    opacity: 0.95;
}

.full-screen-anchor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.flame-anchor {
    position: absolute;
    left: var(--flame-x);
    top: var(--flame-y);
    width: 50px;
    height: 140px;
    transform: translate(-50%, -100%);
    pointer-events: none;
}

/* LOOPS */
.anim-sway {
    width: 100%;
    height: 100%;
    animation: chaos-sway 7s ease-in-out infinite;
}

.anim-breathe {
    width: 100%;
    height: 100%;
    animation: chaos-breathe 5.3s ease-in-out infinite;
}

.anim-burst {
    width: 100%;
    height: 100%;
    animation: chaos-burst 29s linear infinite;
}

.z-img .anim-sway,
.z-img .anim-breathe,
.z-img .anim-burst {
    transform-origin: 50% 43.5%;
}

.z-syn .anim-sway,
.z-syn .anim-breathe,
.z-syn .anim-burst {
    transform-origin: 50% 100%;
}

.img-bg-holder {
    width: 100%;
    height: 100%;
    background-image: url('https://ritualkiev.com.ua/wp-content/uploads/2026/02/candle.webp');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    mask-image: radial-gradient(ellipse 30px 90px at 50% 36%, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 30px 90px at 50% 36%, black 40%, transparent 80%);
    filter: brightness(1.3) contrast(1.2);
}

.z-img {
    z-index: 3;
}

.z-syn {
    z-index: 4;
    mix-blend-mode: screen;
}

.flame-main-visual {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at bottom, rgba(255, 200, 80, 0.6) 0%, rgba(255, 100, 0, 0.3) 50%, transparent 85%);
    border-radius: 50% 50% 20% 20%;
    filter: blur(6px);
}

.flame-core-visual {
    position: absolute;
    bottom: 5%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: radial-gradient(ellipse at bottom, rgba(255, 255, 255, 0.8) 0%, rgba(255, 230, 150, 0.5) 70%, transparent 100%);
    border-radius: 50% 50% 30% 30%;
    filter: blur(4px);
    animation: quick-shiver 0.1s infinite alternate;
}

/* LIGHTING SYSTEM - COMPRESSED */
.light-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.light-base-breathe {
    z-index: 6;
    background: radial-gradient(circle at var(--flame-x) var(--flame-y), transparent 15%, rgba(0, 0, 0, 0.8) 60%, #000 95%);
    mix-blend-mode: multiply;
    animation: anim-light-breathe 5.3s ease-in-out infinite;
}

.light-burst-mrak {
    z-index: 7;
    background: #000;
    mix-blend-mode: multiply;
    animation: anim-light-mrak 29s linear infinite;
    opacity: 0;
}

.light-burst-flare {
    z-index: 8;
    background: radial-gradient(circle at var(--flame-x) var(--flame-y), rgba(255, 160, 0, 0.65) 0%, transparent 55%);
    mix-blend-mode: screen;
    animation: anim-light-flare 29s linear infinite;
    opacity: 0;
}

.light-micro-flicker {
    z-index: 9;
    background: radial-gradient(circle at var(--flame-x) var(--flame-y), rgba(255, 200, 100, 0.05) 0%, transparent 40%);
    mix-blend-mode: screen;
    animation: quick-flicker 0.15s infinite alternate;
}

/* KEYFRAMES */

@keyframes chaos-sway {

    0%,
    100% {
        transform: rotate(0deg) skewX(0deg);
    }

    15% {
        transform: rotate(2deg) skewX(-1deg);
    }

    30% {
        transform: rotate(-3deg) skewX(2deg);
    }

    45% {
        transform: rotate(1deg) skewX(0deg);
    }

    60% {
        transform: rotate(4deg) skewX(-3deg);
    }

    75% {
        transform: rotate(-2deg) skewX(1deg);
    }

    90% {
        transform: rotate(1.5deg) skewX(-0.5deg);
    }
}

@keyframes chaos-breathe {

    0%,
    100% {
        transform: scaleY(1);
    }

    25% {
        transform: scaleY(1.08);
    }

    50% {
        transform: scaleY(0.92);
    }

    75% {
        transform: scaleY(1.02);
    }
}

@keyframes chaos-burst {

    0%,
    35% {
        transform: scale(1);
        opacity: 1;
    }

    41% {
        transform: scale(0.85);
        opacity: 0.9;
    }

    45% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    51% {
        transform: scale(1.3, 1.1);
        opacity: 1;
    }

    53% {
        transform: scale(0.9);
        opacity: 1;
    }

    60% {
        transform: scale(1);
        opacity: 1;
    }

    72% {
        transform: scale(1);
        opacity: 1;
    }

    75% {
        transform: scale(0.6, 0.6);
        opacity: 0.6;
    }

    78% {
        transform: scale(1);
        opacity: 1;
    }

    95% {
        transform: scale(1.1);
        opacity: 1;
    }

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

/* COMPRESSED LIGHTING ANIMATIONS */

@keyframes anim-light-mrak {

    0%,
    70% {
        opacity: 0;
    }

    75% {
        opacity: 0.35;
    }

    80% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

@keyframes anim-light-flare {

    0%,
    48% {
        opacity: 0;
    }

    51% {
        opacity: 0.25;
    }

    54% {
        opacity: 0;
    }

    92% {
        opacity: 0;
    }

    95% {
        opacity: 0.15;
    }

    98% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

@keyframes anim-light-breathe {

    0%,
    100% {
        opacity: 0.4;
    }

    25% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.45;
    }

    75% {
        opacity: 0.4;
    }
}

@keyframes quick-flicker {
    from {
        opacity: 0.15;
    }

    to {
        opacity: 0.25;
    }
}

/* SPARKS */
.sparks-container {
    position: absolute;
    left: var(--flame-x);
    top: var(--flame-y);
    width: 100px;
    height: 400px;
    transform: translate(-50%, -100%);
    z-index: 5;
    pointer-events: none;
}

.spark {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    width: 3px;
    height: 3px;
    bottom: 0;
    opacity: 0;
    box-shadow: 0 0 5px #ffaa00;
    mix-blend-mode: screen;
}

.spark:nth-child(1) {
    left: 45%;
    animation: spark-fly-1 3.5s infinite linear;
    animation-delay: 0s;
}

.spark:nth-child(2) {
    left: 52%;
    animation: spark-fly-2 4.2s infinite linear;
    animation-delay: 1.5s;
    width: 2px;
}

.spark:nth-child(3) {
    left: 48%;
    animation: spark-fly-3 3.8s infinite linear;
    animation-delay: 2.2s;
    width: 4px;
}

.spark:nth-child(4) {
    left: 55%;
    animation: spark-fly-1 5.0s infinite linear;
    animation-delay: 0.5s;
    width: 2px;
}

.spark:nth-child(5) {
    left: 40%;
    animation: spark-fly-2 4.5s infinite linear;
    animation-delay: 3s;
}

.spark:nth-child(6) {
    left: 50%;
    animation: spark-fly-3 4.0s infinite linear;
    animation-delay: 1s;
    width: 3px;
}

@keyframes spark-fly-1 {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(-300px) translateX(-40px);
        opacity: 0;
    }
}

@keyframes spark-fly-2 {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(-250px) translateX(30px);
        opacity: 0;
    }
}

@keyframes spark-fly-3 {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(-350px) translateX(10px);
        opacity: 0;
    }
}

@media (max-width: 768px) {

    .candle-bg,
    .img-bg-holder {
        background-size: cover;
    }

    .img-bg-holder {
        -webkit-mask-image: radial-gradient(ellipse 30px 90px at 50% 47%, black 40%, transparent 80%);
        mask-image: radial-gradient(ellipse 30px 90px at 50% 47%, black 40%, transparent 80%);
    }

    :root {
        --flame-y: 47%;
    }

    .sparks-container {
        height: 300px;
    }

    .flame-patch {
        height: 160px;
        width: 80px;
        filter: blur(20px);
    }

    .z-img .anim-sway,
    .z-img .anim-breathe,
    .z-img .anim-burst {
        transform-origin: 50% 47%;
    }

    /* Mobile Text Layout Fixes */
    .hero-section {
        height: 100vh !important;
        /* Force exact screen height */
        min-height: 0 !important;
        overflow: hidden !important;
        /* Prevent scroll */
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        /* Push everything down */
        padding-bottom: 20px !important;
        /* Move text lower (reduced from 40px) */
    }

    .hero-section .container {
        flex: 0 0 auto !important;
        width: 100% !important;
        display: block !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    .hero-section .row {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin-bottom: 0 !important;
    }

    .hero-section .title-block {
        text-align: center !important;
        width: 100% !important;
        margin-bottom: 0 !important;
        padding-bottom: 10px !important;
        display: flex !important;
        /* Force flex centering for children */
        flex-direction: column !important;
        align-items: center !important;
    }

    /* Make text larger on mobile */
    .hero-section h1 {
        font-size: 28px !important;
        line-height: 1.2 !important;
        margin-bottom: 15px !important;
    }

    .hero-section p {
        font-size: 18px !important;
        margin-bottom: 25px !important;
    }

    /* Center button */
    .hero-section .btn {
        display: inline-block !important;
        margin: 0 auto !important;
        float: none !important;
        /* Remove any float */
    }

    .hero-section .image-block {
        display: none !important;
    }
}