@keyframes bob-and-spin {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(10deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.bob-animation {
  /* animation: bob-and-spin 2s infinite ease-in-out; */
  display: inline-block;
}

.navbar-bob-animation {
  animation: bob-and-spin 2s infinite ease-in-out;
  display: inline-block;
}

/* Splash Screen Styles */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  z-index: 999999; 
  display: flex;
  justify-content: center;
  align-items: center;
  animation: splash-fade-out 0.8s ease-out 1.8s forwards;
}

/* Dark mode support for Splash Screen */
@media (prefers-color-scheme: dark) {
    #splash-screen { background-color: #121212; }
}
body.dark #splash-screen { background-color: #121212; }

#splash-logo {
  width: 15rem; 
  max-width: 80%;
  height: auto;
  animation: logo-entrance-spin 1.5s ease-out;
}

@keyframes logo-entrance-spin {
  0% { transform: scale(0) rotate(-540deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes splash-fade-out {
  0% { opacity: 1; visibility: visible; }
  99% { opacity: 0; visibility: visible; }
  100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* --- Professional Interactivity --- */

/* 1. Subtle Hover Lift for Cards */
.card-simple, .card, .pub-list-item, .stream-item {
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease !important;
  border-radius: 8px; /* Ensure consistent rounding */
}

.card-simple:hover, .card:hover, .stream-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15) !important;
  z-index: 1;
}

/* 2. Micro-interactions for Buttons */
.btn {
  transition: all 0.2s ease !important;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn:active {
  transform: translateY(0);
}

/* 3. Scroll Reveal Animation Class */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Typewriter Cursor */
.cursor {
  display: inline-block;
  width: 2px;
  margin-left: 4px;
  background-color: currentColor;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Glassmorphism Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark .navbar {
    background: rgba(18, 18, 18, 0.65) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Fix Navbar Text in Dark Mode */
body.dark .navbar-light .navbar-brand,
body.dark .navbar-light .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

body.dark .navbar-light .navbar-nav .nav-link:hover,
body.dark .navbar-light .navbar-nav .nav-link:focus {
    color: #ffffff !important;
}

/* Fix Mobile Menu Toggler in Dark Mode */
body.dark .navbar-light .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .navbar-light .navbar-toggler-icon {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Enhanced About Section */
#about {
    position: relative;
    /* Soft gradient overlay */
    background-image: linear-gradient(180deg, rgba(158,171,116,0.05) 0%, rgba(255,255,255,0) 100%);
}

body.dark #about {
    background-image: linear-gradient(180deg, rgba(158,171,116,0.1) 0%, rgba(18,18,18,0) 100%);
}

.avatar-playground {
    position: relative;
    display: inline-block;
    width: 270px;
    height: 270px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    overflow: visible; 
    isolation: isolate;
    cursor: pointer;
}

.avatar-playground .avatar-circle {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1; 
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(158, 171, 116, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.dark .avatar-circle {
    border-color: rgba(255, 255, 255, 0.16);
}

/* --- CAMBIO: CONFIGURACIÓN GRADUABLE DE ESCRITORIO --- */
.peek-cat-video {
    position: absolute;
    left: -18.5%;     
    top: -38.8%;      
    z-index: 4;        
    width: 74%;       
    height: auto;
    transform-origin: bottom right;
    background: transparent !important;
    pointer-events: none;
    
    /* En vez de display:none, usamos opacidad y visibilidad oculta */
    opacity: 0;
    visibility: hidden;
    /* Reducimos el tiempo a 0.15s para que sea un desvanecimiento superrápido */
    transition: opacity 0.15s ease-out, visibility 0.15s ease-out, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.vr-goggles {
    position: absolute;
    left: 50%;
    top: 15%;        
    z-index: 3;        
    width: 40%;    
    height: auto;
    opacity: 0;
    display: none;        
    pointer-events: none;
    transform: translateX(-50%); 
}

/* --- CAMBIO: HOVER DE ESCRITORIO SIN DISPLAY: BLOCK --- */
.avatar-playground:hover .peek-cat-video,
.avatar-playground:focus-within .peek-cat-video {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.avatar-playground:hover .avatar-circle,
.avatar-playground:focus-within .avatar-circle {
    transform: translateY(2px) scale(0.99);
    box-shadow: 0 10px 30px rgba(158, 171, 116, 0.32);
}

.avatar-playground:hover .vr-goggles,
.avatar-playground:focus-within .vr-goggles {
    display: block;
    animation: goggles-hit-and-fall 6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes goggles-hit-and-fall {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-5%) rotate(0deg);
  }
  8% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotate(0deg);
  }
  45% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotate(0deg);
  }
  54% {
    opacity: 1;
    transform: translateX(-25%) translateY(0) rotate(18deg);
  }
  58% {
    opacity: 1;
    transform: translateX(-65%) translateY(0) rotate(-14deg);
  }
  62% {
    opacity: 1;
    transform: translateX(-35%) translateY(0) rotate(16deg);
  }
  66% {
    opacity: 1;
    transform: translateX(-55%) translateY(0) rotate(-6deg);
  }
  70% {
    opacity: 1;
    transform: translateX(-48%) translateY(0) rotate(3deg);
  }
  72% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotate(0deg);
  }
  88% {
    opacity: 1;
    transform: translateX(-15%) translateY(65%) rotate(45deg);
  }
  98%, 100% {
    opacity: 0;
    transform: translateX(15%) translateY(200%) rotate(80deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-playground:hover .peek-cat-video,
  .avatar-playground:focus-within .peek-cat-video {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    animation: none;
  }
  .avatar-playground:hover .vr-goggles,
  .avatar-playground:focus-within .vr-goggles {
    opacity: 1;
    transform: translateX(-50%);
    animation: none;
  }
}

.peek-cat-img-mobile {
  display: none !important;
}

/* --- MOBILE CONFIGURATION (IOS / IPHONE) --- */
@supports (-webkit-touch-callout: none) {
  /* Completely hide the WebM video on iOS devices */
  .peek-cat-video {
    display: none !important;
  }

  /* Base state for the mobile fallback image (rendered but invisible) */
  .peek-cat-img-mobile {
    display: block !important; 
    position: absolute;
    left: -18.5%;     
    top: -38.8%;      
    z-index: 4;        
    width: 74%;       
    height: auto;
    transform-origin: bottom right;
    pointer-events: none;
    
    /* Strict hidden state */
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  }

  /* Force 100% visibility via CSS when the avatar container is hovered, focused, or active */
  .avatar-playground:hover .peek-cat-img-mobile,
  .avatar-playground:focus-within .peek-cat-img-mobile,
  .avatar-playground:active .peek-cat-img-mobile {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) !important;
  }
}