/* CSS Variables & Light Gray Theme */
:root {
    /* Palette: Gray Gradients and High Contrast Elements */
    --bg-body-start: #f8fafc;
    --bg-body-mid: #e2e8f0;
    --bg-body-end: #cbd5e1;

    --bg-card: #ffffff;
    --bg-card-subtle: #f1f5f9;

    --gold-accent: #b45309;
    --gold-light: #fffbeb;
    --gold-border: #f59e0b;

    --text-title: #0f172a;
    --text-body: #1e293b;
    --text-muted: #475569;
    --text-light: #64748b;

    --font-serif: 'Cinzel', serif;
    --font-garamond: 'Cormorant Garamond', serif;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-mono: monospace;
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--bg-body-start) 0%, var(--bg-body-mid) 50%, var(--bg-body-end) 100%);
    background-attachment: fixed;
    color: var(--text-body);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background-color: var(--gold-border);
    color: #ffffff;
}

/* Content revealed after opening the invitation */
.hidden-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease, max-height 0.8s ease;
}

.hidden-content.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    max-height: 100000px;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body-mid);
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-accent);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-container {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* SVG Icon styling helper using CSS Filters */
/* Gold Accent (#b45309): invert(33%) sepia(87%) saturate(1684%) hue-rotate(15deg) brightness(95%) contrast(98%) */
/* White (#ffffff): brightness(0) invert(1) */
/* Dark Title (#0f172a): invert(7%) sepia(21%) saturate(3620%) hue-rotate(189deg) brightness(98%) contrast(96%) */
/* Blue (#1d4ed8): invert(25%) sepia(88%) saturate(3025%) hue-rotate(218deg) brightness(94%) contrast(98%) */

.filter-gold {
    filter: invert(33%) sepia(87%) saturate(1684%) hue-rotate(15deg) brightness(95%) contrast(98%);
}

.filter-white {
    filter: brightness(0) invert(1);
}

.filter-blue {
    filter: invert(25%) sepia(88%) saturate(3025%) hue-rotate(218deg) brightness(94%) contrast(98%);
}

.filter-dark {
    filter: invert(7%) sepia(21%) saturate(3620%) hue-rotate(189deg) brightness(98%) contrast(96%);
}

.svg-icon {
    display: inline-block;
    vertical-align: middle;
    width: 1.125rem;
    height: 1.125rem;
    filter: invert(33%) sepia(87%) saturate(1684%) hue-rotate(15deg) brightness(95%) contrast(98%);
}

.header-brand .svg-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.btn-share .svg-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.cross-icon-wrapper .svg-icon {
    width: 3.75rem;
    height: 3.75rem;
}

.section-tag .svg-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.card-icon .svg-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
}

.card-dates .svg-icon {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.25rem;
}

.detail-icon-svg {
    width: 1.75rem;
    height: 1.75rem;
    filter: invert(33%) sepia(87%) saturate(1684%) hue-rotate(15deg) brightness(95%) contrast(98%);
    margin-bottom: 0.4rem;
}

.detail-icon-church {
    width: 3.1rem;
    height: 3.1rem;
}

.location-title .svg-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.location-title-blue .svg-icon {
    filter: invert(25%) sepia(88%) saturate(3025%) hue-rotate(218deg) brightness(94%) contrast(98%);
}

.btn-action-primary .svg-icon {
    width: 1.5rem;
    height: 1.5rem;
    filter: brightness(0) invert(1);
}

.btn-action-blue .svg-icon {
    width: 3.4rem;
    height: 3.4rem;
    margin: -1rem 0;
    filter: brightness(0) invert(1);
}

.btn-secondary .svg-icon {
    width: 1.5rem;
    height: 1.5rem;
    filter: invert(7%) sepia(21%) saturate(3620%) hue-rotate(189deg) brightness(98%) contrast(96%);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand i {
    color: var(--gold-accent);
    font-size: 1.125rem;
}

.header-brand span {
    font-family: var(--font-serif);
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-title);
    font-weight: 600;
}

