/* ============================================
   DESIGN TOKENS & CSS VARIABLES
   ============================================ */
:root {
    /* Colors */
    --bg-dark: #0e0c15;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-hover: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --text-primary: #f5f0ff;
    --text-secondary: rgba(245, 240, 255, 0.65);
    --accent-pink: #e891b9;
    --accent-purple: #b48cde;
    --accent-blue: #7eb4e2;
    --gradient-primary: linear-gradient(135deg, #e891b9 0%, #b48cde 50%, #7eb4e2 100%);
    --gradient-btn: linear-gradient(135deg, #e891b9 0%, #c78ad8 100%);
    --gradient-btn-hover: linear-gradient(135deg, #f0a5ca 0%, #d49ee6 100%);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 12px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--glass-highlight);
    --shadow-glow: 0 0 30px rgba(232, 145, 185, 0.25);

    /* Spacing */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 32px;
    --space-xl: 48px;
    --space-2xl: 64px;

    /* Radii */
    --radius-card: 28px;
    --radius-btn: 16px;
    --radius-sm: 12px;

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Outfit', var(--font-main);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   PROGRESSIVE SECTION REVEAL
   Sections start hidden. JS removes this class
   and animates them in when the user clicks
   the button in the previous section.
   ============================================ */
.section-hidden {
    display: none !important;
}

/* ============================================
   ANIMATED AMBIENT BACKGROUND
   Floating radial gradient lights that drift
   with staggered CSS keyframe loops (18-22s)
   ============================================ */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient-bg .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    will-change: transform;
}

.ambient-bg .orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(232, 145, 185, 0.55) 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation: float-orb-1 20s ease-in-out infinite;
}

.ambient-bg .orb-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(180, 140, 222, 0.45) 0%, transparent 70%);
    top: 40%;
    right: -15%;
    animation: float-orb-2 22s ease-in-out infinite;
}

.ambient-bg .orb-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(126, 180, 226, 0.4) 0%, transparent 70%);
    bottom: -10%;
    left: 30%;
    animation: float-orb-3 18s ease-in-out infinite;
}

.ambient-bg .orb-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(232, 145, 185, 0.3) 0%, transparent 70%);
    top: 60%;
    left: -5%;
    animation: float-orb-4 19s ease-in-out infinite;
}

@keyframes float-orb-1 {

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

    25% {
        transform: translate(80px, 60px) scale(1.1);
    }

    50% {
        transform: translate(40px, 120px) scale(0.95);
    }

    75% {
        transform: translate(100px, 30px) scale(1.05);
    }
}

@keyframes float-orb-2 {

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

    25% {
        transform: translate(-70px, 50px) scale(1.08);
    }

    50% {
        transform: translate(-30px, -80px) scale(0.92);
    }

    75% {
        transform: translate(-90px, 20px) scale(1.05);
    }
}

@keyframes float-orb-3 {

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

    33% {
        transform: translate(60px, -70px) scale(1.12);
    }

    66% {
        transform: translate(-40px, -30px) scale(0.9);
    }
}

@keyframes float-orb-4 {

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

    30% {
        transform: translate(50px, -40px) scale(1.1);
    }

    60% {
        transform: translate(-30px, 60px) scale(0.95);
    }
}

/* ============================================
   SECTION LAYOUT
   ============================================ */
.section {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg) var(--space-md);
}

/* ============================================
   GLASSMORPHISM CARD
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-xl) var(--space-lg);
    width: 100%;
    max-width: 400px;
    transition: transform 0.5s var(--ease-smooth), box-shadow 0.5s var(--ease-smooth);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card), 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ============================================
   SECTION 1 — LANDING
   ============================================ */
#landing .glass-card {
    text-align: center;
}

.landing-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
    font-weight: 400;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 36px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.35s var(--ease-smooth), box-shadow 0.35s var(--ease-smooth);
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--gradient-btn);
    color: #fff;
    box-shadow: 0 4px 20px rgba(232, 145, 185, 0.3);
}

.btn-primary:hover {
    background: var(--gradient-btn-hover);
    box-shadow: var(--shadow-glow);
    transform: scale(1.04);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: scale(1.04);
}

.btn-secondary:active {
    transform: scale(0.97);
}

