/* Section secondaire : tuteur, exercices, citations et leçons. */
.features {
  --features-sauge: #A3C6A4;
  overflow: hidden;
  padding: 96px 0 88px;
  color: var(--nuit-ink);
  background-color: var(--nuit);
  background-image:
    radial-gradient(circle at 15% 8%, rgba(244, 162, 139, 0.13), transparent 29%),
    linear-gradient(var(--nuit-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--nuit-line) 1px, transparent 1px);
  background-size: auto, 30px 30px, 30px 30px;
  border-bottom: 1px solid var(--nuit-border);
}

.features-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 44px;
}

.features-heading {
  max-width: 13ch;
  margin: 4px 0 0;
  color: var(--nuit-ink);
  font-size: clamp(38px, 5.1vw, 60px);
  letter-spacing: -0.025em;
}

.features-kicker {
  display: block;
  color: var(--accent);
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
}

.features-lead {
  max-width: 38ch;
  margin: 0 0 6px;
  color: var(--nuit-sub);
  font-size: clamp(17px, 1.7vw, 20px);
}

.features-selector-hint {
  display: none;
  margin: 0 0 12px;
  color: var(--nuit-sub);
  font-size: 14px;
  font-weight: 600;
}

.features-js .features-selector-hint { display: block; }

/* Sélecteur : contrôle segmenté (piste + indicateur qui glisse). */
.features-switch {
  display: none;
  max-width: 600px;
  /* Référence des unités cqi : la taille des libellés suit la largeur réelle
     de la barre, donc aussi le zoom de page de Safari (150 % sur un iPhone de
     402 pt = 268 px CSS). */
  container-type: inline-size;
}

.features-js .features-switch { display: block; }

.features-tabs {
  --features-col: 0;
  --features-row: 0;
  --features-pad: 5px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: var(--features-pad);
  border: 1px solid var(--nuit-border);
  border-radius: 22px;
  background: rgba(251, 243, 236, 0.06);
  box-shadow: inset 0 1px 3px rgba(8, 6, 5, 0.35);
}

.features-tabs-indicator {
  position: absolute;
  top: var(--features-pad);
  bottom: var(--features-pad);
  left: var(--features-pad);
  width: calc((100% - 2 * var(--features-pad)) / 4);
  border-radius: 17px;
  background: var(--accent);
  box-shadow: 0 2px 0 var(--encre);
  transform: translate(calc(var(--features-col) * 100%), calc(var(--features-row) * 100%));
  transition: transform 0.32s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.features-tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 64px;
  padding: 8px 4px 7px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: rgba(251, 243, 236, 0.72);
  cursor: pointer;
  font-family: 'Baloo 2', sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.features-tab-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

/* « Exercices », le plus long libellé, mesure 4,17 fois la taille de police en
   Baloo 2. La taille suit la largeur de la barre (6cqi - 2,1px) pour qu'un
   libellé tienne toujours dans son segment avec au moins 6 px d'écart avec son
   voisin ; si 11 px ne suffit plus, features.js passe la barre en deux rangées. */
.features-tab-label {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(11px, calc(6cqi - 2.1px), 16px);
}

@media (hover: hover) {
  .features-tab:hover { color: var(--nuit-ink); background: rgba(251, 243, 236, 0.07); }
}

.features-tab[aria-selected='true'],
.features-tab[aria-selected='true']:hover {
  color: var(--nuit);
  background: transparent;
}

.features-tab:focus-visible {
  outline: 2px solid var(--nuit-ink);
  outline-offset: 2px;
}

/* Pagination purement visuelle : reflète l'onglet actif. */
.features-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
}

.features-dots span {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(251, 243, 236, 0.22);
  transition: width 0.32s cubic-bezier(0.3, 0.7, 0.2, 1), background-color 0.2s ease;
}

.features-dots span.is-active {
  width: 20px;
  background: var(--accent);
}

