/* ==========================================================================
   Landing page IBM SkillsBuild – Formation IA gratuite
   Palette IBM (brief) + 3 nuances de texte Carbon pour la lisibilité/contraste.
   Mobile-first.
   ========================================================================== */

:root {
  /* Palette du brief */
  --ibm-blue: #0f62fe;      /* CTA, liens, éléments interactifs */
  --black: #000000;         /* Titres principaux */
  --white: #ffffff;         /* Fond principal */
  --gray-10: #f2f4f8;       /* Fonds secondaires */
  --blue-10: #e5f6ff;       /* Sections de mise en avant */

  /* Compléments Carbon (justifiés : états et lisibilité) */
  --ibm-blue-hover: #0050e6; /* survol bouton (Carbon button-primary-hover) */
  --ibm-blue-active: #002d9c;
  --text: #161616;           /* texte courant (Carbon text-primary) */
  --text-secondary: #525252; /* texte secondaire, contraste 7.8:1 sur blanc */
  --border: #c6c6c6;         /* séparateurs FAQ */
  --border-subtle: #e0e0e0;  /* header, footer, cartes */

  --font-sans: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, Consolas, monospace;

  --gutter: 1rem;
  --section-space: 2.25rem;
  --ease: cubic-bezier(0.2, 0, 0.38, 0.9); /* Carbon productive standard */
}

@media (min-width: 672px)  { :root { --gutter: 2rem; } }
@media (min-width: 1056px) { :root { --section-space: 3rem; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { margin: 0; color: var(--black); font-weight: 400; }

h1 {
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.5rem);
  line-height: 1.2;
}

h3 {
  font-size: 1.125rem;
  line-height: 1.4;
  font-weight: 600;
}

p { margin: 0; }

a { color: var(--ibm-blue); }
a:hover { color: var(--ibm-blue-hover); }

:focus-visible {
  outline: 2px solid var(--ibm-blue);
  outline-offset: 2px;
}

[id] { scroll-margin-top: 1rem; }

.container {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ibm-blue);
  color: var(--white);
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; color: var(--white); }

/* Listes de mise en page (sans puces) */
.site-nav ul, .hero__assurances, .skills, .steps, .site-footer__legal ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- CTA (composant CTAButton) ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  width: 22rem;          /* même largeur pour tous les CTA (calée sur le libellé le plus long) */
  max-width: 100%;
  min-height: 3rem;
  padding: 0.875rem 1rem 0.875rem 1.25rem;
  background: var(--ibm-blue);
  color: var(--white);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  transition: background-color 150ms var(--ease);
}
/* Animation discrète : un reflet lumineux traverse le bouton automatiquement,
   toutes les 4 s (traversée de 0,75 s puis pause) */
.cta::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  animation: cta-shine 4s var(--ease) infinite;
}
@keyframes cta-shine {
  0% { transform: skewX(-20deg) translateX(0); }
  19%, 100% { transform: skewX(-20deg) translateX(480%); }
}
.cta:hover { background: var(--ibm-blue-hover); color: var(--white); }
.cta:active { background: var(--ibm-blue-active); }
.cta:focus-visible {
  outline: none;
  border-color: var(--ibm-blue);
  box-shadow: inset 0 0 0 1px var(--ibm-blue), inset 0 0 0 2px var(--white);
}
.cta__arrow { flex: none; }

@media (max-width: 479px) {
  .cta { width: 100%; }
}

.cta-group { margin-top: 2rem; }
.cta-group__note {
  margin-top: 0.75rem;
  font-style: italic;
  color: var(--text-secondary);
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--border-subtle); }
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.75rem;
}
.site-header__logo { display: inline-block; padding: 0.25rem 0; }
.site-header__logo img { width: auto; height: 1.5rem; }

.site-nav ul {
  display: flex;
  gap: 1.5rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ibm-blue); border-bottom-color: var(--ibm-blue); }

/* ---------- Hero ---------- */
.hero {
  padding-block: 1.75rem 2.25rem;
  overflow: hidden;
}
.hero__inner {
  display: grid;
  gap: 3rem;
  align-items: center;
}
.hero__content { max-width: 44rem; }
.hero__lead {
  margin-top: 1.25rem;
  font-size: 1.125rem;
  line-height: 1.55;
}
.hero__assurances {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.5rem 0 2rem;
  font-weight: 600;
}
.hero__assurances li { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero__assurances li::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  background: url("../icon/check.svg") center / contain no-repeat;
}
.hero__motif { display: none; }

@media (min-width: 1056px) {
  .hero { padding-block: 3rem; }
  .hero__inner { grid-template-columns: minmax(0, 1fr) 22rem; gap: 4rem; }
  .hero__motif { display: block; width: 22rem; height: auto; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-space); }
.section--muted { background: var(--gray-10); }

