/* ============================================================
   Mausoleo — ambiente, pórtico y muro de nichos
   Todo el archivo vive bajo .mausoleum-space para no afectar
   a las galerías normales, que comparten memorial.css.

   La piedra es el verde de marca (#104D2E) llevado a penumbra,
   con el índigo (#212155) en las sombras y el ámbar (#FFC857)
   como única luz. No se introduce ningún color ajeno al sistema.
   ============================================================ */

.mausoleum-space {
    /* Piedra: verde de marca en penumbra */
    --mz-stone-900: #0b1713;
    --mz-stone-800: #12211c;
    --mz-stone-700: #1b2f28;
    --mz-stone-600: #274036;
    /* Mármol: la arena clara del sistema */
    --mz-marble-100: #f7f4ef;
    --mz-marble-200: #e7e3d8;
    /* Grabado: tinta verde, no negro */
    --mz-engrave: #2b4a3c;
    --mz-engrave-soft: #4d6b5e;
    /* Luz sobre piedra */
    --mz-light: #e8efe9;
    --mz-light-soft: rgba(232, 239, 233, 0.62);
    /* Ámbar de marca */
    --mz-amber: var(--accent-amber, #FFC857);
    --mz-amber-deep: #d9a53a;
    --mz-amber-soft: rgba(255, 200, 87, 0.35);
    /* Índigo de marca, para las sombras frías */
    --mz-indigo: rgba(33, 33, 85, 0.4);

    /* Grano de piedra: SVG inline, sin peticiones ni imágenes */
    --mz-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");

    background-color: var(--mz-stone-900);
    background-image:
        radial-gradient(ellipse 85% 50% at 50% -8%, rgba(255, 200, 87, 0.13), transparent 68%),
        radial-gradient(ellipse 55% 45% at 88% 8%, var(--mz-indigo), transparent 62%),
        radial-gradient(ellipse 78% 62% at 50% 30%, transparent 40%, rgba(4, 10, 8, 0.6) 100%),
        linear-gradient(180deg, var(--mz-stone-800) 0%, var(--mz-stone-900) 55%, #060e0b 100%);
    background-attachment: fixed;
    color: var(--mz-light);
}

/* ---------- Cabecera y pie dentro del ambiente ---------- */
.mausoleum-space .topbar {
    background: transparent !important;
    border-bottom: none;
    box-shadow: none;
}
/* El PNG del logo trae fondo blanco opaco: en el ambiente usamos la versión
   sin fondo, con los verdes e índigos de marca subidos de luminosidad. */
.mausoleum-space .topbar .navbar-brand {
    background: url("../assets/images/new_logo_stone.png") left center / contain no-repeat;
    opacity: .88;
}
.mausoleum-space .topbar .logo-img { visibility: hidden; }
.mausoleum-space .topbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath stroke='rgba(232,239,233,0.75)' stroke-width='2' stroke-linecap='round' d='M4 8h22M4 15h22M4 22h22'/%3E%3C/svg%3E");
}
.mausoleum-space footer,
.mausoleum-space footer .text-muted {
    color: rgba(232, 239, 233, 0.38) !important;
}

/* Superficie de mármol reutilizable */
.mz-marble {
    background-color: var(--mz-marble-100);
    background-image:
        var(--mz-noise),
        linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, 0.32) 37%, transparent 45%),
        linear-gradient(160deg, #fbf9f4 0%, #e7e3d8 55%, #f4f1e9 100%);
    background-blend-mode: overlay, normal, normal;
}

/* Texto grabado: sobre mármol claro la luz cae dentro del surco */
.mz-engraved {
    color: var(--mz-engrave);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75), 0 -1px 1px rgba(11, 23, 19, 0.25);
}
/* Sobre piedra oscura se invierte el relieve */
.mz-engraved-dark {
    color: var(--mz-light);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8), 0 -1px 0 rgba(255, 255, 255, 0.14);
}

/* ============================================================
   Pórtico — el umbral
   ============================================================ */
.mz-portico {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 470px;
    padding: 2.6rem 1.25rem 2.5rem;
    text-align: center;
    overflow: hidden;
    border-radius: 46% 46% 4px 4px / 26% 26% 4px 4px;
    background-color: var(--mz-stone-700);
    background-image:
        var(--mz-noise),
        radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 200, 87, 0.18), transparent 70%),
        linear-gradient(180deg, #24392f 0%, #16261f 55%, #0c1712 100%);
    background-blend-mode: overlay, normal, normal;
    box-shadow:
        inset 0 0 90px rgba(4, 10, 8, 0.8),
        inset 0 2px 0 rgba(232, 239, 233, 0.08),
        0 30px 70px rgba(4, 10, 8, 0.6);
}
.mz-portico--cover {
    background-image:
        linear-gradient(180deg, rgba(8, 18, 14, 0.42) 0%, rgba(8, 18, 14, 0.68) 50%, rgba(8, 18, 14, 0.93) 100%),
        var(--mz-cover);
    background-blend-mode: normal, normal;
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}

