/* =========================================================
   A Little Gift For You - style.css
   Tema angkasa: langit malam, bintang, planet bercincin.
   ========================================================= */

:root {
    --space-950: #050816;
    --space-900: #080d20;
    --space-800: #0e1533;
    --panel: rgba(19, 26, 58, 0.82);
    --border: rgba(126, 143, 214, 0.26);
    --border-strong: rgba(159, 140, 255, 0.45);
    --star: #eef1ff;
    --text: #dce2f8;
    --muted: #bcc5e6;
    --label: #a5b0dd;
    --accent: #a99bff;
    --accent-soft: #8f83ff;
    --cyan: #6ee7e0;
    --btn: #5b4fd6;
    --btn-hover: #6f63f0;
    --shadow: 0 22px 55px rgba(2, 4, 14, 0.6);
    --radius: 26px;
}

/* Pengaturan dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--space-950);
    background-image:
        radial-gradient(ellipse 90% 60% at 15% 0%, rgba(96, 82, 220, 0.30), transparent 60%),
        radial-gradient(ellipse 75% 55% at 95% 100%, rgba(32, 116, 160, 0.22), transparent 65%),
        radial-gradient(ellipse 60% 45% at 50% 55%, rgba(124, 60, 190, 0.12), transparent 70%);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 74px 16px 34px;
    overflow-x: hidden;
    color: var(--text);
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Tautan ke halaman musik */
.music-link {
    position: fixed;
    top: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #6f63f0, #4a3fc0);
    color: #ffffff;
    border: 1px solid rgba(180, 190, 255, 0.3);
    border-radius: 999px;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    z-index: 10;
    box-shadow: 0 10px 24px rgba(30, 20, 90, 0.55);
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.music-link:hover {
    background: linear-gradient(135deg, #8276ff, #5a4fdc);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(80, 60, 200, 0.55);
}

.music-link:active {
    transform: scale(0.97);
}

/* Container */
.container {
    width: min(92%, 460px);
    position: relative;
    z-index: 2;
}

/* Kartu utama & sapaan */
.card,
.greeting {
    position: relative;
    background: linear-gradient(160deg, rgba(30, 39, 82, 0.9), rgba(12, 17, 40, 0.95));
    padding: 36px 26px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: appear 0.9s ease both;
    overflow: hidden;
}

.card::before,
.greeting::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(159, 140, 255, 0.7), transparent);
}

.card.is-leaving {
    animation: disappear 0.35s ease forwards;
}

/* Ilustrasi planet */
.planet-art {
    width: min(100%, 232px);
    margin: -6px auto 4px;
}

.planet-art svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 26px rgba(124, 108, 240, 0.35));
    animation: floaty 6s ease-in-out infinite;
}

/* Ilustrasi komet */
.comet-art {
    width: min(100%, 220px);
    margin: -4px auto 6px;
}

.comet-art svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 18px rgba(143, 131, 255, 0.4));
}

.small-text {
    font-size: 11.5px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--label);
    margin: 14px 0 12px;
}

h1 {
    font-size: 29px;
    color: #f4f6ff;
    margin-bottom: 14px;
    line-height: 1.25;
    letter-spacing: -0.2px;
    text-shadow: 0 0 28px rgba(159, 140, 255, 0.35);
}

.description,
.message {
    font-size: 15px;
    line-height: 1.95;
    color: var(--muted);
}

/* Tombol */
.open-btn,
.back-btn,
.surprise-btn,
.reply-btn {
    display: inline-block;
    margin-top: 24px;
    padding: 13px 24px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s,
                border-color 0.25s, color 0.25s;
}

