/* =========================================================
   CPT Grid Widget — Feuille de styles
   ========================================================= */

/* ── Variables par défaut (écrasables via Elementor) ──── */
.cptg-section {
  --cptg-accent:        #F5A623;
  --cptg-accent-hover:  #1E1E1E;
  --cptg-accent-light:  #fff8ed;
  --cptg-dark:          #1E1E1E;
  --cptg-muted:         #7a8196;
  --cptg-border:        #e4e7f0;
  --cptg-card-bg:       #ffffff;
  --cptg-radius:        18px;
  --cptg-radius-sm:     10px;
  --cptg-shadow:        0 2px 16px rgba(17,19,24,.07), 0 1px 3px rgba(17,19,24,.05);
  --cptg-shadow-hover:  0 16px 48px rgba(17,19,24,.13), 0 4px 12px rgba(17,19,24,.07);
  --cptg-ease:          cubic-bezier(.4,0,.2,1);
}

/* ── Reset / base ─────────────────────────────────────── */
.cptg-section *,
.cptg-section *::before,
.cptg-section *::after {
  box-sizing: border-box;
}

/* ── Section ──────────────────────────────────────────── */
.cptg-section {
  width: 100%;
  font-family: "Montserrat", sans-serif;
}

/* ── Top bar (filtres + toggle) ────────────────────────── */
.cptg-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

/* ── Filter bar ───────────────────────────────────────── */
.cptg-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  background: #fff;
  border-radius: 60px;
  padding: 5px 6px;
  box-shadow: 0 2px 14px rgba(17,19,24,.08);
}

.cptg-filter__btn {
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--cptg-muted);
  letter-spacing: .01em;
  white-space: nowrap;
  transition:
    color .28s var(--cptg-ease),
    background .28s var(--cptg-ease),
    box-shadow .28s var(--cptg-ease);
  line-height: 1.4;
  font-family: "Montserrat", sans-serif;
}

.cptg-filter__btn:hover:not(.is-active) {
  color: var(--cptg-dark);
  background: #f2f4f8;
}

.cptg-filter__btn.is-active {
  background: var(--cptg-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(245,166,35,.40); /* fallback Safari < 15.4 */
  box-shadow: 0 4px 14px color-mix(in srgb, var(--cptg-accent) 40%, transparent);
}

/* ── View toggle ──────────────────────────────────────── */
.cptg-view-toggle {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.cptg-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--cptg-radius-sm);
  border: 1.5px solid var(--cptg-border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cptg-muted);
  transition: all .28s var(--cptg-ease);
}

.cptg-toggle-btn:hover,
.cptg-toggle-btn.is-active {
  background: var(--cptg-dark);
  border-color: var(--cptg-dark);
  color: #fff;
}

/* ── Grid wrapper (arrows + grid) ─────────────────────── */
.cptg-grid-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* ── Arrows ───────────────────────────────────────────── */
.cptg-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 94px;
  transition:
    transform .28s var(--cptg-ease),
    opacity .28s var(--cptg-ease);
}

.cptg-arrow:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.cptg-arrow:not(:disabled):hover {
  transform: scale(1.1);
}

.cptg-arrow--prev {
  background: var(--cptg-dark);
  color: #fff;
  margin-right: 18px;
  box-shadow: 0 4px 16px rgba(17,19,24,.22);
}

.cptg-arrow--next {
  background: var(--cptg-accent);
  color: #fff;
  margin-left: 18px;
  box-shadow: 0 4px 20px rgba(245,166,35,.42); /* fallback Safari < 15.4 */
  box-shadow: 0 4px 20px color-mix(in srgb, var(--cptg-accent) 42%, transparent);
}

/* ── Grid ─────────────────────────────────────────────── */
.cptg-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
}

/* ── Card ─────────────────────────────────────────────── */
.cptg-card {
  background: var(--cptg-card-bg);
  border-radius: var(--cptg-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(228,231,240,.7);
  transition:
    box-shadow .32s var(--cptg-ease),
    transform  .32s var(--cptg-ease);
  /* Pas d'animation ici : c'est le JS qui ajoute .cptg-enter pour éviter le conflit */
}

.cptg-card.cptg-hidden {
  display: none !important;
}

.cptg-card:hover {
  box-shadow: var(--cptg-shadow-hover);
  transform: translateY(-6px);
}

@keyframes cptgCardIn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Card image ───────────────────────────────────────── */
.cptg-card__image-wrap {
  display: block;
  text-decoration: none;
}

.cptg-card__image {
  position: relative;
  height: 236px;
  overflow: hidden;
}

.cptg-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10,12,20,.2) 100%);
  pointer-events: none;
}

