/* =======================================================
   TRAM-E — PAGE RÉSIDENCES
   Couleurs primaires franches, zéro dégradé, grille uniforme
======================================================= */

body.page-residences {
  background: white;
  color: #f0ece0;
}

.res-wrapper {
  width: 100%;
  min-height: 100%;
}

/* =======================================================
   HERO
======================================================= */

.res-hero {
  padding: 0 4rem 3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgb(33, 36, 39);
  z-index: 0;
}
.page-evenements .res-hero{
  background-color: #e67e22;
}
.page-residences .res-hero{
  background-color: #29bad4;
}

.res-hero events {
  background-color: #ffc20a;
}
.res-hero__eyebrow {
  font-family: "Mohave", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: white;
  margin-bottom: 1rem;
  z-index: 2;
}

.res-hero__title {
  font-family: "Matrimoine", sans-serif;
  font-size: clamp(3.5rem, 8vw, 9rem);
  line-height: 0.9;
  color: rgb(255, 255, 255);
  margin-bottom: 1.5rem;
  z-index: 2;
}

.res-hero__intro {
  font-family: "Mohave", sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  color: rgba(255, 255, 255, 0.8);
  max-width: 520px;
  border-left: 3px solid #fff;
  padding-left: 1.2rem;
  z-index: 2;
}
/* =======================================================
   GRILLE — cases toutes identiques
======================================================= */

.res-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 300px; /* hauteur uniforme */
  gap: 4px;
  padding: 4px;
}

/* =======================================================
   CARTE
======================================================= */

.res-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--card-color, #222);
}

/* Image de fond */
.res-card__bg {
  position: absolute;
  inset: 0;
}

.res-card__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: brightness(0.55);
}

.res-card__placeholder {
  width: 100%;
  height: 100%;
  background: var(--card-color, #333);
}

/* Overlay aplat couleur au survol — PAS de dégradé */
.res-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-color, #000);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
  mix-blend-mode: multiply;
}

.res-card:hover::after {
  opacity: 0.55;
}

/* Trait coloré pleine largeur en bas */
.res-card::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-color, #fff);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
  z-index: 3;
}

.res-card:hover::before {
  transform: scaleX(1);
}

/* Zoom image au hover */
.res-card:hover .res-card__bg img {
  transform: scale(1.06);
  filter: brightness(0.4);
}

.res-card--video {
  position: relative;   
  display: block;
  width: 100%;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  appearance: none;
}
.res-video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
}

.res-video-lightbox.active {
  display: flex;
}

.res-video-lightbox video {
  max-width: 90vw;
  max-height: 85vh;
}

.res-video-lightbox__close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}
/* =======================================================
   CONTENU DE LA CARTE
======================================================= */

.res-card__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  z-index: 2;
}

.res-card__title {
  font-family: "Matrimoine", sans-serif;
  font-size: clamp(1.1rem, 1.8vw, 1.6rem);
  line-height: 1.1;
  color: #fff;
  margin-bottom: 0;
  transition: margin-bottom 0.3s ease;
}

.res-card__desc {
  font-family: "Mohave", sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin: 0.6rem 0 0.8rem;
  max-width: 280px;
  /* Caché par défaut, révélé au hover */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.35s ease,
    opacity 0.3s ease 0.05s;
}

.res-card:hover .res-card__desc {
  max-height: 80px;
  opacity: 1;
}

.res-card__cta {
  font-family: "Mohave", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: var(--card-color, #555);
  padding: 4px 12px;
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease 0.1s,
    transform 0.25s ease 0.1s;
}

.res-card:hover .res-card__cta {
  opacity: 1;
  transform: translateY(0);
}

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

.res-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.res-lightbox.active {
  display: flex;
}

.res-lb__inner {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.res-lb__header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 1rem;
}

.res-lb__title {
  font-family: "Matrimoine", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: #fff;
  margin-bottom: 0.4rem;
}

.res-lb__desc {
  font-family: "Mohave", sans-serif;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
}

.res-lb__main {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
}

.res-lb__main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.res-lb__thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.res-lb__thumbs img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  border: 2px solid transparent;
}

.res-lb__thumbs img:hover,
.res-lb__thumbs img.active {
  opacity: 1;
  border-color: #fff;
}

.res-lb__empty {
  font-family: "Mohave", sans-serif;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding: 4rem;
  font-style: italic;
}

/* Boutons lightbox */
.res-lb__close,
.res-lb__prev,
.res-lb__next {
  position: fixed;
  background: #fff;
  color: #000;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    transform 0.2s;
  font-family: "Mohave", sans-serif;
}

.res-lb__close:hover,
.res-lb__prev:hover,
.res-lb__next:hover {
  background: #ff00e9;
  color: #fff;
}

.res-lb__close {
  top: 1.5rem;
  right: 1.5rem;
}
.res-lb__prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}
.res-lb__next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}
.res-lb__prev:hover {
  transform: translateY(-50%) scale(1.1);
}
.res-lb__next:hover {
  transform: translateY(-50%) scale(1.1);
}

/* =======================================================
   RESPONSIVE
======================================================= */

@media (max-width: 1024px) {
  .res-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .res-hero {
    padding: 4rem 2rem 2.5rem;
  }
}

@media (max-width: 640px) {
  .res-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 220px;
  }
  .res-hero {
    padding: 3rem 1.5rem 2rem;
  }
  .res-lb__prev,
  .res-lb__next {
    display: none;
  }
  .res-card__desc {
  max-height: 80px;
  opacity: 1;
}
.res-card__cta {
  opacity: 1;
  transform: translateY(0);
}
}

/* =======================================================
   PAGE DÉTAIL RÉSIDENCE — /residence.php?slug=...
======================================================= */

.res-detail {
  width: 100%;
  min-height: 100%;
  background: #111;
}

/* =======================================================
   LAYOUT 2 COLONNES — fixe gauche / galerie droite
======================================================= */

.res-detail__layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
  align-items: start;
}

/* =======================================================
   COLONNE GAUCHE — sticky
======================================================= */

.res-detail__left {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0d0d0d;
}

/* En-tête : lien retour + titre + description */
.res-detail__header {
  padding: 2.5rem 2.5rem 2rem;
  flex-shrink: 0;
}

.res-detail__back {
  display: inline-block;
  font-family: "Mohave", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.res-detail__back:hover {
  color: var(--res-color);
}

.res-detail__label {
  font-family: "Mohave", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--res-color);
  margin-bottom: 0.8rem;
}

.res-detail__titre {
  font-family: "Matrimoine", sans-serif;
  font-size: clamp(2rem, 3.5vw, 3.5rem);
  line-height: 1;
  color: #fff;
  margin-bottom: 1.5rem;
}

.res-detail__desc {
  font-family: "Mohave", sans-serif;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.55);
  border-left: 3px solid var(--res-color);
  padding-left: 1rem;
}

/* Barre couleur séparatrice */
.res-detail__bar {
  height: 4px;
  background: var(--res-color);
  flex-shrink: 0;
}

/* Zone média : vidéo ou cover — prend le reste de la hauteur */
.res-detail__media {
  flex: 1;
  overflow: hidden;
  background: var(--res-color, #222);
  position: relative;
  min-height: 0;
}

.res-detail__media img,
.res-detail__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.res-detail__placeholder {
  width: 100%;
  height: 100%;
  background: var(--res-color, #333);
  opacity: 0.3;
}

/* =======================================================
   COLONNE DROITE — galerie scrollable
======================================================= */

.res-detail__right {
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  min-height: 100vh;
}

/* Image principale */
.res-detail__gal-main {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}

.res-detail__gal-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Compteur */
.res-detail__gal-count {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: "Mohave", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 10px;
  border-radius: 2px;
}

/* Boutons prev/next */
.res-detail__gal-prev,
.res-detail__gal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}

.res-detail__gal-prev {
  left: 1rem;
}
.res-detail__gal-next {
  right: 1rem;
}

.res-detail__gal-prev:hover,
.res-detail__gal-next:hover {
  background: var(--res-color);
}

/* Grille de vignettes */
.res-detail__gal-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
  flex: 1;
  align-content: start;
}

.res-detail__gal-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  transition:
    border-color 0.2s,
    opacity 0.2s;
  opacity: 0.55;
}

.res-detail__gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.res-detail__gal-thumb:hover {
  opacity: 0.85;
}
.res-detail__gal-thumb.active {
  border-color: var(--res-color);
  opacity: 1;
}

/* Galerie vide */
.res-detail__gal-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  font-family: "Mohave", sans-serif;
  color: rgba(255, 255, 255, 0.2);
  font-style: italic;
}

/* =======================================================
   RESPONSIVE — TABLETTE
======================================================= */

@media (max-width: 1024px) {
  .res-detail__layout {
    grid-template-columns: 320px 1fr;
  }

  .res-detail__header {
    padding: 2rem;
  }
}

/* =======================================================
   RESPONSIVE — MOBILE
======================================================= */

@media (max-width: 768px) {
  .res-detail__layout {
    grid-template-columns: 1fr;
  }

  /* Colonne gauche : non sticky, hauteur auto */
  .res-detail__left {
    position: static;
    height: auto;
  }

  .res-detail__media {
    height: 55vw;
    min-height: 220px;
  }

  .res-detail__gal-thumbs {
    grid-template-columns: repeat(3, 1fr);
  }
}
