/* ==========================================================================
   CONFIGURATION GLOBALE (Polices & Variables)
   ========================================================================== */
:root {
  --font-display: 'carte', serif;
  --font-body: Arial, Helvetica, sans-serif;
  --color-background: #404040;
  --color-surface: #FFF5EE;
  --color-text-primary: #222;
  --color-text-warm: #832;
  --color-accent: #4444FF;
  --shadow-vignette: 8px 8px 15px rgba(0, 0, 0, 0.3);
  --shadow-vignette-hover: -15px 15px 30px rgba(0, 0, 0, 0.25);
}

@font-face {
  font-family: 'carte';
  src: url('/commun/img_son/Tartlers_End.ttf');
}

/* ==========================================================================
   STYLES DE BASE
   ========================================================================== */
html {
  font-size: 1.3vw;
  font-family: var(--font-body);
  box-sizing: border-box; /* Inclut padding dans la largeur */
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  background-color: var(--color-background);
  padding-bottom: 8vh;
  margin: 0;
  min-height: 100vh;
}

a {
  text-decoration: none;
}

/* ==========================================================================
   ÉLÉMENTS PRINCIPAUX (Titre, Message)
   ========================================================================== */
#zone_principale {
  position: absolute;
  top: 1vh;
  height: 93vh;
  left: 1vw;
  right: 1vw;
  background-color: var(--color-surface);
  border-radius: 5px;
}

#titre_atelier {
  position: absolute;
  top: 3vh;
  right: 3vw;
  text-align: right;
  font-size: 1em;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-family: var(--font-display);
  color: #ffffff;
  background: linear-gradient(90deg, #FFD700, #00EE00, #0000FF, #FF00FF, #F00, #7a4b22);
  background-size: 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
  animation: gradient-shift 6s infinite ease-in-out;
  cursor: pointer;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#titre_atelier:hover::before {
  content: '👁  ';
}

#message_bienvenue {
  position: absolute;
  top: 5vh;
  left: 4vw;
  font-size: clamp(0.7em, 1.5vw, 1em);
  font-family: var(--font-display);
  color: var(--color-text-warm);
  font-weight: bold;
  letter-spacing: 0.1em;
  padding: 10px 20px;
  background: linear-gradient(90deg, #ffefba, #ffffff);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  animation: slideAndRotate 1s ease-out;
}

@keyframes slideAndRotate {
  from {
    opacity: 0;
    transform: translateX(-100px) rotate(-8deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(0deg) scale(1);
  }
}

#LVH
{
	width: 36%;
	height: auto;
	position: fixed;
	top: 40%;
	left:50%;
	transform: translate(-50%, -50%);
}

/* ==========================================================================
   VIGNETTES (en positionnement absolu)
   ========================================================================== */
.vignette {
  position: absolute;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-vignette);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.vignette:hover {
  transform: translateZ(50px) translateY(-15px) rotateX(15deg) rotateY(-15deg) rotateZ(2deg);
  box-shadow: var(--shadow-vignette-hover), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.vignette:active {
  background-color: yellow;
}

.nb_element_vignette {
  position: absolute;
  bottom: 5%;
  right: 5%;
  font-family: var(--font-display);
  font-weight: 600;
  text-align: right;
  color: var(--color-text-primary);
  font-size: 0.8em;
  letter-spacing: 0.1em;
}

.nom_atelier_vignette {
  position: absolute;
  top: 10%;
  left: 4%;
  width: 92%;
  height: 50%;
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  white-space: normal;
  color: var(--color-accent);
  font-size: 0.9em;
  letter-spacing: 0.1em;
}

.nom_atelier_vignette > div {
  padding-top: 1vh;
  text-align: right;
  font-style: italic;
  color: red;
  opacity: 0.7;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
#home-footer {
    position: fixed;
    bottom: 0;
    left: 1vw;
    width: 98vw;
    background: linear-gradient(to top, #241, #3D352A);
    color: #EE9;
    font-size: clamp(10px, 1.5vw, 16px);
    padding: 1vh 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
}

#footer-info {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 1vw;
    max-width: 100%; /* Prévention du débordement */
}

#lien-link {
    flex: 1;
    text-align: center;
}

#lien-link > a {
    color: red;
    font-size: clamp(12px, 1.6vw, 16px);
    opacity: 0.8;
    transition: opacity 0.5s ease;
}

#lien-link > a:hover {
    opacity: 1;
}

#footer-credits {
    flex: 1;
    text-align: right;
    white-space: nowrap;
    padding: 0 1vw;
    max-width: 100%; /* Prévention du débordement */
}

/* ==========================================================================
   POSITIONNEMENT RESPONSIVE
   ========================================================================== */
@media (orientation: landscape) {
  .vignette { width: 20vw; height: 20vh; }

  #theme_simple_english, #theme_russe, #theme_vietnamien { left: 3vw; }
  #theme_anglais, #theme_bulgare, #theme_allemand { left: 27vw; }
  #theme_chinois, #theme_français_A2, #theme_espagnol { right: 27vw; }
  #theme_japonais, #theme_LVH, #theme_tkd { right: 3vw; }

  #theme_simple_english, #theme_anglais, #theme_français_A2, #theme_LVH { top: 15vh; }
  #theme_russe, #theme_bulgare, #theme_chinois, #theme_japonais { top: 42vh; }
  #theme_vietnamien, #theme_allemand, #theme_espagnol, #theme_tkd { top: 69vh; }
}

