/**
 * index-sections-ext.css
 * Phase 3.1 (v2.42.0) — Styles vue éditoriale mobile
 *
 * Périmètre : viewport mobile uniquement (< 768px).
 * Tout est scopé pour ne jamais affecter le rendu desktop existant.
 *
 * Tokens utilisés (cf. tokens.css prod, ne pas inventer de nouvelles couleurs) :
 *   --ivoire, --ivoire-deep, --encre, --boow, --nuit
 *   --font-display, --font-body, --font-mono
 *   --fs-xs, --fs-sm, --fs-md
 *   --ease-out-quart
 */

/* ─────────────────────────────────────────────────────────
   Toggle Vue éditoriale / Vue libre (mobile seulement)
   ───────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .mobile-view-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin: 0 16px 14px;
    background: var(--ivoire-deep, #EBE4D2);
    border-radius: 999px;
    align-self: flex-start;
  }

  .mobile-view-toggle-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--encre, #374366);
    font-family: var(--font-mono, 'Geist Mono', ui-monospace, monospace);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 200ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1)),
                background-color 200ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1));
  }

  .mobile-view-toggle-btn:hover {
    opacity: 0.85;
  }

  .mobile-view-toggle-btn.is-active {
    background: var(--ivoire, #F5EFE0);
    color: var(--nuit, #1A2845);
    opacity: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }
}

/* Cacher le toggle en desktop, même s'il avait été rendu */
@media (min-width: 768px) {
  .mobile-view-toggle {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────
   Sections narratives
   ───────────────────────────────────────────────────────── */
@media (max-width: 767px) {

  .mobile-index-section {
    margin-bottom: 22px;
  }

  .mobile-index-section:last-of-type {
    margin-bottom: 8px;
  }

  /* Header de section */
  .mobile-index-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 18px 10px;
    user-select: none;
  }

  .mobile-index-head.is-collapsible {
    cursor: pointer;
    padding-bottom: 12px;
  }

  .mobile-index-head.is-collapsible:hover .mobile-index-label {
    opacity: 1;
  }

  .mobile-index-label {
    font-family: var(--font-display, 'Unbounded', serif);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: -0.01em;
    color: var(--nuit, #1A2845);
    opacity: 0.88;
    transition: opacity 180ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1));
  }

  .mobile-index-count {
    font-family: var(--font-mono, 'Geist Mono', ui-monospace, monospace);
    font-size: 11px;
    color: var(--encre, #374366);
    opacity: 0.55;
    letter-spacing: 0.02em;
  }

  .mobile-index-chev {
    margin-left: auto;
    color: var(--encre, #374366);
    opacity: 0.5;
    transition: transform 220ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1)),
                opacity 180ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1));
  }

  .mobile-index-head.is-collapsible:hover .mobile-index-chev {
    opacity: 0.85;
  }

  .mobile-index-section.is-collapsed .mobile-index-chev {
    transform: rotate(-90deg);
  }

  /* Body de section : contient les .sub-card-wrapper */
  .mobile-index-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    max-height: 9999px;
    transition: max-height 320ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1)),
                opacity 220ms var(--ease-out-quart, cubic-bezier(0.165, 0.84, 0.44, 1));
  }

  .mobile-index-section.is-collapsed .mobile-index-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }

  /* Densité légèrement réduite des sub-cards en vue éditoriale */
  #dashboard-sub-list[data-mobile-mode="editorial"] .sub-card-wrapper {
    margin: 0;
  }

  /* "Le silence" : visuellement adouci */
  .mobile-index-section[data-section-id="silence"] .mobile-index-label {
    opacity: 0.6;
    font-weight: 400;
  }

  .mobile-index-section[data-section-id="silence"] .sub-card {
    opacity: 0.75;
  }

  /* Mode libre : pas de section visible, juste la liste plate */
  #dashboard-sub-list[data-mobile-mode="libre"] {
    /* Pas de styles spécifiques nécessaires : tout est déjà géré par le rendu natif */
  }
}

/* Desktop : tout ce qui précède est explicitement neutralisé en cas de doute */
@media (min-width: 768px) {
  .mobile-index-section,
  .mobile-index-head,
  .mobile-index-body,
  .mobile-index-label,
  .mobile-index-count,
  .mobile-index-chev {
    /* En desktop, ces classes ne devraient pas exister (le module ne les crée pas).
       Si elles existent par erreur, on les rend invisibles. */
    all: revert;
  }
}
