/**
 * Love Template - Main Styles
 * Modern, Romantic, Responsive
 */

/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --primary-color: #ff6b9d;
    --secondary-color: #c44569;
    --accent-color: #ff8fab;
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --overlay-color: rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity; /* เปลี่ยนจาก mandatory เป็น proximity เพื่อให้ smooth กว่า */
    -webkit-overflow-scrolling: touch; /* รองรับ iOS */
}

/* ปิด scroll-snap ใน mobile ขนาดเล็กเพื่อให้เลื่อนได้ลื่น */
@media (max-width: 768px) {
    html {
        scroll-snap-type: none;
    }
}

body {
    font-family: 'Kanit', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3 {
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.8rem); }

p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-muted);
}

/* ============================================
   Page Sections
   ============================================ */
.page-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    scroll-snap-align: start;
    position: relative;
    overflow: visible;
}

/* ============================================
   Floating Hearts Animation
   ============================================ */
.floating-hearts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.heart {
    position: absolute;
    font-size: 1.5rem;
    animation: floatHeart 6s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes floatHeart {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   Welcome Section
   ============================================ */
.welcome-section {
    text-align: center;
    z-index: 10;
}

.welcome-title {
    margin-bottom: 1rem;
    text-shadow: 0 0 20px var(--primary-color);
}

.welcome-subtitle {
    margin-bottom: 2rem;
    max-width: 400px;
}

/* ============================================
   Envelope Image Design
   ============================================ */
.envelope-wrapper {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.envelope-container-img {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* รูปซองจดหมาย */
.envelope-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

/* จดหมายที่จะแสดงเมื่อเปิด */
.letter-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 95%;
    max-width: 300px;
    background: linear-gradient(145deg, #ffffff 0%, #fefcf9 100%);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    opacity: 0;
    z-index: 3;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.letter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

/* เนื้อหาจดหมาย */
.letter-inner {
    padding: 25px 20px;
    max-height: 300px;
    overflow-y: auto;
}

.letter-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 12px;
    animation: iconRotate 1s ease-out;
}

@keyframes iconRotate {
    0% { transform: rotate(-180deg) scale(0); }
    100% { transform: rotate(0) scale(1); }
}

.letter-greeting {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.letter-body {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 15px;
    text-align: left;
}

.letter-closing {
    font-size: 1rem;
    color: #777;
    text-align: right;
    margin-top: 15px;
}

.letter-closing span {
    color: var(--primary-color);
    font-weight: 600;
}

/* ============================================
   Opened State
   ============================================ */
.envelope-container-img.opened .envelope-img {
    transform: scale(0) rotate(180deg);
    opacity: 0;
    pointer-events: none;
}

.envelope-container-img.opened .letter-card {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Hint */
.envelope-hint {
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    animation: hintPulse 2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-5px); }
}

.envelope-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ปุ่มไปต่อ */
.envelope-next-btn {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    transition: all 0.4s ease;
    margin-top: 1.5rem;
    display: inline-flex !important;
    z-index: 10;
    position: relative;
}

.envelope-next-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ============================================
   Responsive Envelope
   ============================================ */
@media (max-width: 768px) {
    .envelope-container-img {
        max-width: 380px;
    }
    
    .letter-card {
        max-width: 260px;
    }
    
    .letter-inner {
        padding: 20px 15px;
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .envelope-container-img {
        max-width: 320px;
    }
    
    .letter-card {
        max-width: 240px;
    }
    
    .letter-inner {
        padding: 18px 12px;
        max-height: 220px;
    }
    
    .letter-body {
        font-size: 0.85rem;
    }
}

/* ============================================
   Image Frames - Various Styles
   ============================================ */
.section-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.image-frame {
    position: relative;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-frame img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

/* Frame Style: Heart */
.frame-heart {
    border-radius: 50% 50% 0 0;
    transform: rotate(-45deg);
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.frame-heart img {
    transform: rotate(45deg) scale(1.4);
    transform-origin: center;
}

.frame-heart:hover {
    transform: rotate(-45deg) scale(1.05);
}

/* Frame Style: Classic (กรอบทอง) */
.frame-classic {
    border: 15px solid;
    border-image: linear-gradient(135deg, #d4af37, #f9d67a, #d4af37) 1;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(212, 175, 55, 0.2);
    border-radius: 8px;
}

.frame-classic:hover {
    transform: scale(1.02);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 25px rgba(212, 175, 55, 0.3);
}

/* Frame Style: Polaroid */
.frame-polaroid {
    background: white;
    padding: 15px 15px 60px 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    transform: rotate(-2deg);
}

.frame-polaroid:hover {
    transform: rotate(0deg) scale(1.02);
}

.frame-polaroid::after {
    content: '♥';
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Frame Style: Shadow (เงาสวย) */
.frame-shadow {
    border-radius: 15px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(255, 107, 157, 0.2);
}

.frame-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.4),
        0 15px 30px rgba(255, 107, 157, 0.3);
}

/* Frame Style: Circle */
.frame-circle {
    border-radius: 50%;
    overflow: hidden;
    aspect-ratio: 1;
    border: 8px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.frame-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.4);
}

/* Frame Style: Neon */
.frame-neon {
    border-radius: 15px;
    border: 3px solid var(--primary-color);
    box-shadow: 
        0 0 20px var(--primary-color),
        0 0 40px rgba(255, 107, 157, 0.5),
        inset 0 0 20px rgba(255, 107, 157, 0.1);
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% { 
        box-shadow: 
            0 0 20px var(--primary-color),
            0 0 40px rgba(255, 107, 157, 0.5),
            inset 0 0 20px rgba(255, 107, 157, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 30px var(--primary-color),
            0 0 60px rgba(255, 107, 157, 0.7),
            inset 0 0 30px rgba(255, 107, 157, 0.2);
    }
}

/* Frame Style: Vintage */
.frame-vintage {
    border: 20px solid #8b7355;
    border-radius: 4px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 30px rgba(139, 115, 85, 0.3);
    background: linear-gradient(135deg, #d4c4b5, #8b7355);
    padding: 10px;
}

.frame-vintage:hover {
    transform: scale(1.02);
}

/* Responsive */
@media (max-width: 768px) {
    .section-image-container {
        max-width: 350px;
    }
    
    .image-frame {
        max-width: 100%;
    }
    
    .image-frame img {
        max-height: 300px;
    }
    
    .frame-classic {
        border-width: 10px;
    }
    
    .frame-polaroid {
        padding: 10px 10px 50px 10px;
    }
    
    .frame-vintage {
        border-width: 15px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .section-image-container {
        max-width: 300px;
    }
    
    .image-frame {
        max-width: 100%;
    }
    
    .image-frame img {
        max-height: 250px;
    }
    
    .frame-classic {
        border-width: 8px;
    }
    
    .frame-polaroid {
        padding: 8px 8px 40px 8px;
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 400;
    font-family: 'Kanit', 'Segoe UI', sans-serif;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.6);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4); }
    50% { box-shadow: 0 4px 40px rgba(255, 107, 157, 0.8); }
}

/* ============================================
   Countdown Timer
   ============================================ */
.countdown-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2rem 0;
}

.countdown-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    min-width: 100px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.countdown-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.countdown-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   Question Section
   ============================================ */
.question-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Proposal Section
   ============================================ */
.proposal-section {
    text-align: center;
}

.proposal-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hearts-decoration {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hearts-decoration span {
    font-size: 2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.hearts-decoration span:nth-child(2) { animation-delay: 0.2s; }
.hearts-decoration span:nth-child(3) { animation-delay: 0.4s; }
.hearts-decoration span:nth-child(4) { animation-delay: 0.6s; }
.hearts-decoration span:nth-child(5) { animation-delay: 0.8s; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ============================================
   Celebration Section
   ============================================ */
.celebration-section {
    text-align: center;
}

.celebration-title {
    font-size: clamp(2rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    animation: celebrateText 0.5s ease-out;
}

@keyframes celebrateText {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Gallery Section
   ============================================ */
.gallery-section {
    padding: 3rem 1rem;
}

.love-message {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Music Section
   ============================================ */
.music-section {
    text-align: center;
}

.music-icon {
    font-size: 4rem;
    margin-bottom: 2rem;
    animation: musicPulse 2s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.music-player {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.music-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
}

/* ============================================
   Navigation Dots
   ============================================ */
.nav-dots {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.nav-dot.active,
.nav-dot:hover {
    background: var(--primary-color);
    transform: scale(1.3);
}

/* ============================================
   Music Toggle Button
   ============================================ */
.music-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    transition: var(--transition);
}

.music-toggle:hover {
    transform: scale(1.1);
}

.music-toggle.playing {
    animation: musicPlaying 1s ease-in-out infinite;
}

@keyframes musicPlaying {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   Partners Names
   ============================================ */
.partners-names {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    font-size: 1.5rem;
}

.partners-names .heart {
    color: var(--primary-color);
    animation: heartBeat 1.5s ease-in-out infinite;
    position: static;
    font-size: 1.5rem;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-heart {
    font-size: 4rem;
    animation: loadingBeat 1s ease-in-out infinite;
}

@keyframes loadingBeat {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .page-section {
        padding: 1.5rem;
    }
    
    .countdown-container {
        gap: 0.8rem;
    }
    
    .countdown-item {
        min-width: 70px;
        padding: 1rem;
    }
    
    .countdown-number {
        font-size: 1.8rem;
    }
    
    .nav-dots {
        right: 10px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .countdown-container {
        gap: 0.5rem;
    }
    
    .countdown-item {
        min-width: 60px;
        padding: 0.8rem;
    }
    
    .countdown-number {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* ============================================
   Scrollbar Custom
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gradient-1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }
