:root {
    --void: #0a0a0c;
    --void-soft: #111016;
    --pink: #ff3b7a;
    --pink-soft: #ff8aae;
    --magenta: #d4367a;
    --gold: #e7bb6d;
    --white: #fff4f7;
    --muted: rgba(255, 225, 234, 0.62);
    --glass: rgba(23, 16, 24, 0.58);
    --border: rgba(255, 138, 174, 0.18);
    --shadow: 0 0 35px rgba(255, 59, 122, 0.26);
    --mx: 0;
    --my: 0;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--void);
    color: var(--white);
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    position: relative;
    font-family: Georgia, "Times New Roman", serif;
    isolation: isolate;
    user-select: none;
}

button {
    font: inherit;
}

#cosmos,
#effects {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#cosmos {
    z-index: -9;
}

#effects {
    z-index: 30;
    pointer-events: none;
}

.nebula {
    position: fixed;
    inset: -22%;
    z-index: -8;
    opacity: 0.72;
    filter: blur(70px) saturate(130%);
    background:
        radial-gradient(circle at 26% 32%, rgba(255, 59, 122, 0.24), transparent 28%),
        radial-gradient(circle at 72% 30%, rgba(212, 54, 122, 0.18), transparent 32%),
        radial-gradient(circle at 50% 78%, rgba(107, 29, 115, 0.18), transparent 34%);
    animation: nebulaDrift 24s ease-in-out infinite alternate;
    transform: translate3d(calc(var(--mx) * -0.8px), calc(var(--my) * -0.8px), 0);
    will-change: transform;
}

.nebula::before,
.nebula::after {
    content: "";
    position: absolute;
    width: 44vw;
    height: 44vw;
    min-width: 300px;
    min-height: 300px;
    border-radius: 50%;
    filter: blur(60px);
}

.nebula::before {
    top: 10%;
    right: 8%;
    background: rgba(255, 42, 114, 0.1);
    animation: cloudOne 18s ease-in-out infinite alternate;
}

.nebula::after {
    bottom: 5%;
    left: 7%;
    background: rgba(121, 41, 159, 0.12);
    animation: cloudTwo 21s ease-in-out infinite alternate;
}

.islamic-pattern {
    position: fixed;
    inset: -20%;
    z-index: -7;
    opacity: 0.045;
    background-size: 150px 150px;
    background-image:
        linear-gradient(30deg, transparent 45%, rgba(255, 190, 210, 0.8) 46%, rgba(255, 190, 210, 0.8) 48%, transparent 49%),
        linear-gradient(-30deg, transparent 45%, rgba(255, 190, 210, 0.8) 46%, rgba(255, 190, 210, 0.8) 48%, transparent 49%),
        linear-gradient(90deg, transparent 45%, rgba(231, 187, 109, 0.7) 46%, rgba(231, 187, 109, 0.7) 48%, transparent 49%);
    mask-image: radial-gradient(circle at center, black 10%, transparent 70%);
    animation: patternBreathe 12s ease-in-out infinite;
    transform: translate3d(calc(var(--mx) * 0.4px), calc(var(--my) * 0.4px), 0) rotate(4deg);
}

.grain,
.scanlines,
.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.grain {
    z-index: 80;
    opacity: 0.055;
    background-image: repeating-radial-gradient(circle at 17% 25%, rgba(255, 255, 255, 0.3) 0 0.6px, transparent 0.7px 3px);
    background-size: 8px 8px;
    animation: grainShift 0.3s steps(2) infinite;
    mix-blend-mode: soft-light;
}

.scanlines {
    z-index: 81;
    opacity: 0.16;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.36) 3px, transparent 4px);
}

.vignette {
    z-index: 79;
    background: radial-gradient(circle at center, transparent 34%, rgba(5, 4, 8, 0.28) 70%, rgba(3, 3, 5, 0.88) 112%);
}

.scene {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    perspective: 1100px;
}

.diorama {
    position: relative;
    width: min(960px, 100%);
    height: min(760px, 100%);
    display: grid;
    place-items: center;
    transform-style: preserve-3d;
}

