/* =========================================================
   VINYLED GALLERY
   Production / Responsive / Component-focused
========================================================= */

/* =========================================================
   COMPONENT TOKENS
   Scoped to the gallery to avoid global CSS conflicts
========================================================= */

.gallery-section {
  --gallery-bg: #05070b;
  --gallery-card: #0b1017;
  --gallery-card-hover: #101722;

  --gallery-text: #f5f7fa;
  --gallery-muted: #8e99a8;
  --gallery-subtle: #626d7c;

  --gallery-border: rgba(255, 255, 255, 0.09);
  --gallery-border-hover: rgba(255, 255, 255, 0.2);

  --gallery-accent: #6ca8ff;
  --gallery-success: #43df88;

  --gallery-radius: 18px;
  --gallery-container: 1380px;

  --gallery-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  width: 100%;
  padding: clamp(64px, 8vw, 110px) 20px;

  color: var(--gallery-text);
  background: var(--gallery-bg);

  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

.gallery-section *,
.gallery-section *::before,
.gallery-section *::after {
  box-sizing: border-box;
}

/* =========================================================
   CONTAINER
========================================================= */

.gallery-container {
  width: min(100%, var(--gallery-container));
  margin-inline: auto;
}

/* =========================================================
   ACCESSIBILITY
========================================================= */

.gallery-section .sr-only {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;

  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);

  white-space: nowrap;

  border: 0;
}

/* =========================================================
   HEADER
========================================================= */

.gallery-header {
  width: min(100%, 760px);

  margin-inline: auto;
  margin-bottom: clamp(38px, 5vw, 56px);

  text-align: center;
}

.gallery-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  margin-bottom: 16px;

  color: var(--gallery-accent);

  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;

  text-transform: uppercase;
}

.gallery-eyebrow::before,
.gallery-eyebrow::after {
  content: "";

  width: 24px;
  height: 1px;

  background: currentColor;
  opacity: 0.7;
}

.gallery-header h1 {
  margin: 0;

  color: var(--gallery-text);

  font-size: 23px;
  font-weight: 500;

  line-height: 1.1;
  letter-spacing: 0;
}

.gallery-description {
  width: min(100%, 640px);

  margin: 16px auto 0;

  color: var(--gallery-muted);

  font-size: 0.98rem;
  line-height: 1.7;
}

/* =========================================================
   LIVE STATUS
========================================================= */

.gallery-live-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  margin-top: 24px;
  padding: 8px 13px;

  border: 1px solid rgba(67, 223, 136, 0.18);
  border-radius: 999px;

  background: rgba(67, 223, 136, 0.06);

  color: #a7eec4;

  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.live-dot {
  position: relative;

  width: 8px;
  height: 8px;

  flex: 0 0 auto;

  border-radius: 50%;

  background: var(--gallery-success);

  box-shadow: 0 0 0 0 rgba(67, 223, 136, 0.55);

  animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(67, 223, 136, 0.55);
  }

  70% {
    box-shadow: 0 0 0 7px rgba(67, 223, 136, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(67, 223, 136, 0);
  }
}

/* =========================================================
   SEARCH
========================================================= */

.gallery-search-wrapper {
  margin-top: 22px;
}

.gallery-search {
  position: relative;

  display: flex;
  align-items: center;

  width: min(100%, 560px);
  min-height: 54px;

  margin-inline: auto;

  border: 1px solid var(--gallery-border);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.045);

  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.gallery-search:focus-within {
  border-color: rgba(108, 168, 255, 0.55);

  background: rgba(255, 255, 255, 0.065);

  box-shadow: 0 0 0 4px rgba(108, 168, 255, 0.08);
}

.search-icon {
  width: 20px;
  height: 20px;

  margin-left: 19px;

  flex: 0 0 auto;

  color: var(--gallery-muted);
}

.gallery-search input {
  width: 100%;
  min-width: 0;

  padding: 15px 48px 15px 13px;

  border: 0;
  outline: 0;

  background: transparent;

  color: var(--gallery-text);

  font: inherit;
  font-size: 0.9rem;
}

.gallery-search input::placeholder {
  color: #697485;
}

.search-clear {
  position: absolute;
  right: 8px;

  display: grid;
  place-items: center;

  width: 38px;
  height: 38px;

  border: 0;
  border-radius: 50%;

  background: transparent;

  color: var(--gallery-muted);

  font-size: 1.35rem;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gallery-text);
}

/* =========================================================
   GRID
========================================================= */

.gallery-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: clamp(14px, 1.7vw, 24px);
}

/* =========================================================
   CARD
========================================================= */

.gallery-card {
  position: relative;

  min-width: 0;

  aspect-ratio: 4 / 5;

  overflow: hidden;

  border: 1px solid var(--gallery-border);
  border-radius: var(--gallery-radius);

  background: var(--gallery-card);

  isolation: isolate;

  cursor: pointer;

  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);

  transition:
    transform 0.5s var(--gallery-ease),
    border-color 0.35s ease,
    box-shadow 0.5s ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  transform: translateY(-6px);

  border-color: var(--gallery-border-hover);

  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

