/* ==========================================================================
   SanMiguel — Pantalla de carga
   Un plano que se dibuja solo: muros, mobiliario y cota, con el mismo
   lenguaje del planner del inicio. CSS autocontenido.
   Prefijo: .sm-load
   ========================================================================== */

.sm-load {
    --sm-load-primary: #bb976d;
    --sm-load-title: #172430;
    --sm-load-cream: #f7f5f2;
    --sm-load-ciclo: 2.6s;
    background: var(--sm-load-cream) !important;
    flex-direction: column;
    gap: 26px;
    font-family: "Josefin Sans", ui-sans-serif, system-ui, sans-serif;
}

.sm-load__plano {
    width: 168px;
    height: 126px;
    overflow: visible;
}

/* Retícula de fondo, siempre presente */
.sm-load__grid {
    stroke: rgba(187, 151, 109, 0.22);
    stroke-width: 0.6;
}

/* Trazos que se dibujan */
.sm-load__muros,
.sm-load__interior {
    fill: none;
    stroke: var(--sm-load-title);
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.sm-load__muros {
    stroke-width: 3;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    animation: sm-load-trazo var(--sm-load-ciclo) cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.sm-load__interior {
    stroke-width: 2;
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: sm-load-trazo var(--sm-load-ciclo) cubic-bezier(0.65, 0, 0.35, 1) infinite;
    animation-delay: 0.34s;
}

/* Mobiliario: aparece cuando los muros ya están */
.sm-load__mueble {
    fill: rgba(187, 151, 109, 0.9);
    opacity: 0;
    transform-origin: center;
    animation: sm-load-mueble var(--sm-load-ciclo) ease-out infinite;
}

.sm-load__mueble--2 {
    animation-delay: 0.12s;
}

.sm-load__mueble--3 {
    animation-delay: 0.24s;
}

/* Cota inferior, lo último en aparecer */
.sm-load__cota {
    stroke: var(--sm-load-primary);
    stroke-width: 1.2;
    opacity: 0;
    animation: sm-load-cota var(--sm-load-ciclo) ease-out infinite;
}

@keyframes sm-load-trazo {
    0% {
        stroke-dashoffset: 440;
        opacity: 1;
    }

    38%, 90% {
        stroke-dashoffset: 0;
        opacity: 1;
    }

    100% {
        stroke-dashoffset: 0;
        opacity: 0;
    }
}

@keyframes sm-load-mueble {
    0%, 42% {
        opacity: 0;
        transform: translateY(4px);
    }

    58%, 90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(0);
    }
}

@keyframes sm-load-cota {
    0%, 62% {
        opacity: 0;
    }

    72%, 90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* --- Texto ---------------------------------------------------------------- */
.sm-load__txt {
    display: flex;
    align-items: baseline;
    gap: 3px;
    color: var(--sm-load-title);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.sm-load__punto {
    animation: sm-load-punto 1.2s ease-in-out infinite;
}

.sm-load__punto:nth-child(3) {
    animation-delay: 0.15s;
}

.sm-load__punto:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes sm-load-punto {
    0%, 100% {
        opacity: 0.2;
    }

    50% {
        opacity: 1;
    }
}

/* --- Accesibilidad -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .sm-load__muros,
    .sm-load__interior {
        stroke-dashoffset: 0;
        animation: none;
    }

    .sm-load__mueble,
    .sm-load__cota {
        opacity: 1;
        animation: none;
    }

    .sm-load__punto {
        animation: none;
        opacity: 1;
    }
}
