/* 0. BOX-SIZING GLOBAL */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 1. FONDO Y ESTRUCTURA GENERAL */
.office-bg {
    background-image: 
        linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(219, 234, 254, 0.8)),
        url('https://images.unsplash.com/photo-1497366216548-37526070297c?q=80&w=1600&auto=format&fit=crop'); 
    background-size: cover;
    background-position: center;
    /* background-attachment fijo SOLO en desktop para evitar problemas en móviles */
}

@media (min-width: 768px) {
    .office-bg {
        background-attachment: fixed;
    }
}

/* 2. PANEL GLASSMORPHISM */
.glass-panel {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);

    /* Scroll vertical si el contenido es alto */
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    padding: 1.5rem;
}

/* 3. ANIMACIONES DE TEXTO */
.text-fade {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.text-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 4. EL PERSONAJE (CONTENEDOR) */
#character-container {
    position: relative;
    will-change: transform;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Filtro para camisa */
.character-color-filter img {
    filter: hue-rotate(190deg) saturate(1.5) brightness(0.9);
    display: block;
}

/* 5. ANIMACIÓN DE LAS RUEDAS (Efecto Visual) */
.wheel {
    position: absolute;
    width: 70px; 
    height: 70px;
    border: 5px dashed rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    animation: spin-wheel 0.5s linear infinite;
}

.wheel-back {
    bottom: 22px; 
    left: 52px;
}

.wheel-front {
    bottom: 22px;
    right: 25px;
}

@keyframes spin-wheel {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 6. SOMBRA DINÁMICA */
.animate-float-shadow {
    animation: float-shadow 3s ease-in-out infinite;
}

@keyframes float-shadow {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.2; }
    50% { transform: translateX(-50%) scale(1.2); opacity: 0.1; }
}

/* 7. BALANCEO DEL MUÑECHO */
.animate-walking-loop {
    animation: walking 2s ease-in-out infinite;
}

@keyframes walking {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

/* 8. PERSONAJE 3D */
.personaje-3d {
    position: relative;
    width: 70%;
    margin-top: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: 20px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.personaje-3d:hover {
    transform: rotateY(15deg) rotateX(10deg) scale(1.05);
}

.personaje-3d img,
.personaje-3d video {
    display: block;
    width: 100%;
    height: auto;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 20px;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

video {
    outline: none;
    border: none;
    box-shadow: none;
}

/* 9. SCROLL GLOBAL Y AJUSTES PARA MÓVILES */
html, body {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

main {
    padding-top: 3rem; /* espacio para que el robot no se corte con el header */
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* evita centrar vertical y cortar */
}

/* Ajustes responsivos */
@media (max-width: 640px) {
    h1#main-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    p#sub-title {
        font-size: 1rem;
    }

    .glass-panel {
        padding: 1rem;
        max-height: 85vh;
    }

    .personaje-3d {
        width: 90%;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
}

/* Ajustes para header y logo */
header {
    position: relative;
    z-index: 30;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem 1rem;
}

header img {
    max-height: 48px;
    width: auto;
    display: block;
}

@media (max-width: 640px) {
    header {
        padding: 1rem 0.75rem;
    }
    header img {
        max-height: 36px;
    }
    header span {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
        white-space: nowrap;
    }
}
