/* =========================================================
   Estilos personalizados — complementan a Tailwind
   ========================================================= */

/* Pesos exactos de Outfit */
.font-600 { font-weight: 600; }

/* --- Cuadrícula de fondo (fija, sin coste de scroll) --- */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 35%, transparent 100%);
}

/* --- Aparición al hacer scroll (cascada escalonada) --- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(var(--index, 0) * 80ms);
}

/* --- Feedback táctil al pulsar (sin glow) --- */
.btn-press {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease, background-color 0.2s ease;
}
.btn-press:hover { transform: translateY(-1px); }
.btn-press:active { transform: translateY(0) scale(0.985); }

/* --- Filtro activo --- */
.filtro-btn.is-active {
  background-color: #4d7cfe;
  border-color: #4d7cfe;
  color: #0a0b0d;
  font-weight: 600;
}
.filtro-btn:not(.is-active):hover {
  color: #e8e9ec;
  border-color: rgba(255, 255, 255, 0.22);
}

/* --- Nav activo --- */
.nav-link.is-active { color: #e8e9ec; }

/* --- Tarjeta de proyecto --- */
.proyecto-card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
}
.proyecto-card:hover {
  transform: translateY(-5px);
  border-color: rgba(77, 124, 254, 0.5);
}
.proyecto-card .thumb img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.proyecto-card:hover .thumb img { transform: scale(1.05); }

/* --- Barras del panel hero (micro-animación perpetua) --- */
.bar {
  transform-origin: bottom;
  animation: barPulse 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.18s);
}
@keyframes barPulse {
  0%, 100% { transform: scaleY(0.78); }
  50%      { transform: scaleY(1); }
}

/* --- Cursor parpadeante del "notebook" --- */
.caret { animation: blink 1.1s steps(1) infinite; color: #4d7cfe; }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* --- Botón flotante "volver arriba" --- */
.to-top {
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease, color 0.2s ease;
}
.to-top.is-shown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- Scrollbar sutil --- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #0a0b0d; }
::-webkit-scrollbar-thumb {
  background: #23262d;
  border-radius: 999px;
  border: 2px solid #0a0b0d;
}
::-webkit-scrollbar-thumb:hover { background: #34384180; }

/* --- Lightbox: ampliar imágenes del proyecto --- */
img.zoomable { cursor: zoom-in; }
img.zoomable:focus-visible {
  outline: 2px solid #4d7cfe;
  outline-offset: 3px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 3rem);
  background: rgba(8, 9, 11, 0.93);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 0.3s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox__img {
  max-width: min(1100px, 92vw);
  max-height: 84vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a0b0d;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox.is-open .lightbox__img {
  transform: scale(1);
  opacity: 1;
}
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  height: 2.75rem;
  width: 2.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 18, 22, 0.8);
  color: #e8e9ec;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.lightbox__btn:hover {
  border-color: rgba(77, 124, 254, 0.6);
  color: #4d7cfe;
}
.lightbox__btn:focus-visible {
  outline: 2px solid #4d7cfe;
  outline-offset: 2px;
}
.lightbox__close { top: clamp(1rem, 4vw, 2rem); right: clamp(1rem, 4vw, 2rem); }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: clamp(0.5rem, 3vw, 2rem); }
.lightbox__nav--next { right: clamp(0.5rem, 3vw, 2rem); }
.lightbox.is-single .lightbox__nav { display: none; }
.lightbox__count {
  position: absolute;
  bottom: clamp(1rem, 4vw, 2rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #9a9ca3;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 18, 22, 0.7);
}
.lightbox.is-single .lightbox__count { display: none; }

/* --- Respeta "reducir movimiento" --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