.gallery-card:focus-visible {
  outline: 2px solid var(--gallery-accent);
  outline-offset: 4px;
}

/* =========================================================
   IMAGE
========================================================= */

.gallery-card-image {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  opacity: 0;

  background: #0c121a;

  transition:
    opacity 0.45s ease,
    transform 0.8s var(--gallery-ease);
}

.gallery-card-image.is-loaded {
  opacity: 1;
}

.gallery-card:hover .gallery-card-image,
.gallery-card:focus-visible .gallery-card-image {
  transform: scale(1.045);
}

/* =========================================================
   LOADING PLACEHOLDER
========================================================= */

.gallery-card::before {
  content: "";

  position: absolute;
  inset: 0;

  z-index: 0;

  background: linear-gradient(100deg, #0a0f16 20%, #151d29 40%, #0a0f16 60%);

  background-size: 200% 100%;

  animation: gallery-shimmer 1.4s linear infinite;
}

.gallery-card.is-loaded::before {
  display: none;
}

@keyframes gallery-shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

/* =========================================================
   GRADIENT OVERLAY
========================================================= */

.gallery-card-overlay {
  position: absolute;
  inset: 0;

  z-index: 2;

  display: flex;
  align-items: flex-end;

  padding: 22px 18px;

  pointer-events: none;

  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.86) 0%,
    rgba(0, 0, 0, 0.42) 34%,
    rgba(0, 0, 0, 0) 72%
  );
}

.gallery-card-title {
  max-width: 90%;

  margin: 0;

  color: #fff;

  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  font-weight: 750;

  line-height: 1.3;
  letter-spacing: -0.015em;
}

/* =========================================================
   POST META
========================================================= */

.gallery-card-meta {
  position: absolute;

  top: 13px;
  left: 13px;

  z-index: 3;

  display: flex;
  align-items: center;

  gap: 7px;
}

.gallery-count {
  display: inline-flex;
  align-items: center;

  min-height: 28px;

  padding-inline: 9px;

  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;

  background: rgba(0, 0, 0, 0.55);

  color: #fff;

  font-size: 0.7rem;
  font-weight: 700;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* =========================================================
   CAROUSEL DOTS
========================================================= */

.gallery-dots {
  position: absolute;

  left: 50%;
  bottom: 13px;

  z-index: 4;

  display: flex;
  align-items: center;

  gap: 5px;

  transform: translateX(-50%);

  padding: 6px 8px;

  border-radius: 999px;

  background: rgba(0, 0, 0, 0.4);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gallery-dot {
  width: 5px;
  height: 5px;

  padding: 0;

  border: 0;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.45);

  cursor: pointer;

  transition:
    width 0.2s ease,
    background 0.2s ease;
}

.gallery-dot.is-active {
  width: 15px;

  border-radius: 999px;

  background: #fff;
}

/* =========================================================
   CAROUSEL ARROWS
========================================================= */

.gallery-carousel-button {
  position: absolute;

  top: 50%;

  z-index: 5;

  display: grid;
  place-items: center;

  width: 38px;
  height: 38px;

  padding: 0;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;

  background: rgba(0, 0, 0, 0.48);

  color: #fff;

  font-size: 1.5rem;
  line-height: 1;

  cursor: pointer;

  opacity: 0;

  transform: translateY(-50%);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transition:
    opacity 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease;
}

.gallery-card:hover .gallery-carousel-button,
.gallery-card:focus-within .gallery-carousel-button {
  opacity: 1;
}

.gallery-carousel-button:hover {
  background: rgba(0, 0, 0, 0.72);
}

.gallery-carousel-prev {
  left: 12px;
}

.gallery-carousel-next {
  right: 12px;
}

/* =========================================================
   EMPTY STATE
========================================================= */

.gallery-empty {
  padding: 70px 20px;

  text-align: center;
}

.gallery-empty[hidden] {
  display: none;
}

.empty-icon {
  margin-bottom: 12px;

  color: var(--gallery-subtle);

  font-size: 2.5rem;
}

.gallery-empty h3 {
  margin: 0;

  color: var(--gallery-text);

  font-size: 1.1rem;
}

.gallery-empty p {
  margin: 8px 0 20px;

  color: var(--gallery-muted);

  font-size: 0.9rem;
}

.empty-reset {
  padding: 10px 16px;

  border: 1px solid var(--gallery-border);
  border-radius: 999px;

  background: transparent;

  color: var(--gallery-text);

  cursor: pointer;
}

/* =========================================================
   LIGHTBOX
   IMPORTANT:
   Must remain above global site header/footer
========================================================= */

.gallery-lightbox {
  position: fixed !important;
  inset: 0 !important;

  z-index: 2147483647 !important;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100vw;
  height: 100dvh;

  padding: max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));

  overflow: hidden;

  visibility: hidden;
  opacity: 0;

  pointer-events: none;

  isolation: isolate;

  background: rgba(2, 4, 7, 0.97);

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.gallery-lightbox.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   LIGHTBOX BACKDROP
========================================================= */

