/* Por La Eternidad — vista pública memorial */
:root {
    --mem-bg-deep: #12182a;
    --mem-bg-mid: #1c2640;
    --mem-bg-soft: #243352;
    --mem-gold: #d4af6a;
    --mem-gold-soft: #e8d4a8;
    --mem-text: #f8f4ec;
    --mem-text-muted: #c8c0b4;
    --mem-overlay: rgba(12, 16, 28, 0.72);
    --font-display: "Cormorant Garamond", Georgia, serif;
    --font-body: "Outfit", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.is-hidden {
    display: none !important;
}

.memorial-body {
    margin: 0;
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--mem-text);
    background: var(--mem-bg-deep);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Partículas suaves */
.memorial-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--mem-gold);
    opacity: 0.35;
    animation: float-particle 12s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 80%; top: 15%; animation-delay: 2s; }
.particle:nth-child(3) { left: 50%; top: 60%; animation-delay: 4s; }
.particle:nth-child(4) { left: 25%; top: 80%; animation-delay: 1s; }
.particle:nth-child(5) { left: 70%; top: 75%; animation-delay: 3s; }
.particle:nth-child(6) { left: 40%; top: 30%; animation-delay: 5s; }
.particle:nth-child(7) { left: 90%; top: 50%; animation-delay: 2.5s; }
.particle:nth-child(8) { left: 15%; top: 45%; animation-delay: 4.5s; }

@keyframes float-particle {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.2; }
    50% { transform: translateY(-24px) scale(1.2); opacity: 0.5; }
}

/* —— Pantalla de entrada —— */
.memorial-intro {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(165deg, #0e1220 0%, var(--mem-bg-mid) 45%, #1a2238 100%);
    padding: 2rem;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.memorial-intro--has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--intro-bg);
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    filter: blur(4px);
}

.memorial-intro--has-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(165deg, rgba(14, 18, 32, 0.85) 0%, rgba(28, 38, 64, 0.9) 100%);
}

.memorial-intro__portrait {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(212, 175, 106, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin: 0 auto 1.25rem;
    display: block;
    position: relative;
    z-index: 1;
}

.memorial-intro.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.memorial-intro__inner {
    text-align: center;
    max-width: 32rem;
    animation: intro-fade 1.2s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes intro-fade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.memorial-intro__ornament {
    font-size: 1.5rem;
    color: var(--mem-gold);
    margin: 0 0 1rem;
    letter-spacing: 0.3em;
}

.memorial-intro__label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--mem-gold-soft);
    margin: 0 0 0.75rem;
}

.memorial-intro__name {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 8vw, 3.5rem);
    font-weight: 400;
    margin: 0 0 0.5rem;
    line-height: 1.15;
    color: var(--mem-text);
}

.memorial-intro__dates {
    font-size: 1.15rem;
    color: var(--mem-text-muted);
    margin: 0 0 1.25rem;
}

.memorial-intro__quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--mem-text-muted);
    margin: 0 0 2rem;
    line-height: 1.5;
}

.memorial-intro__btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 2rem;
    border: 1px solid var(--mem-gold);
    background: rgba(212, 175, 106, 0.12);
    color: var(--mem-gold-soft);
    font-family: var(--font-body);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.memorial-intro__btn:hover {
    background: rgba(212, 175, 106, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(212, 175, 106, 0.2);
}

.memorial-intro__btn-arrow {
    font-size: 1.1rem;
    animation: bounce-arrow 2s ease-in-out infinite;
}

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

/* —— Contenido principal —— */
.memorial-main {
    position: relative;
    z-index: 1;
}

/* Hero */
.memorial-hero {
    position: relative;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem 3rem;
    overflow: hidden;
}

.memorial-hero__bg {
    position: absolute;
    inset: -10%;
    background-size: cover;
    background-position: center;
    filter: blur(2px);
    transform: scale(1.05);
    animation: ken-burns 24s ease-in-out infinite alternate;
}

.memorial-hero__bg.has-image {
    opacity: 0.45;
}

@keyframes ken-burns {
    from { transform: scale(1.05); }
    to { transform: scale(1.12); }
}

.memorial-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(14, 18, 32, 0.5) 0%,
        var(--mem-overlay) 50%,
        var(--mem-bg-deep) 100%
    );
}

