/* =====================================
   Happy Birthday - Rifda Auliana
   Main Stylesheet
   ===================================== */

/* ----- CSS Variables ----- */
:root {
    --bg-color: #FFF0F5;
    --text-main: #4A2C35;
    --text-secondary: #6B4A55;
    --accent: #FF4D6D;
    --glass: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
}

/* ----- Base Styles ----- */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Manrope', sans-serif;
    overflow-x: hidden;
    cursor: none;
}

/* Smooth transitions for all text elements */
/* Smooth transitions for text colors only - NOT background */
body,
h1,
h2,
h3,
h4,
p,
span,
div,
a {
    transition: color 1s ease;
}

/* Optimized background layers */
[id^="bg-layer-"] {
    will-change: opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Force hardware boost */
    pointer-events: none;
    /* Ensure clicks pass through */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

/* Perf Utility */
.will-change-transform {
    will-change: transform;
    backface-visibility: hidden;
}

h1,
h2,
h3,
h4,
.serif {
    font-family: 'Italiana', serif;
}

.handwriting {
    font-family: 'Nothing You Could Do', cursive;
}

/* ----- Custom Love Cursor ----- */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.cursor-dot {
    font-size: 20px;
    color: #FF4D6D;
    text-shadow:
        0 0 10px rgba(255, 77, 109, 0.8),
        0 0 20px rgba(255, 77, 109, 0.6),
        0 0 30px rgba(255, 77, 109, 0.4);
    animation: heartPulse 1s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.7));
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes heartPulse {

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

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

.cursor-outline {
    width: 45px;
    height: 45px;
    border: 2px solid rgba(255, 77, 109, 0.5);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 77, 109, 0.1) 0%, transparent 70%);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    animation: outlineRotate 4s linear infinite;
}

@keyframes outlineRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        border-radius: 50% 50% 50% 50%;
    }

    25% {
        border-radius: 60% 40% 60% 40%;
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg);
        border-radius: 50% 50% 50% 50%;
    }

    75% {
        border-radius: 40% 60% 40% 60%;
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        border-radius: 50% 50% 50% 50%;
    }
}

body.hovering .cursor-dot {
    font-size: 28px;
    animation: heartPulse 0.5s ease-in-out infinite;
}

body.hovering .cursor-outline {
    width: 70px;
    height: 70px;
    background: radial-gradient(circle, rgba(255, 77, 109, 0.2) 0%, transparent 70%);
    border-color: rgba(255, 77, 109, 0.7);
    box-shadow:
        0 0 20px rgba(255, 77, 109, 0.4),
        inset 0 0 20px rgba(255, 77, 109, 0.1);
}

/* Cursor trail hearts */
.cursor-heart {
    position: fixed;
    font-size: 12px;
    color: #FF4D6D;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    will-change: transform, opacity;
    /* Optimization */
    animation: floatHeart 1s ease-out forwards;
}

@keyframes floatHeart {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -100px) scale(0.3) rotate(45deg);
    }
}

/* ----- Flower Parallax (Optimization) ----- */
.flower-parallax {
    will-change: transform;
    pointer-events: none;
    backface-visibility: hidden;
    /* Reduces repaints */
}

/* ----- Floating Hearts for Story Section ----- */
.floating-heart {
    opacity: 0.4;
    /* filter: blur(1px); Removed for performance */
    will-change: transform;
}

.animate-float-1 {
    animation: floatUp1 6s ease-in-out infinite;
}

.animate-float-2 {
    animation: floatUp2 8s ease-in-out infinite;
}

.animate-float-3 {
    animation: floatUp3 7s ease-in-out infinite;
}

@keyframes floatUp1 {

    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate3d(0, -30px, 0) rotate(10deg) scale(1.1);
        opacity: 0.6;
    }
}

@keyframes floatUp2 {

    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 0.2;
    }

    50% {
        transform: translate3d(0, -40px, 0) rotate(-15deg) scale(1.2);
        opacity: 0.5;
    }
}

@keyframes floatUp3 {

    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 0.25;
    }

    50% {
        transform: translate3d(0, -25px, 0) rotate(5deg) scale(1.15);
        opacity: 0.55;
    }
}

/* ----- Loader ----- */
.loader {
    position: fixed;
    inset: 0;
    background: #FF4D6D;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.loader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* ----- Hero Section Styles ----- */
.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    will-change: transform;
    /* Optimization */
    backface-visibility: hidden;
    /* Optimization */
    animation: blobFloat 20s infinite alternate;
}

@keyframes blobFloat {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        /* Force 3D */
    }

    100% {
        transform: translate3d(50px, -50px, 0) scale(1.1);
        /* Force 3D */
    }
}

.floating-item {
    position: absolute;
    pointer-events: none;
    animation: simpleFloat 6s ease-in-out infinite;
}

@keyframes simpleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Scroll Thread */
.scroll-thread {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, #FF4D6D);
}