.section__intro { max-width: 44rem; margin-bottom: 2rem; }
.section__intro p { margin-top: 1rem; font-size: 1.125rem; color: var(--text-secondary); }
.section__intro-cta { margin-top: 1.5rem; }

/* ---------- Compétences ---------- */
/* Mobile : 2 colonnes compactes (icône et textes réduits) ; tablette : 2 colonnes ; ordinateur : 3 */
.skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.skill {
  padding: 1rem 0.875rem;
  background: var(--gray-10);
}
.skill__icon { width: 2rem; height: 2rem; margin-bottom: 0.75rem; }
.skill h3 { font-size: 1rem; line-height: 1.3; }
.skill p { margin-top: 0.375rem; font-size: 0.875rem; line-height: 1.45; color: var(--text-secondary); }

@media (min-width: 672px) {
  .skills { gap: 1rem; }
  .skill { padding: 1.5rem; }
  .skill__icon { width: 2.5rem; height: 2.5rem; margin-bottom: 1.5rem; }
  .skill h3 { font-size: 1.125rem; line-height: 1.4; }
  .skill p { margin-top: 0.5rem; font-size: 1rem; line-height: 1.5; }
}
@media (min-width: 1056px) { .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Badge ---------- */
.badge-layout {
  display: grid;
  gap: 1.5rem;
}
.badge-layout__content p { font-size: 1.0625rem; }
.badge-layout__content .cta-group__note { margin-top: 0.75rem; font-size: 1rem; }

@media (min-width: 900px) {
  .badge-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "figure title"
      "figure content";
    grid-template-rows: 1fr auto;
    gap: 1.25rem 4rem;
  }
  .badge-layout__title { grid-area: title; align-self: end; }
  .badge-layout__figure { grid-area: figure; align-self: center; }
  .badge-layout__content { grid-area: content; align-self: start; }
}

.badge-layout__figure { margin: 0; }
.badge-layout__figure img {
  width: 100%;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.badge-layout__figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---------- Réassurance ---------- */
.reassurance {
  display: grid;
  gap: 2rem;
  margin-top: 2.5rem;
}
.reassurance__text {
  padding-left: 1.25rem;
  border-left: 4px solid var(--ibm-blue);
  max-width: 40rem;
}
.reassurance__claim {
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--black);
}
.reassurance__text p + p { margin-top: 1rem; font-size: 1.125rem; }

@media (min-width: 900px) {
  .reassurance:has(.stats) { grid-template-columns: 1fr 1fr; align-items: center; }
}

.stats { background: var(--blue-10); padding: 1.5rem; }
.stats__list { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 0; }
/* Les deux chiffres restent centrés verticalement, même quand les étoiles passent à la ligne */
.stats__item { display: flex; flex-direction: column-reverse; justify-content: center; }
.stats__item dt { color: var(--text-secondary); }
.stats__item dd { margin: 0; }
.stats__value { font-size: 2rem; line-height: 1.2; color: var(--black); }
.stats__source:empty { display: none; }
.stats__source { margin-top: 1rem; font-size: 0.75rem; color: var(--text-secondary); }

.stars {
  position: relative;
  display: inline-block;
  width: 5.5rem;
  height: 1.1rem;
  vertical-align: middle;
  background: url("../icon/etoile-vide.svg") left / 1.1rem repeat-x;
}
.stars__fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: url("../icon/etoile.svg") left / 1.1rem repeat-x;
}

/* ---------- Étapes : cartes empilées au scroll (position: sticky, sans JS) ----------
   Chaque carte se fige à --stack-top + (index × --stack-step) ; la suivante
   vient la recouvrir en laissant visible le haut des précédentes (n° d'étape). */