@media (orientation: portrait) {
  #zone_principale { height: 94vh; }
  #titre_atelier { top: 2vh; right: 4vw; font-size: 2em; }
  #message_bienvenue { top: 6vh; left: 6vw; width: 55vw; padding: 10px; font-size: 2em; }

  /* 1. Ajustement de la taille des cartes pour donner de l'air */
  .vignette { width: 42vw; height: 11vh; } 
  .nb_element_vignette, .nom_atelier_vignette { font-size: clamp(11px, 2.5vw, 24px); }

  /* 2. Correction des textes qui se chevauchent */
  .nom_atelier_vignette {
      height: auto; /* Annule le 50% qui forçait le débordement */
      line-height: 1.1; 
  }
  .nom_atelier_vignette > div {
      padding-top: 2px; /* Réduit drastiquement l'espace avant le texte rouge */
  }

  /* 3. Replacement vertical (adapté à la nouvelle hauteur de 11vh) */
  #theme_simple_english, #theme_français_A2, #theme_russe, #theme_chinois, #theme_allemand, #theme_vietnamien { left: 4vw; }
  #theme_anglais, #theme_LVH, #theme_bulgare, #theme_japonais, #theme_espagnol, #theme_tkd { right: 4vw; }

  #theme_simple_english, #theme_anglais { top: 14vh; }
  #theme_français_A2, #theme_LVH { top: 27vh; }
  #theme_russe, #theme_bulgare { top: 40vh; }
  #theme_chinois, #theme_japonais { top: 53vh; }
  #theme_allemand, #theme_espagnol { top: 66vh; }
  #theme_vietnamien, #theme_tkd { top: 79vh; }

  /* 4. Correction du Footer (empêche le texte d'être tronqué) */
  #home-footer {
      font-size: clamp(10px, 2.2vw, 14px);
      padding: 1vh 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      min-height: 6vh;
      height: auto;
  }
  #footer-info, #footer-credits {
      flex: 1;
      white-space: normal; /* Remplace nowrap pour autoriser le retour à la ligne */
      line-height: 1.2;
      padding: 0 2vw;
  }
  #footer-info { text-align: left; }
  #footer-credits { text-align: right; }
  #lien-link {
      flex: 1;
      text-align: center;
  }

  /* 5. Correction de l'image LVH */
  #LVH {
      width: auto;
      height: 5vh;
      position: absolute; /* Remplace le 'fixed' pour rester DANS la carte */
      top: 33%;
      left: 50%;
      transform: translate(-50%, -50%);
  }
}
/* ==========================================================================
   CORRECTION SPÉCIFIQUE iPHONE SE ET TRÈS PETITS ÉCRANS
   ========================================================================== */
@media (max-width: 375px) and (orientation: portrait), (max-height: 700px) and (orientation: portrait) {
  
  /* On réduit la taille du titre et du bandeau pour gagner de la place en haut */
  #titre_atelier { font-size: 1.5em; top: 1.5vh; }
  #message_bienvenue { font-size: 1.8em; padding: 5px; top: 6vh;width: 55vw; }
  /* On donne un poil plus de hauteur relative aux cartes pour encaisser le texte */
  .vignette { height: 12vh; } 
  
  /* Réduction drastique des typographies internes */
  .nb_element_vignette, .nom_atelier_vignette { 
      font-size: clamp(9px, 3.5vw, 12px); 
  }
  .nom_atelier_vignette > div {
      font-size: 0.85em; /* Réduit le sous-titre rouge (CECRL, JLPT...) */
  }

  /* Ajustement de l'image LVH pour ne pas déborder */
  #LVH { height: 5vh; }

  /* Ajustement du footer pour qu'il reste sur une ou deux lignes propres */
  #home-footer { font-size: 9px; padding: 0.5vh 0; }
  #footer-info, #footer-credits { padding: 0 1vw; }
}
/* ==========================================================================
   CORRECTION ÉCRANS CARRÉS / TABLETTES (Ratio proche de 1:1)
   ========================================================================== */
@media (min-aspect-ratio: 3/4) and (max-aspect-ratio: 4/3) {
  
  #message_bienvenue {
        top: 9vh;
        width: 65vw;
        font-size: 1.4em;
    }
  
  /* On réduit la taille maximale des polices pour éviter les débordements */
  .nb_element_vignette, .nom_atelier_vignette { 
      font-size: clamp(12px, 1.8vw, 18px); 
  }
  .nom_atelier_vignette > div {
      font-size: 0.85em;
  }

  /* On fige la hauteur des cartes et on réduit un peu leur largeur */
  .vignette { 
      height: 10vh; 
      width: 44vw; 
  }

  /* CORRECTION : On force le placement sur 2 colonnes et on annule les valeurs héritées */
  #theme_simple_english, #theme_français_A2, #theme_russe, #theme_chinois, #theme_allemand, #theme_vietnamien { 
      left: 4vw; 
      right: auto; 
  }
  #theme_anglais, #theme_LVH, #theme_bulgare, #theme_japonais, #theme_espagnol, #theme_tkd { 
      right: 4vw; 
      left: auto; 
  }

  /* On rapproche les cartes verticalement (intervalle de 12vh au lieu de 13vh) */
  #theme_simple_english, #theme_anglais { top: 15vh; }
  #theme_français_A2, #theme_LVH { top: 27vh; }
  #theme_russe, #theme_bulgare { top: 39vh; }
  #theme_chinois, #theme_japonais { top: 51vh; }
  #theme_allemand, #theme_espagnol { top: 63vh; }
  #theme_vietnamien, #theme_tkd { top: 75vh; }
  
  /* La dernière carte se termine à 85vh (75 + 10), laissant 15vh pour le footer */
  #LVH { height: 5vh; width:auto;}
}