.cptg-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s var(--cptg-ease);
}

.cptg-card:hover .cptg-card__image img {
  transform: scale(1.06);
}

/* ── Badge ────────────────────────────────────────────── */
.cptg-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  background: rgba(15,17,26,.68);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 40px;
  backdrop-filter: blur(8px) saturate(1.5);
  -webkit-backdrop-filter: blur(8px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.13);
  line-height: 1.4;
  font-family: "Montserrat", sans-serif;
}

/* ── Card body ────────────────────────────────────────── */
.cptg-card__body {
  padding: 26px 26px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 11px;
}

/* ── Title ────────────────────────────────────────────── */
.cptg-card__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--cptg-dark);
  line-height: 1.38;
  letter-spacing: -.01em;
  margin: 0;
}

.cptg-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color .22s var(--cptg-ease);
}

.cptg-card__title a:hover {
  color: var(--cptg-accent);
}

/* ── Description ──────────────────────────────────────── */
.cptg-card__desc {
  font-size: 13.5px;
  color: var(--cptg-muted);
  line-height: 1.7;
  flex: 1;
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

/* ── Divider ──────────────────────────────────────────── */
.cptg-card__divider {
  height: 1px;
  background: var(--cptg-border);
  margin: 2px 0;
  flex-shrink: 0;
}

/* ── Link ─────────────────────────────────────────────── */
.cptg-card__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cptg-accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: gap .28s var(--cptg-ease), color .28s var(--cptg-ease);
}

.cptg-card__link:hover {
  gap: 13px;
  color: var(--cptg-accent-hover);
}

.cptg-card__link-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cptg-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .28s var(--cptg-ease);
}

.cptg-card__link-icon svg {
  stroke: var(--cptg-accent);
  transition: stroke .28s var(--cptg-ease);
}

.cptg-card__link:hover .cptg-card__link-icon {
  background: var(--cptg-accent);
}

.cptg-card__link:hover .cptg-card__link-icon svg {
  stroke: #fff;
}

/* ── Empty state ──────────────────────────────────────── */
.cptg-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--cptg-muted);
  text-align: center;
  opacity: .6;
}

.cptg-empty p {
  font-size: 14px;
  margin: 0;
}

/* ── Pagination dots ──────────────────────────────────── */
.cptg-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}

.cptg-dot {
  height: 8px;
  width: 8px;
  border-radius: 4px;
  background: var(--cptg-border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all .28s var(--cptg-ease);
}

.cptg-dot.is-active {
  background: var(--cptg-accent);
  width: 26px;
}

.cptg-dot:not(.is-active):hover {
  background: var(--cptg-muted);
}

/* ══════════════════════════════════════════════
   LIST VIEW
══════════════════════════════════════════════ */
.cptg-grid.is-list-view {
  grid-template-columns: 1fr !important;
}

.cptg-grid.is-list-view .cptg-card {
  flex-direction: row;
}

.cptg-grid.is-list-view .cptg-card__image-wrap {
  width: 260px;
  flex-shrink: 0;
}

.cptg-grid.is-list-view .cptg-card__image {
  height: 100%;
  min-height: 180px;
}

/* ══════════════════════════════════════════════
   RE-ENTER ANIMATION (JS toggle)
══════════════════════════════════════════════ */
.cptg-card.cptg-enter {
  animation: cptgCardIn .42s var(--cptg-ease) both;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

/* Tablette large */
@media (max-width: 1100px) {
  .cptg-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Tablette */
@media (max-width: 768px) {
  .cptg-arrow {
    display: none;
  }

  .cptg-grid.is-list-view .cptg-card {
    flex-direction: column;
  }

  .cptg-grid.is-list-view .cptg-card__image-wrap {
    width: 100%;
  }

  .cptg-filter__btn {
    font-size: 12px;
    padding: 8px 14px;
  }

  .cptg-top-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile */
@media (max-width: 560px) {
  .cptg-grid {
    grid-template-columns: 1fr !important;
  }

  .cptg-filter-bar {
    border-radius: 16px;
    padding: 8px;
  }

  .cptg-filter__btn {
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 11.5px;
  }

  .cptg-card__body {
    padding: 20px 20px 18px;
  }

  .cptg-card__title {
    font-size: 17px;
  }

  .cptg-card__image {
    height: 200px;
  }
}

.cptg-top-bar .cptg-view-toggle .cptg-toggle-btn{
    padding: 0!important
}
#cptg-84be47f .cptg-grid-wrapper  .cptg-arrow{
    margin: 0 15px!important;
}
#cptg-84be47f .cptg-grid-wrapper{
    align-items: center
}