/* ===================================================================
   SECTION: Fragmented Lab — Weapons & Armor Showcase
   =================================================================== */

/* --- Page Background --- */
.lab-page {
  background: var(--color-bg);
}

/* Compact footer on lab page */
.lab-page .footer {
  padding: var(--space-sm) var(--space-lg) var(--space-xs);
  gap: var(--space-xs);
}

.lab-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.lab-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: brightness(0.8) saturate(1.15);
}

/* Inverted gradient: darker on top (bright ring area), lighter on bottom (dark ground) */
.lab-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 20%, rgba(6, 8, 14, 0.25) 0%, transparent 70%),
    linear-gradient(
      to bottom,
      rgba(6, 8, 14, 0.55) 0%,
      rgba(6, 8, 14, 0.45) 15%,
      rgba(6, 8, 14, 0.3) 30%,
      rgba(6, 8, 14, 0.25) 50%,
      rgba(6, 8, 14, 0.3) 65%,
      rgba(6, 8, 14, 0.4) 80%,
      rgba(6, 8, 14, 0.55) 90%,
      rgba(6, 8, 14, 0.7) 100%
    );
}

/* --- Hero / Title Area --- */
.lab-hero {
  position: relative;
  z-index: var(--z-base);
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--nav-height) var(--space-md) var(--space-md);
  text-align: center;
}

.lab-hero-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-cyan);
  margin-bottom: var(--space-sm);
  opacity: 0;
  animation: labFadeIn 0.8s ease forwards 0.3s;
}

.lab-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: var(--lh-heading);
  color: var(--color-text);
  margin-bottom: var(--space-md);
  opacity: 0;
  animation: labFadeIn 0.8s ease forwards 0.5s;
}

.lab-hero-title span {
  background: var(--gradient-blue-aqua);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lab-hero-sub {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--color-text);
  max-width: 550px;
  line-height: var(--lh-body);
  opacity: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  animation: labFadeIn 0.8s ease forwards 0.6s;
}

/* --- Pill Switch --- */
.lab-tabs {
  position: relative;
  z-index: var(--z-base);
  display: flex;
  justify-content: center;
  padding: 0 var(--space-md) var(--space-md);
}

.lab-pill-switch {
  display: flex;
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 3px;
  gap: 0;
}

.lab-tab {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  padding: 0.55rem 1.8rem;
  border: none;
  border-radius: 50px;
  background: transparent;
  color: var(--color-text-dim);
  cursor: pointer;
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
}

.lab-tab:hover {
  color: var(--color-text);
}

.lab-tab.active {
  color: #fff;
}

/* Sliding pill indicator */
.lab-pill-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), width 0.3s ease;
  z-index: 0;
}

/* --- Items Grid --- */
.lab-content {
  position: relative;
  z-index: var(--z-base);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-lg);
}

/* Weapons grid — 5 columns */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

.lab-grid[hidden] {
  display: none;
}

/* Armor grid — centered with larger cards */
.lab-grid--armor {
  grid-template-columns: repeat(3, 340px);
  justify-content: center;
}

/* --- Item Card — Dark grey glass style --- */
.lab-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(
      135deg,
      rgba(30, 32, 38, 0.55) 0%,
      rgba(22, 24, 30, 0.5) 50%,
      rgba(28, 30, 36, 0.55) 100%
    );
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* Top specular reflection */
.lab-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
  border-radius: 14px 14px 0 0;
}

