/* =============================================================
   Custom Post Slider — styles de base
   Les couleurs, typos et tailles sont contrôlées par Elementor.
   ============================================================= */

/* ── Wrapper ───────────────────────────────────────────────── */
.cps-wrapper {
  position: relative;
  width: 100%;
  --cps-arrow-button-size: 44px;
  --cps-arrow-outside-gap: 12px;
}

/* ── Viewport / masque ─────────────────────────────────────── */
.cps-viewport {
  overflow: hidden;
  /* Ne pas forcer le curseur 'main' : laisser le comportement par défaut
     (texte sélectionnable) et n'afficher le curseur de saisie que pendant
     le drag via le script JS qui mettra 'grabbing' sur mousedown. */
  cursor: default;
}

/* ── Track ─────────────────────────────────────────────────── */
.cps-track {
  display: flex !important;
  will-change: transform;
}

/* ── Slide ──────────────────────────────────────────────────── */
.cps-slide {
  flex-shrink: 0 !important;
  min-width: 0 !important;
}

/* ── Carte ──────────────────────────────────────────────────── */
.cps-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

/* ── Image ──────────────────────────────────────────────────── */
.cps-image-wrap {
  display: block;
  overflow: hidden;
  height: 200px; /* valeur par défaut, surchargée par Elementor */
  flex-shrink: 0;
}

.cps-image-wrap a {
  display: block;
  width: 100%;
  height: 100%;
}

.cps-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.cps-card:hover .cps-image-wrap img {
  transform: scale(1.04);
}

/* ── Contenu ────────────────────────────────────────────────── */
.cps-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}

/* ── Méta ───────────────────────────────────────────────────── */
.cps-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: #888;
}

.cps-meta-sep {
  opacity: 0.5;
}

/* ── Titre ──────────────────────────────────────────────────── */
.cps-title {
  margin: 0 0 8px;
  line-height: 1.3;
}

.cps-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cps-title a:hover {
  opacity: 0.8;
}

/* ── Extrait ────────────────────────────────────────────────── */
.cps-excerpt {
  margin: 0 0 12px;
  flex: 1; /* pousse le bouton en bas */
  line-height: 1.6;
}

/* ── Bouton ─────────────────────────────────────────────────── */
.cps-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  align-self: flex-start;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.1s ease;
  line-height: 1;
}

.cps-button--icon-after {
  flex-direction: row-reverse;
}

.cps-button-icon,
.cps-button-text {
  display: inline-flex !important;
  align-items: center !important;
}

.cps-button-icon {
  flex-shrink: 0;
  line-height: 0;
}

.cps-button-icon svg {
  display: block !important;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.cps-button-icon i {
  font-size: 1em;
}

.cps-button:hover {
  transform: translateY(-1px);
}

.cps-button:active {
  transform: translateY(0);
}

/* ── Navigation (flèches) ───────────────────────────────────── */
.cps-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px;
  margin-top: 0;
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: calc((var(--cps-arrow-button-size) + var(--cps-arrow-outside-gap)) * -1);
  right: calc((var(--cps-arrow-button-size) + var(--cps-arrow-outside-gap)) * -1);
  transform: translateY(-50%);
  padding: 0 !important;
  pointer-events: none;
  z-index: 10;
}

/* Bouton flèche */
.cps-wrapper .cps-arrow {
  appearance: none;
  -webkit-appearance: none;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--cps-arrow-button-size) !important;
  height: var(--cps-arrow-button-size) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  cursor: pointer;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: all;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.1s ease;
  flex-shrink: 0;
  line-height: 1 !important;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.cps-wrapper .cps-arrow:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.cps-wrapper .cps-arrow:active {
  transform: translateY(0);
}

.cps-wrapper .cps-arrow.is-disabled,
.cps-wrapper .cps-arrow[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.cps-wrapper .cps-arrow svg {
  display: block !important;
  width: 20px;
  height: 20px;
  fill: #333;
  pointer-events: none !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

/* ── Dots ───────────────────────────────────────────────────── */
.cps-dots {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.cps-wrapper .cps-dot {
  appearance: none;
  -webkit-appearance: none;
  display: block !important;
  width: 8px;
  height: 8px;
  min-width: 0 !important;
  min-height: 0 !important;
  border-radius: 50px;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  background-color: #ccc;
  line-height: 1 !important;
  font-size: 0;
  box-sizing: border-box;
  transition:
    background-color 0.25s ease,
    width 0.25s ease;
}

/* Clic sur image / titre / bouton */
.cps-button,
.cps-image-wrap a,
.cps-title a {
  cursor: pointer;
}

.cps-dot.is-active {
  background-color: #333;
  width: 24px;
}

/* ── Visibilité responsive Elementor ───────────────────────── */
@media (min-width: 1025px) {
  .cps-responsive-visibility:not(.cps-show-desktop) {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .cps-responsive-visibility:not(.cps-show-tablet) {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .cps-responsive-visibility:not(.cps-show-mobile) {
    display: none !important;
  }
}

/* ── Message vide ───────────────────────────────────────────── */
.cps-no-posts {
  padding: 24px;
  text-align: center;
  color: #888;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 767px) {
  .cps-wrapper {
    --cps-arrow-button-size: 38px;
  }

  .cps-nav {
    left: calc((var(--cps-arrow-button-size) + var(--cps-arrow-outside-gap)) * -1);
    right: calc((var(--cps-arrow-button-size) + var(--cps-arrow-outside-gap)) * -1);
  }

  .cps-nav {
    gap: 6px;
  }
  .cps-arrow {
    width: var(--cps-arrow-button-size) !important;
    height: var(--cps-arrow-button-size) !important;
  }
  .cps-arrow svg {
    width: 18px;
    height: 18px;
  }
}

/* Accessibility helper: visually hidden but available to screen readers */
.cps-sr-only {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Visible focus states for keyboard users */
.cps-arrow:focus,
.cps-dot:focus,
.cps-button:focus,
.cps-image-wrap a:focus,
.cps-title a:focus {
  outline: 3px solid rgba(21, 156, 228, 0.6);
  outline-offset: 2px;
}
