/* ===================================
   NUANCIER - STYLES POUR LES NUANCES
   =================================== */

:root {
  --primary-green: #015769;
  --accent-gold: #e6c97a;
  --text-dark: #18181b;
  --text-light: #666;
  --background-light: #f8f9fa;
  --border-light: #e0e4e7;
  --shadow-light: rgba(1, 87, 105, 0.1);
  --shadow-medium: rgba(1, 87, 105, 0.15);
  --shadow-strong: rgba(1, 87, 105, 0.25);
}

.nuancier-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 20px;
}

.nuancier-intro {
  text-align: center;
  margin-bottom: 80px;
}

.nuancier-intro h1 {
  font-family: "Abhaya Libre", serif;
  font-size: 3rem;
  color: var(--primary-green);
  margin-bottom: 24px;
  font-weight: 500;
  letter-spacing: -0.5px;
}

.nuancier-intro p {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--text-light);
  max-width: 700px;
  margin: 0 auto;
}

/* Grille des nuances */
.nuances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 40px;
  margin-top: 60px;
}

/* ===================================
   CARTE DE BASE - STRUCTURE COMMUNE
   =================================== */

/* Carte de nuance avec volet intégré */
.nuance-card {
  position: relative;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow-light);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  height: 280px;
}

/* Container de l'image et du volet */
.nuance-content-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* Image carrée avec bords arrondis - OCCUPE TOUTE LA LARGEUR PAR DÉFAUT */
.nuance-image-container {
  position: relative;
  width: 100%;
  height: 280px;
  flex-shrink: 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.nuance-image {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(
    135deg,
    var(--nuance-color, #d2b48c),
    var(--nuance-color-light, #d2b48c80)
  );
}

.nuance-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Image de fallback avec dégradé */
.nuance-image.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--nuance-color),
    var(--nuance-color-light)
  );
}

.nuance-image.fallback::before {
  content: "🌾";
  font-size: 4rem;
  opacity: 0.8;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Pastille de couleur sur l'image */
.couleur-pastille {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 3;
  transition: transform 0.3s ease;
}

/* Overlay avec nom de la nuance */
.nuance-name-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 40px 20px 20px;
  z-index: 2;
}

.nuance-name {
  font-family: "Abhaya Libre", serif;
  font-size: 1.5rem;
  color: white;
  font-weight: 500;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Volet de lecture - MASQUÉ PAR DÉFAUT */
.nuance-details-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  background: white;
  border-radius: 0 20px 20px 0;
  padding: 0;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 4;
  opacity: 0;
  visibility: hidden;
  box-shadow: none;
}

/* ===================================
   COMPORTEMENT DESKTOP - HOVER UNIQUEMENT
   =================================== */

/* Desktop : HOVER pour afficher le volet sur le côté */
@media (min-width: 769px) {
  .nuance-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 48px var(--shadow-medium);
  }

  .nuance-card:hover .nuance-details-panel {
    width: 320px;
    padding: 32px 28px;
    opacity: 1;
    visibility: visible;
    box-shadow: -8px 0 32px var(--shadow-light);
  }

  .nuance-card:hover .nuance-image-container {
    width: calc(100% - 320px);
  }

  .nuance-card:hover .nuance-image {
    border-radius: 20px 0 0 20px;
  }

  .nuance-card:hover .nuance-image img {
    transform: scale(1.08);
  }

  .nuance-card:hover .couleur-pastille {
    transform: scale(1.1);
  }
}

/* ===================================
   CONTENU DU VOLET - STYLES COMMUNS
   =================================== */

/* Contenu du volet - UTILISE LA COULEUR DE LA NUANCE */
.panel-header {
  margin-bottom: 24px;
}

.panel-title {
  font-family: "Abhaya Libre", serif;
  font-size: 1.4rem;
  color: var(--nuance-color, var(--primary-green));
  font-weight: 500;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.panel-reference {
  display: inline-block;
  background: linear-gradient(
    135deg,
    var(--nuance-color, var(--primary-green)),
    var(--nuance-color, #018a9f)
  );
  color: white;
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px var(--shadow-light);
}

/* Information couleur dans le volet */
.panel-color-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  padding: 16px;
  background: var(--background-light);
  border-radius: 12px;
  border-left: 4px solid var(--nuance-color, var(--primary-green));
}

.panel-color-pastille {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--nuance-color, rgba(1, 87, 105, 0.2));
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.panel-color-text {
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--nuance-color, var(--primary-green));
  font-weight: 600;
  background: white;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Description dans le volet */
.panel-description {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-dark);
  margin: 20px 0;
  padding: 16px;
  background: var(--background-light);
  border-radius: 12px;
}

/* Métadonnées */
.panel-meta {
  margin-top: 20px;
}

.panel-meta-item {
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.meta-label {
  font-weight: 600;
  color: var(--nuance-color, var(--primary-green));
  display: inline-block;
  min-width: 80px;
}

.meta-value {
  color: var(--text-dark);
}

/* État vide */
.nuances-empty {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-light);
}

.nuances-empty h3 {
  font-family: "Abhaya Libre", serif;
  font-size: 1.8rem;
  margin-bottom: 16px;
  color: var(--primary-green);
}

.nuances-empty p {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto;
}

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