.brand {
    position: absolute;
    top: 10%;
    left: 50%;
    z-index: 8;
    text-align: center;
    transform: translateX(-50%) translate3d(calc(var(--mx) * 0.18px), calc(var(--my) * 0.18px), 80px);
}

.brand-latin {
    margin: 0;
    direction: rtl;
    font-size: clamp(1.4rem, 4vw, 3.2rem);
    line-height: 1.2;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #fff2f6;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.65), 0 0 22px rgba(255, 59, 122, 0.75), 0 0 55px rgba(212, 54, 122, 0.48);
    animation: logoPulse 4.8s ease-in-out infinite;
    font-family: Georgia, "Times New Roman", serif;
    white-space: nowrap;
}

.brand-arabic {
    display: none;
}

.subtitle-container {
    position: absolute;
    bottom: 22%;
    left: 50%;
    z-index: 8;
    transform: translateX(-50%) translate3d(calc(var(--mx) * 0.1px), calc(var(--my) * 0.1px), 60px);
    width: 90%;
    max-width: 700px;
    text-align: center;
    padding: 0 20px;
}

.subtitle {
    font-size: clamp(1.1rem, 2.2vw, 1.8rem);
    letter-spacing: 0.08em;
    color: rgba(255, 225, 234, 0.8);
    text-shadow: 0 0 20px rgba(255, 59, 122, 0.2), 0 0 40px rgba(255, 59, 122, 0.1);
    font-weight: 400;
    line-height: 1.9;
    transition: opacity 0.5s ease;
    word-wrap: break-word;
    white-space: normal;
    direction: rtl;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 138, 174, 0.06);
}

.heart-zone {
    position: relative;
    z-index: 12;
    width: clamp(180px, 30vw, 340px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    transform-style: preserve-3d;
    transform: translate3d(calc(var(--mx) * 0.32px), calc(var(--my) * 0.32px), 100px);
    transition: transform 120ms linear;
    margin-top: 35px;
}

.heartbeat-field {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    filter: blur(12px);
    opacity: 0.55;
    background: radial-gradient(circle, rgba(255, 59, 122, 0.2), transparent 58%);
    animation: fieldPulse 2.9s ease-in-out infinite;
}

.heart-ring {
    position: absolute;
    width: 59%;
    height: 59%;
    border: 1px solid rgba(255, 111, 155, 0.28);
    border-radius: 50%;
    opacity: 0;
    animation: ringPulse 2.9s cubic-bezier(.2, .7, .2, 1) infinite;
}

.heart-ring:nth-child(2) {
    animation-delay: 0.18s;
}

.heart-ring:nth-child(3) {
    animation-delay: 0.36s;
}

.heart-button {
    position: relative;
    width: 48%;
    aspect-ratio: 1;
    border: 0;
    outline: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 59, 122, 0.82)) drop-shadow(0 0 42px rgba(212, 54, 122, 0.52));
    transform-style: preserve-3d;
    animation: heartBeat 2.9s cubic-bezier(.22, .61, .36, 1) infinite, heartFloat 7s ease-in-out infinite;
}

.heart-button::before,
.heart-button::after {
    content: "";
    position: absolute;
    width: 68%;
    height: 104%;
    top: 0;
    border-radius: 60% 60% 44% 44%;
    background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.92), transparent 12%),
        radial-gradient(circle at 35% 30%, rgba(255, 156, 187, 0.78), transparent 28%),
        linear-gradient(145deg, #ff7aa3 0%, var(--heart-color, #ff3b7a) 38%, #bb174e 100%);
    box-shadow: inset 9px 5px 20px rgba(255, 255, 255, 0.16), inset -12px -14px 24px rgba(74, 0, 28, 0.35);
    transition: background 0.9s ease, filter 0.9s ease;
}

.heart-button::before {
    left: 50%;
    transform-origin: 0 100%;
    transform: rotate(-45deg);
}

.heart-button::after {
    right: 50%;
    transform-origin: 100% 100%;
    transform: rotate(45deg);
}