.features-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.65fr);
  align-items: center;
  gap: 70px;
  min-height: 720px;
  padding-top: 38px;
}

/* Sans JS, les quatre contenus restent visibles. */
.features-panel + .features-panel {
  border-top: 1px solid var(--nuit-border);
}

.features-js .features-panel { display: none; }
.features-js .features-panel.features-panel-active { display: grid; }
.features-js .features-panel + .features-panel { border-top: 0; }

.features-copy { max-width: 520px; }

.features-count {
  display: block;
  color: var(--accent);
  font-family: 'Caveat', cursive;
  font-size: 23px;
  font-weight: 700;
}

.features-copy h3 {
  margin: 6px 0 16px;
  color: var(--nuit-ink);
  font-family: 'Baloo 2', sans-serif;
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.06;
}

.features-copy p {
  margin: 0;
  color: #B8AEA6;
  font-size: 18px;
}

.features-list {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #E1D8D1;
  font-size: 15px;
}

.features-list li::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--features-sauge);
  content: '';
}

.features-visual {
  display: flex;
  justify-content: center;
}

.features-phone {
  width: min(310px, 72vw);
  aspect-ratio: 1206 / 2622;
  overflow: hidden;
  border: 7px solid #191512;
  border-radius: 40px;
  background: #191512;
  box-shadow: 0 24px 54px rgba(8, 6, 5, 0.46);
}

.features-phone img {
  width: 100%;
  height: 100%;
  border-radius: 31px;
  object-fit: cover;
  object-position: top;
}

@media (max-width: 900px) {
  .features { padding: 72px 0; }
  .features-header { display: block; }
  .features-lead { margin-top: 18px; }
  .features-panel { gap: 40px; }
}

@media (max-width: 680px) {
  .features { padding: 48px 0; }
  .features-header { margin-bottom: 22px; }
  .features-heading { font-size: 34px; }
  .features-lead { margin-top: 12px; font-size: 16px; }

  .features-switch { max-width: none; }
  .features-tabs { --features-pad: 4px; border-radius: 20px; }
  .features-tabs-indicator { border-radius: 16px; }
  .features-tab { min-height: 58px; padding: 7px 3px 6px; border-radius: 16px; font-size: 14px; }
  .features-tab-label { font-size: clamp(11px, calc(6cqi - 2.1px), 14px); }
  .features-tab-icon { width: 20px; height: 20px; flex-basis: 20px; }
  .features-dots { margin-top: 12px; }

  .features-panel {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 24px;
    min-height: 880px;
    padding-top: 24px;
  }

  .features-count { font-size: 21px; }
  .features-copy h3 { margin-bottom: 12px; font-size: 28px; line-height: 1.1; }
  .features-copy p { font-size: 16px; }
  .features-list { gap: 6px; margin-top: 16px; }
  .features-list li { gap: 9px; font-size: 14px; }
  .features-phone { width: min(250px, 72vw); }
}

/* Repli mesuré par features.js : si un libellé ne tient plus à 11 px (zoom de
   page extrême), la barre passe en deux rangées de deux, libellés à 14 px. */
.features-tabs.features-tabs-stacked {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}

.features-tabs.features-tabs-stacked .features-tabs-indicator {
  bottom: auto;
  width: calc((100% - 2 * var(--features-pad)) / 2);
  height: calc((100% - 2 * var(--features-pad)) / 2);
}

.features-tabs.features-tabs-stacked .features-tab { min-height: 54px; padding: 6px; }
.features-tabs.features-tabs-stacked .features-tab-label { font-size: 14px; }

.features-js .features-panel.features-panel-enter {
  animation: features-panel-in 0.28s ease both;
}

@keyframes features-panel-in {
  from { opacity: 0; transform: translateX(calc(var(--features-enter-from, 0) * 18px)); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .features-tabs-indicator,
  .features-tab,
  .features-dots span { transition: none; }
  .features-js .features-panel.features-panel-enter { animation: none; }
}
