/* ============================================================
   Parcours & ergonomie mobile (nov. 2026)
   Chargé en dernier : s'appuie sur les variables de style.css / dark.css,
   donc le mode sombre suit automatiquement.
   ============================================================ */

/* ---------- 1. En-tête : le thème sombre reste accessible sur mobile ---------- */
@media (max-width: 560px) {
  .site-header .favorite-button.theme-toggle { display: inline-flex; min-width: 44px; min-height: 44px; }
  .site-header { gap: 4px; }
  .site-header .header-actions { gap: 4px; }
  .lang-option { min-width: 40px; }
}

/* ---------- 2. Premier écran mobile : l'éditeur remonte ---------- */
@media (max-width: 560px) {
  .intro { padding-top: 10px; padding-bottom: 6px; }
  .intro h1 { font-size: 1.3rem; line-height: 1.25; margin-bottom: 0; }
  .intro .intro-copy { display: none; }               /* texte complet conservé sur ordinateur et dans « Pourquoi » */
  .editor-panel .panel-heading { padding: 10px var(--space-md); }
  .editor-panel .panel-kicker { display: none; }
  .editor-panel .panel-heading h2 { font-size: 1.05rem; margin: 0; }
  .editor-panel .draft-indicator { font-size: .72rem; white-space: nowrap; }
  .editor-panel .trust-badge { margin: 8px var(--space-sm) 0; padding: 6px 10px; font-size: .78rem; line-height: 1.35; }
  .editor-panel .seo-tip { display: none; }
}

/* ---------- 3. Barre d'outils : deux rangées nettes, libellés visibles ---------- */
@media (max-width: 768px) {
  .editor-panel .toolbar {
    display: grid; grid-template-columns: repeat(60, minmax(0, 1fr)); gap: 0; padding: 8px 4px;
  }
  .editor-panel .toolbar .tool-bold, .editor-panel .toolbar .tool-italic,
  .editor-panel .toolbar .tool-underline, .editor-panel .toolbar .tool-strikethrough { grid-column: span 10; }
  .editor-panel .toolbar .style-select:not([hidden]) { grid-column: span 20; align-self: stretch; min-height: 52px; width: 100%; min-width: 0; font-size: .85rem; }
  .editor-panel .toolbar .tool-paste, .editor-panel .toolbar .tool-clear-format,
  .editor-panel .toolbar .tool-undo, .editor-panel .toolbar .tool-redo, .editor-panel .toolbar .tool-clear { grid-column: span 12; }
  .editor-panel .toolbar .tool-button, .editor-panel .toolbar .style-select:not([hidden]) { margin: 3px; }
  .editor-panel .toolbar .tool-button {
    min-width: 0; width: auto; min-height: 52px; padding: 6px 1px; gap: 2px; justify-content: center;
  }
  .editor-panel .toolbar .tool-button span:not([aria-hidden="true"]) {
    display: block; font-size: .72rem; line-height: 1.1; font-weight: 600; letter-spacing: 0; text-align: center;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-transform: lowercase;
  }
  .editor-panel .toolbar .tool-button span:not([aria-hidden="true"])::first-letter { text-transform: uppercase; }
  .editor-panel .toolbar .tool-button span[aria-hidden="true"] { font-size: 1.05rem; line-height: 1; }
  .editor-panel .toolbar .tool-button svg { width: 18px; height: 18px; }
}