.heart-button:active {
    animation-play-state: paused;
    transform: scale(0.9);
}

.heart-shine {
    position: absolute;
    z-index: 4;
    width: 19%;
    height: 39%;
    top: 14%;
    left: 31%;
    border-radius: 50%;
    opacity: 0.72;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.92), transparent);
    filter: blur(5px);
    transform: rotate(-25deg);
    pointer-events: none;
}

.heart-crack {
    position: absolute;
    z-index: 5;
    top: 28%;
    left: 50%;
    width: 1px;
    height: 26%;
    opacity: 0.26;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.85), transparent);
    transform: rotate(7deg);
    pointer-events: none;
}

.heart-aura {
    position: absolute;
    width: 68%;
    height: 68%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 59, 122, 0.18), rgba(212, 54, 122, 0.06) 44%, transparent 72%);
    filter: blur(18px);
    animation: auraPulse 2.9s ease-in-out infinite;
}

.heart-label {
    position: absolute;
    bottom: 4%;
    left: 50%;
    min-width: 160px;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 218, 229, 0.42);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    pointer-events: none;
}

.astrolabe {
    position: absolute;
    right: clamp(-120px, -10vw, -40px);
    bottom: clamp(-100px, -7vh, -30px);
    width: clamp(210px, 34vw, 430px);
    aspect-ratio: 1;
    z-index: 1;
    opacity: 0.16;
    border: 1px solid rgba(231, 187, 109, 0.62);
    border-radius: 50%;
    transform: translate3d(calc(var(--mx) * -0.08px), calc(var(--my) * -0.08px), -80px);
    animation: astrolabeRotate 45s linear infinite;
}

.astrolabe::before,
.astrolabe::after {
    content: "";
    position: absolute;
    inset: 10%;
    border: 1px dashed rgba(231, 187, 109, 0.52);
    border-radius: 50%;
}

.astrolabe::after {
    inset: 25%;
    background:
        linear-gradient(45deg, transparent 48%, rgba(231, 187, 109, 0.35) 49%, rgba(231, 187, 109, 0.35) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(231, 187, 109, 0.35) 49%, rgba(231, 187, 109, 0.35) 51%, transparent 52%);
    border-style: solid;
}

.astrolabe-lines {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(90deg, transparent 49.7%, rgba(231, 187, 109, 0.32) 50%, transparent 50.3%),
        linear-gradient(0deg, transparent 49.7%, rgba(231, 187, 109, 0.32) 50%, transparent 50.3%),
        conic-gradient(from 0deg, transparent 0 10deg, rgba(231, 187, 109, 0.28) 10deg 11deg, transparent 11deg 25deg, rgba(231, 187, 109, 0.28) 25deg 26deg, transparent 26deg 40deg);
}

.seal {
    position: absolute;
    z-index: 19;
    right: clamp(2px, 3vw, 26px);
    bottom: clamp(2px, 3vh, 25px);
    width: 60px;
    height: 60px;
    border: 1px solid rgba(231, 187, 109, 0.28);
    border-radius: 50%;
    cursor: pointer;
    color: #f0c980;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.24), transparent 16%), radial-gradient(circle at center, #9a293d 0 42%, #721b2e 43% 64%, #41101d 65%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.34), 0 0 24px rgba(231, 187, 109, 0.12), inset 0 0 13px rgba(0, 0, 0, 0.4);
    display: grid;
    place-items: center;
    font-size: 1.45rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.seal:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.4), 0 0 34px rgba(231, 187, 109, 0.22);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
    background: rgba(4, 3, 6, 0.74);
    backdrop-filter: blur(14px);
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.letter {
    position: relative;
    width: min(560px, 100%);
    max-height: min(74dvh, 680px);
    overflow: auto;
    padding: clamp(28px, 6vw, 52px);
    border: 1px solid rgba(231, 187, 109, 0.24);
    border-radius: 28px;
    color: #4b2430;
    background: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04)), radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.78), transparent 28%), #ead8c0;
    box-shadow: 0 35px 100px rgba(0, 0, 0, 0.55), inset 0 0 80px rgba(110, 61, 35, 0.08);
    transform: translateY(35px) scale(0.94) rotate(-1deg);
    transition: transform 0.5s cubic-bezier(.2, .8, .2, 1);
}