.open-btn,
.surprise-btn {
    background: linear-gradient(135deg, #6f63f0, #4a3fc0);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(60, 45, 170, 0.45);
}

.open-btn:hover,
.surprise-btn:hover {
    background: linear-gradient(135deg, #8377ff, #5a4fdc);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(80, 60, 200, 0.5);
}

.open-btn:active,
.surprise-btn:active {
    transform: scale(0.97);
}

.reply-btn {
    background: rgba(110, 231, 224, 0.08);
    border-color: rgba(110, 231, 224, 0.45);
    color: #c7f7f3;
}

.reply-btn:hover {
    background: rgba(110, 231, 224, 0.16);
    transform: translateY(-2px);
}

.back-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(150, 165, 220, 0.35);
    color: var(--muted);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #f4f6ff;
    transform: translateY(-2px);
}

/* Halaman sapaan */
.greeting.show {
    animation: appear 0.9s ease both;
}

.reveal {
    opacity: 0;
}

.greeting.show .reveal {
    animation: riseIn 0.65s ease forwards;
    animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}

/* Pesan manis acak */
.note {
    margin: 22px auto 0;
    padding: 16px 18px;
    max-width: 340px;
    background: rgba(159, 140, 255, 0.10);
    border: 1.5px dashed rgba(159, 140, 255, 0.42);
    border-radius: 18px;
}

.note.is-popping {
    animation: notePop 0.45s ease;
}

.note p {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
}

/* Hati */
.heart {
    margin: 22px 0 10px;
    font-size: 26px;
    color: var(--accent);
    text-shadow: 0 0 16px rgba(159, 140, 255, 0.65);
    animation: heartbeat 1.3s ease-in-out infinite;
}

.signature {
    font-size: 13px;
    font-style: italic;
    color: var(--label);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.actions > * {
    margin-top: 0;
}

/* Galeri foto */
.gallery-section {
    margin-top: 28px;
}

.gallery-section h2 {
    font-size: 16px;
    color: #e9edff;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.photo {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 2px solid rgba(140, 158, 220, 0.35);
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #1b2350, #121936);
    cursor: zoom-in;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.photo:hover {
    transform: translateY(-3px);
    border-color: rgba(169, 155, 255, 0.7);
    box-shadow: 0 10px 24px rgba(90, 70, 200, 0.4);
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 24px;
    color: var(--accent);
}

/* Pratinjau foto */
.lightbox {
    border: 1px solid var(--border);
    padding: 0;
    border-radius: 18px;
    background: #0d142e;
    color: var(--text);
    max-width: min(92vw, 520px);
    width: auto;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}

.lightbox::backdrop {
    background: rgba(3, 6, 18, 0.8);
    backdrop-filter: blur(4px);
}

.lightbox figure {
    margin: 0;
}

.lightbox img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
}

.lightbox figcaption {
    padding: 12px 18px 16px;
    font-size: 13px;
    text-align: center;
    color: var(--muted);
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(180, 190, 255, 0.35);
    background: linear-gradient(135deg, #6f63f0, #4a3fc0);
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.lightbox-close:hover {
    background: linear-gradient(135deg, #8377ff, #5a4fdc);
}

/* Roket mendarat */
.landing {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: none;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
}

body.landing-active .landing {
    display: grid;
    animation: landingOut 0.3s ease 1.05s forwards;
}

.rocket-stack {
    position: relative;
    width: 110px;
    display: grid;
    justify-items: center;
    transform: translateY(-115vh);
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45));
}

body.landing-active .rocket-stack {
    animation: rocketLand 1s cubic-bezier(0.3, 0.9, 0.35, 1) forwards;
}

.rocket {
    display: block;
    width: 110px;
    height: auto;
}

.rocket-flame {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 26px;
    height: 62px;
    margin-top: -6px;
    border-radius: 50% 50% 50% 50% / 26% 26% 74% 74%;
    background: radial-gradient(ellipse at 50% 0%,
        #ffffff 0 10%,
        #a9fff9 24%,
        #6ee7e0 45%,
        rgba(143, 131, 255, 0.55) 70%,
        rgba(143, 131, 255, 0) 100%);
    filter: blur(0.6px);
    transform: translateX(-50%);
    transform-origin: top center;
    animation: flameFlicker 0.14s ease-in-out infinite alternate;
}

body.landing-active .rocket-flame {
    animation: flameFlicker 0.14s ease-in-out infinite alternate,
               flameOut 0.28s ease 0.7s forwards;
}

.landing-ring {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 34px;
    height: 10px;
    margin-top: -2px;
    border-radius: 50%;
    border: 2px solid rgba(110, 231, 224, 0.9);
    opacity: 0;
    transform: translateX(-50%) scale(0.2);
}

body.landing-active .landing-ring {
    animation: ringPulse 0.7s ease 0.72s forwards;
}

.landing-letter {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 48px;
    height: 34px;
    margin-top: -2px;
    border-radius: 5px;
    background: linear-gradient(160deg, #f8f5ff, #d9d3ff);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45),
                0 0 18px rgba(159, 140, 255, 0.55);
    display: grid;
    place-items: center;
    font-size: 15px;
    color: #6b5ce0;
    opacity: 0;
    transform: translate(-50%, 0) scale(0.7);
}

.landing-letter::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 5px;
    background:
        linear-gradient(150deg, transparent 48%, rgba(107, 92, 224, 0.35) 50%, transparent 52%),
        linear-gradient(210deg, transparent 48%, rgba(107, 92, 224, 0.35) 50%, transparent 52%);
}

.landing-letter span {
    position: relative;
    z-index: 1;
}

body.landing-active .landing-letter {
    animation: letterDrop 0.7s cubic-bezier(0.34, 1.05, 0.5, 1) 0.42s forwards;
}

@keyframes rocketLand {
    0% {
        transform: translateY(-115vh) rotate(-6deg);
    }
    65% {
        transform: translateY(0) rotate(0deg);
    }
    78% {
        transform: translateY(-14px);
    }
    90% {
        transform: translateY(0);
    }
    96% {
        transform: translateY(-4px);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes flameFlicker {
    from {
        transform: translateX(-50%) scaleY(0.9) scaleX(0.92);
    }
    to {
        transform: translateX(-50%) scaleY(1.12) scaleX(1.04);
    }
}

@keyframes flameOut {
    to {
        opacity: 0;
    }
}

@keyframes ringPulse {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.2);
    }
    30% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(3.4);
    }
}

@keyframes letterDrop {
    0% {
        opacity: 0;
        transform: translate(calc(-50% - 64px), -42vh) rotate(-26deg) scale(0.8);
    }
    10% {
        opacity: 1;
    }
    62% {
        opacity: 1;
        transform: translate(calc(-50% + 58px), 34px) rotate(-4deg) scale(1);
    }
    76% {
        transform: translate(calc(-50% + 62px), 14px) rotate(3deg) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate(calc(-50% + 66px), 34px) rotate(6deg) scale(1);
    }
}

@keyframes landingOut {
    to {
        opacity: 0;
    }
}

/* Bintang latar & meteor */
.starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

/* Galaksi di belakang halaman pesan */
.galaxy {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.4s ease;
}

.galaxy svg {
    display: block;
    width: 100%;
    height: 100%;
    animation: galaxyDrift 50s ease-in-out infinite alternate;
}

body.gift-open .galaxy {
    opacity: 1;
}

@keyframes galaxyDrift {
    0% {
        transform: scale(1) rotate(0deg);
    }
    100% {
        transform: scale(1.06) rotate(2deg);
    }
}

.star {
    position: absolute;
    border-radius: 50%;
    background: var(--star);
    box-shadow: 0 0 6px rgba(200, 214, 255, 0.85);
    animation: twinkle 4s ease-in-out infinite;
}

.meteor {
    position: absolute;
    width: 120px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(207, 227, 255, 0), rgba(207, 227, 255, 0.95));
    filter: drop-shadow(0 0 6px rgba(160, 200, 255, 0.8));
    animation: meteorFly 2.2s linear forwards;
    will-change: transform, opacity;
}

/* Ledakan bintang saat pesan dibuka */
.burst-star {
    position: fixed;
    z-index: 20;
    font-size: 16px;
    color: var(--accent);
    text-shadow: 0 0 12px rgba(159, 140, 255, 0.9);
    pointer-events: none;
    animation: burst 1.1s ease-out forwards;
}

/* Animasi */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.25;
        transform: scale(0.85);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@keyframes meteorFly {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) rotate(30deg) scaleX(0.4);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(46vw, 28vh, 0) rotate(30deg) scaleX(1);
    }
}

@keyframes floaty {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes disappear {
    to {
        opacity: 0;
        transform: translateY(-18px) scale(0.96);
    }
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notePop {
    0% {
        opacity: 0;
        transform: scale(0.94);
    }
    60% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes burst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.4);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--rot));
    }
}

/* Tampilan HP */
@media (max-width: 480px) {
    body {
        padding: 64px 12px 24px;
        align-items: flex-start;
    }

    .container {
        width: 100%;
    }

    .card,
    .greeting {
        padding: 30px 20px;
    }

    h1 {
        font-size: 25px;
    }

    .planet-art {
        width: 198px;
    }

    .comet-art {
        width: 186px;
    }

    .music-link {
        top: 12px;
        right: 12px;
        font-size: 12px;
        padding: 10px 14px;
    }

    .gallery {
        gap: 7px;
    }

    .actions {
        flex-direction: column;
    }

    .actions > * {
        width: 100%;
    }
}

/* Hormati pengguna yang mengurangi animasi */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
    }

    .card.is-leaving {
        opacity: 0;
    }
}
