.kmi-gallery-showcase {
  background:
    radial-gradient(circle at 80% 18%, rgba(0, 136, 255, 0.22), transparent 22rem),
    radial-gradient(circle at 20% 34%, rgba(196, 24, 24, 0.2), transparent 25rem),
    linear-gradient(135deg, #020617 0%, #060817 48%, #0d1117 100%);
  color: #f8fafc;
  height: 380vh;
  /* clip (not hidden): contains the perspective grid floor without creating
     a scroll container, so the sticky inner keeps pinning */
  overflow: clip;
  padding: 0;
  position: relative;
}

.kmi-gallery-showcase::before {
  background:
    linear-gradient(90deg, rgba(0, 255, 170, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(0, 255, 170, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  opacity: 0.22;
  pointer-events: none;
  position: absolute;
  transform: perspective(900px) rotateX(62deg) translateY(18%);
  transform-origin: bottom;
}

.kmi-gallery-showcase::after {
  background: linear-gradient(90deg, transparent, rgba(196, 24, 24, 0.34), rgba(255, 184, 77, 0.2), transparent);
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.kmi-gallery-showcase__inner {
  height: 100vh;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 2;
}

.kmi-gallery-showcase__scene {
  inset: 0;
  perspective: 1600px;
  perspective-origin: 50% 40%;
  position: absolute;
  z-index: 1;
}

.kmi-gallery-showcase__train {
  inset: 0;
  position: absolute;
  transform-style: preserve-3d;
}

.kmi-gallery-showcase__fore {
  align-items: center;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 12vh 1rem 0;
  pointer-events: none;
  position: absolute;
  text-align: center;
  will-change: transform, opacity;
  z-index: 10;
}

.kmi-gallery-showcase__fore::before {
  background: radial-gradient(ellipse 46rem 24rem at 50% 54%, rgba(2, 6, 23, 0.62), transparent 70%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: -1;
}

.kmi-gallery-showcase__eyebrow {
  align-items: center;
  color: #ffb84d;
  display: inline-flex;
  font-family: var(--kmi-ui-font, Inter, sans-serif);
  font-size: 0.72rem;
  font-weight: 900;
  gap: 0.7rem;
  letter-spacing: 0.24em;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
}

.kmi-gallery-showcase__eyebrow::before,
.kmi-gallery-showcase__eyebrow::after {
  background: #c41818;
  content: "";
  height: 2px;
  width: 2.4rem;
}

.kmi-gallery-showcase h2 {
  font-family: var(--kmi-display-font, "Arial Narrow", sans-serif);
  font-size: clamp(2.6rem, 5.6vw, 5.4rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
  text-shadow: 0 6px 40px rgba(2, 6, 23, 0.85);
  text-transform: uppercase;
}

.kmi-gallery-showcase h2 span {
  color: #c41818;
  display: block;
  text-shadow: 0 0 34px rgba(196, 24, 24, 0.35), 0 6px 40px rgba(2, 6, 23, 0.85);
}

.kmi-gallery-showcase__copy {
  color: #cbd5e1;
  font-family: var(--kmi-ui-font, Inter, sans-serif);
  font-size: 0.98rem;
  line-height: 1.7;
  margin: 1.4rem 0 0;
  max-width: 40rem;
  text-shadow: 0 2px 18px rgba(2, 6, 23, 0.9);
}

.kmi-gallery-cta {
  align-items: center;
  background: #c41818;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: inline-flex;
  font-family: var(--kmi-ui-font, Inter, sans-serif);
  font-size: 0.78rem;
  font-weight: 900;
  gap: 0.6rem;
  letter-spacing: 0.18em;
  margin-top: 1.8rem;
  padding: 0.95rem 1.7rem;
  pointer-events: auto;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.kmi-gallery-cta::after {
  content: "\2192";
}

.kmi-gallery-cta:hover {
  background: #a31212;
  box-shadow: 0 0 34px rgba(255, 184, 77, 0.34);
  transform: translateY(-2px);
}

.kmi-gallery-panel {
  aspect-ratio: 3 / 4.1;
  background: rgba(2, 6, 23, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  left: 50%;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(200px, 16.5vw, 250px);
  will-change: transform, opacity, filter;
}

.kmi-gallery-panel::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 24%, rgba(0, 0, 0, 0.5));
  content: "";
  inset: 0;
  opacity: 0.8;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.kmi-gallery-panel::after {
  background: linear-gradient(90deg, rgba(196, 24, 24, 0.65), rgba(255, 184, 77, 0.24), transparent);
  bottom: 0;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  z-index: 3;
}

.kmi-gallery-panel img {
  display: block;
  height: 100%;
  object-fit: cover;
  transform: scale(1.05);
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

.kmi-gallery-panel:hover img {
  transform: scale(1.12);
}

.kmi-gallery-panel__chrome {
  align-items: center;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.76), transparent);
  display: flex;
  gap: 0.35rem;
  height: 2.6rem;
  left: 0;
  padding: 0 1rem;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 4;
}

.kmi-gallery-panel__dot {
  background: rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  height: 0.42rem;
  width: 0.42rem;
}

.kmi-gallery-panel__tag {
  background: rgba(196, 24, 24, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.18);
  bottom: 0.9rem;
  color: #ffffff;
  font-family: var(--kmi-ui-font, Inter, sans-serif);
  font-size: 0.64rem;
  font-weight: 900;
  left: 0.9rem;
  letter-spacing: 0.14em;
  padding: 0.4rem 0.55rem;
  position: absolute;
  text-transform: uppercase;
  z-index: 4;
}

.kmi-gallery-glow {
  animation: kmi-gallery-glow 4.5s ease-in-out infinite alternate;
  background: radial-gradient(circle, rgba(0, 170, 255, 0.4), transparent 64%);
  filter: blur(2px);
  height: 16rem;
  pointer-events: none;
  position: absolute;
  right: 8%;
  top: 12%;
  transform: translateZ(-320px);
  width: 16rem;
}

.kmi-gallery-showcase__caption {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2.4rem;
}

.kmi-gallery-scroll-meter {
  background: rgba(255, 255, 255, 0.1);
  bottom: 2.2rem;
  height: 2px;
  left: 50%;
  overflow: hidden;
  position: absolute;
  transform: translateX(-50%);
  width: min(28rem, 70vw);
  z-index: 11;
}

.kmi-gallery-scroll-meter span {
  background: linear-gradient(90deg, #c41818, #ffb84d);
  display: block;
  height: 100%;
  transform: scaleX(var(--gallery-progress, 0));
  transform-origin: left center;
  width: 100%;
}

.kmi-gallery-chip {
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  font-family: var(--kmi-ui-font, Inter, sans-serif);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 0.7rem 0.9rem;
  text-transform: uppercase;
}

.kmi-gallery-chip strong {
  color: #ffb84d;
  margin-right: 0.4rem;
}

/* Dim the floating quote/WhatsApp buttons while the showcase is pinned */
body.kmi-gallery-pinned .fixed.bottom-6.right-6 {
  opacity: 0.3;
  transform: scale(0.92);
  transition: opacity 300ms ease, transform 300ms ease;
}

body.kmi-gallery-pinned .fixed.bottom-6.right-6:hover {
  opacity: 1;
  transform: scale(1);
}

html[data-theme="light"] .kmi-gallery-showcase {
  background:
    radial-gradient(circle at 80% 18%, rgba(0, 136, 255, 0.14), transparent 22rem),
    radial-gradient(circle at 20% 34%, rgba(196, 24, 24, 0.13), transparent 25rem),
    linear-gradient(135deg, #ffffff 0%, #eef2f7 50%, #fff7ed 100%);
  color: #0f172a;
}

html[data-theme="light"] .kmi-gallery-showcase::before {
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px);
  opacity: 0.24;
}

html[data-theme="light"] .kmi-gallery-showcase h2 {
  text-shadow: 0 6px 40px rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .kmi-gallery-showcase h2 span {
  text-shadow: 0 0 34px rgba(196, 24, 24, 0.22), 0 6px 40px rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .kmi-gallery-showcase__fore::before {
  background: radial-gradient(ellipse 46rem 24rem at 50% 54%, rgba(255, 255, 255, 0.72), transparent 70%);
}

html[data-theme="light"] .kmi-gallery-showcase__copy {
  color: #334155;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .kmi-gallery-panel {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

html[data-theme="light"] .kmi-gallery-chip {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

@keyframes kmi-gallery-glow {
  from {
    opacity: 0.38;
    transform: translateZ(-320px) scale(0.92);
  }
  to {
    opacity: 0.78;
    transform: translateZ(-320px) scale(1.12);
  }
}

@media (max-width: 767px) {
  .kmi-gallery-showcase {
    height: auto;
    min-height: auto;
    padding: 4rem 0 4.5rem;
  }

  .kmi-gallery-showcase__inner {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 0 1rem;
    position: relative;
    top: auto;
  }

  .kmi-gallery-showcase__fore {
    opacity: 1 !important;
    order: -1;
    padding: 0 0 2.5rem;
    pointer-events: auto;
    position: relative;
    transform: none !important;
  }

  .kmi-gallery-showcase__scene {
    perspective: none;
    position: relative;
  }

  .kmi-gallery-showcase__train {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
    position: relative;
    transform: none !important;
  }

  .kmi-gallery-panel {
    aspect-ratio: 3 / 3.4;
    filter: none !important;
    left: auto;
    opacity: 1 !important;
    position: relative;
    top: auto;
    transform: none !important;
    width: 100%;
  }

  .kmi-gallery-panel:nth-of-type(n + 7) {
    display: none;
  }

  .kmi-gallery-glow {
    display: none;
  }

  .kmi-gallery-showcase__caption {
    margin-top: 1.6rem;
  }

  .kmi-gallery-scroll-meter {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kmi-gallery-glow {
    animation: none;
  }
}
