@import 'css/base/variables.css';
@import 'css/base/reset.css';
@import 'css/base/layout.css'; /* Unified Grid Layout */
@import 'css/base/typography.css';
@import 'css/components/cinematic.css';
@import 'css/components/dossier.css'; /* Shared Layout */
@import 'css/components/home-dossier.css'; /* Specific Content */
@import 'css/components/loader.css';
@import 'css/components/logo.css';
@import 'css/custom_visitor.css';

/* ==========================================================================
   MAIN (HOME) LAYOUT & 3D ROOM
   ========================================================================== */
/* #sitio is defined in layout.css */

#contenedor {
    position: relative;
    /* Takes the first column of #sitio grid defined in layout.css */
    width: 100%;
    /* Restore max-width to control grid track sizing (max-content behavior) */
    max-width: var(--container-max-width); 
    height: 100%;
    overflow: hidden;
    
    /* Internal Grid for 3D Room effects */
    display: grid;
    grid-template: 1fr 1fr / 33% 33% 33%;
    gap: 10px;
    
    border-radius: 0px;
    justify-self: center;
    align-self: center;
    justify-content: center;
    touch-action: manipulation;
}

.boton {
    cursor: pointer;
    transition: background-color 0.5s ease-in-out, transform 0.5s ease-in-out;
}
.boton:hover,
.boton:active {
    background-color: var(--color1);
}

.boton:focus-visible {
   outline: 2px solid var(--color1);
   outline-offset: 2px;
}

/* Background Textures for Home */
#texturas {
    grid-row: 1 / -1;
    grid-column: 1 / -1;
    z-index: 9;
    background-image: url(img/texture.webp);
    mix-blend-mode: multiply;
    opacity: 0.6;
}

/* 3D Walls & Perspective (Home Specific) */
.pared {
    overflow: hidden;
    position: relative;
    grid-row: 1 / -1;
    width: 100%;
    min-width: 1000px;
    height: auto;
    align-self: center;
    transform-style: preserve-3d;
}

#paredFondo {
    z-index: 3;
    grid-column: 1 / 2;
    right: -150px;
    justify-self: right;
    
    transform:
    perspective(400px)
    translateX(157px)
    rotateY(16deg)
    scale(0.6);
}

#paredFondob {
    z-index: 2;
    grid-column: 1 / 2;
    right: -150px;
    justify-self: right;
    transform:
        perspective(400px)
        translateX(157px)
        rotateY(16deg)
        scale(0.55);
}

#paredFondo2 {
    z-index: 3;
    grid-column: 3 / 4;
    left: -150px;
    justify-self: left;
    transform:
        perspective(400px)
        translateX(-157px)
        rotateY(-16deg)
        scale(0.6)
        scaleX(-1);
}

#paredFondo2b {
    z-index: 2;
    grid-column: 3 / 4;
   left: -150px;
    justify-self: left;
    transform:
        perspective(400px)
        translateX(-157px)
        rotateY(-16deg)
        scale(0.55)
        scaleX(-1);
}

#vistaSala {
    z-index: 1;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    width: 300%;
    height: 100%;
    transform-style: preserve-3d;
    position: relative;
    right: -33%;
    display: grid;
    justify-content: center;
    align-content: center;
    justify-self: center;
    align-self: center;
    transform: 
        perspective(400px) 
        rotateY(-10deg) 
        scale(0.17);
    transform-origin: center;
}

#vistaSala2 {
    z-index: 1;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: grid;
    width: 300%;
    height: 100%;
    position: relative;
    left: -33%;
    justify-content: center;
    align-content: center;
    justify-self: center;
    align-self: center;
    transform: 
        perspective(400px) 
        rotateY(10deg) 
        scale(0.17);
    transform-style: preserve-3d;
    transform-origin: center;    
}

#vistaSala > img {
    box-shadow: 5px 5px 10px var(--color-bg-dark);
    justify-self: center;
    align-self: center;
}

.sala {
    display: grid;
    position: relative;    
    height: 100%;
    margin-top: -1em;
    grid-template: 50% 1fr auto auto / 1fr; /* Flexible rows for titles */
    font-size: 1.5em;
    border-radius: 10px;
    overflow: hidden;
    background-position: top;
    background-size: cover;
    align-items: center;
    justify-content: center; 
    cursor: pointer;
    gap: 0px;
    box-shadow: 0px 0px 0px var(--color-shadow);
    transition: box-shadow 0.5s ease-out, transform 0.5s ease-out;
    grid-row: 2 / 3; /* Always on the bottom part of the cartel */
    
    /* Dynamic Tilt from JS */
    transform: 
        rotateY(var(--sala-tilt, 0deg)) 
        translateZ(25px)
        translateX(var(--sala-tx, 0px));
}

.sala-bg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.sala-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: transform, opacity;
    animation: kenBurns 25s ease-out infinite alternate;
}

.sala-bg-layer.active {
    opacity: 1;
}

@keyframes kenBurns {
    0% { transform: scale(1) translate(0, 0); }
    33% { transform: scale(1.2) translate(-3%, 2%); }
    66% { transform: scale(1.1) translate(3%, -2%); }
    100% { transform: scale(1.3) translate(0, 3%); }
}

.sala:hover,
.sala:active {
    box-shadow: -2px 2px 0px var(--color1),
    2px 2px 0px var(--color2);
    transform: 
        perspective(1000px) 
        translateZ(30px);
    transition: box-shadow 0.5s ease-out, transform 0.5s ease-out;
}

/* Base text container at the bottom */
.sala::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%; /* Cover titles area */
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

.sala > b, .sala > p, .sala > h3 {
    position: relative;
    z-index: 2;
    margin: 0;
    width: 100%;
    padding: 0 20px;
    color: var(--color-text-white);
    text-align: center;
}

.sala > b {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem); /* Dynamic resizing */
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    height: 100%;
    padding-bottom: 5px;
    text-shadow: 0px 2px 10px rgba(0,0,0,0.5);
}

.sala > p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.45em; /* Smaller relative to b */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.9;
    padding-bottom: 8px;
    line-height: 1.4;
}

/* Last child padding */
.sala > p:last-child {
    padding-bottom: 25px;
}

/* .sala1, .sala2 specific positions removed to allow dynamic grid flow */

#techo {
    grid-row: 1 / 2;
    grid-column: 1 / -1;
    z-index: 0;
    overflow: hidden;
    position: relative;
}

#techo::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(360deg, #96969686 0%, #fff8f8c4 99%);
    mix-blend-mode: hard-light;
}

#piso {
    grid-row: 2 / 3;
    grid-column: 1 / -1;
    z-index: 0;
    overflow: hidden;
    position: relative;
}

#piso::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(180deg, #464693 0%, #998b8b 99%);
    mix-blend-mode: multiply;
}

/* Home Layout Responsive (via .is-not-desktop class from JS) */
/* Layout behaviors are handled in css/base/layout.css */

.is-not-desktop #contenedor {
     /* Center grid if needed */
     justify-self: center;
}

/* Mobile Layout (injected via .is-mobile class from JS) */

.is-mobile #contenedor {
    height: 100%;
    width: 100%;
    border-radius: 0px;
}

/* Slim View: Hide Decorative Backgrounds only on mobile */
.is-mobile .pared, 
.is-mobile #texturas, 
.is-mobile #cinematic-overlay {
    display: none !important;
}

/* Sutil indicativo de Swipe para el Home */
.is-mobile #sitio::after {
    content: 'SCROLLEA';
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Poppins', sans-serif;
    font-size: 0.7em;
    letter-spacing: 0.25em;
    color: rgba(0,0,0,0.8);
    pointer-events: none;
    animation: swipeHint 2s infinite ease-in-out;
    z-index: 1001;
    mix-blend-mode: multiply;
    transition: opacity 0.3s;
}
  
/* Override text for Phone devices */
.is-phone #sitio::after {
    content: 'DESLIZA';  
}

/* Hide hint when menu is open */
body.menu-open #sitio::after {
    opacity: 0;
}


@keyframes swipeHint {
    0%, 100% { opacity: 0.2; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.6; transform: translateX(-50%) translateY(-5px); }
}