.modal.open .letter {
    transform: translateY(0) scale(1) rotate(0);
}

.letter::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(101, 55, 31, 0.15);
    border-radius: 20px;
    pointer-events: none;
}

.letter-title {
    margin: 0;
    text-align: center;
    font-size: clamp(1.7rem, 5vw, 2.8rem);
    color: #7a263e;
}

.letter-text {
    margin: 26px 0 0;
    font-size: clamp(1rem, 2.6vw, 1.2rem);
    line-height: 2.05;
    text-align: right;
}

.letter-signature {
    margin: 30px 0 0;
    text-align: left;
    color: #862b47;
    font-size: 1.25rem;
    font-style: italic;
}

.close-letter {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(90, 40, 50, 0.16);
    border-radius: 50%;
    cursor: pointer;
    color: #652134;
    background: rgba(255, 255, 255, 0.25);
    font-size: 1.4rem;
}

@keyframes nebulaDrift {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }

    100% {
        transform: translate3d(3%, 2%, 0) scale(1.08);
    }
}

@keyframes cloudOne {
    to {
        transform: translate3d(-12%, 8%, 0) scale(1.2);
    }
}

@keyframes cloudTwo {
    to {
        transform: translate3d(10%, -8%, 0) scale(1.15);
    }
}

@keyframes patternBreathe {

    0%,
    100% {
        opacity: 0.025;
    }

    50% {
        opacity: 0.06;
    }
}

@keyframes grainShift {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-1%, 1%);
    }

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

    75% {
        transform: translate(0.5%, 1%);
    }

    100% {
        transform: translate(-0.5%, -0.5%);
    }
}

@keyframes logoPulse {

    0%,
    100% {
        opacity: 0.84;
        filter: brightness(0.95);
    }

    50% {
        opacity: 1;
        filter: brightness(1.18);
    }
}

@keyframes subtitleFade {

    0%,
    100% {
        opacity: 0.2;
        transform: translateY(4px);
    }

    45%,
    65% {
        opacity: 0.8;
        transform: translateY(0);
    }
}

@keyframes heartBeat {

    0%,
    15%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    7% {
        transform: scale(1.115) rotate(-0.7deg);
    }

    11% {
        transform: scale(0.985) rotate(0.5deg);
    }

    18% {
        transform: scale(1.075) rotate(0.65deg);
    }

    24% {
        transform: scale(1) rotate(0deg);
    }

    7.5% {
        filter: drop-shadow(0 0 23px rgba(255, 59, 122, 0.95)) drop-shadow(0 0 70px rgba(212, 54, 122, 0.72));
    }
}

@keyframes heartFloat {

    0%,
    100% {
        translate: 0 0;
    }

    50% {
        translate: 0 -7px;
    }
}

@keyframes auraPulse {

    0%,
    15%,
    100% {
        transform: scale(0.88);
        opacity: 0.35;
    }

    8%,
    19% {
        transform: scale(1.15);
        opacity: 0.72;
    }
}

@keyframes fieldPulse {

    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.28;
    }

    10%,
    22% {
        transform: scale(1.12);
        opacity: 0.72;
    }
}

@keyframes ringPulse {

    0%,
    5% {
        transform: scale(0.55);
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    45%,
    100% {
        transform: scale(1.75);
        opacity: 0;
    }
}

@keyframes astrolabeRotate {
    to {
        rotate: 360deg;
    }
}

@media (max-width: 640px) {
    .brand {
        top: 8%;
    }

    .brand-latin {
        font-size: clamp(1.7rem, 6vw, 2.5rem);
    }

    .heart-zone {
        width: min(78vw, 260px);
        margin-top: 25px;
    }

    .subtitle-container {
        bottom: 20%;
    }

    .subtitle {
        font-size: clamp(.85rem, 2.5vw, 1rem);
        padding: 6px 10px;
        line-height: 1.6;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}