.svg-wrap {
  --svg-gap: 14px;
  --svg-radius: 14px;
  --svg-bg: #0b0b0d;
  --svg-accent: #ffffff;
  --svg-columns: 4;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 0;
  box-sizing: border-box;
}
.svg-wrap *, .svg-wrap *::before, .svg-wrap *::after {
  box-sizing: border-box;
}

.svg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.svg-filter-btn {
  font: 500 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.svg-filter-btn:hover {
  border-color: rgba(0, 0, 0, 0.35);
}

.svg-filter-btn.is-active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.svg-grid {
  /* --svg-cols = columns in use at the current screen size. */
  --svg-cols: var(--svg-columns);
  display: grid;
  grid-template-columns: repeat(var(--svg-cols), 1fr);
  gap: var(--svg-gap);
}

/* Fewer videos than a full row: switch to a centered flex row.
   Each card keeps exactly the width it would have in a full row,
   so cards never stretch — they just sit in the middle. */
.svg-grid.svg-centered {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.svg-grid.svg-centered > .svg-item {
  flex: 0 0 calc((100% - (var(--svg-cols) - 1) * var(--svg-gap)) / var(--svg-cols));
  max-width: calc((100% - (var(--svg-cols) - 1) * var(--svg-gap)) / var(--svg-cols));
}

.svg-item.svg-hidden {
  display: none;
}

@media (max-width: 900px) {
  .svg-grid { --svg-cols: 2; }
}
@media (max-width: 480px) {
  .svg-grid { --svg-cols: 1; }
}

.svg-item {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--svg-radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--svg-bg);
  isolation: isolate;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.svg-item img.svg-poster,
.svg-item video.svg-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.svg-item:hover img.svg-poster,
.svg-item:hover video.svg-poster {
  transform: scale(1.04);
  filter: brightness(0.75);
}

.svg-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid var(--svg-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background 0.25s ease;
  backdrop-filter: blur(2px);
}

.svg-item:hover .svg-play {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(0, 0, 0, 0.65);
}

.svg-play::after {
  content: "";
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--svg-accent);
  margin-left: 3px;
}

.svg-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px 8px;
  font: 500 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ---------- Lightbox ---------- */
.svg-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 40px 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.svg-lightbox.svg-open {
  display: flex;
  opacity: 1;
}

.svg-lightbox-inner {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.svg-lightbox video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 85vh;
  border-radius: 12px;
  background: #000;
  display: block;
  outline: none;
}

.svg-lightbox-title {
  display: none;
}

.svg-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.svg-close:hover { background: rgba(0, 0, 0, 0.7); }

.svg-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.svg-nav:hover { background: rgba(255, 255, 255, 0.25); }
.svg-prev { left: -56px; }
.svg-next { right: -56px; }

@media (max-width: 560px) {
  .svg-prev { left: 6px; }
  .svg-next { right: 6px; }
}