.memorial-hero__content {
    position: relative;
    z-index: 2;
    max-width: 40rem;
}

.memorial-hero__eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--mem-gold);
    margin: 0 0 1rem;
}

.memorial-hero__name {
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 3.25rem);
    font-weight: 400;
    margin: 0 0 0.5rem;
    color: var(--mem-text);
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}

.memorial-hero__dates {
    font-size: 1.1rem;
    color: var(--mem-gold-soft);
    margin: 0 0 1rem;
}

.memorial-hero__quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--mem-text-muted);
    margin: 0;
    line-height: 1.55;
}

.memorial-hero__frame {
    margin-top: 2rem;
    border: 2px solid rgba(212, 175, 106, 0.4);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.memorial-hero__frame img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.memorial-hero__scroll-hint {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--mem-text-muted);
    margin: 0;
}

/* Galería */
.memorial-gallery-section {
    padding: 2rem 1rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(180deg, var(--mem-bg-deep) 0%, var(--mem-bg-mid) 100%);
}

.memorial-section-head {
    text-align: center;
    margin-bottom: 2rem;
}

.memorial-section-head__title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 400;
    color: var(--mem-text);
    margin: 0 0 0.5rem;
}

.memorial-section-head__sub {
    font-size: 0.9rem;
    color: var(--mem-text-muted);
    margin: 0;
}

.collage-mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    grid-auto-rows: 130px;
    gap: 10px;
    grid-auto-flow: dense;
}

.collage-item {
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    background: var(--mem-bg-soft);
    opacity: 0;
    transform: translateY(16px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

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

.collage-item:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.collage-item--wide {
    grid-column: span 2;
}

.collage-item--tall {
    grid-row: span 2;
}

.collage-item--hero {
    grid-column: span 2;
    grid-row: span 2;
}

.collage-item img,
.collage-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.collage-item.is-video::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.collage-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--mem-text-muted);
}

.collage-loader__spinner {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(212, 175, 106, 0.25);
    border-top-color: var(--mem-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.collage-empty {
    text-align: center;
    padding: 2rem;
    color: var(--mem-text-muted);
}

/* Footer */
.memorial-footer {
    text-align: center;
    padding: 3rem 1.5rem 4rem;
    border-top: 1px solid rgba(212, 175, 106, 0.15);
}

.memorial-footer__line {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.35rem;
    color: var(--mem-gold-soft);
    margin: 0 0 0.5rem;
}

.memorial-footer__brand {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--mem-text-muted);
    margin: 0;
    opacity: 0.7;
}

/* Música flotante */
.memorial-music-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    border: 1px solid var(--mem-gold);
    border-radius: 999px;
    background: rgba(28, 38, 64, 0.92);
    color: var(--mem-gold-soft);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: background 0.2s, transform 0.2s;
}

.memorial-music-fab:hover {
    background: rgba(36, 51, 82, 0.98);
    transform: scale(1.03);
}

.memorial-music-fab.is-playing {
    background: rgba(212, 175, 106, 0.2);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: rgba(8, 10, 18, 0.95);
}

.lightbox.is-hidden {
    display: none !important;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 78vh;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--mem-text-muted);
    font-size: 0.95rem;
    max-width: 36rem;
}

@media (prefers-reduced-motion: reduce) {
    .particle,
    .memorial-hero__bg,
    .memorial-intro__btn-arrow,
    .collage-item {
        animation: none !important;
        transition: none !important;
    }
    .collage-item {
        opacity: 1;
        transform: none;
    }
}

@media (min-width: 768px) {
    .collage-mosaic {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-auto-rows: 160px;
        gap: 12px;
    }
}