.btn-share {
    font-size: 0.75rem;
    background-color: var(--gold-light);
    color: var(--gold-accent);
    border: 1px solid var(--gold-border);
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-share:hover {
    background-color: #fef3c7;
    transform: translateY(-1px);
}

/* Floating Audio Toggle (Icon-only round button) */
.audio-toggle-floating {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    background: #ffffff;
    border: 1px solid var(--gold-border);
    color: var(--gold-accent);
    border-radius: 9999px;
    box-shadow: 0 10px 25px -5px rgba(180, 83, 9, 0.25);
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.audio-toggle-floating:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 14px 28px -5px rgba(180, 83, 9, 0.3);
    background-color: var(--gold-light);
}

.audio-toggle-floating.playing {
    background: var(--gold-accent);
    color: #ffffff;
    border-color: #92400e;
}

.audio-toggle-floating .svg-icon {
    width: 1.35rem;
    height: 1.35rem;
    filter: invert(33%) sepia(87%) saturate(1684%) hue-rotate(15deg) brightness(95%) contrast(98%);
}

.audio-toggle-floating.playing .svg-icon {
    filter: brightness(0) invert(1);
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.share-text {
    display: none;
}

@media (min-width: 640px) {
    .share-text {
        display: inline;
    }
}

/* Main Container */
.main-content {
    position: relative;
    z-index: 10;
    max-width: 56rem;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

body.invitation-open .main-content {
    gap: 2.5rem;
}

@media (min-width: 640px) {
    .main-content {
        padding: 3rem 1rem;
    }
}

/* Hero Section */
.hero-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cross-icon-wrapper {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #fef3c7, #ffffff);
    border: 1px solid var(--gold-border);
    margin: 0 auto 0.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.cross-icon-wrapper i {
    color: var(--gold-accent);
    font-size: 1.5rem;
}

.hero-titles {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hero-subtitle {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--gold-accent);
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: 0.025em;
}

@media (min-width: 640px) {
    .hero-title {
        font-size: 3.25rem;
    }
}

.quote-header {
    max-width: 42rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    font-style: italic;
    font-family: var(--font-garamond);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-title);
    line-height: 1.5;
    border-top: 1px solid rgba(180, 83, 9, 0.3);
    border-bottom: 1px solid rgba(180, 83, 9, 0.3);
}

@media (min-width: 640px) {
    .quote-header {
        font-size: 1.65rem;
    }
}

.hero-description {
    font-size: 0.95rem;
    color: var(--text-body);
    max-width: 36rem;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 500;
}

@media (min-width: 640px) {
    .hero-description {
        font-size: 1.05rem;
    }
}

/* Main Honoree Card */
.honoree-card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.75rem;
    max-width: 42rem;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(180, 83, 9, 0.3);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.honoree-card:hover {
    box-shadow: 0 15px 30px -5px rgba(180, 83, 9, 0.15);
    border-color: var(--gold-border);
}

@media (min-width: 640px) {
    .honoree-card {
        padding: 2.25rem;
    }
}

.honoree-badge {
    display: block;
    padding: 0.35rem 0.9rem;
    background-color: var(--gold-light);
    border: 1px solid var(--gold-border);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 auto .85rem auto;
    width: 180px;
}

.honoree-name {
    font-family: var(--font-serif);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: 0.015em;
    margin-bottom: 0.6rem;
    text-align: center;
}

@media (min-width: 640px) {
    .honoree-name {
        font-size: 3.35rem;
    }
}

.honoree-dates {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    color: var(--gold-accent);
    font-family: var(--font-garamond);
    font-size: 1.4rem;
    font-weight: 700;
}

@media (min-width: 640px) {
    .honoree-dates {
        font-size: 1.6rem;
    }
}

.honoree-star {
    font-size: 0.85rem;
    color: var(--gold-border);
}

/* Family Section */
.family-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gold-accent);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--text-title);
    font-weight: 700;
}

@media (min-width: 640px) {
    .section-title {
        font-size: 2rem;
    }
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 32rem;
    margin: 0 auto;
    font-weight: 500;
}

