/**
 * DriftWall Component Styles - React Bits Vanilla JS Port
 * Custom styled for Hanoi Metal JSC (Navy & Gold Design System)
 * Bright, clean imagery, smooth 3D perspective and no overlay text.
 */

.drift-wall {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Isolate the wall's layout/paint work from the rest of the page: the
     columns change transform every frame and must never invalidate siblings. */
  contain: layout paint;
  perspective: var(--dw-perspective, 1200px);
  perspective-origin: 50% 50%;
  --dw-tile-w: 220px;
  --dw-tile-h: 146px;
  /* Gutter between tiles. The visible strip is exactly this value (the tile
     insets its inner box by half the gap on each side), so keeping it at a few
     pixels stops full-height empty columns from showing through the wall. */
  --dw-gap: 4px;
  --dw-radius: 10px;
  --dw-lift: 20px;
  --dw-dim: 1;
  --dw-gray: 0;
  --dw-overlay: transparent;
  --dw-edge: 90%;
  -webkit-mask-image:
    radial-gradient(ellipse 85% 88% at 50% 50%, #000 var(--dw-edge), transparent 100%),
    linear-gradient(to top, #000 var(--dw-edge), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(ellipse 85% 88% at 50% 50%, #000 var(--dw-edge), transparent 100%),
    linear-gradient(to top, #000 var(--dw-edge), transparent 100%);
  mask-composite: intersect;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: pointer;
}

@media (max-width: 768px) {
  .drift-wall {
    --dw-tile-w: 160px;
    --dw-tile-h: 110px;
    --dw-gap: 3px;
    --dw-lift: 16px;
    --dw-edge: 90%;
  }
}

/* Crucial: Disable pointer events on 3D containers so they don't block hit testing */
.drift-wall__plane,
.drift-wall__col,
.drift-wall__track {
  pointer-events: none !important;
}

.drift-wall__plane {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: row;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  will-change: transform;
}

.drift-wall__col {
  position: relative;
  width: calc(var(--dw-tile-w) + var(--dw-gap));
  transform-style: preserve-3d;
}

.drift-wall__track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform-style: preserve-3d;
}

/* Paused = off-screen or hidden tab. Drop `will-change` so the browser can
   release the compositor layers instead of holding ~100 tiles in GPU memory. */
.drift-wall--paused .drift-wall__plane,
.drift-wall--paused .drift-wall__track {
  will-change: auto;
}

/* Enable pointer events strictly on the tiles themselves */
.drift-wall__tile {
  position: relative;
  display: block;
  width: 100%;
  height: calc(var(--dw-tile-h) + var(--dw-gap));
  flex: 0 0 auto;
  outline: none;
  transform-style: preserve-3d;
  cursor: pointer !important;
  pointer-events: auto !important;
  text-decoration: none;
}

.drift-wall__inner {
  position: absolute;
  inset: calc(var(--dw-gap) / 2);
  display: block;
  border-radius: var(--dw-radius);
  overflow: hidden;
  background: #0b1329;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  opacity: 1;
  pointer-events: auto !important;
  cursor: pointer !important;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.drift-wall__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  pointer-events: auto !important;
  cursor: pointer !important;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hide overlay and caption text completely to keep images 100% full, bright, and clean */
.drift-wall__overlay,
.drift-wall__caption {
  display: none !important;
}

/* Active / Hover State: Elevate with luxury gold accent and stable scale (no jitter) */
.drift-wall__tile.is-active,
.drift-wall__tile:hover {
  z-index: 100;
}

.drift-wall__tile.is-active .drift-wall__inner,
.drift-wall__tile:hover .drift-wall__inner,
.drift-wall__tile:focus-visible .drift-wall__inner {
  border-color: #fbbf24;
  box-shadow:
    0 20px 45px -10px rgba(0, 0, 0, 0.9),
    0 0 25px rgba(251, 191, 36, 0.5);
  transform: scale(1.05);
  filter: brightness(1.08);
}

.drift-wall__tile.is-active img,
.drift-wall__tile:hover img,
.drift-wall__tile:focus-visible img {
  transform: scale(1.02);
}

.drift-wall__tile:focus-visible .drift-wall__inner {
  box-shadow:
    0 20px 45px -10px rgba(0, 0, 0, 0.9),
    0 0 0 2px #fbbf24;
}

@media (prefers-reduced-motion: reduce) {
  .drift-wall__plane,
  .drift-wall__track {
    will-change: auto;
  }
}

/* Lightbox Modal */
.drift-wall-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 9, 20, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drift-wall-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.drift-wall-lightbox__dialog {
  position: relative;
  width: 100%;
  max-width: 960px;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.drift-wall-lightbox.is-open .drift-wall-lightbox__dialog {
  transform: scale(1) translateY(0);
}