.lab-card:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 0 20px rgba(0, 100, 238, 0.25),
    0 0 50px rgba(0, 100, 238, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* --- Weapon card color-toned glow per weapon --- */
.lab-card[data-item-id="x30-rapidfire"]:hover {
  box-shadow:
    0 0 30px rgba(0, 168, 255, 0.45),
    0 0 60px rgba(0, 168, 255, 0.2),
    0 0 100px rgba(0, 168, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="labrys"]:hover {
  box-shadow:
    0 0 30px rgba(255, 100, 30, 0.45),
    0 0 60px rgba(255, 100, 30, 0.2),
    0 0 100px rgba(255, 100, 30, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="forbidden-yumi"]:hover {
  box-shadow:
    0 0 30px rgba(0, 200, 230, 0.45),
    0 0 60px rgba(0, 200, 230, 0.2),
    0 0 100px rgba(0, 200, 230, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="sayf"]:hover {
  box-shadow:
    0 0 30px rgba(255, 180, 30, 0.45),
    0 0 60px rgba(255, 180, 30, 0.2),
    0 0 100px rgba(255, 180, 30, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="crimsonic-katana"]:hover {
  box-shadow:
    0 0 30px rgba(255, 60, 100, 0.45),
    0 0 60px rgba(255, 60, 100, 0.2),
    0 0 100px rgba(255, 60, 100, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}

/* Armor suit glow colors */
.lab-card[data-item-id="phantom-suit"]:hover {
  box-shadow:
    0 0 30px rgba(60, 140, 255, 0.45),
    0 0 60px rgba(60, 140, 255, 0.2),
    0 0 100px rgba(60, 140, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="vanguard-suit"]:hover {
  box-shadow:
    0 0 30px rgba(255, 160, 30, 0.45),
    0 0 60px rgba(255, 160, 30, 0.2),
    0 0 100px rgba(255, 160, 30, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.lab-card[data-item-id="berserker-suit"]:hover {
  box-shadow:
    0 0 30px rgba(220, 40, 50, 0.45),
    0 0 60px rgba(220, 40, 50, 0.2),
    0 0 100px rgba(220, 40, 50, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.6);
}

/* Weapon cards — image area centers weapon vertically */
.lab-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  padding-bottom: 2.2rem;
}

.lab-card-image img {
  max-width: 100%;
  max-height: 100%;
  transform: scale(1.15);
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* These weapons' source images are shorter — nudge up to visually center above banner */
.lab-card[data-item-id="labrys"] .lab-card-image img,
.lab-card[data-item-id="forbidden-yumi"] .lab-card-image img,
.lab-card[data-item-id="sayf"] .lab-card-image img {
  margin-top: -1.5rem;
}

.lab-card[data-item-id="sayf"] .lab-card-image img {
  transform: scale(1.2075);
}

.lab-card:hover .lab-card-image img {
  transform: scale(1.3);
}

/* Armor suits — taller cards, images aligned to bottom (same floor point) */
.lab-grid--armor .lab-card-image {
  aspect-ratio: 2 / 3;
  align-items: flex-end;
  padding-bottom: 2.2rem;
  overflow: hidden;
}

.lab-grid--armor .lab-card-image img {
  max-width: 95%;
  max-height: 125%;
  transform-origin: center bottom;
  transform: scale(1.5);
}

/* Phantom is taller source image — reduce 10% */
.lab-card[data-item-id="phantom-suit"] .lab-card-image img {
  transform: scale(1.134);
}

/* Armor suits — 3D pop-out hover on the card itself */
.lab-grid--armor .lab-card {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.35s ease, border-color 0.35s ease;
}

.lab-grid--armor .lab-card:hover {
  transform: none;
}

/* Armor suit images enlarge on hover */
.lab-grid--armor .lab-card:hover .lab-card-image img {
  transform: scale(1.6);
}

.lab-grid--armor .lab-card[data-item-id="phantom-suit"]:hover .lab-card-image img {
  transform: scale(1.2);
}

/* Glass banner — name only (no type, no rank on cards) */
.lab-card-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0.5rem 1rem;
  background:
    linear-gradient(
      135deg,
      rgba(24, 26, 32, 0.6) 0%,
      rgba(18, 20, 26, 0.55) 50%,
      rgba(22, 24, 30, 0.6) 100%
    );
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Inner glow line at top of glass banner */
.lab-card-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  pointer-events: none;
}

/* Hide type and rank labels on cards */
.lab-card-type,
.lab-card-rank {
  display: none;
}

.lab-card-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  line-height: 1.3;
  margin: 0;
  text-align: center;
}

/* --- Detail Modal — Dark grey glass --- */
.lab-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  background: transparent;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ease-base), visibility var(--ease-base);
}

/* Frosted grain texture */
.lab-modal-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  opacity: 0.15;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 1;
}

.lab-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.lab-modal {
  position: relative;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background:
    linear-gradient(
      135deg,
      rgba(30, 32, 38, 0.92) 0%,
      rgba(22, 24, 30, 0.9) 50%,
      rgba(28, 30, 36, 0.92) 100%
    );
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--ease-smooth);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lab-modal-overlay.open .lab-modal {
  transform: scale(1) translateY(0);
}

/* Larger modal for armor suits */
.lab-modal.lab-modal--armor {
  max-width: 1100px;
}

.lab-modal.lab-modal--armor .lab-modal-image {
  min-height: 450px;
}

.lab-modal.lab-modal--armor .lab-modal-image img {
  max-height: 660px;
  transform: scale(1.2);
}

/* Top specular reflection on modal */
.lab-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
  border-radius: 14px 14px 0 0;
}

.lab-modal-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s ease;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lab-modal-close:hover {
  border-color: rgba(0, 200, 255, 0.5);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 168, 255, 0.3);
}

.lab-modal-image {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  min-height: 300px;
}

.lab-modal-image img {
  max-width: 90%;
  max-height: 400px;
  object-fit: contain;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.5));
}

