/* Peter Hồ Hữu Thọ Memorial - Main Stylesheet */

/* ========================================
   Variables & Reset
======================================== */
:root {
    --primary: #1a2332;
    --gold: #C9A961;
    --cream: #FAF8F3;
    --white: #FFFFFF;
    --gray: #6B7280;
    --gray-light: #9CA3AF;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.2);
    --vietnam-red: #DA251D;
    --america-blue: #002868;
    --overlay: rgba(26, 35, 50, 0.85);
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    color: var(--primary);
    background: var(--cream);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   Funeral Slideshow Mode
======================================== */
.funeral-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: none;
    cursor: none;
}

.funeral-mode.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.funeral-controls {
    position: absolute;
    top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 10;
}

.funeral-exit {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.funeral-exit:hover {
    background: rgba(255, 255, 255, 0.2);
}

.funeral-progress {
    color: white;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 25px;
}

.funeral-slideshow {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.funeral-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.funeral-slide.active {
    opacity: 1;
}

.funeral-slide img {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.funeral-caption {
    position: absolute;
    bottom: 60px;
    color: white;
    text-align: center;
    font-family: var(--font-serif);
    font-size: 1.8rem;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    max-width: 80%;
}

.funeral-navigation {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 20px;
    z-index: 10;
}

/* Keyboard hints for funeral mode */
.funeral-mode::after {
    content: 'ESC to exit • ← → to navigate • SPACE to play/pause';
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    z-index: 9;
}

.funeral-nav-btn,
.funeral-play-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.funeral-nav-btn:hover,
.funeral-play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ========================================
   Opening Ceremony
======================================== */
.opening-ceremony {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s, visibility 1s;
    padding: 20px;
    overflow-y: auto;
}

.opening-ceremony.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.ceremony-content {
    text-align: center;
    animation: ceremonyFadeIn 2s ease-out;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 0;
}

@keyframes ceremonyFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ceremony-portrait {
    width: 180px;
    height: 270px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 30px;
    border: 4px solid var(--gold);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ceremony-portrait:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35);
}

.ceremony-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ceremony-name {
    font-family: var(--font-serif);
    font-size: 3rem;
    color: white;
    margin-bottom: 10px;
}

.ceremony-dates {
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.ceremony-flags {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

/* Mobile adjustments for ceremony */
@media (max-width: 768px) {
    .ceremony-name {
        font-size: 2rem;
    }
    
    .ceremony-dates {
        font-size: 1.1rem;
    }
    
    .ceremony-portrait {
        width: 150px;
        height: 225px;
    }
    
    .ceremony-enter {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

.ceremony-enter {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 1px;
}

.ceremony-enter:hover {
    background: var(--gold);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(201, 169, 97, 0.3);
}

/* ========================================
   Navigation
======================================== */
.nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: linear-gradient(180deg, rgba(26, 35, 50, 0.9) 0%, rgba(26, 35, 50, 0.7) 100%);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav.scrolled {
    background: rgba(250, 248, 243, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px var(--shadow);
    padding: 15px 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav.scrolled .nav-brand {
    opacity: 1;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding: 5px 10px;
    transition: all 0.3s;
    border-radius: 20px;
}

.nav.scrolled .nav-link {
    color: var(--primary);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gold);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.3s;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.funeral-btn {
    background: var(--vietnam-red);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.funeral-btn:hover {
    background: #B71C1C;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(218, 37, 29, 0.3);
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* ========================================
   Hero Section
======================================== */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-slideshow {
    width: 100%;
    height: 100%;
    position: relative;
}

.hero-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 3s ease-in-out;
}

.hero-slide.active {
    opacity: 1;
}

.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    max-width: 900px;
    padding: 40px;
    animation: heroFadeIn 2s ease-out;
}

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

.hero-subtitle {
    font-size: 1.1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 20px;
    opacity: 0.9;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(3rem, 7vw, 5rem);
    margin-bottom: 10px;
    font-weight: 600;
}

.hero-vietnamese {
    font-size: 2rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.hero-nickname {
    font-size: 1.5rem;
    font-style: italic;
    opacity: 0.8;
    margin-bottom: 20px;
}

.hero-dates {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: var(--gold);
}

.hero-dash {
    font-size: 2rem;
}

.hero-legacy {
    margin-bottom: 30px;
    opacity: 0.9;
    line-height: 1.8;
}

.hero-legacy p {
    margin-bottom: 10px;
}

.hero-flags {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
}

.flag-icon {
    /* Standardized dimensions for both flags */
    width: 60px;
    height: 40px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

/* Note: Only ARVN flag, not USMC */

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--gold);
    color: white;
}

.btn-primary:hover {
    background: #B8984F;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(201, 169, 97, 0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: var(--primary);
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    animation: bounce 2s infinite;
}

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

.scroll-arrow {
    font-size: 1.5rem;
    margin-top: 10px;
}

/* ========================================
   Obituary / Cáo Phó Section
======================================== */
.obituary {
    padding: 100px 0;
    background: white;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.section-subtitle {
    color: var(--gray);
    font-size: 1.2rem;
}

.obituary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto 40px;
}

.cao-pho,
.obituary-en {
    background: var(--cream);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px var(--shadow);
}

.cao-pho-header,
.obituary-header {
    text-align: center;
    margin-bottom: 30px;
}

.cao-pho-header h3,
.obituary-header h3 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.cross-symbol {
    font-size: 2rem;
    color: var(--gold);
}

.intro-text {
    text-align: center;
    font-style: italic;
    margin-bottom: 30px;
    color: var(--gray);
}

.deceased-info {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
}

.deceased-info h4 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.nickname {
    font-style: italic;
    color: var(--gray);
    margin-bottom: 15px;
}

.life-dates {
    line-height: 1.8;
}

.service-info-vn,
.service-info-en {
    margin-bottom: 30px;
}

.service-info-vn h5,
.service-info-en h5 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.service-info-vn ul,
.service-info-en ul,
.family-info ul {
    list-style: none;
    padding-left: 20px;
}

.service-info-vn li,
.service-info-en li,
.family-info li {
    margin-bottom: 8px;
    position: relative;
}

.service-info-vn li::before,
.service-info-en li::before {
    content: '•';
    position: absolute;
    left: -15px;
    color: var(--gold);
}

.family-info {
    margin-bottom: 30px;
}

.family-info h5 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.extended {
    font-style: italic;
    color: var(--gray);
    margin-top: 15px;
}

.closing {
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    margin-top: 30px;
}

.obituary-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-download,
.btn-print {
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-download:hover,
.btn-print:hover {
    background: var(--gold);
    transform: translateY(-2px);
}

/* ========================================
   Timeline Section
======================================== */
.timeline {
    padding: 100px 0;
    background: var(--cream);
    position: relative;
}

.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--gold), var(--vietnam-red), var(--america-blue));
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 80px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item:nth-child(odd) {
    padding-right: 50%;
    text-align: right;
}

.timeline-item:nth-child(even) {
    padding-left: 50%;
    text-align: left;
}

.timeline-marker {
    position: absolute;
    left: 50%;
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--gold);
    border: 3px solid white;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 3px 10px var(--shadow);
}

.timeline-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow);
    margin: 0 30px;
}

.timeline-year {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 10px;
    font-weight: 600;
}

.timeline-content h3 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.timeline-content p {
    color: var(--gray);
    line-height: 1.8;
}

/* ========================================
   Photo Gallery
======================================== */
.gallery {
    padding: 100px 0;
    background: white;
}

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--primary);
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--gold);
    color: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 40px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow);
    cursor: pointer;
    transition: transform 0.3s;
    background: var(--cream);
}