/* Jambas: las pilastras que enmarcan la entrada */
.mz-portico__jamb {
    position: absolute;
    top: 16%;
    bottom: 0;
    width: 34px;
    pointer-events: none;
    background:
        linear-gradient(90deg,
            rgba(4, 10, 8, 0.5) 0%,
            rgba(126, 150, 137, 0.2) 26%,
            rgba(196, 210, 200, 0.26) 46%,
            rgba(78, 100, 89, 0.2) 70%,
            rgba(4, 10, 8, 0.55) 100%);
    box-shadow: 0 0 26px rgba(4, 10, 8, 0.5);
}
.mz-portico__jamb--left { left: 26px; }
.mz-portico__jamb--right { right: 26px; }

/* Dintel: el apellido grabado en la piedra superior */
.mz-lintel {
    position: relative;
    z-index: 2;
    max-width: 76%;
    padding: 0 1rem .7rem;
    font-family: var(--font-serif);
    font-size: clamp(1rem, 3.4vw, 1.55rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .34em;
    line-height: 1.3;
    color: rgba(232, 239, 233, 0.88);
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.85), 0 -1px 0 rgba(255, 255, 255, 0.16);
    border-bottom: 1px solid var(--mz-amber-soft);
}

.mz-portico__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 720px;
    margin-top: auto;
}
.mz-portico__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .9rem;
    padding: .35rem .95rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 200, 87, 0.42);
    background: rgba(255, 200, 87, 0.1);
    color: rgba(232, 239, 233, 0.92);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .2em;
}
.mz-portico__title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 6.5vw, 3.4rem);
    font-weight: 600;
    line-height: 1.1;
    margin: 0 0 .5rem;
    color: #fbfdfa;
    text-shadow: 0 3px 18px rgba(4, 10, 8, 0.85);
}
.mz-portico__desc {
    max-width: 620px;
    margin: 0 auto 1.4rem;
    color: rgba(232, 239, 233, 0.72);
    font-size: 1.02rem;
    line-height: 1.65;
}
.mz-portico__desc p:last-child { margin-bottom: 0; }

.mz-portico__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    justify-content: center;
    align-items: center;
}