/* ----- Candle Component ----- */
.candle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 2rem;
}

.candle-container {
    position: relative;
    width: 16px;
    height: 50px;
    cursor: pointer;
    transform-origin: bottom center;
    transition: transform 0.3s ease;
}

.candle-container:hover {
    transform: scale(1.2);
}

.wax {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 85%;
    background: linear-gradient(to right, #e6e6e6, #ffffff, #e6e6e6);
    border-radius: 4px;
    box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.05);
}

.wick {
    position: absolute;
    bottom: 85%;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: #333;
}

.flame {
    position: absolute;
    bottom: 95%;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 18px;
    border-radius: 50% 50% 20% 20%;
    background: radial-gradient(white 10%, yellow 40%, orange 80%);
    box-shadow: 0 0 10px orange, 0 0 20px red;
    animation: flicker 0.15s infinite alternate;
    transform-origin: bottom center;
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) skewX(-2deg) scaleY(1);
        opacity: 0.9;
    }

    100% {
        transform: translateX(-50%) skewX(2deg) scaleY(1.1);
        opacity: 1;
    }
}

/* ----- Vinyl Record ----- */
.vinyl-record {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: repeating-radial-gradient(#111 0, #111 2px, #222 3px, #222 4px);
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.vinyl-label {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #FF4D6D;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    text-align: center;
    color: #fff;
    border: 4px solid #111;
}

.spinning {
    animation: spin 8s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ----- Floating Words ----- */
.floating-word {
    position: absolute;
    font-family: 'Italiana', serif;
    color: var(--accent);
    opacity: 0.1;
    pointer-events: none;
    white-space: nowrap;
    z-index: 0;
}

/* ----- Stars ----- */
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {

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

    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* ----- Video Frame ----- */
.video-frame {
    position: relative;
    border-radius: 2rem;
    overflow: hidden;
    box-shadow: 0 30px 60px -15px rgba(255, 77, 109, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 2;
}

/* ----- Collage Cards ----- */
/* ----- Collage Cards (Polaroid Style) ----- */
.collage-card {
    background: white;
    padding: 15px 15px 60px 15px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 10px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), z-index 0s;
    break-inside: avoid;
    margin-bottom: 3rem;
    color: #2b2d42;
    position: relative;
    border-radius: 2px;
}

.collage-card::before {
    /* Tape Effect */
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 100px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.4);
    border-left: 1px dashed rgba(0, 0, 0, 0.1);
    border-right: 1px dashed rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 0.7;
    z-index: 10;
}

.collage-card:hover {
    transform: scale(1.1) rotate(0deg) !important;
    z-index: 50;
    box-shadow:
        0 20px 25px rgba(0, 0, 0, 0.15),
        0 10px 10px rgba(0, 0, 0, 0.1);
}

.collage-card img {
    filter: sepia(20%) contrast(1.1);
    transition: filter 0.3s;
}

.collage-card:hover img {
    filter: sepia(0%) contrast(1.1);
}

.sticker {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    animation: floatSticker 3s ease-in-out infinite alternate;
}

@keyframes floatSticker {
    from {
        transform: translateY(0) rotate(0deg);
    }

    to {
        transform: translateY(-5px) rotate(5deg);
    }
}

/* ----- Apple Music Lyrics Style ----- */
.lyrics-section {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 0;
    mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    overflow: hidden;
}

.lyrics-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 15vh;
    padding-left: 1rem;
    padding-right: 1rem;
}

.lyric-line {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-main);
    opacity: 0;
    filter: blur(6px);
    /* Keeping blur but optimizing transitions */
    transform: scale(0.92) translate3d(0, 15px, 0);
    /* Use 3D translate */
    transform-origin: left center;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.6s ease, filter 0.6s ease;
    margin-bottom: 1.2rem;
    padding: 0.6rem 1rem;
    border-radius: 1rem;
    background: transparent;
    will-change: transform, opacity;
    /* Optimized will-change */
    backface-visibility: hidden;
    /* Prevent repaints */
    cursor: default;
}

/* Visible lyrics on current page */
.lyric-line.visible {
    opacity: 0.35;
    filter: blur(2px);
    transform: scale(0.96) translate3d(0, 0, 0);
    background: rgba(255, 255, 255, 0.03);
}

/* Past lyrics - slightly visible with glass */
.lyric-line.visible.past {
    opacity: 0.6;
    filter: blur(0);
    transform: scale(1) translate3d(0, 0, 0);
    background: rgba(255, 255, 255, 0.05);
    /* backdrop-filter: blur(2px); REMOVED expensive blur */
}

/* Active lyric - highlighted with glass effect */
.lyric-line.visible.active {
    opacity: 1;
    filter: blur(0);
    transform: scale(1.02) translate3d(5px, 0, 0);
    color: var(--accent);
    text-shadow:
        0 0 20px rgba(255, 77, 109, 0.4);
    /* Simplified shadow */
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.15) 0%,
            rgba(255, 255, 255, 0.08) 100%);
    /* backdrop-filter removed for perf */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Upcoming lyrics - blurred */