.gallery-item:hover {
    transform: translateY(-10px);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    padding: 15px;
    text-align: center;
    color: var(--primary);
    font-size: 0.9rem;
}

.gallery-link {
    text-align: center;
}

/* ========================================
   Memories Section
======================================== */
.memories {
    padding: 100px 0;
    background: var(--cream);
}

.memories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 60px;
}

.memory-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    transition: transform 0.3s;
}

.memory-card:hover {
    transform: translateY(-5px);
}

.memory-author {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.author-avatar {
    width: 60px;
    height: 60px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.3rem;
    margin-right: 15px;
}

.author-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
}

.author-info p {
    color: var(--gray);
    font-size: 0.9rem;
}

.memory-text {
    color: var(--primary);
    line-height: 1.8;
    font-style: italic;
    border-left: 3px solid var(--gold);
    padding-left: 20px;
}

.memory-form {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow);
}

.memory-form h3 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
}

.memory-form input,
.memory-form textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 1rem;
}

.memory-form input:focus,
.memory-form textarea:focus {
    outline: none;
    border-color: var(--gold);
}

/* Google Forms iframe responsive */
.form-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.form-container iframe {
    width: 100%;
    max-width: 100%;
    border: none;
}

@media (max-width: 768px) {
    .form-container iframe {
        height: 1400px; /* Much taller on mobile for better form visibility */
    }
}