/* Ornamento del pórtico (rombo entre dos filetes) */
.mz-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    margin: 0 auto 1.1rem;
    max-width: 320px;
}
.mz-rule::before,
.mz-rule::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--mz-amber-soft));
}
.mz-rule::after { background: linear-gradient(90deg, var(--mz-amber-soft), transparent); }
.mz-rule i {
    width: 8px;
    height: 8px;
    background: var(--mz-amber);
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* Botones del ambiente: el ámbar de marca es la luz de la escena */
.mz-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .62rem 1.35rem;
    border-radius: 3px;
    border: 1px solid var(--mz-amber);
    background: linear-gradient(180deg, var(--mz-amber), var(--mz-amber-deep));
    color: #12211c;
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    text-decoration: none;
    transition: filter .2s ease, transform .2s ease;
}
.mz-btn:hover {
    color: #12211c;
    text-decoration: none;
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.mz-btn--ghost {
    background: rgba(232, 239, 233, 0.06);
    border-color: rgba(232, 239, 233, 0.35);
    color: rgba(232, 239, 233, 0.9);
}
.mz-btn--ghost:hover {
    color: #fff;
    background: rgba(232, 239, 233, 0.14);
}

/* Invitación a bajar al muro */
.mz-scroll {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-top: 1.6rem;
    border-radius: 50%;
    border: 1px solid rgba(232, 239, 233, 0.28);
    color: rgba(232, 239, 233, 0.7);
    text-decoration: none;
    animation: mz-bob 2.8s ease-in-out infinite;
}
.mz-scroll:hover {
    color: #fff;
    border-color: rgba(232, 239, 233, 0.6);
    text-decoration: none;
}
@keyframes mz-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* ============================================================
   Muro de nichos
   ============================================================ */
.mz-wall {
    position: relative;
    margin-top: 2.75rem;
    padding: 2.75rem 1.5rem 3.25rem;
    border-radius: 4px;
    background-color: #16271f;
    background-image:
        var(--mz-noise),
        repeating-linear-gradient(90deg, rgba(4, 10, 8, 0.55) 0 3px, rgba(232, 239, 233, 0.03) 3px 4px, transparent 4px 250px),
        repeating-linear-gradient(0deg, rgba(4, 10, 8, 0.55) 0 3px, rgba(232, 239, 233, 0.035) 3px 4px, transparent 4px 132px),
        linear-gradient(180deg, #1d3129 0%, #101c17 100%);
    background-blend-mode: overlay, normal, normal, normal;
    box-shadow:
        inset 0 0 150px rgba(4, 10, 8, 0.85),
        inset 0 1px 0 rgba(232, 239, 233, 0.06),
        0 24px 60px rgba(4, 10, 8, 0.5);
}
.mz-wall__head {
    text-align: center;
    margin-bottom: 2.5rem;
}
.mz-wall__eyebrow {
    display: block;
    margin-bottom: .5rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .28em;
    color: rgba(255, 200, 87, 0.85);
}
.mz-wall__title {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    font-weight: 600;
    margin: 0 0 .35rem;
    color: rgba(232, 239, 233, 0.94);
    text-shadow: 0 2px 3px rgba(4, 10, 8, 0.7);
}
.mz-wall__count {
    font-size: .82rem;
    letter-spacing: .06em;
    color: rgba(232, 239, 233, 0.45);
}

.mz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 2.6rem 2.2rem;
    perspective: 1300px;
}

/* ---------- El nicho ---------- */
.mz-niche {
    --rx: 0deg;
    --ry: 0deg;
    --mx: 50%;
    --my: 0%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.6rem 1.15rem 1.35rem;
    border-radius: 3px;
    text-decoration: none;
    color: var(--mz-engrave);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(11, 23, 19, 0.3),
        0 0 0 1px rgba(4, 10, 8, 0.55),
        0 0 0 9px rgba(7, 16, 12, 0.6),
        0 16px 28px rgba(4, 10, 8, 0.62);
    transform: rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform .2s ease, box-shadow .3s ease;
}
.mz-niche:hover {
    color: var(--mz-engrave);
    text-decoration: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(11, 23, 19, 0.3),
        0 0 0 1px rgba(4, 10, 8, 0.55),
        0 0 0 9px rgba(7, 16, 12, 0.6),
        0 26px 44px rgba(4, 10, 8, 0.75);
}
/* Repisa de piedra bajo la placa */
.mz-niche::before {
    content: "";
    position: absolute;
    left: -9px;
    right: -9px;
    bottom: -19px;
    height: 10px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(180deg, #7d8f83 0%, #3d5147 55%, #14231d 100%);
    box-shadow: 0 9px 16px rgba(4, 10, 8, 0.68);
}
/* Reflejo especular que sigue al cursor */
.mz-niche::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle 240px at var(--mx) var(--my), rgba(255, 255, 255, 0.5), transparent 62%);
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity .3s ease;
}
.mz-niche:hover::after { opacity: 1; }

/* Retrato ovalado tipo porcelana, con el ámbar de marca por marco */
.mz-frame {
    position: relative;
    width: 128px;
    height: 162px;
    flex-shrink: 0;
    margin-bottom: 1.05rem;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(155deg, #ffe6b3 0%, var(--mz-amber) 40%, #b8862a 68%, #ffdf9f 100%);
    box-shadow: 0 7px 16px rgba(4, 10, 8, 0.5), inset 0 0 0 1px rgba(11, 23, 19, 0.3);
}
.mz-frame img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #c4ccc4;
}
/* Brillo de porcelana */
.mz-frame::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    pointer-events: none;
    background: linear-gradient(142deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.07) 30%, transparent 52%);
}
.mz-frame__initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-family: var(--font-serif);
    font-size: 3.1rem;
    font-weight: 600;
    color: #5d7a6c;
    background: linear-gradient(160deg, #e4e6df, #bcc4bc);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65), 0 -1px 1px rgba(11, 23, 19, 0.25);
}

.mz-niche__name {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    line-height: 1.35;
    margin: 0 0 .5rem;
}
.mz-niche .life-years {
    font-size: 1.35rem;
    color: #3c5a4a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65), 0 -1px 1px rgba(11, 23, 19, 0.2);
    margin-bottom: .85rem;
}
.mz-niche .life-years .dash::before {
    background: linear-gradient(90deg, transparent, rgba(16, 77, 46, 0.45), transparent);
}
.mz-niche .life-years .dash::after {
    background: var(--mz-amber-deep);
    border-color: rgba(16, 77, 46, 0.4);
}
.mz-niche .life-years .text-muted { color: #7c8f85 !important; }

.mz-niche__cta {
    margin-top: auto;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--mz-engrave-soft);
}
.mz-niche__cta i {
    margin-left: .35rem;
    transition: transform .25s ease;
}
.mz-niche:hover .mz-niche__cta i { transform: translateX(4px); }

