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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.page-wrapper {
    position: relative;
    min-height: 100vh;
    background: #ffffff;
}

/* Intro: logo + texto - fade in suave → visible 1s → fade out suave (2.5s total) */
.intro {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
}

.intro-1 {
    animation: introSequence 2.5s ease-in-out forwards;
}

/* Intro 2: misma animación, arranca cuando intro 1 está al 25% de desvanecerse (~2.31s) */
.intro-2 {
    animation: introSequence 2.5s ease-in-out 2.31s forwards;
}

.intro-2 .intro-logo {
    width: 50vmin;
    min-width: 200px;
    max-height: 50vh;
}

.intro-logo {
    width: 20vmin;
    min-width: 120px;
    height: auto;
    max-height: 20vh;
    object-fit: contain;
    filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.65));
}

.intro-text {
    font-size: 0.9rem;
    color: #555555;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}

@keyframes introSequence {
    /* 0-0.75s: fade in | 0.75-1.75s: visible 1s | 1.75-2.5s: fade out */
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

/* Overlay: arranca cuando intro 2 empieza a desvanecerse (4.06s) */
.transition-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: #000000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    animation: expandOverlay 1.5s ease-out 4.06s forwards;
}

@keyframes expandOverlay {
    0% {
        width: 0;
        height: 0;
        border-radius: 50%;
    }
    100% {
        width: 300vmax;
        height: 300vmax;
        border-radius: 50%;
        /* vmax asegura que cubra toda la pantalla en cualquier orientación */
    }
}

/* Contenido principal - visible cuando overlay cubre 50% (4.06s + 0.75s = 4.81s) */
.main-content {
    opacity: 0;
    position: relative;
    z-index: 1100;
    min-height: 100vh;
    background: #000000;
    padding: clamp(20px, 4vh, 48px) 0;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(320px, 33vw) minmax(120px, 1fr);
    align-items: center;
    column-gap: clamp(24px, 3vw, 58px);
    overflow: hidden;
    animation: fadeInContent 0.3s ease-out 4.81s forwards;
}

@keyframes fadeInContent {
    to {
        opacity: 1;
    }
}

.hud-boot {
    position: fixed;
    inset: clamp(14px, 2.6vw, 36px);
    display: grid;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease-out, visibility 0.45s ease-out;
    z-index: 1;
    visibility: hidden;
}

.hud-boot.is-visible {
    opacity: 1;
    visibility: visible;
}

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

.hud-wrap svg,
.hud-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.hud {
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.18))
            drop-shadow(0 0 14px rgba(255, 255, 255, 0.08));
    transition: opacity 0.3s ease-out;
}

.hud-boot.is-visible .hud {
    opacity: 1;
}

/* Contenedores */
.container {
    grid-column: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(0.55rem, 1.6vh, 2rem);
    max-height: calc(100dvh - clamp(40px, 8vh, 96px));
}

.side-box {
    grid-row: 1;
    width: min(15vw, 230px);
    min-width: 120px;
    min-height: clamp(180px, 32vh, 340px);
    max-height: clamp(220px, 40vh, 420px);
    align-self: center;
    text-align: center;
    padding: clamp(0.8rem, 1.8vh, 1.6rem);
}

.side-box-left {
    grid-column: 1;
    justify-self: end;
    margin-right: clamp(18px, 2.8vw, 52px);
}

.side-box-right {
    grid-column: 3;
    justify-self: start;
    margin-left: clamp(18px, 2.8vw, 52px);
}

.box {
    border: 5px solid #ffffff;
    padding: clamp(0.7rem, 1.6vh, 2rem);
    color: #ffffff;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    min-height: clamp(64px, 10.5vh, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
}

/* Contenedor con 2 cuadrados horizontales - misma altura que el resto (120px) */
.box-split {
    padding: 0;
    display: flex;
    gap: 0;
    min-height: clamp(64px, 10.5vh, 120px);
}

.box-square {
    flex: 1;
    border-right: 5px solid #ffffff;
    min-height: clamp(64px, 10.5vh, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
}

.box-square:last-child {
    border-right: none;
}

/* Contenedor completo (más ancho o con más presencia) */
.box-full {
    min-height: clamp(78px, 12.5vh, 140px);
}

/* Aparecen en cadena cuando la pantalla está 50% cubierta de negro */
.page-wrapper.boot-done .box {
    animation: fadeInBox 0.4s ease-out forwards;
}

.page-wrapper.boot-done .box:nth-child(1) { animation-delay: 0s; }
.page-wrapper.boot-done .box:nth-child(2) { animation-delay: 0.44s; }
.page-wrapper.boot-done .box:nth-child(3) { animation-delay: 0.88s; }
.page-wrapper.boot-done .box:nth-child(4) { animation-delay: 1.32s; }
.page-wrapper.boot-done .box:nth-child(5) { animation-delay: 1.76s; }
.page-wrapper.boot-done .side-box { animation-delay: 2.26s; }

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

@media (prefers-reduced-motion: reduce) {
    .hud {
        transition: none !important;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
        align-items: center;
        padding: clamp(10px, 3vh, 24px) 1rem;
        row-gap: clamp(0.55rem, 1.6vh, 1.2rem);
        overflow: visible;
    }

    .container {
        grid-column: 1;
        width: min(92vw, 560px);
        max-width: min(92vw, 560px);
        min-width: 0;
        margin: 0 auto;
        max-height: calc(100dvh - clamp(22px, 6vh, 56px));
    }

    .side-box-left,
    .side-box-right {
        grid-column: 1;
        grid-row: auto;
        width: min(92vw, 560px);
        min-width: 0;
        max-width: min(92vw, 560px);
        min-height: clamp(64px, 10.5vh, 120px);
        max-height: none;
        margin: 0 auto;
        justify-self: center;
    }

    .page-wrapper.boot-done .side-box-left { animation-delay: 2.26s; }
    .page-wrapper.boot-done .side-box-right { animation-delay: 2.26s; }

    body.initial-mobile .page-wrapper.boot-done .side-box-left { animation-delay: 2.26s; }
    body.initial-mobile .page-wrapper.boot-done .side-box-right { animation-delay: 2.7s; }
}

@media (max-width: 900px) {
    .hud-boot {
        opacity: 0 !important;
        visibility: hidden !important;
    }
}
