/* ========== GLOBAL ========== */
:root{
  --bg-grad-top: #a9e1f0;
  --bg-grad-bot: #d0e7bd;
  --ink: #222;
  --ink-weak: #2d2d2d;
  --brand: #ff9e4f;
  --header-bg: #222;
  --card-bg: #fff;
  --shadow: 0 4px 12px rgba(0,0,0,.08);
}

html { 
  font-size: 16px;  /* force la base : 1rem = 16px */
  -webkit-text-size-adjust: 100%;  /* évite zoom iOS */
}

* { box-sizing: border-box;  }

body {
  margin: 0;
  font-family: "Fredoka", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  /*font-family: "Comfortaa", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;*/
  line-height: 1.2;
  font-size: 1rem;   /* = 16px partout */
  color: var(--ink);
  background: linear-gradient(to bottom, var(--bg-grad-top), var(--bg-grad-bot));
}

/* ========== HEADER + NAV ========== */
header {
  background: var(--header-bg);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.25rem;
  padding: 0.5rem 5rem;
  position: relative;
  align-items: center;
}

.logo img {
  height: 2.5vw;            /* fluide sur grands écrans */
  min-height: 40px;       /* garde une taille lisible */
  margin-bottom: 0.5rem;
}

.btn {
  font-family: "Comfortaa";
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

/* nav desktop */
.nav-toggle,
.hamburger { display: none; }
.btn.nav-account{ display:none; }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.14em;
}
.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.primary-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}
.primary-nav .nav-account { /* version nav du bouton */
  background: var(--brand);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
}
.btn.desktop{
    margin-top: 0.15rem;
}

/* Bouton fermer dans le menu mobile */
.close-btn {
  display: none; /* caché par défaut */
}

/* ========== MAIN / GRID / CARDS ========== */
main {
  padding: 2rem 5rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}
@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(3, 1fr); /* 3 colonnes quand assez large */
  }
}

