:root {
    --bg-color: #0a0a0e;
    --accent-color: #ff4d6d;
    --secondary-accent: #ffb3c1;
    --text-color: #fff0f3;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Flower Falling Animation */
#flower-container {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.flower {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #ff85a1 20%, #ff4d6d 80%);
    border-radius: 50% 10% 50% 10%;
    box-shadow: 0 0 15px rgba(255, 77, 109, 0.6);
    animation: fall 3s ease-in forwards;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(calc(90vh - 40px)) rotate(360deg);
        opacity: 1;
    }
}

.flower.fade-out {
    opacity: 0;
    transition: opacity 1s;
}

/* Typing Cursor */
#typing-text::after {
    content: '|';
    animation: blink 0.7s infinite;
    color: var(--accent-color);
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Layout Management */
#main-content {
    display: flex;
    width: 100%;
    height: 100%;
    transition: all 1.5s var(--transition-timing);
    position: relative;
    z-index: 2;
    /* Above the tree canvas */
    pointer-events: none;
    /* Let clicks pass to canvas if needed, but we want buttons to work */
}

#left-panel,
#right-panel {
    pointer-events: auto;
    /* Re-enable for content */
}

#left-panel {
    flex: 0 0 0%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 1.5s var(--transition-timing);
}

#left-panel.visible {
    flex: 0 0 50%;
    padding: 40px;
    opacity: 1;
}

#right-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 1.5s var(--transition-timing);
}

/* Canvas Styling */
#tree-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    /* Let clicks pass through to panels */
    z-index: 1;
}

/* Content Styling */
#quote-container {
    max-width: 80%;
    text-align: center;
    margin-bottom: 40px;
}

#typing-text {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    line-height: 1.6;
    color: var(--secondary-accent);
    min-height: 250px;
    text-shadow: 0 0 10px rgba(255, 179, 193, 0.3);
}

#see-memories-btn {
    padding: 15px 35px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #ff4d6d, #c9184a);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    opacity: 0;
}

#see-memories-btn.visible {
    opacity: 1;
    animation: fadeInUp 0.8s forwards;
}

#see-memories-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 77, 109, 0.6);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Homemade+Apple&display=swap');

/* Scrapbook Gallery Styling */
#gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/images/bg_texture.png');
    background-size: cover;
    background-repeat: repeat;
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

.gallery-header {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding: 30px;
    position: sticky;
    top: 0;
    z-index: 10;
}

#close-gallery {
    background: none;
    border: none;
    color: #333;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
}

.gallery-scroll-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 100px;
}

.scrapbook-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    width: 100%;
}

.scrapbook-item {
    position: relative;
    padding: 12px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: rotate(var(--rotation));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 15px;
}

.scrapbook-item:hover {
    transform: rotate(0deg) scale(1.05);
    z-index: 5;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.gallery-item {
    width: 312px;
    height: 312px;
    overflow: hidden;
    cursor: pointer;
}

/* Create "random" variation in sizes to vary row length naturally */
.scrapbook-item:nth-child(3n) .gallery-item {
    width: 264px;
    height: 264px;
}

.scrapbook-item:nth-child(4n+1) .gallery-item {
    width: 288px;
    height: 288px;
}

.scrapbook-item:nth-child(5n) {
    margin-top: 60px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.wish-tag {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 77, 109, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 2;
    transform: rotate(-3deg);
}

/* Tape Effects */
.tape {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 25px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.9rem;
    color: #444;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.mint-tape {
    background: rgba(196, 215, 214, 0.9);
}

.peach-tape {
    background: rgba(228, 193, 175, 0.8);
}

.tape.bottom {
    top: auto;
    bottom: -15px;
}

.handwritten {
    font-family: 'Homemade Apple', cursive;
}

/* Text Stylings */
.scrapbook-text {
    font-family: 'Courier Prime', monospace;
    font-size: 1.1rem;
    color: #444;
    line-height: 1.6;
    margin-top: var(--margin-top, 0);
    max-width: 250px;
    text-align: left;
}

.brush-text {
    display: block;
    margin-top: 15px;
    text-align: center;
    font-size: 1.3rem;
    color: #555;
    position: relative;
}

.brush-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 40px;
    background: rgba(228, 193, 175, 0.3);
    z-index: -1;
    border-radius: 20px;
}

/* Footer Section */
.gallery-footer {
    margin-top: 100px;
    width: 100%;
    text-align: center;
}

.moments-title {
    font-size: 3.5rem;
    color: #222;
    margin-bottom: 50px;
    opacity: 0.8;
}

/* Image Modal */
#image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

#zoomed-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    transform: scale(0.8);
    transition: transform 0.4s var(--transition-timing);
}