@media (min-width: 640px) {
    .section-subtitle {
        font-size: 0.95rem;
    }
}

/* Grid System */
.family-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .family-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-span-full {
        grid-column: span 2 / span 2;
    }
}

/* Family Cards */
.family-card {
    background-color: var(--bg-card);
    border: 1px solid #cbd5e1;
    border-radius: 0.85rem;
    padding: 1.15rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
}

@media (min-width: 640px) {
    .family-card {
        padding: 1.25rem;
    }
}

.family-card:hover {
    border-color: var(--gold-border);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-icon {
    padding: 0.65rem;
    border-radius: 9999px;
    background-color: var(--gold-light);
    color: var(--gold-accent);
    border: 1px solid rgba(245, 158, 11, 0.4);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.card-icon i {
    font-size: 0.85rem;
}

.card-order {
    font-size: 0.75rem;
    color: var(--gold-accent);
    font-family: var(--font-mono);
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.card-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-title);
}

@media (min-width: 640px) {
    .card-name {
        font-size: 1.5rem;
    }
}

.card-relation {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.card-dates {
    font-size: 1.3rem;
    color: var(--gold-accent);
    font-family: var(--font-garamond);
    font-weight: 700;
}

/* Event Details Section */
.service-card {
    background: #ffffff;
    border-radius: 1.25rem;
    border: 1px solid #cbd5e1;
    margin-top: 1rem;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
}

@media (min-width: 640px) {
    .service-card {
        padding: 2.25rem;
    }
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 1024px) {
    .details-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.detail-box {
    background-color: var(--bg-card-subtle);
    padding: 1.15rem 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.detail-icon {
    font-size: 1.65rem;
    color: var(--gold-accent);
    margin-bottom: 0.4rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.detail-value {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--text-title);
    font-weight: 700;
    margin-top: 0.25rem;
}

.detail-value-sm {
    font-size: 0.9rem;
}

/* Location Details Block */
.location-block {
    background-color: #f8fafc;
    border-radius: 0.85rem;
    padding: 1.35rem;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.location-row {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

@media (min-width: 640px) {
    .location-row {
        flex-direction: row;
        align-items: center;
    }
}

.location-row-border {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1.25rem;
}

.location-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold-accent);
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.location-title-blue {
    color: #1d4ed8;
}

.location-desc {
    font-size: 0.85rem;
    color: var(--text-body);
    font-weight: 500;
}

@media (min-width: 640px) {
    .location-desc {
        font-size: 0.95rem;
    }
}

/* Buttons */
.btn-action-primary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--gold-accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.6rem;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(180, 83, 9, 0.2);
}

.btn-action-primary:hover {
    background-color: #92400e;
    transform: translateY(-1px);
}

.btn-action-blue {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: #1d4ed8;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.6rem;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(29, 78, 216, 0.2);
}

.btn-action-blue:hover {
    background-color: #1e40af;
    transform: translateY(-1px);
}

@media (min-width: 640px) {

    .btn-action-primary,
    .btn-action-blue {
        width: auto;
    }
}

.action-buttons-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
    padding-top: 0.5rem;
}

@media (min-width: 640px) {
    .action-buttons-row {
        flex-direction: row;
    }
}

.btn-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-card-subtle);
    color: var(--text-title);
    border: 1px solid #cbd5e1;
    font-size: 0.85rem;
    padding: 0.85rem 1.35rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

/* Final Gratitude Section */
.gratitude-section {
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: #ffffff;
    border-radius: 1.25rem;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
    margin-top: 1rem;
}

.gratitude-quote {
    font-family: var(--font-garamond);
    font-size: 1.35rem;
    color: var(--text-title);
    font-style: italic;
    font-weight: 600;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .gratitude-quote {
        font-size: 1.6rem;
    }
}

.gratitude-signature {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold-accent);
    font-family: var(--font-serif);
    font-weight: 700;
}

/* Footer */
.site-footer {
    position: relative;
    z-index: 10;
    border-top: 1px solid rgba(148, 163, 184, 0.4);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Toast Popup */
.toast-popup {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-title);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    z-index: 50;
    transition: opacity 0.3s ease;
}

/* Fade-in Animation */
.fade-in-up {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Memorial Photo & Candle Animation
   ========================================== */

/* Title row with candle */
.hero-title-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
}

@media (min-width: 640px) {
    .hero-title-row {
        gap: 1.25rem;
    }
}

/* Elegant Photo Frame */
.memorial-photo-frame {
    position: relative;
    width: 11rem;
    height: 13.5rem;
    margin: 1.5rem auto;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .memorial-photo-frame {
        width: 14rem;
        height: 17rem;
    }
}

.memorial-photo-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
    padding: 0.35rem;
    background: #ffffff;
    border: 2px solid var(--gold-accent);
    box-shadow:
        0 0 0 4px rgba(245, 158, 11, 0.12),
        0 0 0 6px rgba(180, 83, 9, 0.08),
        0 12px 40px -8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.memorial-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 0.2rem;
    display: block;
    filter: sepia(0.06) contrast(1.02) brightness(1.01);
}