.card {
  position: relative;             /* pour contenir les absolus */
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1rem;
  min-height: 35vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card img {
  max-height: 30vh;
  width: auto;
  object-fit: contain;
}
.talkid{
  position:relative;
  overflow: visible;
}
.talkid > img{
  position:absolute;
  max-height: 40vh;
  z-index: 2;
}

.card h2 { font-size: 2.2rem;  margin-bottom: 0.25rem; z-index:2;}
.card p  { font-family:sans-serif;color: var(--ink-weak); margin-top: 0; z-index:2; }

/* Variantes */
.hero {
  position: relative;
  background: none;
  box-shadow: none;
  justify-content: center;
  z-index: 2;
  padding:2rem 0;
  overflow: visible;
}
.hero h1{
  font-size: 3.2rem;
}
.card.hero::before {
    content: "";
    position: absolute;
    height: 8em;
    width: 8em;
    bottom:5%;
    left:-15%;
    background: url(https://aj-na.fr/talkid/Images/stars.png) no-repeat center / contain;
    z-index: -1;
}
.image-only {
  background: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-only img { margin-bottom: 0; }
.image-only.talkid img,
.image-only.boy-girl img {max-width:100%;height:auto; }
.image-only.boy-girl { 
  background: #a3e1f5;
  position: relative;
  overflow: visible;
}
.image-only.boy-girl::before {
    content: "";
    position: absolute;
    height: 10em;
    width: 10em;
    top: -6%;
    left: 80%;
    background: url(https://aj-na.fr/talkid/Images/cloud-1.png) no-repeat center / contain;
    z-index: 1;
}
.double-section {
  flex: 0 0 50%;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .75rem;
}
.boy-dad { 
  position:relative;
  background: #a3e1f5; 
  padding: 0; 
  overflow: visible;
}
.boy-dad img {
  position: absolute;
  width: 100%;
  bottom: .2vw;
  right: 0;
}
.boy-dad::before {
    content: "";
    position: absolute;
    height: 8em;
    width: 8em;
    top: -5%;
    left: 85%;
    background: url(https://aj-na.fr/talkid/Images/cloud-2.png) no-repeat center / contain;
    z-index: 1;
}
.kids {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .5rem;
  background-color: #f6d099;
  position:relative;
  overflow: visible;
}
.kids::before {
    content: "";
    position: absolute;
    height: 8em;
    width: 8em;
    top: 25%;
    left: 90%;
    background: url(https://aj-na.fr/talkid/Images/cloud-3.png) no-repeat center / contain;
    z-index: 1;
}
.kids img {
  flex: 0 0 50%;
  max-width: 50%;
  height: auto;
}
.dad-security {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background-color: #f4b886;
  position:relative;
  overflow: visible;
}
.dad-security::before {
    content: "";
    position: absolute;
    height: 8em;
    width: 8em;
    top: 5%;
    left: 85%;
    background: url(https://aj-na.fr/talkid/Images/cloud-4.png) no-repeat center / contain;
    z-index: 1;
}
.dad-security img {
  position: absolute;
  bottom: 0;
}
.kids-talking {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center; /* texte centré, image alignée seule en bas via align-self si besoin */
  gap: .5rem;
  padding: 0;
  background-color: #e7bcd6;
  position:relative;
  overflow: visible;
}
.kids-talking::before {
    content: "";
    position: absolute;
    height: 8em;
    width: 8em;
    top: -10%;
    left: -10%;
    background: url(https://aj-na.fr/talkid/Images/cloud-5.png) no-repeat center / contain;
    z-index: 1;
}
.kids-talking .double-section { padding-left: 1rem; }
.kids-talking img {
  flex: 0 0 50%;
  max-width: 40%;
  height: auto;
  bottom: 0;
  align-self: flex-end; /* image en bas à droite */
}
.voice-magic,
.emoji {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .5rem;
}
.voice-magic { 
  background:  #f6c5d4 url("https://aj-na.fr/talkid/Images/cloud-2.png") no-repeat left -20% bottom -20% / 40%;
}
.emoji       { background-color: #d1c4f1; }

.voice-magic img{
  right: 0;
  max-width: 50%;
}
.emoji img {
  position:absolute;
  right: 0;
}

/* ========== FOOTER ========== */
footer {
  background: var(--header-bg);
  color: #aaa;
  font-size: .9rem;
  padding: 0.5rem 2rem;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-left {
  text-align: center;
  flex: 1;
}
.footer-right {
  display: flex;
  align-items: center;
}
footer p{
  margin:0.5rem;
}
footer a {
  color: #aaa;
  text-decoration: none;
  margin: 0 .5rem;
}
/* Hide native select - use custom dropdown on all devices */
.native-select {
  display: none;
}

/* Custom language selector - shown on all devices */
.custom-language-selector {
  display: block;
}

.custom-lang-button {
  background: #fff;
  color: #222;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Fredoka", sans-serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  justify-content: space-between;
}

.custom-lang-button:hover {
  background: #f0f0f0;
  border-color: rgba(0, 0, 0, 0.3);
}

.lang-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.custom-lang-button:hover .lang-arrow {
  transform: translateY(-2px);
}

.custom-lang-button.open .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem 0;
  min-width: 140px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 100;
  max-height: 0;
  overflow: hidden;
}

.lang-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 300px;
  overflow-y: auto;
}

/* Custom scrollbar styling for language dropdown */
.lang-dropdown::-webkit-scrollbar {
  width: 6px;
}

.lang-dropdown::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.lang-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.lang-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

.lang-dropdown li {
  padding: 0.6rem 0.75rem;
  color: #222;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.lang-dropdown li:first-child {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.lang-dropdown li:last-child {
  border-bottom: none;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.lang-dropdown li:hover {
  background: rgba(0, 0, 0, 0.05);
}

.lang-dropdown li.active {
  background: var(--brand);
  color: #fff;
}

.footer-right {
  position: relative;
}

/* =========================================================
   ===============  LAPTOP (1025px–1439px)  ================
   ========================================================= */
@media (max-width: 1439px) and (min-width: 1025px) {
  main   { padding: 1.5rem 3rem; }
  header { padding: 1rem 3rem; }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
  }

  h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); }
  .card h2 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); }
  .card p  { font-size: clamp(.95rem, 2vw, 1rem); }

  .card img { max-width: 100%; }
  .image-only img { max-height: 40vh; }

  .boy-dad img { height: 38vh; right: 0%; }
  .kids-talking img,  .voice-magic img,  .emoji img { max-width: 55%; right: 5%; }

  footer {
    font-size: .85rem;
    padding: .75rem 1.5rem;
  }
  
  .custom-lang-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
  }
  
  .lang-dropdown li {
    font-size: 0.85rem;
  }
}

/* =========================================================
   =================  TABLET (<= 1024px)  ==================
   ========================================================= */
@media (max-width: 1024px) {
  /* Header compact + hamburger */
  header {
    padding: .75rem 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0rem;
  }
  .logo img { height: 40px; }
  .btn.nav-account{ display:block; }

  /* Afficher l’icône hamburger */
  .hamburger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.25);
    cursor: pointer;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
  }
  .hamburger .bar {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease;
  }

  .primary-nav {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(78vw, 360px);
    background: #222;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    gap: 1rem;
    transform: translateX(100%);
    transition: transform .3s ease;
    z-index: 1000;
  }
  .primary-nav ul {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 100%;
  }
  .primary-nav a { font-size: 1.05rem; }
  .primary-nav .nav-account {
    align-self: stretch;
    text-align: center;
    font-weight: 600;
    margin-top: .5rem;
  }
  .btn.nav-account{
    display:block;
  }
  .btn.desktop{
    display: none;
  }

  header::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 35%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }
  .close-btn {
      display: inline-flex;
      align-self: flex-end;
      font-size: 1.5rem;
      color: #fff;
      cursor: pointer;
      margin-top: auto;
      margin-right: 0.25rem;
      padding: 0.5rem;
      border-radius: 8px;
      transition: background 0.2s ease;
    }
    .close-btn:hover {
      background: rgba(255,255,255,0.1);
    }
  /* Checkbox -> ouvrir le menu */
  .nav-toggle:checked ~ .primary-nav { transform: translateX(0); }
  .nav-toggle:checked ~ .hamburger .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .hamburger .bar:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .hamburger .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Overlay activé quand le menu est ouvert (grâce à :has) */
  header:has(.nav-toggle:checked)::after {
    opacity: 1;
    pointer-events: auto;
  }

  /* Grille plus souple en tablette */
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
  }
