/* =========================================
   TEMPLATE — CARTES DE VISITE
   Grille propre, centrée, cohérente avec Portfolio
========================================= */

/* =========================
   PAGE
========================= */

body.template-page .page-title{
  margin-top: 2rem;
}

.template-section{
  padding: 3rem 0 4rem;
  margin-bottom: 4rem;
}

/* =========================
   GRILLE PRINCIPALE
========================= */

#template-gallery.template-container{
  display: grid;

  /* largeur des cartes */
  grid-template-columns: repeat(auto-fit, minmax(320px, 380px));

  /* centrage horizontal réel */
  justify-content: center;

  gap: 30px;

  /* limite largeur globale comme Portfolio */
  max-width: 1320px;

  margin: 1.5rem auto 0;

  padding: 0 20px;
}

/* =========================
   ITEM
========================= */

.template-item{
  width: 100%;
  max-width: 380px;
  margin: 0 auto;

  position: relative;
  overflow: hidden;

  background: #fff;

  box-shadow: 0 0 12px rgba(0,0,0,0.1);
}

/* IMPORTANT : empêche plein écran */
.template-item img{
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.template-wrapper{
  position: relative;
}

.template-wrapper:hover img{
  transform: scale(1.05);
}

/* =========================
   OVERLAY
========================= */

.template-overlay{
  position: absolute;
  inset: 0;

  background: rgba(0,0,0,0.75);

  color: #fff;

  padding: 20px;

  opacity: 0;

  transition: opacity 0.3s ease;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  text-align: center;

  gap: 10px;

  box-sizing: border-box;
}

.template-wrapper:hover .template-overlay{
  opacity: 1;
}

.template-wrapper:focus-within .template-overlay{
  opacity: 1;
}

.template-wrapper:focus-visible{
  outline: 2px solid var(--cta);
  outline-offset: 4px;
}

.template-overlay h3{
  font-size: clamp(1rem, 2.2vw, 1.1rem);
  margin: 0;
}

.template-overlay p{
  font-size: clamp(0.82rem, 1.9vw, 0.95rem);
  margin: 0;
}




/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px){

  #template-gallery.template-container{
    /* 1 colonne centrée, largeur contrôlée */
    grid-template-columns: minmax(260px, 380px);

    gap: 20px;
    padding: 0 16px;
  }

}

/* =========================
   ACCESSIBILITÉ
========================= */

@media (prefers-reduced-motion: reduce){

  .template-item img,
  .template-overlay{
    transition: none;
  }

  .template-wrapper:hover img{
    transform: none;
  }

}