/* Responsive mobile — iPhone, Android (Samsung, Xiaomi, Pixel).
   Breakpoint : 900px pour couvrir téléphones + tablettes portrait.
   Au-dessus : canvas fixe 1920×1080 scalé, inchangé. */

@media (max-width: 900px) {

  /* ═══════════════════════════════════════════════════════════
     Désactivation du canvas fixe — la page devient fluide.
     ═══════════════════════════════════════════════════════════ */

  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    background: var(--bg-cream);
  }

  .stage {
    position: static;
    display: block;
    overflow: visible;
    background: transparent;
    width: 100%;
    height: auto;
  }

  .slides-root {
    width: 100%;
    height: auto;
    transform: none !important;
    position: relative;
  }

  .slide {
    position: relative;
    inset: auto;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh; /* iOS Safari : viewport dynamique */
    padding: 70px 22px 90px;
    display: none;
  }

  .slide.is-active {
    display: flex;
  }


  /* ═══════════════════════════════════════════════════════════
     Brand mark, progress, footer, badge — compacts.
     ═══════════════════════════════════════════════════════════ */

  .slide__brand {
    font-size: 14px;
    top: 20px;
    left: 22px;
  }

  .slide__progress {
    top: 22px;
    right: 22px;
    gap: 6px;
  }

  .slide__progress span {
    width: 7px;
    height: 7px;
  }

  .slide__footer {
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 0;
    left: 22px;
    right: 22px;
    bottom: 46px;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .slide__badge {
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 8px 14px;
    top: auto;
    right: 22px;
    bottom: 100px;
  }


  /* ═══════════════════════════════════════════════════════════
     Typographie générique.
     ═══════════════════════════════════════════════════════════ */

  .eyebrow {
    font-size: 11px !important;
    margin-bottom: 20px !important;
    letter-spacing: 0.14em;
  }

  .slide__title {
    font-size: clamp(28px, 7.5vw, 44px) !important;
    line-height: 1.1 !important;
    margin-bottom: 20px !important;
    max-width: 100% !important;
  }

  .slide__subtitle {
    font-size: 15px !important;
    line-height: 1.45 !important;
    margin-bottom: 28px !important;
    max-width: 100% !important;
  }

  .slide__footnote {
    font-size: 13px !important;
    max-width: 100% !important;
    line-height: 1.5;
    margin-bottom: 40px !important; /* dégage la place au-dessus du footer */
  }

  .slide__body {
    padding: 40px 0 0 0 !important;
    justify-content: flex-start !important;
    flex: 1;
  }

  .prose-lead {
    font-size: 18px !important;
    margin-bottom: 20px !important;
  }

  .prose {
    font-size: 15px !important;
    margin-bottom: 14px !important;
    max-width: 100% !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Nav bar mobile : plus compacte.
     ═══════════════════════════════════════════════════════════ */

  .nav-bar {
    bottom: 12px;
    right: 12px;
    padding: 4px 6px;
    opacity: 0.7;
  }

  .nav-bar__btn {
    width: 36px;
    height: 36px;
  }

  .nav-bar__counter {
    font-size: 11px;
    min-width: 54px;
    padding: 0 6px;
  }

  .hint {
    font-size: 12px;
    flex-wrap: nowrap;
    padding: 10px 18px;
    max-width: calc(100% - 88px); /* laisse la place à la nav-bar à droite */
    bottom: 64px; /* au-dessus de la nav-bar */
    left: 16px;
    right: auto;
    transform: none;
    text-align: left;
    line-height: 1.4;
    gap: 0;
    display: block;
  }

  .hint__desktop { display: none; }
  .hint__mobile  { display: inline; }


  /* ——— Jump sheet : bottom sheet sur mobile ——— */

  .jump-sheet {
    align-items: flex-end;
  }

  .jump-sheet__panel {
    width: 100vw;
    max-width: none;
    max-height: 82vh;
    border-radius: 16px 16px 0 0;
    padding: 16px 18px 22px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    animation-name: jump-panel-in-mobile;
  }

  @keyframes jump-panel-in-mobile {
    to { transform: translateY(0); opacity: 1; }
  }

  /* Poignée visuelle "grip" en haut du sheet */
  .jump-sheet__panel::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: var(--neutral);
    border-radius: 4px;
    margin: 0 auto 10px;
  }

  .jump-sheet__input { font-size: 16px; } /* évite le zoom iOS */
  .jump-sheet__go { padding: 12px 18px; }

  .jump-sheet__grid {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
    max-height: 52vh;
  }

  .jump-sheet__grid button {
    padding: 14px 0;
    font-size: 14px;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 1 · Cover
     ═══════════════════════════════════════════════════════════ */

  [data-slide="1"] .cover__layout {
    padding-top: 20px;
  }

  [data-slide="1"] .cover__title {
    font-size: clamp(54px, 14vw, 88px) !important;
    letter-spacing: -0.03em !important;
  }

  [data-slide="1"] .cover__subtitle {
    font-size: 22px !important;
  }

  [data-slide="1"] .cover__kicker {
    font-size: 15px !important;
  }

  [data-slide="1"] .cover__eyebrow {
    font-size: 11px !important;
  }

  [data-slide="1"] .cover__signature,
  [data-slide="1"] .cover__spaces {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }

  [data-slide="1"] .cover__signature {
    margin-top: 40px;
  }

  [data-slide="1"] .cover__spaces {
    align-self: flex-end;
    margin-top: 20px;
    font-size: 16px;
  }

  [data-slide="1"] .vibe-loop {
    font-size: 13px !important;
    margin-top: 40px !important;
    max-width: 100% !important;
    min-height: 28px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 2 · Speaker (Sacha Blaise) sur mobile
     ═══════════════════════════════════════════════════════════ */

  [data-slide="2"] .slide__body {
    display: flex !important;
    flex-direction: column !important;
    gap: 28px !important;
    align-items: flex-start !important;
  }

  .speaker-photo {
    width: 200px !important;
    max-width: 55vw !important;
    aspect-ratio: 1 !important;
  }

  .speaker-photo__logo {
    font-size: 9px !important;
    padding: 6px 10px !important;
    bottom: 12px !important;
    left: 12px !important;
  }

  .speaker-intro .slide__title {
    font-size: clamp(44px, 11vw, 72px) !important;
  }

  .speaker-intro__role {
    font-size: 15px !important;
    margin-bottom: 20px !important;
  }

  .speaker-intro__bio {
    font-size: 15px !important;
    margin-bottom: 28px !important;
  }

  .speaker-link {
    padding: 10px 14px !important;
  }

  .speaker-link__label {
    font-size: 10px !important;
  }

  .speaker-link__url {
    font-size: 12px !important;
  }

  .speaker-clients {
    margin-bottom: 24px !important;
    padding: 14px 0 !important;
  }

  .speaker-clients__label {
    font-size: 10px !important;
    margin-bottom: 10px !important;
  }

  .speaker-clients__row {
    gap: 20px !important;
  }

  .client-mark--porsche {
    font-size: 15px !important;
    letter-spacing: 0.22em !important;
  }

  .client-mark--immobilier {
    font-size: 16px !important;
  }

  .client-mark--more {
    font-size: 11px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Citations (3, 43)
     ═══════════════════════════════════════════════════════════ */

  .quote-mark {
    font-size: 120px !important;
    height: 48px !important;
    margin-bottom: 10px !important;
  }

  [data-slide="5"] .quote-text {
    font-size: clamp(34px, 9vw, 56px) !important;
    margin-top: 20px !important;
    margin-bottom: 28px !important;
  }

  [data-slide="5"] .quote-kicker {
    font-size: 15px !important;
  }

  [data-slide="60"] .closing-q1 {
    font-size: 22px !important;
    margin-bottom: 20px !important;
    line-height: 1.3 !important;
  }

  [data-slide="60"] .closing-connector {
    font-size: 16px !important;
    margin-bottom: 20px !important;
  }

  [data-slide="60"] .closing-q2 {
    font-size: clamp(26px, 7vw, 42px) !important;
    line-height: 1.2 !important;
  }

  [data-slide="60"] .closing-footer {
    position: static !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-top: auto;
  }


  /* ═══════════════════════════════════════════════════════════
     Chapter dividers (7, 11, 15)
     ═══════════════════════════════════════════════════════════ */

  .slide--chapter .chapter__layout {
    padding-bottom: 20px;
    margin-top: auto;
  }

  .slide--chapter .chapter__number {
    font-size: 90px !important;
  }

  .slide--chapter .chapter__title {
    font-size: clamp(38px, 10vw, 60px) !important;
    margin-bottom: 20px !important;
  }

  .slide--chapter .chapter__kicker {
    font-size: 17px !important;
  }

  .slide--chapter .chapter__eyebrow {
    margin-bottom: 36px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 2 · Liste numérotée
     ═══════════════════════════════════════════════════════════ */

  .num-list {
    gap: 28px !important;
  }

  .num-list li {
    gap: 20px !important;
    align-items: center;
  }

  .num-list__num {
    font-size: 40px !important;
    min-width: 58px !important;
  }

  .num-list__text {
    font-size: 20px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Toutes les grilles collapsent en 1 colonne.
     ═══════════════════════════════════════════════════════════ */

  .product-grid,
  .examples-grid,
  .eco-grid,
  .destinations-grid,
  .github-grid,
  .gateways-grid,
  .engines-grid,
  .vs-grid,
  .foundation-grid,
  .three-grid,
  .quiz-options,
  .prompt-layout,
  .benefit-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 14px !important;
    max-height: none !important;
    margin-bottom: 24px !important;
  }

  /* Cards génériques : padding réduit */
  .product-card,
  .example-card,
  .eco-card,
  .destination-card,
  .github-card,
  .gateway-card,
  .engine-card,
  .vs-card,
  .foundation-card,
  .triplet-card,
  .guarantee-card,
  .memory-card,
  .quiz-option {
    padding: 22px 20px !important;
  }

  .foundation-card.is-active,
  .product-card.is-active {
    padding: 21px 19px !important;
  }

  /* Tailles des titres de cards */
  .product-card__title,
  .vs-card__price,
  .destination-card__title,
  .github-card__title,
  .engine-card__title,
  .eco-card__title,
  .memory-card__title,
  .guarantee-card__title,
  .triplet-card__title,
  .foundation-card__title {
    font-size: 24px !important;
  }

  .quiz-option__letter {
    font-size: 44px !important;
  }

  .quiz-option__text {
    font-size: 18px !important;
  }

  .foundation-card__num {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  /* Barres de moteurs (slide 6) */
  .engine-metric {
    font-size: 14px !important;
  }

  .engine-metric__label {
    font-size: 11px !important;
  }

  .engine-metric__value {
    font-size: 13px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 13 · Big number
     ═══════════════════════════════════════════════════════════ */

  .benefit-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
  }

  .benefit-number {
    font-size: 110px !important;
  }

  .benefit-label {
    font-size: 20px !important;
    margin-bottom: 28px !important;
  }

  .benefit-body {
    font-size: 16px !important;
  }

  .saas-card {
    padding: 24px 22px !important;
  }

  .saas-card__row dt strong {
    font-size: 15px;
  }

  .saas-card__row dd {
    font-size: 13px;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 14 · Compare blocs
     ═══════════════════════════════════════════════════════════ */

  .vs-card__price {
    font-size: 38px !important;
  }

  .vs-card__sub {
    font-size: 14px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 17 · Prompt
     ═══════════════════════════════════════════════════════════ */

  .prompt-block {
    padding: 24px 22px !important;
  }

  .prompt-block__body p {
    font-size: 14px !important;
  }

  .prompt-point {
    gap: 14px;
  }

  .prompt-point__title {
    font-size: 16px;
  }

  .prompt-point__desc {
    font-size: 14px;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 18 · Mémoires
     ═══════════════════════════════════════════════════════════ */

  .memory-card__path {
    font-size: 15px !important;
    padding: 8px 12px !important;
  }

  .memory-card__sub {
    font-size: 14px !important;
  }

  .memory-card__example-body {
    font-size: 14px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 19 · Tableau 6 mécanismes — restructure en cards
     ═══════════════════════════════════════════════════════════ */

  .mech-table {
    display: block;
  }

  .mech-table thead {
    display: none;
  }

  .mech-table tbody,
  .mech-table tr {
    display: block;
    width: 100%;
  }

  .mech-table tbody tr:nth-child(odd):not(.mech-table__category) {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    margin-bottom: 8px;
  }

  .mech-table tbody tr:not(.mech-table__category) {
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
  }

  .mech-table td {
    display: block;
    padding: 3px 0;
    border: none;
  }

  .mech-table__name {
    width: auto;
    font-size: 16px;
    margin-bottom: 4px;
    padding: 0 !important;
  }

  .mech-table__highlight td:first-child {
    border-left: none;
    padding-left: 0 !important;
  }

  .mech-table__highlight {
    box-shadow: inset 3px 0 0 var(--accent-clay);
    padding-left: 16px !important;
  }

  .mech-table__category td {
    background: transparent !important;
    padding: 12px 0 4px 0 !important;
    color: var(--accent-clay);
    font-weight: var(--fw-bold);
  }

  .mech-table td:nth-child(2) {
    font-size: 14px;
  }

  .mech-table td code {
    font-size: 13px;
    white-space: normal;
  }

  .mech-table td em {
    font-size: 13px;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 20 · Écosystème
     ═══════════════════════════════════════════════════════════ */

  .eco-card__url {
    font-size: 12px !important;
  }

  .eco-card__desc {
    font-size: 14px !important;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 22 · GitHub — code block
     ═══════════════════════════════════════════════════════════ */

  .github-card__terminal {
    font-size: 14px !important;
    overflow-x: auto;
  }

  .github-card__subhead {
    font-size: 11px;
  }

  .github-card__text {
    font-size: 14px;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 8 · Install block
     ═══════════════════════════════════════════════════════════ */

  .install-block__terminal {
    font-size: 14px !important;
    padding: 14px 18px !important;
    overflow-x: auto;
  }


  /* ═══════════════════════════════════════════════════════════
     Slide 41 · Quiz + glossaire
     ═══════════════════════════════════════════════════════════ */

  .glossary__list {
    gap: 4px !important;
  }

  .glossary__row {
    flex-direction: column;
    gap: 2px;
    font-size: 13px !important;
    padding-bottom: 6px;
  }

  .glossary__row dt {
    min-width: auto !important;
  }

  /* ────────────────────────────────────────────────────────────
     Slide RÉFÉRENTIEL — cheatsheet mobile
     ──────────────────────────────────────────────────────────── */
  .cheatsheet {
    margin-top: 20px !important;
    gap: 16px !important;
  }

  .cheatsheet__controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding-bottom: 0 !important;
  }

  .cheatsheet__tabs {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .cheatsheet__tab {
    font-size: 13px !important;
    padding: 8px 12px 10px !important;
    flex: 1 1 auto;
  }

  .cheatsheet__search-wrap {
    min-width: 0 !important;
    width: 100%;
  }

  .cheatsheet__search {
    font-size: 14px !important;
    padding: 8px 12px 8px 34px !important;
  }

  .cheatsheet__search-icon {
    font-size: 15px !important;
    left: 12px !important;
  }

  .cheatsheet__list {
    grid-template-columns: 1fr !important;
    gap: 10px 0 !important;
    max-height: 58vh !important;
    padding-right: 12px !important;
  }

  .cheatsheet__item {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
    padding: 8px 0 !important;
  }

  .cheatsheet__item code {
    font-size: 14px !important;
    white-space: normal !important;
  }

  .cheatsheet__item span {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  /* Bloc pédagogique — empile texte puis code sur mobile */
  .cheatsheet__tip {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 14px 16px !important;
    margin-top: 16px !important;
  }

  .cheatsheet__tip-body {
    font-size: 13px !important;
  }

  .cheatsheet__tip-note {
    font-size: 12px !important;
  }

  .cheatsheet__tip-code {
    font-size: 10px !important;
    padding: 10px 12px !important;
  }

}


/* ═══════════════════════════════════════════════════════════
   Très petits écrans (< 380px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 380px) {
  .slide {
    padding: 60px 16px 80px;
  }

  .slide__title {
    font-size: clamp(24px, 7vw, 36px) !important;
  }

  .slide--chapter .chapter__number {
    font-size: 72px !important;
  }

  .slide--chapter .chapter__title {
    font-size: 34px !important;
  }

  [data-slide="1"] .cover__title {
    font-size: 48px !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   Téléphone en paysage : plus d'espace horizontal
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .slide {
    padding: 40px 60px 60px;
  }

  .slide__title {
    font-size: clamp(22px, 4.5vw, 32px) !important;
    margin-bottom: 14px !important;
  }

  .slide__body {
    padding-top: 24px !important;
  }

  [data-slide="1"] .cover__title {
    font-size: 64px !important;
  }
}