.lyric-line.visible.upcoming {
    opacity: 0.25;
    filter: blur(4px);
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.02);
}

/* ----- Theme Mode Styles ----- */
body.night-mode {
    --glass: rgba(0, 0, 0, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body.night-mode .lyric-line.visible {
    color: rgba(255, 255, 255, 0.3);
}

body.night-mode .lyric-line.visible.active {
    color: #FF6B8A;
    text-shadow: 0 0 40px rgba(255, 107, 138, 0.5);
}

body.night-mode .lyric-line.visible.past {
    color: rgba(255, 255, 255, 0.6);
}

body.twilight-mode .lyric-line.visible {
    color: rgba(255, 229, 236, 0.3);
}

body.twilight-mode .lyric-line.visible.active {
    color: #FFB7C5;
    text-shadow: 0 0 30px rgba(255, 183, 197, 0.5);
}

body.twilight-mode .lyric-line.visible.past {
    color: rgba(255, 229, 236, 0.6);
}

body.sunset-mode .lyric-line.visible {
    color: rgba(46, 26, 31, 0.4);
}

body.sunset-mode .lyric-line.visible.active {
    color: #8B2635;
    text-shadow: 0 0 25px rgba(139, 38, 53, 0.3);
}

body.sunset-mode .lyric-line.visible.past {
    color: rgba(46, 26, 31, 0.7);
}

body.day-mode .lyric-line.visible {
    color: rgba(74, 44, 53, 0.4);
}

body.day-mode .lyric-line.visible.active {
    color: #E63946;
    text-shadow: 0 0 25px rgba(230, 57, 70, 0.3);
}

body.day-mode .lyric-line.visible.past {
    color: rgba(74, 44, 53, 0.7);
}

/* Dynamic text colors using CSS variables */
.dynamic-text {
    color: var(--text-main);
}

.dynamic-text-secondary {
    color: var(--text-secondary);
}

.dynamic-accent {
    color: var(--accent);
}

/* ----- Custom Cute Scrollbar ----- */
/* ----- Custom Cute Scrollbar (Hidden) ----- */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
    display: none;
    /* Chrome/Safari/Webkit */
}

/* Hide scrollbar for IE, Edge and Firefox */
body {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* ----- Shimmer Text Effect ----- */
.shimmer-text {
    background: linear-gradient(to right, #ffffff 0%, #FF4D6D 20%, #ffffff 40%, #ffffff 100%);
    background-size: 200% auto;
    color: #fff;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 200% center;
    }
}

/* ----- Secret Word Styles ----- */
.secret-word {
    cursor: help;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
    border-bottom: 1px dashed rgba(255, 77, 109, 0.4);
}

.secret-word:hover {
    color: #FF4D6D;
    border-bottom: 1px dashed #FF4D6D;
}

/* Draggable Sticker Hover */
.sticker {
    cursor: grab;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.sticker:active {
    cursor: grabbing;
    transform: scale(1.1) !important;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
    z-index: 100 !important;
}

/* ----- Twemoji SVG Styling ----- */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.1em;
    display: inline-block;
}

/* Ensure cursor emojis are properly sized */
.cursor-dot img.emoji {
    height: 20px;
    width: 20px;
}

.cursor-heart img.emoji {
    display: inline-block;
}

/* ----- Mobile Performance Optimizations ----- */
@media (max-width: 768px) {

    /* Disable heavy blurs on mobile */
    .hero-blob {
        filter: blur(40px);
        /* Reduced from 80px */
        animation-duration: 30s;
        /* Slower animation */
    }

    /* Simplify glass effects */
    .collage-card,
    .video-frame,
    .story-card .relative {
        backdrop-filter: blur(5px) !important;
        -webkit-backdrop-filter: blur(5px) !important;
        /* Reduced from 10px+ */
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        /* Simple shadow */
    }

    /* Disable some floating animations that are heavy */
    .floating-item {
        animation: none !important;
    }

    .floating-heart {
        animation-duration: 15s !important;
        /* Slow down */
    }

    /* Hide high-fidelity shimmering text on mobile if causing issues */
    .shimmer-text {
        animation: none;
        background: none;
        -webkit-text-fill-color: #FF4D6D;
        color: #FF4D6D;
    }

    /* Improve scrolling performance */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Disable tilt effect on mobile cards as it requires JS/heavy CSS */
    .story-card,
    .collage-card {
        transform: none !important;
        transition: none !important;
    }

    /* Force GPU acceleration for key elements */
    .h-scroll-container,
    .video-frame,
    .hero-blob {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Touch device optimizations (specifically for iPad/Tablets too) */
@media (hover: none) {

    .cursor-dot,
    .cursor-outline,
    .cursor-trail {
        display: none !important;
    }
}