/* ==========================================================================
   3D PERSPECTIVE STACK GALLERY (PER PINTEREST REFERENCE)
   ========================================================================== */

:root {
  --gallery-bg: #0A0A0E;
  --gallery-surface: #141419;
  --gallery-border: rgba(255, 255, 255, 0.08);
  --gallery-text: #F5F5F7;
  --gallery-muted: #8E8E93;
  --gallery-accent: #FF5722;
}

/* Standalone & Overlay Container */
.gallery-3d-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 700px;
  background-color: var(--gallery-bg);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 87, 34, 0.08), transparent 70%),
    radial-gradient(circle at 50% 50%, rgba(20, 20, 28, 0.6), rgba(10, 10, 14, 0.98));
  color: var(--gallery-text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  font-family: var(--font-display, 'Funnel Display', sans-serif);
}

/* Ambient dynamic glow that shifts with active card color */
.gallery-3d-glow {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 87, 34, 0.18) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(80px);
  pointer-events: none;
  transition: background 0.8s ease, transform 0.8s ease;
  z-index: 1;
}

/* Top Navigation Bar */
.gallery-3d-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  border-bottom: 1px solid var(--gallery-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gallery-3d-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
}

.gallery-3d-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #ffffff;
  color: #000;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
}

.gallery-3d-brand-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
}

/* Center Category Filter Tabs */
.gallery-3d-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-filter-pill {
  background: transparent;
  border: none;
  color: var(--gallery-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-filter-pill:hover {
  color: #fff;
}

.gallery-filter-pill.active {
  background: #ffffff;
  color: #0A0A0E;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Header Right Actions */
.gallery-3d-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gallery-project-counter {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--gallery-muted);
  text-transform: uppercase;
}

.gallery-project-counter strong {
  color: #fff;
}

.gallery-close-btn,
.gallery-action-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.gallery-action-cta {
  background: #fff;
  color: #0A0A0E;
  border: 1px solid #fff;
}

.gallery-action-cta:hover {
  background: #FF5722;
  border-color: #FF5722;
  color: #fff;
}

.gallery-close-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--gallery-border);
}

.gallery-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ==========================================================================
   3D PERSPECTIVE VIEWPORT & STACK DECK
   ========================================================================== */

.gallery-3d-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  perspective: 1200px;
  perspective-origin: 50% 28%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  z-index: 5;
}

.gallery-3d-viewport:active {
  cursor: grabbing;
}

/* Central Stack Deck container */
.gallery-3d-deck {
  position: relative;
  width: min(860px, 88vw);
  height: 520px;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* Individual 3D Perspective Card (Browser Window Style per Reference) */
.gallery-card-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #111116;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.45s ease,
    opacity 0.45s ease,
    filter 0.45s ease;
  will-change: transform, opacity;
  cursor: pointer;
  backface-visibility: hidden;
}

/* Card Browser Mockup Header Bar */
.gallery-card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #16161C;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}

.gallery-card-dots {
  display: flex;
  gap: 6px;
}

.gallery-card-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-block;
}

.gallery-card-dots span:nth-child(1) { background: #FF5F56; }
.gallery-card-dots span:nth-child(2) { background: #FFBD2E; }
.gallery-card-dots span:nth-child(3) { background: #27C93F; }

.gallery-card-url-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 14px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--gallery-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-card-url-pill .lock-icon {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
}

.gallery-card-category-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gallery-accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-card-category-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gallery-accent);
}

/* Card Visual Body */
.gallery-card-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #0D0D12;
  overflow: hidden;
}

.gallery-card-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
}

.gallery-card-3d:hover .gallery-card-media {
  transform: scale(1.03);
}

/* Bottom Overlay Strip */
.gallery-card-caption {
  position: relative;
  z-index: 2;
  padding: 24px 30px;
  background: linear-gradient(0deg, rgba(8, 8, 12, 0.96) 0%, rgba(8, 8, 12, 0.75) 60%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.gallery-card-caption-left {
  max-width: 65%;
}

.gallery-card-index {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gallery-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.gallery-card-title {
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.gallery-card-title .title-bold {
  color: #ffffff;
}

.gallery-card-title .title-muted {
  display: block;
  font-size: 0.68em;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.gallery-card-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card CTA Action Button */
.gallery-card-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: #0A0A0E;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: all 0.25s ease;
}

.gallery-card-cta-btn:hover {
  background: var(--gallery-accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 87, 34, 0.4);
}

.gallery-card-cta-btn .arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}

.gallery-card-cta-btn:hover .arrow {
  transform: translateX(4px);
}

/* Hover effects when hovering inactive cards */
.gallery-card-3d:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 40px 100px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   BOTTOM CONTROLS & METADATA BAR
   ========================================================================== */

.gallery-3d-footer {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-top: 1px solid var(--gallery-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
}

.gallery-footer-tagline {
  color: var(--gallery-muted);
  letter-spacing: 1.5px;
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-footer-tagline strong {
  color: #fff;
}

/* Navigation Arrows & Wheel Scrub Hint */
.gallery-scrub-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gallery-nav-arrow-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--gallery-border);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.gallery-nav-arrow-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.gallery-scrub-hint {
  color: var(--gallery-muted);
  font-size: 11px;
  letter-spacing: 0.5px;
}

.gallery-footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gallery-view-all-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 100px;
  transition: all 0.25s ease;
}

.gallery-view-all-link:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Fullscreen Modal Variant (when triggered from index.html) */
.gallery-3d-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-3d-modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .gallery-3d-header {
    padding: 16px 20px;
  }
  .gallery-3d-filters {
    display: none; /* Hide pills on small screens, keep counter */
  }
  .gallery-3d-deck {
    width: 92vw;
    height: 440px;
  }
  .gallery-card-caption {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .gallery-card-caption-left {
    max-width: 100%;
  }
  .gallery-3d-footer {
    padding: 14px 20px;
    flex-direction: column;
    gap: 12px;
  }
}