/* ========================================
   Service Section
======================================== */
.service {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
    color: white;
}

.service .section-header .section-title,
.service .section-header .section-subtitle {
    color: white;
}

.service-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 60px;
}

.service-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.service-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

.service-time {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 15px;
}

.service-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.service-card p {
    opacity: 0.9;
    line-height: 1.6;
}

.service-card.final {
    grid-column: span 2;
    background: rgba(201, 169, 97, 0.2);
    border-color: var(--gold);
}

.service-contact {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.service-contact h3 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 20px;
}

.service-contact p {
    margin-bottom: 15px;
    line-height: 1.8;
}

/* Google Maps Integration */
.map-container {
    width: 100%;
    margin-top: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.map-container iframe {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 10px;
}

/* Make maps responsive */
@media (max-width: 768px) {
    .map-container iframe {
        height: 150px;
    }
}

/* ========================================
   Virtual Candle Section - Enhanced
======================================== */
.candle-section {
    padding: 100px 0;
    background: linear-gradient(180deg, #ffffff 0%, #faf8f3 50%, #ffffff 100%);
    position: relative;
    overflow: hidden;
}

/* Floating particles effect */
.candle-section::before,
.candle-section::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    animation: float-up 15s linear infinite;
}

.candle-section::before {
    left: 20%;
    animation-delay: 0s;
}

.candle-section::after {
    left: 80%;
    animation-delay: 7s;
}

@keyframes float-up {
    0% {
        bottom: -10px;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: translateX(50px);
    }
}

/* Floating particles for ethereal effect */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4), transparent);
    border-radius: 50%;
    bottom: -10px;
    animation: float-particle 20s linear infinite;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.particle:nth-child(2) {
    left: 30%;
    animation-delay: 3s;
    animation-duration: 22s;
}

.particle:nth-child(3) {
    left: 50%;
    animation-delay: 6s;
    animation-duration: 20s;
}

.particle:nth-child(4) {
    left: 70%;
    animation-delay: 9s;
    animation-duration: 24s;
}

.particle:nth-child(5) {
    left: 90%;
    animation-delay: 12s;
    animation-duration: 19s;
}

@keyframes float-particle {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: translateX(0) scale(1);
    }
    10% {
        opacity: 0.6;
    }
    50% {
        transform: translateX(30px) scale(1.2);
    }
    90% {
        opacity: 0.6;
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: translateX(-30px) scale(0.8);
    }
}

.candle-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.candle-wrapper {
    width: 300px;
    height: 400px;
    margin: 0 auto 40px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ethereal glow effect */
.candle-wrapper::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15), transparent 70%);
    border-radius: 50%;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 2s ease;
    animation: etherealGlow 4s ease-in-out infinite;
}

.candle-wrapper.lit::before {
    opacity: 1;
}

