/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #fff5f7;
    --color-surface: #ffffff;
    --color-text: #2d2d3d;
    --color-text-secondary: #6b6b7b;
    --color-accent: #ff6b9d;
    --color-accent-light: #ffb3d9;
    --color-accent-warm: #ffd4e5;
    --color-border: #ffe4ec;
    --color-snow: #e8f3ff;
    --color-tree: #2d5f3f;
    --color-gold: #ffd700;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 30px;
    --shadow: 0 2px 12px rgba(255, 107, 157, 0.08);
    --shadow-md: 0 4px 20px rgba(255, 107, 157, 0.12);
    --shadow-lg: 0 8px 30px rgba(255, 107, 157, 0.15);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Canvas layers */
#stars-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Lightrope Garland */
.lightrope {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    position: fixed;
    top: 0;
    z-index: 3;
    margin: 0;
    padding: 0;
    pointer-events: none;
    width: 100%;
    list-style: none;
}

.lightrope li {
    position: relative;
    animation-fill-mode: both;
    animation-iteration-count: infinite;
    list-style: none;
    margin: 0;
    padding: 0;
    display: block;
    width: 12px;
    height: 28px;
    border-radius: 50%;
    margin: 20px;
    display: inline-block;
    background: rgba(255, 0, 0, 1);
    box-shadow: 0px 4.6px 24px 3px rgba(255, 0, 0, 1);
    animation-name: flash-1;
    animation-duration: 2s;
}

.lightrope li:nth-child(2n+1) {
    background: rgba(0, 255, 0, 1);
    box-shadow: 0px 4.6px 24px 3px rgba(0, 255, 0, 1);
    animation-name: flash-2;
    animation-duration: 0.4s;
}

.lightrope li:nth-child(4n+2) {
    background: rgba(0, 150, 255, 1);
    box-shadow: 0px 4.6px 24px 3px rgba(0, 150, 255, 1);
    animation-name: flash-3;
    animation-duration: 1.1s;
}

.lightrope li:nth-child(6n+3) {
    background: rgba(255, 215, 0, 1);
    box-shadow: 0px 4.6px 24px 3px rgba(255, 215, 0, 1);
    animation-name: flash-1;
    animation-duration: 1.5s;
}

.lightrope li:nth-child(odd) {
    animation-duration: 1.8s;
}

.lightrope li:nth-child(3n+1) {
    animation-duration: 1.4s;
}

.lightrope li:before {
    content: "";
    position: absolute;
    background: #222;
    width: 10px;
    height: 9.3px;
    border-radius: 3px;
    top: -4.6px;
    left: 1px;
}

.lightrope li:after {
    content: "";
    top: -14px;
    left: 9px;
    position: absolute;
    width: 52px;
    height: 18.6px;
    border-bottom: solid #222 2px;
    border-radius: 50%;
}

.lightrope li:last-child:after {
    content: none;
}

.lightrope li:first-child {
    margin-left: -40px;
}

@keyframes flash-1 {
    0%, 100% {
        background: rgba(255, 0, 0, 1);
        box-shadow: 0px 4.6px 24px 3px rgba(255, 0, 0, 1);
    }
    50% {
        background: rgba(255, 0, 0, 0.4);
        box-shadow: 0px 4.6px 24px 3px rgba(255, 0, 0, 0.2);
    }
}

@keyframes flash-2 {
    0%, 100% {
        background: rgba(0, 255, 0, 1);
        box-shadow: 0px 4.6px 24px 3px rgba(0, 255, 0, 1);
    }
    50% {
        background: rgba(0, 255, 0, 0.4);
        box-shadow: 0px 4.6px 24px 3px rgba(0, 255, 0, 0.2);
    }
}

@keyframes flash-3 {
    0%, 100% {
        background: rgba(0, 150, 255, 1);
        box-shadow: 0px 4.6px 24px 3px rgba(0, 150, 255, 1);
    }
    50% {
        background: rgba(0, 150, 255, 0.4);
        box-shadow: 0px 4.6px 24px 3px rgba(0, 150, 255, 0.2);
    }
}

#snow-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: pointer;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Christmas Tree */
.christmas-tree {
    position: fixed;
    left: 50px;
    bottom: 0;
    width: 180px;
    height: 300px;
    z-index: 2;
    opacity: 0.85;
    transition: transform 0.3s ease;
}

.christmas-tree:hover {
    transform: scale(1.05);
}

/* Tree bottom layer */
.christmas-tree::before {
    content: '';
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 90px solid transparent;
    border-right: 90px solid transparent;
    border-bottom: 110px solid var(--color-tree);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

/* Tree middle layer */
.christmas-tree::after {
    content: '';
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 75px solid transparent;
    border-right: 75px solid transparent;
    border-bottom: 100px solid var(--color-tree);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

/* Page structure */
.page-wrapper {
    position: relative;
    z-index: 2;
    max-width: 850px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Header */
.site-header {
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-xl);
}

.site-header time {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--color-accent-warm);
    border-radius: 50px;
    box-shadow: var(--shadow);
}

/* Countdown Timer */
.countdown-timer {
    margin-top: var(--spacing-lg);
    text-align: center;
}

/* Fullscreen Placeholder */
.fullscreen-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.placeholder-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--spacing-xl);
}

.placeholder-snowflakes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.placeholder-main {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl) var(--spacing-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
}