/* Ornamental corners */
.memorial-corner {
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    z-index: 2;
}

@media (min-width: 640px) {
    .memorial-corner {
        width: 1.8rem;
        height: 1.8rem;
    }
}

.memorial-corner::before,
.memorial-corner::after {
    content: '';
    position: absolute;
    background-color: var(--gold-accent);
    border-radius: 1px;
}

/* Horizontal bar of L */
.memorial-corner::before {
    width: 100%;
    height: 2.5px;
}

/* Vertical bar of L */
.memorial-corner::after {
    width: 2.5px;
    height: 100%;
}

.memorial-corner-tl {
    top: -0.35rem;
    left: -0.35rem;
}

.memorial-corner-tl::before {
    top: 0;
    left: 0;
}

.memorial-corner-tl::after {
    top: 0;
    left: 0;
}

.memorial-corner-tr {
    top: -0.35rem;
    right: -0.35rem;
}

.memorial-corner-tr::before {
    top: 0;
    right: 0;
}

.memorial-corner-tr::after {
    top: 0;
    right: 0;
}

.memorial-corner-bl {
    bottom: -0.35rem;
    left: -0.35rem;
}

.memorial-corner-bl::before {
    bottom: 0;
    left: 0;
}

.memorial-corner-bl::after {
    bottom: 0;
    left: 0;
}

.memorial-corner-br {
    bottom: -0.35rem;
    right: -0.35rem;
}

.memorial-corner-br::before {
    bottom: 0;
    right: 0;
}

.memorial-corner-br::after {
    bottom: 0;
    right: 0;
}

/* Candle — rosado/rojizo en la base, beige amarillento arriba */
.candle {
    width: 3em;
    height: 4.5em;
    font-size: 10px;
    background: linear-gradient(#f7ead0,
            #f0dbb3,
            #e8c4b0,
            #d89a9a,
            #c47070 50%,
            rgba(150, 75, 75, 0.75));
    box-shadow:
        inset 0.5em -1em 1.2em rgba(0, 0, 0, 0.35),
        inset -0.5em 0 1.2em rgba(0, 0, 0, 0.35);
    border-radius: 1.5em / 0.6em;
    position: relative;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 0.1em;
}

@media (min-width: 640px) {
    .candle {
        width: 3.8em;
        height: 5.5em;
        font-size: 12px;
    }
}