/* Veladora sobre la repisa */
.mz-candle {
    position: absolute;
    right: 14px;
    bottom: -19px;
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.mz-candle__wax {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 18px;
    height: 16px;
    border-radius: 2px 2px 3px 3px;
    background: linear-gradient(180deg, #f7f5ee 0%, #d5d3c6 60%, #a6a89b 100%);
    box-shadow: 0 2px 5px rgba(4, 10, 8, 0.6);
}
.mz-candle__flame {
    position: absolute;
    left: 50%;
    bottom: 15px;
    width: 10px;
    height: 16px;
    margin-left: -5px;
    border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
    background: radial-gradient(ellipse at 50% 74%, #fffdf2 0%, var(--mz-amber) 38%, #f0972a 66%, rgba(255, 200, 87, 0) 88%);
    box-shadow: 0 0 22px 7px rgba(255, 200, 87, 0.42);
    transform-origin: 50% 100%;
    animation: mz-flicker 2.6s ease-in-out infinite;
}
@keyframes mz-flicker {
    0%, 100% { transform: scale(1, 1); opacity: .94; }
    25% { transform: scale(.96, 1.08); opacity: 1; }
    50% { transform: scale(1.04, .94); opacity: .88; }
    75% { transform: scale(.98, 1.05); opacity: 1; }
}

/* Nicho vacío */
.mz-empty {
    grid-column: 1 / -1;
    padding: 3rem 1.5rem;
    text-align: center;
    border-radius: 3px;
    color: var(--mz-engrave-soft);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 0 0 1px rgba(4, 10, 8, 0.55),
        0 0 0 9px rgba(7, 16, 12, 0.6),
        0 16px 28px rgba(4, 10, 8, 0.62);
}

/* ============================================================
   Perfil individual dentro del ambiente
   Las superficies claras conservan el verde e índigo de marca:
   solo cambia la piedra que las rodea.
   ============================================================ */
.mausoleum-space .memorial-hero,
.mausoleum-space .card-memorial,
.mausoleum-space .memorial-card {
    border: none;
    border-radius: 3px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.65),
        0 0 0 1px rgba(4, 10, 8, 0.55),
        0 0 0 9px rgba(7, 16, 12, 0.55),
        0 22px 45px rgba(4, 10, 8, 0.6);
}
.mausoleum-space .memorial-hero {
    background-color: var(--mz-marble-100);
    background-image:
        var(--mz-noise),
        linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, 0.3) 37%, transparent 45%),
        linear-gradient(160deg, #fbf9f4 0%, #e9e5da 58%, #f5f2eb 100%);
    background-blend-mode: overlay, normal, normal;
}
.mausoleum-space .memorial-hero::after { display: none; }
.mausoleum-space .card-memorial,
.mausoleum-space .memorial-card { background: var(--soft-sand, #f7f4ef); }
.mausoleum-space .portrait-card {
    background: linear-gradient(160deg, #fbf9f4, #e7e3d8);
    border-color: rgba(16, 77, 46, 0.22);
}
.mausoleum-space .memorial-hero h1,
.mausoleum-space .memorial-hero .life-years {
    color: var(--mz-engrave);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 -1px 1px rgba(11, 23, 19, 0.18);
}
.mausoleum-space .memorial-hero .text-muted { color: var(--mz-engrave-soft) !important; }
.mausoleum-space .sembranza-text { color: #263a31; }
.mausoleum-space .password-cover-bg { border-radius: 4px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 767.98px) {
    .mz-portico {
        min-height: 380px;
        border-radius: 42% 42% 4px 4px / 14% 14% 4px 4px;
        padding: 1.25rem 1rem 2rem;
    }
    .mz-portico__jamb { display: none; }
    .mz-lintel { max-width: 90%; letter-spacing: .22em; }
    .mz-wall { padding: 2rem 1rem 2.5rem; }
    .mz-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 2.4rem 1.5rem;
    }
}

/* ============================================================
   Accesibilidad: sin movimiento
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .mz-candle__flame,
    .mz-scroll {
        animation: none !important;
    }
    .mz-niche,
    .mz-niche::after,
    .mz-niche__cta i {
        transition: none !important;
    }
    .mz-niche {
        transform: none !important;
    }
}
