﻿:root {
    --bg-start: #FFFBE6;
    --bg-end: #FFD466;
    --text-primary: #023E8A;
    --text-secondary: #0077B6;
    --primary-color: #00B4D8;
    --error-color: #F95738;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
    background-attachment: fixed;
}

/* Floating Light Particles Container */
#particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    animation: float 15s linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(110vh) translateX(0) scale(1);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) translateX(50px) scale(0.5);
        opacity: 0;
    }
}

/* Confetti Container */
#confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    font-size: 1.2rem;
    animation: explode 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot));
        opacity: 0;
    }
}

/* Screens Setup */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 16px;
    z-index: 10;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: scale(0.95);
}

/* Screen 1: Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px 0 rgba(255, 212, 102, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1.1rem, 4vw, 2.5rem);
    text-align: center;
    max-width: 380px;
    width: min(92vw, 380px);
    transform: translateY(0) scale(1);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.glass-card.success {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
}

.serif-heading {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.9rem, 6vw, 2.5rem);
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.sans-subtext {
    font-weight: 400;
    font-size: clamp(0.95rem, 2.7vw, 1rem);
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="password"] {
    padding: 16px 20px;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.6);
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: clamp(1rem, 3.2vw, 1.1rem);
    color: var(--text-primary);
    text-align: center;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    width: 100%;
    box-sizing: border-box;
    letter-spacing: 2px;
}

input[type="password"]::placeholder {
    color: rgba(138, 109, 115, 0.6);
    letter-spacing: normal;
}

input[type="password"]:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.5);
}

button#unlock-btn {
    padding: 16px 24px;
    border-radius: 30px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
    width: 100%;
    box-sizing: border-box;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button#unlock-btn:hover {
    background: #0096C7;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 180, 216, 0.6);
}

button#unlock-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
}

/* Error Jiggle */
#error-message {
    color: var(--error-color);
    font-size: 0.95rem;
    margin-top: 1.2rem;
    margin-bottom: -1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 500;
    height: 0;
}

#error-message.show {
    opacity: 1;
    height: auto;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.jiggle {
    animation: shake 0.4s ease-in-out;
    border-color: var(--error-color) !important;
    background: rgba(230, 57, 70, 0.05) !important;
    color: var(--error-color) !important;
}

/* Screen 2: Swipe Reveal */
.cards-container {
    position: relative;
    width: min(90vw, 320px);
    aspect-ratio: 4 / 5;
    height: auto;
    max-height: 72dvh;
    z-index: 20;
    perspective: 1000px;
}

.polaroid-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 8px;
    padding: 16px 16px 60px 16px;
    box-shadow: 0 15px 35px rgba(0, 63, 138, 0.15);
    box-sizing: border-box;
    user-select: none;
    touch-action: none;
    -webkit-user-select: none;
}

/* Top Card Wrapper (Specific to the cover card) */
.top-card {
    background: linear-gradient(to bottom, #fffffa, #fffafb);
}

.swipe-card {
    z-index: 1;
    /* Default, overridden by inline styles */
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;

    /* Default cards underneath are scaled down and invisible */
    transform: scale(0.9) translateY(10px);
    opacity: 0;
    pointer-events: none;
}

/* The true top card */
.swipe-card.top-card {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* When a card becomes the new top card after a swipe */
.swipe-card.revealed {
    transform: scale(1) rotate(-2deg);
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 20px 40px rgba(0, 63, 138, 0.25);
    background: #fffffa;
}

.swipe-card.dragging {
    transition: none;
    /* remove transition during drag */
    cursor: grabbing;
    box-shadow: 0 25px 50px rgba(0, 63, 138, 0.2);
}

.swipe-card.swiped-out {
    transition: transform 0.6s cubic-bezier(0.55, 0.085, 0.68, 0.53), opacity 0.6s;
    opacity: 0;
    pointer-events: none;
}

.top-card-content {
    text-align: center;
}

.swipe-text {
    font-size: clamp(1.8rem, 7vw, 2.2rem);
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.arrow-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.bouncing-arrow {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    animation: bounceRight 1.5s infinite ease-in-out;
}

@keyframes bounceRight {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(20px);
    }
}



.photo-frame {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
}

.handwritten-caption {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.5rem, 7vw, 2.2rem);
    color: #4A3A3D;
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    text-align: center;
    margin: 0;
    line-height: 56px;
}

/* Screen 3: Birthday Video section */
body.scrollable {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100dvh;
}

#screen-3 {
    position: relative;
    z-index: 50;
    /* Above cards container */
}

.hidden-section {
    display: none;
    opacity: 0;
    transition: opacity 1s ease;
    width: 100%;
}

.hidden-section.visible {
    display: block;
    opacity: 1;
}

.birthday-hero {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    box-sizing: border-box;
}

.birthday-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(2.4rem, 10vw, 5rem);
    color: var(--text-primary);
    margin: 0;
    opacity: 0;
    /* Changed by animation */
}

.visible .birthday-text {
    animation: popInText 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popInText {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.scroll-indicator {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
    font-size: clamp(1rem, 3.4vw, 1.2rem);
    opacity: 0;
    /* Changed by animation */
}

.visible .scroll-indicator {
    animation: fadeInArrow 1.5s ease 1s forwards;
    /* 1s delay */
}

@keyframes fadeInArrow {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.arrow-down-container {
    margin-top: 10px;
}

.bouncing-arrow-down {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    animation: bounceDown 2s infinite ease-in-out;
}

@keyframes bounceDown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(15px);
    }
}

/* Video Secion */
.video-section {
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem 6rem;
    /* extra bottom padding */
    box-sizing: border-box;
}

.video-container {
    background: #ffffff;
    padding: 16px 16px 60px 16px;
    /* space for handwritten text */
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 63, 138, 0.25);
    max-width: 600px;
    width: min(92vw, 600px);
    position: relative;
    transform: rotate(1deg);
    /* Slight polaroid tilt */
}

.video-container video {
    width: 100%;
    border-radius: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    background: #000;
    display: block;
}

.video-caption {
    bottom: 0px;
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    .screen {
        padding: 12px;
    }

    .cards-container {
        width: min(92vw, 340px);
    }

    .polaroid-card {
        padding: 12px 12px 52px 12px;
    }

    .handwritten-caption {
        line-height: 52px;
    }

    .swipe-text {
        margin-bottom: 1.4rem;
    }

    .birthday-hero {
        padding: 0 14px;
    }

    .scroll-indicator {
        margin-top: 32px;
    }

    .video-section {
        padding: 1.25rem 0.75rem 4rem;
    }

    .video-container {
        padding: 12px 12px 52px 12px;
        transform: none;
    }

    .bouncing-arrow,
    .bouncing-arrow-down {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .glass-card {
        border-radius: 20px;
    }

    .sans-subtext {
        margin-bottom: 1.5rem;
    }

    input[type="password"],
    button#unlock-btn {
        padding: 14px 16px;
    }

    .cards-container {
        width: min(94vw, 320px);
        max-height: 70dvh;
    }

    .birthday-text {
        line-height: 1.1;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .screen {
        align-items: flex-start;
        padding-top: 10px;
    }

    .glass-card {
        padding: 1rem 1.25rem;
    }

    .cards-container {
        width: min(62vw, 320px);
        max-height: 78dvh;
    }

    .birthday-hero {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .birthday-text {
        font-size: clamp(2rem, 6vw, 3rem);
    }

    .video-section {
        min-height: 100dvh;
        padding: 1rem;
    }
}
