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

body {
  background-color: #fbf8f2;
  color: #000000;
  font-family: 'Space Mono', monospace;
  overflow: hidden; 
  width: 100vw;
  height: 100vh;
  user-select: none;
}

/* ==========================================
   PANTALLA INTRO
   ========================================== */
#intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #fbf8f2;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 1s ease, visibility 1s ease;
}

.cipher-text {
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.15em;
}

.char {
  display: inline-block;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 1.2s ease;
}

.char.scatter-up { transform: translateY(-120vh) scale(0.6) rotate(15deg); opacity: 0; }
.char.scatter-down { transform: translateY(120vh) scale(0.6) rotate(-15deg); opacity: 0; }

#intro-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* ==========================================
   NAVEGACIÓN FIJA Y TEXTO CENTRAL
   ========================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  /* Elevamos el z-index al máximo para que NADA se le ponga encima */
  z-index: 9999; 
  
  /* Tu fondo difuminado */
  background-color: rgba(251, 248, 242, 0.8); 
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); 
  
  /* Nos aseguramos de que la barra sí registre los clics */
  pointer-events: auto;
}

.header-left, nav { pointer-events: auto; }

.header-left {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}

nav { display: flex; gap: 2rem; }

.header-left a {
  color: #000000;
  text-decoration: none;
  transition: opacity 0.3s ease;
  /* Obligamos a los enlaces a saltar al frente del difuminado */
  position: relative;
  z-index: 10000;
}

nav a {
  color: #000000;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: opacity 0.3s ease;
  /* Obligamos a los enlaces a saltar al frente del difuminado */
  position: relative;
  z-index: 10000;
}

nav a:hover { opacity: 0.5; }

.hero-fixed-info {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
  background: rgba(251, 248, 242, 0.85);
  padding: 1.5rem 2.5rem;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0,0,0,0.05);
}

.archive-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.last-update { font-size: 0.85rem; color: #333333; }

.drag-hint {
  margin-top: 0.8rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #333333;
  opacity: 0.9;
}

/* ==========================================
   LIENZO INFINITO
   ========================================== */
.viewport {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  position: relative;
}

.viewport:active { cursor: grabbing; }

.infinite-canvas {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.tile {
  position: absolute;
  width: 4000px;
  height: 4000px;
}

.canvas-item {
  position: absolute;
  filter: grayscale(100%); /* <-- ¡Esta es la línea que devuelve el blanco y negro! */
  transition: filter 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  pointer-events: auto;
}

.canvas-item:hover {
  filter: grayscale(0%); /* <-- ¡Y esta devuelve el color al pasar el mouse! */
  z-index: 999 !important;
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

/* ==========================================
   POPUP DE ETIQUETAS
   ========================================== */
#tag-popup {
  position: fixed;
  top: -1000px; /* Escondido fuera de la pantalla por defecto */
  left: -1000px;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 6px; 
  padding: 1rem 1.2rem;
  z-index: 2000; 
  pointer-events: none; 
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  max-width: 250px;
  box-shadow: 2px 4px 15px rgba(0,0,0,0.08); 
}

#tag-popup.active {
  opacity: 1;
  visibility: visible;
}

.tag-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: #000000;
  font-weight: 700;
}

.tag-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  color: #333333;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
  header { padding: 1.5rem; }
  nav a, .header-left { font-size: 0.75rem; }
  .hero-fixed-info { width: 85%; padding: 1rem; }
}