/* Subtle pulse for primary buttons */
@keyframes btn-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(232, 145, 185, 0.3);
    }

    50% {
        box-shadow: 0 4px 28px rgba(232, 145, 185, 0.45);
    }
}

.btn-primary {
    animation: btn-pulse 3s ease-in-out infinite;
}

.btn-primary:hover {
    animation: none;
}

/* ============================================
   SECTION 2 — ENVELOPE / LETTER
   ============================================ */
#letter-section {
    flex-direction: column;
    gap: var(--space-lg);
}

/* Envelope container */
.envelope-wrapper {
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.envelope {
    width: 220px;
    height: 160px;
    position: relative;
    margin: 0 auto;
    animation: envelope-float 4s ease-in-out infinite;
    filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.4));
}

@keyframes envelope-float {

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

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

/* Envelope body */
.envelope-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #f8e8f0 0%, #ecdaf5 100%);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.envelope-body::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(232, 145, 185, 0.15);
}

/* Envelope flap using CSS triangle */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    transform-origin: top center;
    transition: transform 0.8s var(--ease-smooth);
    z-index: 2;
}

.envelope-flap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 110px solid transparent;
    border-right: 110px solid transparent;
    border-top: 80px solid #e6d0e8;
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

/* Heart seal on envelope */
.envelope-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    z-index: 3;
    transition: opacity 0.4s ease;
}

.envelope.open .envelope-seal {
    opacity: 0;
}

.envelope-tap-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: var(--space-sm);
    opacity: 0.7;
}

/* Letter card */
.letter-card {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.letter-card .glass-card {
    max-width: 100%;
}

.letter-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.85;
    margin-bottom: var(--space-lg);
    text-align: left;
}

.letter-text p {
    margin-bottom: var(--space-sm);
}

.letter-greeting {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md) !important;
}

.letter-name {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
}

.letter-cta {
    color: var(--accent-lavender);
    font-weight: 600;
    margin-top: var(--space-sm);
}



/* ============================================
   SECTION 3 — QUESTION
   ============================================ */
#question-section {
    flex-direction: column;
    min-height: 100dvh;
}

.question-card {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.question-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.question-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: center;
}

.question-buttons .btn {
    width: 100%;
    max-width: 280px;
}

/* Dodging button wrapper — positioned absolutely when escaping */
.dodge-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px;
    display: flex;
    justify-content: center;
}

.dodge-wrapper .btn-secondary {
    width: 100%;
}

/* Tease text — pill badge so it's always readable */
.tease-text {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: rgba(180, 140, 222, 0.85);
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 60;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 12px rgba(180, 140, 222, 0.35);
}

/* ============================================
   SUCCESS OVERLAY
   Dark backdrop + centered glass card.
   ============================================ */
.success-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-md);
    background: rgba(14, 12, 21, 0.85);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.success-overlay.active {
    pointer-events: all;
    opacity: 1;
    visibility: visible;
}

.success-overlay .glass-card {
    text-align: center;
    max-width: 340px;
    width: 90%;
    margin: auto;
    padding: var(--space-xl) var(--space-lg);
}

.success-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============================================
   CONFETTI & HEARTS CANVAS
   ============================================ */
.confetti-canvas {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
}

/* Floating hearts container */
.hearts-container {
    position: fixed;
    inset: 0;
    z-index: 98;
    pointer-events: none;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    font-size: 1.4rem;
    opacity: 0;
    will-change: transform;
}

/* Dodge button uses transform only — no position changes needed */


/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* iPhone 14 base (390px) — default styles above */

@media (min-width: 480px) {
    .landing-title {
        font-size: 2.4rem;
    }

    .glass-card {
        padding: var(--space-xl) var(--space-xl);
    }
}

@media (min-width: 768px) {
    .landing-title {
        font-size: 2.8rem;
    }

    .question-buttons {
        flex-direction: row;
        justify-content: center;
        gap: var(--space-md);
    }

    .question-buttons .btn {
        width: auto;
        min-width: 180px;
    }

    .dodge-wrapper {
        width: auto;
        min-width: 180px;
    }

    .glass-card {
        max-width: 480px;
    }
}

@media (min-width: 1024px) {
    .glass-card {
        max-width: 520px;
    }
}

/* Safe area padding for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .section:last-of-type {
        padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}