@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #231b15 0%, #0d0a08 100%);
    font-family: 'Outfit', sans-serif;
    color: #e6dfd5;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

/* Stage Container & Scaling */
#viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#stage {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1440px;
    height: 810px;
    transform-origin: center center;
    background-color: #17110d;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    overflow: hidden;
}

/* Base Layers */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Background Layer */
#background-layer {
    z-index: 1;
}

/* Stop-motion intro video — full-cover, above static image */
#bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2; /* Sits above #bg-current during playback */
    display: none; /* Shown only during video playback */
    pointer-events: none;
    user-select: none;
}

/* Static background image */
.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    z-index: 1;
    transition: none; /* Transitions handled via GSAP */
}

.bg-image.active {
    opacity: 1;
}

/* External Link Layer (cliccare a tutto schermo) */
#external-link-layer {
    z-index: 10;
    pointer-events: auto;
}

#main-external-link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0); /* Transparent click-catcher */
}

/* Interactive UI Layer */
#interactive-ui-layer {
    z-index: 20;
}

/* Navigation Buttons */
.ui-btn {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.3s ease;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
}

.ui-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Tactile Hover Effects for Cardboard elements */
.ui-btn:hover {
    transform: scale(1.05) translateY(-4px);
    filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.6)) brightness(1.05);
}

.ui-btn:active {
    transform: scale(0.96) translateY(1px);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

/* Index Tabs specific styling */
.index-tab-hotspot {
  position: absolute;
  cursor: pointer;
  pointer-events: auto; /* Esplicito: cliccabile anche se il parent layer ha pointer-events:none */
  /* Maschera poligonale per seguire l'inclinazione della linguetta di carta */
  clip-path: polygon(0% 15%, 98% 0%, 100% 85%, 2% 100%);
  
  /* No base rotation on container since clipPath is pre-slanted */
  
  background: transparent;
  border: none;
  
  /* Feedback visivo al passaggio del mouse */
  transition: background-color 0.2s ease, transform 0.15s ease, filter 0.2s ease;
}

.index-tab-hotspot:hover {
  background-color: rgba(255, 255, 255, 0.08);
  transform: scale(1.01);
  filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Instructions Overlay */
#instructions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 10, 8, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(230, 223, 213, 0.15);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(230, 223, 213, 0.8);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.5s ease;
    display: flex;
    gap: 15px;
    align-items: center;
}

#instructions.visible {
    opacity: 1;
}

.key-badge {
    background: rgba(230, 223, 213, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
    font-weight: bold;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0d0a08;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px dashed #d1c7bd;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.load-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 20px;
    color: #e6dfd5;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