@media (min-width: 769px) and (max-width: 1024px) {
  .nuances-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
  }

  .nuance-card {
    height: 260px;
  }

  .nuance-image-container {
    height: 260px;
  }

  .nuance-card:hover .nuance-details-panel {
    width: 280px;
    padding: 28px 24px;
  }

  .nuance-card:hover .nuance-image-container {
    width: calc(100% - 280px);
  }
}

/* ===================================
   MOBILE - CLIC POUR OUVRIR EN BAS
   =================================== */

@media (max-width: 768px) {
  .nuancier-container {
    padding: 40px 16px;
  }

  .nuancier-intro h1 {
    font-size: 2.4rem;
  }

  .nuances-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  /* CARTE MOBILE - STRUCTURE VERTICALE */
  .nuance-card {
    height: auto;
    overflow: visible;
    margin: 0 auto 20px auto;
    max-width: 100%;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow-light);
  }

  .nuance-content-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
  }

  .nuance-image-container {
    width: 100% !important;
    height: 280px !important;
    position: relative;
    transition: none;
  }

  .nuance-image {
    border-radius: 20px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transition: border-radius 0.4s ease;
  }

  .nuance-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: none !important;
    transition: none;
  }

  /* VOLET MOBILE - CACHÉ PAR DÉFAUT, PARTIE DU FLUX */
  .nuance-details-panel {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: 0;
    background: white;
    border-radius: 0 0 20px 20px;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-top: 1px solid #f0f0f0;
    box-shadow: none !important;
    z-index: 1;
  }

  /* CARTE MOBILE ACTIVE - VOLET OUVERT DANS LE FLUX */
  .nuance-card.active {
    transform: none !important;
    margin-bottom: 40px;
    box-shadow: 0 8px 32px var(--shadow-light) !important;
  }

  .nuance-card.active .nuance-details-panel {
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 24px 20px !important;
    width: 100% !important;
  }

  .nuance-card.active .nuance-image {
    border-radius: 20px 20px 0 0 !important;
  }

  .nuance-card.active .couleur-pastille {
    transform: none !important;
  }

  /* CONTENU DU VOLET MOBILE - RESPONSIVE */
  .panel-title {
    font-size: 1.3rem !important;
    margin-bottom: 12px !important;
    line-height: 1.2 !important;
  }

  .panel-reference {
    font-size: 0.85rem !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
  }

  .panel-color-info {
    margin: 16px 0 !important;
    padding: 12px !important;
    gap: 12px !important;
  }

  .panel-color-pastille {
    width: 32px !important;
    height: 32px !important;
  }

  .panel-color-text {
    font-size: 0.9rem !important;
    padding: 4px 8px !important;
  }

  .panel-description {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin: 16px 0 !important;
    padding: 16px !important;
  }

  .panel-meta-item {
    font-size: 0.85rem !important;
    margin-bottom: 8px !important;
  }

  .meta-label {
    font-weight: 600 !important;
    min-width: 70px !important;
  }
}

@media (max-width: 480px) {
  .nuancier-intro h1 {
    font-size: 2rem;
  }

  .nuances-grid {
    gap: 32px;
    padding: 0 8px;
  }

  .nuance-card {
    margin: 0 auto 16px auto !important;
    width: 100%;
    max-width: none;
  }

  .nuance-image-container {
    height: 250px !important;
  }

  .nuance-card.active {
    margin-bottom: 32px !important;
  }

  .couleur-pastille {
    width: 36px;
    height: 36px;
    top: 12px;
    right: 12px;
    border: 3px solid rgba(255, 255, 255, 0.95);
  }

  .nuance-card.active .nuance-details-panel {
    padding: 20px 16px !important;
  }

  .panel-title {
    font-size: 1.2rem !important;
  }

  .panel-description {
    font-size: 0.85rem !important;
    padding: 12px !important;
  }

  .panel-meta-item {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 360px) {
  .nuance-image-container {
    height: 220px !important;
  }

  .nuance-card.active .nuance-details-panel {
    padding: 16px 12px !important;
  }

  .nuance-card {
    margin: 0 auto 12px auto !important;
  }

  .nuance-card.active {
    margin-bottom: 24px !important;
  }
}

/* ===================================
   ANIMATIONS ET ACCESSIBILITÉ
   =================================== */

/* Animation d'apparition */
.nuance-card {
  opacity: 0;
  transform: translateY(40px);
  animation: fadeInUp 0.8s ease forwards;
}

.nuance-card:nth-child(1) {
  animation-delay: 0.1s;
}
.nuance-card:nth-child(2) {
  animation-delay: 0.2s;
}
.nuance-card:nth-child(3) {
  animation-delay: 0.3s;
}
.nuance-card:nth-child(4) {
  animation-delay: 0.4s;
}
.nuance-card:nth-child(5) {
  animation-delay: 0.5s;
}
.nuance-card:nth-child(6) {
  animation-delay: 0.6s;
}
.nuance-card:nth-child(7) {
  animation-delay: 0.7s;
}
.nuance-card:nth-child(8) {
  animation-delay: 0.8s;
}

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

/* Effet de focus pour l'accessibilité */
.nuance-card:focus {
  outline: 3px solid var(--nuance-color, var(--primary-green));
  outline-offset: 4px;
}