/* Superficie superior de la vela (elipse) — tono beige */
.candle::before {
    content: '';
    position: absolute;
    width: inherit;
    height: 0.9em;
    border: 0.15em solid #d89a9a;
    border-radius: 50%;
    box-sizing: border-box;
    background: radial-gradient(#6b5a4a,
            /* centro oscuro (donde nace la mecha) */
            #c9a88a,
            #e8c4b0,
            #d89a9a,
            #c47070);
    filter: opacity(0.85);
}

/* Mecha — negra arriba (donde nace la llama), beige abajo para empalmar */
.candle .thread {
    position: absolute;
    width: 0.2em;
    height: 1em;
    top: -0.6em;
    background: linear-gradient(#1a1a1a,
            /* negro en la punta (arriba) */
            #222,
            #3a2a20,
            #f0dbb3 92%
            /* beige al final, se funde con la vela */
        );
    border-radius: 40% 40% 0 0;
}

@media (min-width: 640px) {
    .candle .thread {
        width: 0.22em;
        height: 1.2em;
        top: -0.75em;
    }
}

/* Contenedor de la llama */
.candle .flames {
    position: absolute;
    width: 0.9em;
    left: 50%;
    transform: translateX(-50%);
}

@media (min-width: 640px) {
    .candle .flames {
        width: 1.1em;
    }
}

/* Llama interna azul — reposicionada para nacer en la punta de la mecha */
.candle .flames::before {
    content: '';
    position: absolute;
    width: inherit;
    height: 1.5em;
    background-color: rgba(65, 105, 225, 0.6);
    top: -1.9em;
    left: 0;
    /* base de la llama justo en la punta de la mecha */
    border-radius: 50% 50% 35% 35%;
    border: 0.06em solid rgba(30, 144, 255, 0.5);
    box-sizing: border-box;
    filter: opacity(0.7);
}

@media (min-width: 640px) {
    .candle .flames::before {
        height: 1.9em;
        top: -2.35em;
    }
}

/* Llama externa brillante — reposicionada */
.candle .flames::after {
    content: '';
    position: absolute;
    width: inherit;
    height: 2.9em;
    top: -3.2em;
    left: 0;
    /* base alineada con la punta de la mecha */
    background: linear-gradient(#fff8e7 80%, transparent);
    border-radius: 50% 50% 20% 20%;
    box-shadow: 0 -0.25em 0.2em rgba(218, 165, 32, 0.7);
    animation:
        candle-enlarge 5s linear infinite,
        candle-move 6s linear infinite;
}

@media (min-width: 640px) {
    .candle .flames::after {
        height: 3.8em;
        top: -4.15em;
    }
}

/* Resplandor de la llama */
.candle .glow {
    position: absolute;
    width: 4em;
    height: 6em;
    background-color: rgba(245, 158, 11, 0.35);
    border-radius: 50%;
    top: -4.5em;
    filter: blur(2em);
    animation: candle-blink 100ms infinite;
}

@media (min-width: 640px) {
    .candle .glow {
        width: 5em;
        height: 7em;
        top: -5.5em;
        filter: blur(2.5em);
    }
}

/* Keyframes de la vela */
@keyframes candle-move {

    0%,
    100% {
        transform: rotate(2deg);
    }

    50% {
        transform: rotate(-2deg);
    }
}

@keyframes candle-enlarge {

    0%,
    100% {
        height: 2.9em;
        top: -3.2em;
    }

    50% {
        height: 3.3em;
        top: -3.5em;
    }
}

@media (min-width: 640px) {
    @keyframes candle-enlarge {

        0%,
        100% {
            height: 3.8em;
            top: -4.15em;
        }

        50% {
            height: 4.4em;
            top: -4.55em;
        }
    }
}

@keyframes candle-blink {
    to {
        filter: blur(2em) opacity(0.75);
    }
}

/* ==========================================
   Botón Abrir Invitación
   ========================================== */
.open-invitation-container {
    text-align: center;
    margin: 2rem 0;
    transition: all 0.5s ease;
}

.open-invitation-container.hidden {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    pointer-events: none;
}

.btn-open-invitation {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--gold-light);
    color: var(--gold-accent);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 2.5rem;
    border: 1px solid var(--gold-border);
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(180, 83, 9, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.05em;
}

.btn-open-invitation:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(180, 83, 9, 0.5);
}

.btn-open-invitation .btn-icon {
    width: 1.3rem;
    height: 1.3rem;
    filter: brightness(0) invert(1);
}

/* ==========================================
   Contenido Oculto (se revela al abrir)
   ========================================== */
.hidden-wrapper {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.8s ease, max-height 0.8s ease;
}

.hidden-wrapper.visible {
    opacity: 1;
    max-height: 100000px;
    overflow: visible;
}