/* ---------- 4. Symboles : une seule rangée qui défile ---------- */
@media (max-width: 768px) {
  .symbol-bar {
    flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 8px var(--space-sm);
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .symbol-bar::-webkit-scrollbar { display: none; }
  .symbol-btn { flex: 0 0 auto; scroll-snap-align: start; }
}

/* ---------- 5. Bas de page : la barre fixe ne masque plus rien ---------- */
@media (max-width: 1024px) {
  body:has(.mobile-bottom-bar) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- 6. Bandeau de consentement : au-dessus de la barre du bas, compact ---------- */
@media (max-width: 1024px) {
  body:has(.mobile-bottom-bar) .consent-banner {
    bottom: calc(76px + env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto;
    border: 1px solid var(--border-medium); border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  }
}
@media (max-width: 560px) {
  .consent-banner { padding: 12px 14px 10px; }
  .consent-content { gap: 8px; }
  .consent-content h3 { font-size: .98rem; }
  .consent-content p { font-size: .8rem; line-height: 1.4; margin: 0; }
  .consent-button { min-height: 44px; font-size: .95rem; }
  .consent-footer a { font-size: .8rem; }
}

/* ---------- 7. Pied de page lisible sur mobile ---------- */
@media (max-width: 560px) {
  .site-footer .footer-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 0 var(--space-md); }
  .site-footer .footer-legal a { display: inline-flex; align-items: center; min-height: 40px; }
}

/* ---------- 8. « Ensuite » : étapes lisibles, sans mur de boutons ---------- */
@media (max-width: 560px) {
  .next-steps { gap: 6px; }
  .next-steps-label { flex-basis: 100%; }
  .next-step { flex: 1 1 calc(50% - 6px); min-height: 44px; justify-content: center; font-size: .85rem; }
}

/* ---------- Ajustements issus du contrôle visuel ---------- */
/* En-tête mobile : logo | thème | FR-EN | menu, sur une ligne sans chevauchement */
@media (max-width: 560px) {
  html.menu-ready .site-header { padding-right: var(--gutter-width, 16px); }
  html.menu-ready .site-header .menu-toggle-mobile { position: static; }
  .site-header .brand-logo { max-width: 150px; height: auto; }
  .site-header .header-actions { margin-left: auto; flex: 0 0 auto; }
}
/* Libellés de la barre d'outils : casse normale, jamais tronqués */
@media (max-width: 768px) {
  .editor-panel .toolbar .tool-button span:not([aria-hidden="true"]) { font-size: .72rem; }
}
:root[data-theme="dark"] .post-input { background: var(--color-white); color: var(--text-primary); }

@media (max-width: 380px) {
  .editor-panel .toolbar .tool-button span:not([aria-hidden="true"]) { font-size: .66rem; }
}
@media (max-width: 380px) {
  .editor-panel .toolbar .tool-underline span:not([aria-hidden="true"]) { font-size: .6rem; letter-spacing: -.01em; }
  .editor-panel .panel-heading h2 { font-size: .95rem; }
  .editor-panel .draft-indicator { font-size: .64rem; }
}

/* Menu : ne passe pas sous la barre du bas */
@media (max-width: 1024px) {
  body:has(.mobile-bottom-bar) .menu-panel { max-height: calc(100dvh - 160px); }
}
@media (max-width: 560px) {
  .menu-panel a { min-height: 40px; }
}

/* En-tête ordinateur/tablette : plus de débordement horizontal (FR/EN coupé) */
@media (min-width: 761px) and (max-width: 1439px) {
  .site-header .header-note { display: none; }
  .site-header .share-button span { display: none; }
  .site-header .share-button { min-width: 44px; justify-content: center; padding: 0 10px; }
}
/* Tablette / petit portable : la navigation passe dans le menu (comme sur mobile) */
@media (min-width: 761px) and (max-width: 1100px) {
  html.menu-ready .site-nav { display: none; }
  .menu-toggle-desktop { display: none; }
  .menu-toggle-mobile { display: inline-flex; }
}

/* ---------- Hub des outils : 4 étapes + Plus ---------- */
.tool-steps { max-width: var(--max-content-width); margin: 0 auto; padding: 0 var(--gutter-width) var(--space-xl); }
.tool-step { margin-top: var(--space-lg); }
.tool-step-title { margin: 0; font-size: 1.25rem; text-align: left; color: var(--color-primary-text, #1e7e34); }
.tool-step-sub { margin: 2px 0 0; color: var(--text-secondary); font-size: .95rem; text-align: left; }
.tool-step .tool-grid { padding: var(--space-sm) 0 0; max-width: none; }

/* ---------- Home : « Aussi gratuits » en grille sur mobile (plus de cartes coupées) ---------- */
@media (max-width: 560px) {
  .tools-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 8px; }
  .tools-strip-label { grid-column: 1 / -1; }
  .tools-strip-item { min-width: 0; padding: 10px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .tools-strip-item strong { font-size: .9rem; }
  .tools-strip-all { grid-column: 1 / -1; min-width: 0; flex-direction: row; justify-content: center; }
}

/* ---------- Carrousel : l'outil remonte sur mobile ---------- */
@media (max-width: 560px) {
  .page-header { padding-top: var(--space-md); padding-bottom: var(--space-sm); }
  .page-header h1 { font-size: 1.5rem; line-height: 1.25; }
  .page-header .page-subtitle { font-size: .95rem; line-height: 1.45; margin-top: 8px; }
  .page-header .cs-chips { display: none; }
}

/* Très petits écrans (320 px) : le sélecteur de langue n'affiche que l'autre langue pour tenir sur la ligne sans chevaucher le menu */
@media (max-width: 340px) {
  html.menu-ready .site-header .lang-switch .lang-option.is-active { display: none; }
  html.menu-ready .site-header .brand-logo { max-width: 128px; }
}