.placeholder-icon {
    font-size: 5rem;
    margin-bottom: var(--spacing-lg);
    animation: float 3s ease-in-out infinite;
}

.placeholder-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: var(--spacing-md);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.placeholder-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: var(--spacing-lg);
    font-family: var(--font-serif);
}

.placeholder-hint {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

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

/* Timer Content */
.timer-content {
    display: block;
}

.timer-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.timer-display {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.timer-block {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    min-width: 80px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.timer-block:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.timer-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-serif);
    line-height: 1;
}

.timer-unit {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    text-transform: lowercase;
}

/* Main content */
.content {
    margin-bottom: var(--spacing-2xl);
}

/* Letter */
.letter {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: fadeIn 1s ease-out;
}

.letter::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 179, 217, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.letter::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(232, 243, 255, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Letter intro */
.letter-intro {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--color-border);
    position: relative;
    z-index: 1;
}

.letter-intro h1 {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--color-accent);
    text-shadow: 2px 2px 0px rgba(255, 179, 217, 0.2);
}

.letter-intro .lead {
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

/* Letter body */
.letter-body {
    position: relative;
    z-index: 1;
}

.letter-body p {
    margin-bottom: var(--spacing-md);
    font-size: 1.125rem;
    line-height: 1.9;
}

.reveal-text {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.reveal-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.letter-body h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-accent);
}

.letter-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--color-accent);
}

/* Callout */
.callout {
    background: linear-gradient(135deg, #fff0f6 0%, #ffe8f0 100%);
    border: 2px solid var(--color-accent-warm);
    border-radius: var(--radius);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin: var(--spacing-xl) 0;
    box-shadow: var(--shadow-md);
    position: relative;
}

.callout::before {
    content: '♡';
    position: absolute;
    top: -15px;
    left: 30px;
    font-size: 2rem;
    color: var(--color-accent);
    background: var(--color-surface);
    padding: 0 10px;
}

.callout h2 {
    margin-bottom: var(--spacing-md);
}

.callout p {
    margin-bottom: 0;
    font-size: 1.125rem;
    line-height: 1.8;
}

/* Promises grid */
.promises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-xl) 0;
}

.promise-card {
    background: linear-gradient(135deg, #ffffff 0%, #fff9fc 100%);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.promise-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 107, 157, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.promise-card:hover {
    background: linear-gradient(135deg, #fff0f6 0%, #ffe8f0 100%);
    border-color: var(--color-accent-light);
    transform: translateY(-8px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.promise-card:hover::before {
    opacity: 1;
}

.promise-card h3 {
    color: var(--color-accent);
    margin-bottom: var(--spacing-sm);
    font-size: 1.25rem;
    position: relative;
    z-index: 1;
}

.promise-card p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

/* Closing */
.closing {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 2px solid var(--color-border);
}

.closing p {
    font-size: 1.125rem;
    line-height: 1.9;
}

.closing p:first-child {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-accent);
    background: linear-gradient(135deg, #fff0f6 0%, transparent 100%);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
}

.signature {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    font-style: italic;
    text-align: right;
    margin-top: var(--spacing-lg);
    color: var(--color-accent);
    text-shadow: 1px 1px 0px rgba(255, 179, 217, 0.3);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.site-footer p {
    background: var(--color-accent-warm);
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 50px;
    color: var(--color-accent);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 1024px) {
    .christmas-tree {
        left: 20px;
        transform: scale(0.8);
    }
}

@media (max-width: 768px) {
    .page-wrapper {
        padding: var(--spacing-sm);
    }

    .letter {
        padding: var(--spacing-lg);
        border-radius: var(--radius);
    }

    .letter-intro h1 {
        font-size: 2.5rem;
    }

    .letter-intro .lead {
        font-size: 1.125rem;
    }

    .letter-body p {
        font-size: 1rem;
    }

    .promises-grid {
        grid-template-columns: 1fr;
    }

    .signature {
        font-size: 1.5rem;
    }

    .timer-display {
        gap: 0.5rem;
    }

    .timer-block {
        min-width: 70px;
        padding: 0.75rem;
    }

    .timer-value {
        font-size: 1.5rem;
    }

    .christmas-tree {
        display: none;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .letter-intro h1 {
        font-size: 2rem;
    }

    .site-header time {
        font-size: 0.75rem;
    }

    .timer-block {
        min-width: 60px;
        padding: 0.5rem;
    }

    .timer-value {
        font-size: 1.25rem;
    }

    .timer-unit {
        font-size: 0.625rem;
    }
}

/* Selection */
::selection {
    background: var(--color-accent-light);
    color: var(--color-surface);
}

::-moz-selection {
    background: var(--color-accent-light);
    color: var(--color-surface);
}

/* Floating animation for promise cards */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.promise-card {
    animation: float 3s ease-in-out infinite;
}

.promise-card:nth-child(1) {
    animation-delay: 0s;
}

.promise-card:nth-child(2) {
    animation-delay: 0.3s;
}

.promise-card:nth-child(3) {
    animation-delay: 0.6s;
}

.promise-card:nth-child(4) {
    animation-delay: 0.9s;
}

/* Smooth scroll indicator */
body::after {
    content: '↓';
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--color-accent);
    animation: bounce 2s infinite;
    z-index: 10;
    opacity: 0.6;
}

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

/* Hide scroll indicator after scrolling */
body.scrolled::after {
    display: none;
}
