/* ---------- RESET & GLOBAL VARIABLES (Premium Palette) ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #FCF9F5;
    --bg-surface: #FFFFFF;
    --text-primary: #191714;
    --text-secondary: #5C5A58;
    --text-tertiary: #8C8984;
    --border-light: #EFEAE4;
    --border-medium: #E4DDD6;
    --accent-rose: #C76B6B;
    --accent-rose-soft: #F1E0E0;
    --accent-indigo: #5D5A6F;
    --accent-gold: #D9B48B;
    --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.02), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.01);
    --shadow-lg: 0 20px 35px -12px rgba(0, 0, 0, 0.08);
    --radius-card: 24px;
    --radius-element: 14px;
    --transition-smooth: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    scroll-behavior: smooth;
}

h1, h2, h3, h4, .serif-accent {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.container-premium {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Hero */
.hero {
    text-align: center;
    padding-top: 3rem;
    padding-bottom: 2rem;
}
.hero__title {
    font-size: clamp(2.8rem, 7vw, 4.8rem);
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-rose) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}
.hero__sub {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto;
}

/* Form Card */
.form-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    padding: 2rem 2rem 2.2rem;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-light);
    margin-bottom: 2.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}
.form-field {
    margin-bottom: 1.25rem;
}
.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}
input, select, textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-element);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 3px rgba(199, 107, 107, 0.15);
}
textarea {
    resize: vertical;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.theme-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.theme-buttons {
    display: flex;
    gap: 0.8rem;
}
.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 60px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    box-shadow: var(--shadow-sm);
}
.theme-btn:hover {
    transform: scale(1.08);
}
.theme-btn.active {
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 2px rgba(199, 107, 107, 0.3);
}

/* Note Card with Theme Variants */
.note-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: background 0.3s, border 0.3s;
    border: 1px solid var(--border-light);
    margin-bottom: 2rem;
}
.note-card__inner {
    padding: 2rem;
}
.theme-rose {
    background: linear-gradient(145deg, #FFF8F5, #FFF0EC);
    border-left: 6px solid #C76B6B;
}
.theme-ocean {
    background: linear-gradient(145deg, #F5F9FF, #E6F0FA);
    border-left: 6px solid #5B86E5;
}
.theme-sunset {
    background: linear-gradient(145deg, #FFF7F0, #FDE8F0);
    border-left: 6px solid #D97A7A;
}
.theme-forest {
    background: linear-gradient(145deg, #F2F8EC, #E2F0E0);
    border-left: 6px solid #6C9E6A;
}
.theme-lavender {
    background: linear-gradient(145deg, #F9F5FF, #EFE9FC);
    border-left: 6px solid #A48AD3;
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}
.names-area {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.names-area .name {
    font-family: 'Playfair Display', serif;
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--text-primary);
}
.names-area .heart-symbol {
    color: var(--accent-rose);
    font-size: 1.4rem;
}
.relationship-badge {
    background: var(--accent-rose-soft);
    padding: 0.25rem 1rem;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--accent-rose);
}
.illustration-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.relationship-icon {
    width: 96px;
    height: 96px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
    padding: 1rem;
}
.relationship-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.message-block {
    background: rgba(255,255,240,0.5);
    border-radius: 20px;
    padding: 1.5rem;
    margin: 1.8rem 0;
    border-left: 4px solid var(--accent-rose);
}
.message-block p {
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--text-primary);
}
.quote-block {
    font-style: italic;
    font-family: 'Playfair Display', serif;
    color: var(--text-secondary);
    border-left: 2px solid var(--accent-gold);
    padding-left: 1.5rem;
    margin: 1.2rem 0;
    font-size: 1rem;
}
.custom-message {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-medium);
    font-size: 0.95rem;
    color: var(--accent-indigo);
}

/* Buttons */
.action-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
    margin-bottom: 2rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.8rem;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
}
.btn-primary {
    background: var(--accent-rose);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent-rose) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(199, 107, 107, 0.25);
}
.btn-outline {
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    background: transparent;
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-rose);
    background: rgba(199, 107, 107, 0.05);
    transform: translateY(-2px);
}
.btn-secondary {
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}
.btn-secondary:hover {
    border-color: var(--accent-indigo);
    background: var(--bg-surface);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.2rem;
    margin-top: 1.2rem;
}
.gallery-item {
    background: var(--bg-surface);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.gallery-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.gallery-date {
    padding: 0.6rem;
    font-size: 0.7rem;
    text-align: center;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-light);
}
.empty-gallery {
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    border-radius: 28px;
}

/* Floating hearts & confetti */
.heart-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.25;
}
.heart-bg .heart-float {
    position: absolute;
    font-size: 14px;
    animation: float 20s infinite linear;
    color: var(--accent-rose);
}
@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    20% { opacity: 0.4; }
    80% { opacity: 0.4; }
    100% { transform: translateY(-20vh) rotate(360deg); opacity: 0; }
}
.confetti {
    position: fixed;
    width: 6px;
    height: 12px;
    background: var(--accent-rose);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
}

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-light);
    margin-top: 3rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* Print styles */
@media print {
    .theme-switcher, .action-group, .form-card, .gallery-grid, footer, .hero, #saveSection {
        display: none !important;
    }
    .note-card {
        box-shadow: none;
        border: 1px solid #ccc;
        margin: 0;
        page-break-inside: avoid;
    }
    body, .note-card, .note-card__inner {
        background: white;
        color: black;
    }
    .relationship-icon img {
        filter: grayscale(0);
    }
}

/* Responsive */
@media (max-width: 860px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .container-premium {
        padding: 0 20px;
    }
    .note-card__inner {
        padding: 1.5rem;
    }
    .names-area .name {
        font-size: 1.3rem;
    }
}
@media (max-width: 560px) {
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
    }
    .hero__title {
        font-size: 2.2rem;
    }
    .theme-btn {
        width: 32px;
        height: 32px;
    }
}