/* ── Base ── */

.cpg-wrap {
  width: 100%;
  font-size: 1rem;
}

/* ── Filters ── */

.cpg-filter {
  background: #212121;
  padding: 0.6rem;
  border-radius: 0.8rem;
  margin-bottom: 2rem;
}

.cpg-filter__buttons {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.8rem;
}

.cpg-filter__btn {
  flex: 1;
  padding: 1.4rem 1rem;
  border: none;
  border-radius: 0.6rem;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: clamp(1rem, calc(0.2vw + 0.95rem), 1.125rem);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cpg-filter__btn:hover {
  background: #151515;
}

.cpg-filter__btn.active {
  background: linear-gradient(to right, #743ad5, #d53a9d);
  color: #fff;
}

.cpg-filter__icon {
  width: 1.4em;
  height: 1.4em;
  object-fit: contain;
  border-radius: 3px;
}

/* ── Grid ── */

.cpg-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.cpg-grid--1 .cpg-card { width: 100%; }
.cpg-grid--2 .cpg-card { width: calc(50% - 1rem); }
.cpg-grid--3 .cpg-card { width: calc(33.3333% - 1.3333rem); }
.cpg-grid--4 .cpg-card { width: calc(25% - 1.5rem); }
.cpg-grid--5 .cpg-card { width: calc(20% - 1.6rem); }
.cpg-grid--6 .cpg-card { width: calc(16.6667% - 1.6667rem); }
.cpg-grid--7 .cpg-card { width: calc(14.2857% - 1.7143rem); }
.cpg-grid--8 .cpg-card { width: calc(12.5% - 1.75rem); }
.cpg-grid--9 .cpg-card { width: calc(11.1111% - 1.7778rem); }

/* ── Cards ── */

.cpg-card {
  background: linear-gradient(to bottom right, #743ad5, #d53a9d);
  border-radius: 1rem;
  padding: 2px;
  opacity: 0;
  transform: translateY(40px);
  cursor: pointer;
}

.cpg-card.cpg-hidden {
  opacity: 0 !important;
  position: absolute !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

.cpg-card.cpg-visible {
  animation: cpgUp 0.6s ease-out forwards;
}

@keyframes cpgUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cpg-card__inner {
  background: #1e1e1e;
  border-radius: calc(1rem - 2px);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cpg-card__thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.cpg-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s;
}

.cpg-card:hover .cpg-card__thumb img {
  transform: scale(1.05);
}

.cpg-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(116, 58, 213, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background 0.3s;
}

.cpg-card:hover .cpg-card__play {
  background: rgba(213, 58, 157, 0.9);
}

.cpg-card__play svg {
  width: 22px;
  height: 22px;
  display: block;
}

.cpg-card__content {
  padding: 1rem 1.2rem 1.2rem;
}

.cpg-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

/* ── Lightbox ── */

.cpg-lb {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.cpg-lb.active {
  opacity: 1;
}

.cpg-lb__inner {
  width: 90%;
  max-width: 960px;
  position: relative;
}

.cpg-lb__media {
  width: 100%;
  border-radius: 1rem;
  overflow: hidden;
}

.cpg-lb__media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.cpg-lb__media img {
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
  display: block;
}

.cpg-lb__close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
}

.cpg-lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}

.cpg-lb__nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.cpg-lb__nav--p { left: -64px; }
.cpg-lb__nav--n { right: -64px; }

.cpg-lb__count {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

/* ── Pagination ── */

.cpg-pagination {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 2rem 0 !important;
}

.cpg-pagination__btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 3.2rem;
  height: 3.2rem;
  border: none;
  border-radius: 0.5rem;
  background: #2a2a2a;
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.cpg-pagination__btn:hover {
  background: #3a3a3a;
}

.cpg-pagination__btn.active {
  background: linear-gradient(to right, #743ad5, #d53a9d);
}

.cpg-pagination__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Responsive ── */

@media (max-width: 1100px) {
  .cpg-lb__nav--p { left: 8px; }
  .cpg-lb__nav--n { right: 8px; }
}

@media (max-width: 991px) {
  .cpg-grid--3 .cpg-card,
  .cpg-grid--4 .cpg-card,
  .cpg-grid--5 .cpg-card,
  .cpg-grid--6 .cpg-card,
  .cpg-grid--7 .cpg-card,
  .cpg-grid--8 .cpg-card,
  .cpg-grid--9 .cpg-card {
    width: calc(50% - 1rem);
  }
}

@media (max-width: 767px) {
  .cpg-filter__buttons {
    flex-wrap: wrap !important;
  }

  .cpg-filter__btn {
    flex: 1 1 calc(50% - 0.4rem);
  }

  .cpg-grid .cpg-card {
    width: 100% !important;
  }
}