#image-modal.visible #zoomed-image {
    transform: scale(1);
}

.hidden {
    display: none !important;
}

/* Animations for Tree Shift */
.shift-right #right-panel {
    order: 2;
}

.center-content #right-panel {
    flex: 0 0 100%;
}

/* Cinematic Collage Styling */
.birthday-collage {
    width: 100%;
    max-width: 850px;
    background: #000;
    border-radius: 40px;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 100px auto;
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.collage-left {
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.gift-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,6H16c0-2-1.8-4-4-4S8,4,8,6H4C2.9,6,2,6.9,2,8v12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8C22,6.9,21.1,6,20,6z M12,4c1.1,0,2,0.9,2,2h-4C10,4.9,10.9,4,12,4z M20,20H4V8h16V20z M7,10v2h2v-2H7z M15,10v2h2v-2H15z"/></svg>') no-repeat center;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,6H16c0-2-1.8-4-4-4S8,4,8,6H4C2.9,6,2,6.9,2,8v12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8C22,6.9,21.1,6,20,6z M12,4c1.1,0,2,0.9,2,2h-4C10,4.9,10.9,4,12,4z M20,20H4V8h16V20z M7,10v2h2v-2H7z M15,10v2h2v-2H15z"/></svg>') no-repeat center;
    margin-bottom: 20px;
}

.collage-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 900;
    font-size: 5rem;
    line-height: 1;
    color: #fff;
    font-style: italic;
    margin: 0;
    letter-spacing: -2px;
}

.collage-tagline {
    font-family: 'Homemade Apple', cursive;
    color: #fff;
    font-size: 1.4rem;
    margin-top: 15px;
    opacity: 0.9;
}

.collage-main-img-container {
    margin-top: 40px;
    width: 110% !important;
    height: auto !important;
    margin-left: -5%;
    overflow: visible !important;
    /* Prevent cropping from gallery-item overflow */
}

.collage-main-img-container img {
    width: 100%;
    height: auto;
    object-fit: contain;
    /* Ensure full image is visible without cropping */
    border: none;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.collage-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.side-thumb {
    width: 100%;
    height: 240px;
    border-radius: 50px;
    overflow: hidden;
    background: #1a1a1a;
}

.side-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: all 0.5s ease;
}

.side-thumb:hover img {
    filter: grayscale(0%);
    transform: scale(1.1);
}
/* Envelope & Letter Section */
.envelope-section {
    width: 100%;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
}

.envelope-wrapper {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.envelope-wrapper:hover {
    transform: translateY(-5px);
}

.envelope {
    position: relative;
    width: 300px;
    height: 220px;
    background: #fdf5e6;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.envelope-body {
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-bottom: 110px solid #f9f0da;
    z-index: 3;
}

.envelope-body::before {
    content: '';
    position: absolute;
    left: -150px;
    bottom: -110px;
    width: 0;
    height: 0;
    border-top: 110px solid transparent;
    border-bottom: 110px solid transparent;
    border-left: 150px solid #f7ead0;
}

.envelope-body::after {
    content: '';
    position: absolute;
    right: -150px;
    bottom: -110px;
    width: 0;
    height: 0;
    border-top: 110px solid transparent;
    border-bottom: 110px solid transparent;
    border-right: 150px solid #f7ead0;
}

.top-flap {
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 110px solid #fdf5e6;
    transform-origin: top;
    transition: transform 0.4s 0.3s ease;
    z-index: 4;
}

.letter {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 280px;
    height: 208px;
    background: white;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    z-index: 2;
    transition: transform 0.6s 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-content {
    color: #444;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
}

.ribbon {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 220px;
    background: #c9184a;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.5s ease;
}

.ribbon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 30px;
    background: #ff4d6d;
    border-radius: 5px;
}

/* Open State Animation */
.envelope-wrapper.open .ribbon {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
}

.envelope-wrapper.open .top-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope-wrapper.open .letter {
    transform: translateY(-160px);
    z-index: 10;
}

.click-hint {
    position: absolute;
    bottom: -40px;
    width: 100%;
    text-align: center;
    font-family: 'Courier Prime', monospace;
    color: #666;
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}