.card {
  align-self: flex-start; /* empêche de s’étirer à la hauteur des autres */
  height: auto;
}
/* Nuages ajustés */
.card.hero::before {
    height: 7em;
    width: 7em;
    bottom: 0%;
    left: -20%;
  }
  .boy-dad::before,.dad-security::before{
    display:none;
  }
  .image-only.boy-girl::before {
    height: 7em;
    width: 7em;
    top: -10%;
    left: 80%;
  }
  .kids::before {
    height: 7em;
    width: 7em;
  }
  .voice-magic {
    background-position:left -20% bottom -10%;
  }
  
  /* Footer responsive for tablet */
  .footer-content {
    padding: 0.25rem 0;
  }
  
  .custom-lang-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
  }
  
  .lang-dropdown li {
    font-size: 0.85rem;
  }

}

/* =========================================================
   ==================  MOBILE (<= 768px)  ==================
   ========================================================= */
@media (max-width: 768px) {
  main { padding: 2rem;}
  .hero h1 {
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  line-height: 3rem;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Cartes : plus hautes, padding doux */
  .card {
    min-height: 30dvh;
    padding: 1rem 1.25rem;
  }

  .card > img,
  .image-only > img,
  .kids > img,
  .kids-talking > img,
  .dad-security > img,
  .boy-dad > img {
    position: static !important;
    display: block;
    height: auto;
    max-width: auto;
    order: -1;                   
  }
  .boy-dad > img,
  .kids-talking > img,
  .voice-magic > img,
  .emoji > img {
    order: 2;
    align-self: center;
    max-width: auto;
  }
  .dad-security{max-height: fit-content;}
  .dad-security > img {
    max-height: 100%;
    order: 2;                   
    width: 100%;
}
.kids-talking .double-section {
    padding-left: 0rem;
}
  .voice-magic > img, .emoji > img{
   order: 2;
    align-self: center;
    flex: 0 0 50%;
    max-width: 50%;             
  }

  /* Typo compacte */
  h1 { font-size: clamp(1.5rem, 6vw, 2.25rem); }
  .card h2 { font-size: clamp(1.25rem, 4.8vw, 1.6rem); margin-bottom: 0;}
  .card p  { font-size: clamp(.95rem, 3.8vw, 1.05rem); }

  /* Paddings de variantes */
  .boy-dad,
  .image-only.boy-girl,
  .kids,
  .kids-talking,
  .voice-magic,
  .emoji {
    padding: 1rem;
  }
  .dad-security{
    padding:0;
  }

/* Nuages ajustés */
.kids::before {
    top: -5%;
    left: 70%;
  }
  .kids-talking::before {
    height: 7em;
    width: 7em;
    top: 0%;
    left: -3%;
  }
  .voice-magic {
    background-position: left -20% bottom -35%;
  }
  
  /* Footer responsive for mobile */
  footer {
    padding: 0.5rem 1rem;
  }
  .footer-content {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.25rem 0;
  }
  .footer-left {
    text-align: center;
  }
  .footer-left p {
    margin: 0.25rem;
  }
  
  /* Adjust sizes for mobile */
  .custom-lang-button {
    font-size: 0.85rem;
    padding: 0.45rem 0.65rem;
    min-width: 110px;
  }
  
  .lang-dropdown {
    min-width: 130px;
  }
  
  .lang-dropdown li {
    font-size: 0.85rem;
    padding: 0.55rem 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary-nav,
  .hamburger .bar { transition: none; }
}

/* =========================================================
   ==================  MOBILE (<= 425px)  ==================
   ========================================================= */
@media (width <= 425px) {
  .grid {grid-template-columns: repeat(auto-fit, minmax(200px, max-content));grid-auto-columns: max-content;}
  .card {
    width: auto;
    max-width: 100%;
    height: auto;
  }

  .kids,
  .boy-dad,
  .dad-security,
  .kids-talking,
  .voice-magic,
  .emoji {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .double-section {max-width: 100%;  }
  .dad-security > img {
    max-width: auto;
    height: 100%;
  }
  .kids-talking > img, .voice-magic > img, .emoji > img{
    order: 2;
    align-self: center;
    flex: 0 0 50%;
    max-width: 100%;  
    height: 20vh;           
  }
  /* Nuages ajustés */
    .kids-talking::before {
    top: 25%;
    left: -5%;
  }
  .image-only.boy-girl::before {
      height: 6em;
      width: 6em;
      top: -20%;
      left: 70%;
  }
  .card.hero::before {
      height: 6em;
      width: 6em;
      bottom: 0%;
      left: -10%;
    }
    .voice-magic {
    background-position:left -20% bottom -5%;
  }
}