
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --night: #090812;
    --purple: #21152d;
    --pink: #d65b83;
    --gold: #e5bd78;
    --cyan: #74c8cb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    font-family: 'Vazirmatn', sans-serif;
    background: var(--night);
    overflow: hidden;
}

.carnival {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse at 50% 48%, rgba(73, 37, 75, 0.32), transparent 48%),
        linear-gradient(180deg, #0b0b19 0%, #171124 48%, #100d18 76%, #080910 100%);
}

/* SKY */

.sky {
    position: absolute;
    inset: 0;
    z-index: -5;
    overflow: hidden;
}

.moon {
    position: absolute;
    top: 9%;
    right: 16%;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff5d9, #d8c7aa 70%, #a99b8b);
    box-shadow:
        0 0 25px rgba(241, 221, 186, 0.25),
        0 0 85px rgba(220, 196, 164, 0.13);
    animation: moonPulse 5s ease-in-out infinite alternate;
}

@keyframes moonPulse {
    from { opacity: .75; }
    to { opacity: 1; }
}

.stars {
    position: absolute;
    inset: 0;
    opacity: .65;
    background-image:
        radial-gradient(2px 2px at 8% 16%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 20% 34%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 32% 12%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 45% 27%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 59% 11%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 72% 29%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 88% 17%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 94% 43%, #fff 50%, transparent 100%),
        radial-gradient(1px 1px at 13% 48%, #fff 50%, transparent 100%),
        radial-gradient(2px 2px at 81% 54%, #fff 50%, transparent 100%);
    animation: starTwinkle 4s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
    from { opacity: .3; }
    to { opacity: .8; }
}

.cloud {
    position: absolute;
    width: 330px;
    height: 65px;
    border-radius: 50%;
    background: rgba(76, 64, 91, .3);
    filter: blur(25px);
    animation: cloudDrift 42s linear infinite;
}

.cloud-one { top: 22%; left: -15%; }
.cloud-two {
    top: 38%;
    right: -15%;
    animation-duration: 55s;
    animation-direction: reverse;
}
.cloud-three {
    top: 9%;
    left: 48%;
    opacity: .45;
    animation-duration: 65s;
}

@keyframes cloudDrift {
    from { transform: translateX(-10%); }
    to { transform: translateX(120vw); }
}

/* DISTANT CITY */

.distant-city {
    position: absolute;
    z-index: -4;
    bottom: 23%;
    left: 0;
    width: 100%;
    height: 110px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    opacity: .45;
}

.distant-city span {
    flex: 1;
    height: 45%;
    background: #0d0d19;
    position: relative;
}

.distant-city span:nth-child(2n) { height: 75%; }
.distant-city span:nth-child(3n) { height: 58%; }
.distant-city span:nth-child(4n) { height: 90%; }

.distant-city span::after {
    content: "";
    position: absolute;
    inset: 12px 8px;
    background: repeating-linear-gradient(
        90deg,
        rgba(218, 161, 99, .3) 0 3px,
        transparent 3px 13px
    );
}

/* CARNIVAL SIGN */

.carnival-sign {
    position: absolute;
    z-index: 3;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: min(360px, 70%);
    padding: 9px;
    border: 1px solid rgba(223, 171, 109, .45);
    background: rgba(24, 14, 29, .88);
    box-shadow:
        0 0 25px rgba(211, 93, 128, .12),
        inset 0 0 20px rgba(211, 93, 128, .08);
    animation: signFlicker 6s infinite;
}

.sign-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 5px;
    border: 1px solid rgba(229, 189, 120, .35);
}

.sign-title {
    direction: ltr;
    color: #f1c78c;
    font-family: Georgia, serif;
    font-size: clamp(15px, 2.5vw, 22px);
    letter-spacing: 3px;
    text-shadow: 0 0 12px rgba(240, 177, 111, .6);
}

.sign-subtitle {
    color: #c98b9d;
    font-size: 8px;
    letter-spacing: 4px;
}

.sign-star {
    color: var(--gold);
    font-size: 12px;
}

.sign-bulbs {
    position: absolute;
    inset: -5px;
    pointer-events: none;
    background:
        radial-gradient(circle, #f5d18d 2px, transparent 3px) 0 0 / 35px 35px;
    opacity: .65;
}

@keyframes signFlicker {
    0%, 92%, 96%, 100% { opacity: 1; }
    93% { opacity: .75; }
    95% { opacity: .9; }
}

/* FERRIS WHEEL */

.ferris-wheel {
    position: absolute;
    z-index: -1;
    left: 8%;
    bottom: 14%;
    width: 390px;
    height: 440px;
    filter: drop-shadow(0 0 18px rgba(220, 143, 107, .12));
}

.wheel-structure {
    position: absolute;
    top: 0;
    left: 50%;
    width: 340px;
    height: 340px;
    transform: translateX(-50%);
    animation: wheelRotate 65s linear infinite;
}

@keyframes wheelRotate {
    to { transform: translateX(-50%) rotate(360deg); }
}

.wheel-ring {
    position: absolute;
    border: 3px solid #796078;
    border-radius: 50%;
    inset: 0;
}

.outer-ring {
    box-shadow:
        0 0 12px rgba(218, 135, 160, .35),
        inset 0 0 12px rgba(218, 135, 160, .15);
}

.inner-ring {
    inset: 20px;
    border-width: 2px;
    border-color: #9b7b80;
}

.wheel-spokes {
    position: absolute;
    inset: 0;
}

.wheel-spokes i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 50%;
    background: linear-gradient(180deg, #b58b88, #57445c);
    transform-origin: top center;
}

.wheel-spokes i:nth-child(1) { transform: rotate(0deg); }
.wheel-spokes i:nth-child(2) { transform: rotate(30deg); }
.wheel-spokes i:nth-child(3) { transform: rotate(60deg); }
.wheel-spokes i:nth-child(4) { transform: rotate(90deg); }
.wheel-spokes i:nth-child(5) { transform: rotate(120deg); }
.wheel-spokes i:nth-child(6) { transform: rotate(150deg); }
.wheel-spokes i:nth-child(7) { transform: rotate(180deg); }
.wheel-spokes i:nth-child(8) { transform: rotate(210deg); }
.wheel-spokes i:nth-child(9) { transform: rotate(240deg); }
.wheel-spokes i:nth-child(10) { transform: rotate(270deg); }
.wheel-spokes i:nth-child(11) { transform: rotate(300deg); }
.wheel-spokes i:nth-child(12) { transform: rotate(330deg); }

.wheel-hub {
    position: absolute;
    width: 20px;
    height: 20px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #d7ad78;
    border: 4px solid #49394f;
    box-shadow: 0 0 15px rgba(238, 189, 126, .45);
}

.wheel-cabins {
    position: absolute;
    inset: 0;
}

.cabin {
    position: absolute;
    width: 25px;
    height: 32px;
    border: 2px solid #b17c79;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(90deg, #503a52, #a45b72, #4b344e);
    box-shadow: 0 0 9px rgba(218, 116, 143, .2);
}

.cabin-1 { top: -13px; left: 50%; transform: translateX(-50%); }
.cabin-2 { top: 7%; right: 13%; transform: rotate(45deg); }
.cabin-3 { top: 50%; right: -12px; transform: translateY(-50%) rotate(90deg); }
.cabin-4 { bottom: 7%; right: 13%; transform: rotate(-45deg); }
.cabin-5 { bottom: -13px; left: 50%; transform: translateX(-50%); }
.cabin-6 { bottom: 7%; left: 13%; transform: rotate(45deg); }
.cabin-7 { top: 50%; left: -12px; transform: translateY(-50%) rotate(90deg); }
.cabin-8 { top: 7%; left: 13%; transform: rotate(-45deg); }

.wheel-leg {
    position: absolute;
    top: 280px;
    width: 10px;
    height: 155px;
    background: linear-gradient(90deg, #443747, #9a7580, #3d3044);
    transform-origin: top center;
}

.leg-left {
    left: 48%;
    transform: rotate(18deg);
}

.leg-right {
    right: 48%;
    transform: rotate(-18deg);
}

.wheel-base {
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 9px;
    background: #685064;
    box-shadow: 0 5px 15px #000;
}

/* CAROUSEL */

.carousel-scene {
    position: absolute;
    z-index: 0;
    right: 12%;
    bottom: 13%;
    width: 300px;
    height: 300px;
    filter: drop-shadow(0 0 20px rgba(225, 143, 111, .12));
}

.carousel-roof {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 115px;
}

.roof-topper {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 13px;
    height: 25px;
    background: #c69a69;
    border-radius: 50% 50% 0 0;
}

.roof-cone {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 145px solid transparent;
    border-right: 145px solid transparent;
    border-bottom: 90px solid #58364e;
    filter: drop-shadow(0 5px 3px rgba(0, 0, 0, .6));
}

.roof-edge {
    position: absolute;
    bottom: 17px;
    left: 0;
    width: 100%;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(90deg, #9e5c72, #e2b77b, #9e5c72);
    box-shadow: 0 0 18px rgba(228, 174, 117, .35);
}

.roof-lights {
    position: absolute;
    z-index: 2;
    bottom: 20px;
    left: 12px;
    width: calc(100% - 24px);
    height: 8px;
    border-radius: 50%;
    background: repeating-linear-gradient(
        90deg,
        #ffe0a1 0 5px,
        transparent 5px 22px
    );
    filter: drop-shadow(0 0 5px #f5c77e);
    animation: bulbsBlink 2s infinite alternate;
}

@keyframes bulbsBlink {
    from { opacity: .55; }
    to { opacity: 1; }
}

.carousel-body {
    position: absolute;
    top: 105px;
    left: 50%;
    transform: translateX(-50%);
    width: 225px;
    height: 140px;
    overflow: hidden;
    border-radius: 50% 50% 8px 8px;
    background: linear-gradient(180deg, #8e5269, #392c43 80%);
    border: 3px solid #b47d79;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, .55);
}

.carousel-inner {
    position: absolute;
    inset: 0;
    animation: carouselRotate 18s linear infinite;
}

@keyframes carouselRotate {
    to { transform: rotate(360deg); }
}

.carousel-pole {
    position: absolute;
    top: 0;
    width: 4px;
    height: 130px;
    background: linear-gradient(90deg, #b98d70, #f0d09a, #73506a);
    transform-origin: top center;
}

.pole-one { left: 25%; }
.pole-two { left: 50%; }
.pole-three { left: 75%; }
.pole-four { left: 90%; }

.carousel-horse {
    position: absolute;
    width: 44px;
    height: 30px;
    animation: horseBob 2s ease-in-out infinite alternate;
}

.horse-one { left: 12%; top: 54px; }
.horse-two { left: 43%; top: 35px; animation-delay: .7s; }
.horse-three { left: 72%; top: 58px; animation-delay: 1.2s; }

.horse-body {
    position: absolute;
    top: 10px;
    left: 4px;
    width: 28px;
    height: 13px;
    border-radius: 50%;
    background: #e2c49a;
    box-shadow: inset -4px -3px 0 rgba(80, 43, 50, .25);
}

.horse-head {
    position: absolute;
    top: 0;
    left: 26px;
    width: 12px;
    height: 16px;
    border-radius: 50% 50% 30% 30%;
    background: #e2c49a;
    transform: rotate(-20deg);
}

.horse-leg {
    position: absolute;
    top: 20px;
    left: 12px;
    width: 3px;
    height: 10px;
    background: #e2c49a;
    box-shadow: 13px 0 #e2c49a;
}

@keyframes horseBob {
    from { transform: translateY(-4px); }
    to { transform: translateY(5px); }
}

.carousel-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(180deg, #c18b70, #51374b);
    border: 2px solid #d1a176;
    box-shadow: 0 8px 15px rgba(0, 0, 0, .6);
}

/* TICKET BOOTH */

.ticket-booth {
    position: absolute;
    z-index: 1;
    bottom: 12%;
    right: 3%;
    width: 115px;
    height: 145px;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .6));
}

.booth-roof {
    position: absolute;
    top: 0;
    left: -8px;
    width: 131px;
    height: 25px;
    background: repeating-linear-gradient(
        90deg,
        #9f4e63 0 18px,
        #e4c18a 18px 36px
    );
    border: 2px solid #d3a879;
    border-radius: 5px 5px 0 0;
}

.booth-body {
    position: absolute;
    top: 23px;
    width: 100%;
    height: 115px;
    background: linear-gradient(90deg, #34273b, #644052, #30243a);
    border: 2px solid #8c6673;
}

.booth-window {
    position: absolute;
    top: 12px;
    left: 15px;
    width: 80px;
    height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #f2d6a4;
    background: rgba(255, 198, 125, .13);
    border: 2px solid #bd9875;
    box-shadow: inset 0 0 18px rgba(238, 179, 111, .25);
}

.booth-window span {
    font-size: 13px;
    font-weight: 700;
}

.booth-window small {
    font-size: 8px;
}

.booth-door {
    position: absolute;
    bottom: 0;
    left: 38px;
    width: 38px;
    height: 38px;
    background: #211a2b;
    border: 2px solid #755565;
    border-bottom: 0;
}

.booth-counter {
    position: absolute;
    bottom: 0;
    left: -5px;
    width: 125px;
    height: 7px;
    background: #a87972;
}

/* DECORATIVE LIGHTS */

.decorative-lights {
    position: absolute;
    z-index: 2;
    top: 23%;
    left: 4%;
    width: 90%;
    height: 35px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    pointer-events: none;
}

.decorative-lights span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e9c184;
    box-shadow: 0 0 12px 3px rgba(237, 185, 120, .5);
    animation: lightBlink 2.4s ease-in-out infinite alternate;
}

.decorative-lights span:nth-child(3n) {
    background: #d76b8d;
    box-shadow: 0 0 12px 3px rgba(215, 107, 141, .5);
    animation-delay: .8s;
}

.decorative-lights span:nth-child(2n) {
    animation-delay: 1.3s;
}

@keyframes lightBlink {
    from { opacity: .35; }
    to { opacity: 1; }
}

/* GROUND AND FOG */

.ground {
    position: absolute;
    z-index: 1;
    bottom: 0;
    width: 100%;
    height: 23%;
    background: linear-gradient(180deg, #171321, #090a11 85%);
}

.ground-line {
    position: absolute;
    top: 10px;
    left: -5%;
    width: 110%;
    height: 2px;
    background: rgba(177, 132, 124, .2);
    transform: rotate(-2deg);
}

.fog {
    position: absolute;
    width: 55%;
    height: 75px;
    border-radius: 50%;
    background: rgba(159, 139, 169, .12);
    filter: blur(25px);
}

.fog-one {
    top: 0;
    left: -10%;
    animation: fogDrift 24s ease-in-out infinite alternate;
}

.fog-two {
    top: 30%;
    right: -12%;
    animation: fogDrift 30s ease-in-out infinite alternate-reverse;
}

.fog-three {
    top: 50%;
    left: 30%;
    width: 40%;
    opacity: .6;
    animation: fogDrift 35s ease-in-out infinite alternate;
}

@keyframes fogDrift {
    from { transform: translateX(-5%); }
    to { transform: translateX(20%); }
}

/* VIGNETTE */

.vignette {
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(4, 4, 10, .45), transparent 25%, transparent 75%, rgba(4, 4, 10, .45)),
        linear-gradient(0deg, rgba(4, 4, 10, .45), transparent 35%, transparent 75%, rgba(4, 4, 10, .2));
}

/* ERROR CONTENT */

.error-content {
    position: absolute;
    z-index: 5;
    top: 53%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(430px, 90%);
    padding: 22px;
    text-align: center;
    color: #f5e8df;
    text-shadow: 0 3px 12px rgba(0, 0, 0, .9);
    animation: contentAppear 1.5s ease-out both;
}

@keyframes contentAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.error-label {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: #e7b5a2;
}

.error-label p {
    font-size: 11px;
    font-weight: 400;
}

.error-label span {
    width: 24px;
    height: 1px;
    background: rgba(231, 181, 162, .6);
}

.error-content h1 {
    direction: ltr;
    font-family: Georgia, serif;
    font-size: clamp(85px, 12vw, 125px);
    line-height: 1.12;
    letter-spacing: 8px;
    color: #f0c18e;
    text-shadow:
        0 0 15px rgba(234, 166, 133, .35),
        0 5px 25px rgba(0, 0, 0, .8);
}

.error-content h2 {
    margin: 3px 0 12px;
    font-size: clamp(19px, 2.5vw, 24px);
    font-weight: 600;
    color: #fff0e4;
}

.description {
    max-width: 340px;
    margin: 0 auto;
    color: #e1d4d0;
    font-size: 13px;
    line-height: 2.2;
    font-weight: 400;
    text-shadow: 0 2px 8px #000;
}

.home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    margin-top: 24px;
    padding: 11px 23px;
    border: 1px solid rgba(225, 179, 133, .65);
    border-radius: 3px;
    color: #f2d7b6;
    background: rgba(35, 22, 38, .8);
    text-decoration: none;
    font-size: 13px;
    backdrop-filter: blur(8px);
    transition: .3s ease;
}

.home-button:hover {
    background: rgba(142, 70, 94, .35);
    border-color: #f2c58c;
    box-shadow: 0 0 22px rgba(225, 159, 128, .22);
    transform: translateY(-3px);
}

.button-arrow {
    font-size: 18px;
    transition: transform .3s ease;
}

.home-button:hover .button-arrow {
    transform: translateX(-5px);
}

/* FOOTER */

.bottom-note {
    position: absolute;
    z-index: 6;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: max-content;
    max-width: 95%;
    color: rgba(228, 206, 193, .65);
    font-size: 9px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.status-light {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d66c85;
    box-shadow: 0 0 8px #d66c85;
    animation: lightBlink 1.5s infinite alternate;
}

.separator {
    color: #d6a878;
}

/* TABLET */

@media (max-width: 900px) {
    .ferris-wheel {
        left: -3%;
        transform: scale(.85);
        transform-origin: bottom left;
    }

    .carousel-scene {
        right: 5%;
        transform: scale(.85);
        transform-origin: bottom right;
    }

    .ticket-booth {
        right: 1%;
        transform: scale(.85);
        transform-origin: bottom right;
    }

    .error-content {
        top: 53%;
    }
}

/* MOBILE */

@media (max-width: 600px) {
    .moon {
        width: 65px;
        height: 65px;
        top: 8%;
        right: 9%;
    }

    .carnival-sign {
        top: 4%;
        width: 78%;
    }

    .sign-title {
        font-size: 15px;
        letter-spacing: 2px;
    }

    .sign-subtitle {
        font-size: 7px;
    }

    .ferris-wheel {
        left: -115px;
        bottom: 10%;
        transform: scale(.68);
        transform-origin: bottom left;
    }

    .carousel-scene {
        right: -40px;
        bottom: 10%;
        transform: scale(.68);
        transform-origin: bottom right;
    }

    .ticket-booth {
        right: 2%;
        bottom: 8%;
        transform: scale(.65);
        transform-origin: bottom right;
    }

    .decorative-lights {
        top: 26%;
        left: 0;
        width: 100%;
    }

    .error-content {
        top: 52%;
        width: 96%;
        padding: 12px;
    }

    .error-content h1 {
        font-size: clamp(76px, 20vw, 100px);
        letter-spacing: 5px;
    }

    .error-content h2 {
        font-size: 19px;
    }

    .description {
        max-width: 290px;
        font-size: 11px;
        line-height: 2;
    }

    .home-button {
        margin-top: 18px;
        padding: 10px 18px;
        font-size: 12px;
    }

    .bottom-note {
        bottom: 12px;
        gap: 6px;
        font-size: 7px;
        letter-spacing: .3px;
    }

    .ground {
        height: 19%;
    }
}

/* SMALL HEIGHT */

@media (max-height: 650px) and (min-width: 601px) {
    .carnival-sign {
        top: 2%;
        transform: translateX(-50%) scale(.8);
    }

    .ferris-wheel {
        transform: scale(.72);
        transform-origin: bottom left;
    }

    .carousel-scene {
        transform: scale(.72);
        transform-origin: bottom right;
    }

    .error-content {
        top: 53%;
    }

    .error-content h1 {
        font-size: 75px;
    }

    .home-button {
        margin-top: 12px;
    }
}

/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
/* FLOATING DUST */

.dust-particle {
    position: absolute;
    z-index: 3;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #e9c7a0;
    box-shadow: 0 0 8px rgba(233, 199, 160, .65);
    pointer-events: none;
    animation: dustFloat 13s linear infinite;
}

@keyframes dustFloat {
    0% {
        transform: translate(0, 20px);
        opacity: 0;
    }

    20% {
        opacity: .7;
    }

    75% {
        opacity: .4;
    }

    100% {
        transform: translate(-35px, -120px);
        opacity: 0;
    }
}