.lightbox-backdrop {
  position: absolute;
  inset: 0;

  z-index: 0;

  background: rgba(2, 4, 7, 0.97);

  cursor: default;
}

/* =========================================================
   LIGHTBOX CONTENT
========================================================= */

.lightbox-content {
  position: relative;

  z-index: 2;

  display: flex;
  flex-direction: column;
  align-items: center;

  width: min(1100px, calc(100vw - 120px));
  max-width: 1100px;

  max-height: calc(100dvh - 48px);

  margin: 0 auto;
}

/* =========================================================
   IMAGE WRAPPER
========================================================= */

.lightbox-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;

  min-height: 0;
}

/* =========================================================
   LIGHTBOX IMAGE
========================================================= */

.lightbox-image {
  display: block;

  width: auto;
  height: auto;

  max-width: 100%;
  max-height: calc(100dvh - 120px);

  object-fit: contain;

  border-radius: 8px;

  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.55);

  user-select: none;
  -webkit-user-drag: none;
}

/* =========================================================
   LIGHTBOX INFORMATION
========================================================= */

.lightbox-info {
  width: min(700px, 100%);

  margin-top: 18px;

  text-align: center;
}

.lightbox-info h2 {
  margin: 0;

  color: #fff;

  font-size: 0.75rem;
  font-weight: 650;

  line-height: 1.35;
}

.lightbox-info p {
  margin: 7px 0 0;

  color: var(--gallery-muted);

  font-size: 0.85rem;
  line-height: 1.5;
}

.lightbox-counter {
  display: block;

  margin-top: 9px;

  color: var(--gallery-subtle);

  font-size: 0.72rem;
  font-weight: 700;

  letter-spacing: 0.08em;
}

/* =========================================================
   LIGHTBOX CONTROLS
========================================================= */

.lightbox-close,
.lightbox-arrow {
  position: fixed !important;

  z-index: 2147483647 !important;

  display: grid;
  place-items: center;

  width: 50px;
  height: 50px;

  padding: 0;

  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;

  background: rgba(15, 20, 28, 0.85);

  color: #fff;

  cursor: pointer;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.13);

  border-color: rgba(255, 255, 255, 0.24);
}

/* =========================================================
   CLOSE BUTTON
   Deliberately positioned near viewport edge
   so it cannot sit under a normal site header
========================================================= */

.lightbox-close {
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));

  font-size: 1.65rem;
  line-height: 1;
}

/* =========================================================
   PREVIOUS / NEXT
========================================================= */

.lightbox-arrow {
  top: 50%;

  font-size: 2rem;

  transform: translateY(-50%);
}

.lightbox-arrow:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox-prev {
  left: max(18px, env(safe-area-inset-left));
}

.lightbox-next {
  right: max(18px, env(safe-area-inset-right));
}

/* =========================================================
   FOCUS
========================================================= */

.gallery-lightbox button:focus-visible {
  outline: 2px solid var(--gallery-accent);
  outline-offset: 3px;
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-carousel-button {
    opacity: 1;
  }

  .lightbox-content {
    width: calc(100vw - 90px);

    max-width: 100%;
  }

  .lightbox-image {
    max-height: calc(100dvh - 120px);
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {
  .gallery-section {
    padding-inline: 12px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;

    gap: 14px;
  }

  .gallery-card {
    aspect-ratio: 4 / 5;
  }

  .gallery-header {
    margin-bottom: 30px;
  }

  .gallery-description {
    font-size: 0.9rem;
  }

  .gallery-search {
    min-height: 50px;
  }

  .gallery-search input {
    font-size: 0.85rem;
  }

  .gallery-card-title {
    font-size: 0.95rem;
  }

  .gallery-header h1 {
    margin-top: -20px;

    font-size: 15px;
    font-weight: 500;

    line-height: 1.2;
    letter-spacing: 0;
  }

  .gallery-carousel-button {
    width: 36px;
    height: 36px;
  }

  .gallery-lightbox {
    padding: max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .lightbox-content {
    width: 100%;
  }

  .lightbox-image {
    max-width: 100%;

    max-height: calc(100dvh - 145px);

    border-radius: 6px;
  }

  .lightbox-arrow {
    width: 42px;
    height: 42px;

    font-size: 1.5rem;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));

  width: 58px;
  height: 58px;
  font-size: 1.9rem;

  }
}

/* =========================================================
   VERY SMALL SCREENS
========================================================= */

@media (max-width: 380px) {
  .gallery-section {
    padding-inline: 10px;
  }

  .gallery-lightbox {
    padding-inline: 10px;
  }

  .lightbox-content {
    width: 100%;
  }

  .lightbox-image {
    max-height: calc(100dvh - 130px);
  }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .gallery-section *,
  .gallery-section *::before,
  .gallery-section *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.001ms !important;
  }
}