.lab-modal-info {
  position: relative;
  z-index: 1;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Hide type label in modal too */
.lab-modal-type {
  display: none;
}

.lab-modal-name {
  font-family: var(--font-heading);
  font-size: var(--fs-h2);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  line-height: var(--lh-heading);
  margin-bottom: var(--space-xs);
}

.lab-modal-rank {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  display: none;
}

.lab-modal-desc {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: rgba(255, 255, 255, 0.7);
  line-height: var(--lh-body);
  margin-bottom: var(--space-md);
}

/* Stat bars */
.lab-modal-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lab-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.lab-stat-label {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  min-width: 70px;
}

.lab-stat-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.lab-stat-fill {
  height: 100%;
  background: var(--gradient-blue-aqua);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Abilities list */
.lab-modal-abilities {
  margin-top: var(--space-md);
}

.lab-modal-abilities-title {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--space-xs);
}

.lab-modal-abilities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lab-ability-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
}

/* --- Animations --- */
@keyframes labFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Cards appear without slide-up */
.lab-card {
  opacity: 0;
}

.lab-card.visible {
  animation: labFadeIn 0.4s ease forwards;
}

.lab-card:nth-child(1) { animation-delay: 0s; }
.lab-card:nth-child(2) { animation-delay: 0.06s; }
.lab-card:nth-child(3) { animation-delay: 0.12s; }
.lab-card:nth-child(4) { animation-delay: 0.18s; }
.lab-card:nth-child(5) { animation-delay: 0.24s; }
.lab-card:nth-child(6) { animation-delay: 0.3s; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .lab-hero {
    min-height: 55vh;
    padding-bottom: var(--space-lg);
  }

  .lab-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-sm);
  }

  .lab-grid--armor {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .lab-modal {
    grid-template-columns: 1fr;
    max-height: 85vh;
  }

  .lab-modal-image {
    padding: var(--space-md);
    min-height: 200px;
  }

  .lab-modal-image img {
    max-height: 250px;
  }

  .lab-modal-info {
    padding: var(--space-md);
  }

  .lab-tab {
    padding: 0.5rem 1rem;
    font-size: var(--fs-tiny);
  }
}

@media (max-width: 480px) {
  .lab-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
  }

  .lab-grid--armor {
    grid-template-columns: 1fr 1fr;
  }

  .lab-card-name {
    font-size: 0.85rem;
  }
}

/* Game logo above lab hero title */
.lab-hero-game-logo {
  display: block;
  width: clamp(220px, 32vw, 380px);
  height: auto;
  margin: 0 auto var(--space-md);
  filter: drop-shadow(0 0 18px rgba(0, 240, 255, 0.18)) drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
}
@media (max-width: 640px) {
  .lab-hero-game-logo { width: clamp(180px, 60vw, 280px); }
}

/* Shared per-page game logo for FAQ / Press section headers */
.section-header .page-game-logo {
  display: block;
  width: clamp(180px, 26vw, 300px);
  height: auto;
  margin: 0 auto var(--space-sm);
  filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.16)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
@media (max-width: 640px) {
  .section-header .page-game-logo { width: clamp(160px, 55vw, 240px); }
}