@keyframes etherealGlow {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

.candle {
    width: 80px;
    height: 200px;
    background: linear-gradient(to bottom, #FFF5E1, #FFE4B5, #FFDEAD);
    border-radius: 5px 5px 10px 10px;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 -20px 30px rgba(139, 69, 19, 0.2);
}

.flame {
    width: 45px;
    height: 60px;
    background: radial-gradient(circle at bottom, #FFF 0%, #FFD700 20%, #FF6347 60%, #FF4500 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: absolute;
    bottom: 250px;  /* Position flame at top of candle */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 1.5s ease;
    filter: blur(0.5px);
}

.flame.lit {
    opacity: 1;
    animation: flicker 3s ease-in-out infinite, rise 2s ease-in-out infinite;
    box-shadow: 
        0 0 40px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(255, 140, 0, 0.3),
        0 -20px 40px rgba(255, 69, 0, 0.2);
}

@keyframes flicker {
    0%, 100% { 
        transform: translateX(-50%) scale(1) rotate(-2deg);
        filter: brightness(1) blur(0.5px);
    }
    25% { 
        transform: translateX(-50%) scale(1.05) rotate(1deg);
        filter: brightness(1.1) blur(0.8px);
    }
    50% { 
        transform: translateX(-50%) scale(0.98) rotate(-1deg);
        filter: brightness(0.95) blur(0.3px);
    }
    75% { 
        transform: translateX(-50%) scale(1.02) rotate(2deg);
        filter: brightness(1.05) blur(0.6px);
    }
}

@keyframes rise {
    0%, 100% { bottom: 250px; }
    50% { bottom: 255px; }
}

/* Smoke effect */
.smoke {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 40px;
    opacity: 0;
}

.smoke.visible {
    animation: smoke 3s ease-out;
}

@keyframes smoke {
    0% {
        opacity: 0.3;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-60px) scale(3);
        filter: blur(8px);
    }
}

.candle-count {
    color: var(--gray);
    margin-top: 20px;
    font-size: 1.1rem;
}

.candle-count span {
    color: var(--gold);
    font-weight: 600;
    font-size: 1.3rem;
}

/* ========================================
   Footer
======================================== */
.footer {
    padding: 60px 0 40px;
    background: var(--primary);
    color: white;
}

.footer-content {
    text-align: center;
}

.footer-quote {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-style: italic;
    margin-bottom: 30px;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--gold);
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-copyright {
    opacity: 0.6;
    font-size: 0.9rem;
}

/* ========================================
   Lightbox
======================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: opacity 0.3s;
    z-index: 2001;
}

.lightbox-close:hover {
    opacity: 0.7;
}

#lightboxImage {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    color: white;
    text-align: center;
    font-size: 1.2rem;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
}

/* Keyboard hints for lightbox */
.lightbox::after {
    content: 'ESC to close • ← → to navigate';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-family: var(--font-sans);
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 80px 40px;
        transition: right 0.3s;
        box-shadow: -10px 0 30px var(--shadow);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-toggle {
        display: block;
    }

    .funeral-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
        position: fixed;
        top: 20px;
        right: 60px; /* Position next to menu button */
        z-index: 1001;
    }
    
    .funeral-btn span {
        display: inline; /* Keep emoji visible */
    }
    
    /* Adjust nav container spacing on mobile */
    .nav-container {
        gap: 10px;
    }
    
    .nav-brand {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-vietnamese {
        font-size: 1.5rem;
    }

    .timeline-item {
        padding: 0 !important;
        text-align: left !important;
        padding-left: 70px !important;
        margin-bottom: 60px !important;
    }

    .timeline-line {
        left: 30px;
        width: 4px; /* Make line thicker on mobile for better visibility */
    }

    .timeline-marker {
        left: 30px;
        width: 24px; /* Larger marker on mobile */
        height: 24px;
        transform: translateX(-50%);
    }
    
    .timeline-content {
        margin: 0 20px 0 10px; /* Better spacing on mobile */
        box-shadow: 0 5px 20px var(--shadow); /* Enhanced shadow for better visibility */
    }

    .obituary-content {
        grid-template-columns: 1fr;
    }

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

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

    .service-timeline {
        grid-template-columns: 1fr;
    }

    .service-card.final {
        grid-column: span 1;
    }
    
    /* Hide keyboard hints on mobile */
    .funeral-mode::after,
    .lightbox::after {
        display: none;
    }
}

/* ========================================
   Go to Top Button
======================================== */
.go-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Mobile specific styles for go-to-top button */
@media (max-width: 768px) {
    .go-to-top {
        bottom: 80px; /* Move up to avoid browser UI */
        right: 20px;
        width: 60px; /* Bigger on mobile */
        height: 60px;
        font-size: 2rem; /* Larger arrow */
    }
}

.go-to-top:hover {
    background: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.go-to-top.visible {
    display: flex;
}

/* ========================================
   Flag Dimension Fixes - Ensure Consistency
======================================== */
/* Ceremony section flags - ensure same size */
.ceremony-flags .flag-icon {
    width: 60px;
    height: 40px;
    object-fit: contain;
}

/* Hero section flags - ensure same size */
.hero-flags .flag-icon {
    width: 60px;
    height: 40px;
    object-fit: contain;
}

/* Smaller flags if needed in other contexts */
.nav .flag-icon,
.footer .flag-icon {
    width: 30px;
    height: 20px;
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .nav,
    .funeral-btn,
    .ceremony-enter,
    .scroll-indicator,
    .btn,
    .memory-form {
        display: none !important;
    }

    .hero {
        height: auto;
        padding: 40px;
        background: white !important;
    }

    .hero-content {
        color: var(--primary) !important;
    }

    .timeline-item {
        page-break-inside: avoid;
    }

    .memory-card {
        page-break-inside: avoid;
    }

    .service-card {
        page-break-inside: avoid;
    }
}