.steps {
  --stack-top: 1rem;
  --stack-step: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.step {
  position: sticky;
  top: calc(var(--stack-top) + var(--i, 0) * var(--stack-step));
  display: grid;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
}
.step:nth-child(1) { --i: 0; }
.step:nth-child(2) { --i: 1; }
.step:nth-child(3) { --i: 2; }
.step:nth-child(4) { --i: 3; }
/* Alternance des fonds : étapes 1 et 3 en bleu clair, 2 et 4 en blanc */
.step:nth-child(odd) { background: var(--blue-10); border-color: #cde9f8; }
.step__number {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--ibm-blue);
  margin-bottom: 0.5rem;
}
.step h3 { font-size: 1.375rem; }
.step__text p:not(.step__number) { margin-top: 0.75rem; font-size: 1.0625rem; color: var(--text-secondary); }
.step__media { margin: 0; }
.step__media img {
  width: 100%;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

@media (min-width: 900px) {
  /* Valeurs relevées sur la référence : décalage de 78 px entre cartes, 40 px de padding, 10 px d'écart */
  .steps { --stack-top: 2rem; --stack-step: 78px; gap: 10px; }
  .step { grid-template-columns: 5fr 7fr; gap: 3rem; padding: 40px; }
  .step__text { max-width: 28rem; }
}

/* Écran trop bas pour empiler sans masquer le contenu : défilement classique */
@media (max-height: 599px) {
  .step { position: static; }
}

#comment-s-inscrire .cta-group { margin-top: 2.5rem; }

/* ---------- FAQ ---------- */
.faq-layout__intro p { margin-top: 1rem; font-size: 1.0625rem; color: var(--text-secondary); max-width: 32rem; }

@media (min-width: 1056px) {
  .faq-layout {
    display: grid;
    grid-template-columns: 5fr 7fr;
    grid-template-rows: auto 1fr;
    column-gap: 4rem;
    align-items: start;
  }
  .faq-layout__intro { grid-column: 1; grid-row: 1; }
  .faq-layout > .faq { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  .faq-layout__cta { grid-column: 1; grid-row: 2; }
}

.faq { margin-top: 2rem; border-top: 1px solid var(--border); }
.faq__item { border-bottom: 1px solid var(--border); }
.faq__item summary {
  position: relative;
  display: block;
  padding: 1.125rem 3rem 1.125rem 0;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 110ms var(--ease);
}
.faq__item[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq__item summary:hover h3 { color: var(--ibm-blue); }
.faq__item summary h3 { font-size: 1.0625rem; display: inline; }
.faq__item summary:focus-visible { outline-offset: -2px; }
.faq__item p { padding: 0 3rem 1.25rem 0; color: var(--text-secondary); }

/* Mobile : FAQ resserrée (intro plus proche des questions, questions moins hautes) */
@media (max-width: 671px) {
  .faq-layout__intro p { margin-top: 0.75rem; font-size: 1rem; }
  .faq { margin-top: 1.25rem; }
  .faq__item summary { padding-block: 0.875rem; }
  .faq__item p { padding: 0 1rem 1rem 0; }
  .faq-layout__cta { margin-top: 1.5rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 3rem 2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.site-footer__brands {
  display: grid;
  gap: 2rem;
}
@media (min-width: 672px) {
  .site-footer__brands { grid-template-columns: 1fr 1fr; gap: 4rem; }
}
.site-footer__brand p { margin-top: 0.75rem; max-width: 26rem; }
.site-footer__wordmark {
  display: block;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--black);
}
.site-footer__logo { width: auto; height: 1.5rem; }
.site-footer__logo--tralalere { height: 2.5rem; }
.site-footer__legal {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
.site-footer__legal ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
}
.site-footer__legal a { display: inline-block; padding: 0.25rem 0; color: var(--text); }
.site-footer__legal a:hover { color: var(--ibm-blue); }

.site-footer__link {
  padding: 0.25rem 0;
  font: inherit;
  color: var(--text);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}
.site-footer__link:hover { color: var(--ibm-blue); }

/* ---------- Consentement cookies ---------- */
.consent {
  position: fixed;
  right: 0.5rem;
  bottom: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  max-width: 34rem;
  max-height: calc(100vh - 1rem);
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.875rem;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
}
.consent__text { line-height: 1.45; }
.consent__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.875rem;
}
/* « Tout refuser » et « Tout accepter » ont volontairement le même poids visuel (CNIL) */
.consent__btn {
  min-height: 2.75rem;
  padding: 0.5rem;
  font: inherit;
  line-height: 1.2;
  color: var(--white);
  background: var(--ibm-blue);
  border: 1px solid var(--ibm-blue);
  cursor: pointer;
}
.consent__btn:hover { background: var(--ibm-blue-hover); }
.consent__btn--ghost { color: var(--ibm-blue); background: var(--white); }
.consent__btn--ghost:hover { color: var(--ibm-blue-hover); background: var(--blue-10); }
.consent__title { font-size: 1rem; font-weight: 600; color: var(--black); }
.consent__list { margin: 0.75rem 0 0; padding: 0; list-style: none; }
.consent__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
}
.consent__item label { cursor: pointer; }
.consent__label { display: block; font-weight: 600; color: var(--text); }
.consent__desc { display: block; color: var(--text-secondary); }
.consent__always { flex: none; color: var(--text-secondary); font-size: 0.8125rem; }
.consent__switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  background: #8d8d8d;
  border-radius: 1rem;
  cursor: pointer;
  transition: background-color 150ms var(--ease);
}
.consent__switch::after {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  background: var(--white);
  border-radius: 50%;
  transition: transform 150ms var(--ease);
}
.consent__switch:checked { background: var(--ibm-blue); }
.consent__switch:checked::after { transform: translateX(1.25rem); }

@media (min-width: 672px) {
  .consent { right: auto; bottom: 1rem; left: 1rem; padding: 1.25rem; }
}

/* ---------- Préférences utilisateur ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  /* Pas de reflet animé : seul le changement de couleur reste */
  .cta::after { display: none; }
}
