/* Gégé : mise en page de l'app. Les couleurs, typos, espacements et composants viennent du design system
   (tokens.css et composants.css, copiés de design/systeme) : ici, seulement l'assemblage des écrans. */

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root { --taille-lecture: 19px; }

/* ---------- Ossature : barre latérale (ordinateur) ou onglets (téléphone) ---------- */
.app { display: flex; min-height: 100vh; }
.barre-laterale { position: sticky; top: 0; height: 100vh; flex: none; }
.barre-laterale .logo { border-radius: 7px; }
.barre-laterale .gg-side__brand { text-decoration: none; color: var(--ink); }
.barre-laterale a.gg-side__item { text-decoration: none; }
.etat-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; font: 500 13px/18px var(--font-sans); color: var(--danger); text-decoration: none; }
.raccourcis { margin-top: 14px; gap: 4px; }
.contenu { flex: 1; min-width: 0; padding: var(--space-8) var(--space-8) var(--space-16); }
.ecran { max-width: var(--measure); margin: 0 auto; display: grid; gap: var(--space-6); min-width: 0; }
.ecran > * { min-width: 0; }
.onglets { display: none; }
.onglets a { text-decoration: none; }
.hors-ligne { position: sticky; top: 0; z-index: 30; justify-content: center; }

@media (max-width: 899px) {
  .barre-laterale { display: none; }
  .contenu { padding: var(--space-4) var(--space-4) calc(var(--tabbar) + var(--space-8)); padding-top: max(var(--space-4), env(safe-area-inset-top)); }
  .onglets { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 94%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .page-lire .onglets { display: none; }  /* lecture : pas d'onglets, barre d'actions flottante */
  .page-lire .contenu { padding-bottom: 120px; }
}

/* ---------- En-têtes d'écran ---------- */
.tete { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.tete > div { min-width: 0; }
.tete .gg-overline { margin-bottom: 4px; }
.tete .gg-gauge { flex: none; }
.tete .gg-gauge__txt { white-space: nowrap; }
.avertissement, .intro, .echec-export { margin: 0; }
.echec-export { color: var(--danger); }
.important { color: var(--accent-strong); font-weight: 600; }

/* ---------- Cartes en liste ---------- */
.cartes { display: grid; }
a.gg-card { text-decoration: none; color: inherit; }
.gg-card__img { display: grid; place-items: center; }
.repli-image { color: var(--ink-faint); }
.gg-card .lu { display: inline-flex; align-items: center; gap: 3px; color: var(--success); }
.evenements, .sequences { display: grid; gap: var(--space-2); }
a.gg-event, a.gg-seq { text-decoration: none; color: inherit; }
.en-plus { padding-top: var(--space-4); border-top: 1px solid var(--line); }
.sorties { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.vide { padding: var(--space-8) 0; }

/* ---------- Séquence ---------- */
.pile { touch-action: pan-y; }
.carte-seq { position: relative; cursor: pointer; transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-slow) var(--ease-out); will-change: transform; }
.carte-seq .gg-card__img { min-height: 140px; }
.carte-seq.part-gauche { transform: translateX(-120%) rotate(-6deg); opacity: 0; }
.carte-seq.part-droite { transform: translateX(120%) rotate(6deg); opacity: 0; }
.actions-seq { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: var(--space-2); }
.actions-seq .gg-btn, a.gg-tag, a.gg-row, a.gg-side__item { text-decoration: none; }

/* ---------- Lecture ---------- */
.lecture { gap: var(--space-5); }
.barre-lecture { padding: 0; margin: 0 -8px; }
.barre-lecture a { text-decoration: none; }
.titre-lecture { margin: 0; text-wrap: balance; }
.gg-read { font-size: var(--taille-lecture); line-height: 1.63; }
.gg-read .gg-inter { font: var(--text-title-2); margin: 1.4em 0 .5em; }
.gg-read ul { margin: 0 0 1.1em; padding-left: 1.2em; }
.gg-read blockquote { margin: 0 0 1.1em; padding-left: 1em; border-left: 3px solid var(--line-strong); color: var(--ink-muted); }
.gg-read strong { font-weight: 600; }
.note-incomplet { margin-top: var(--space-4); }
.original { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.original a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; }
.notation { padding-top: var(--space-6); border-top: 1px solid var(--line); }
.actions-fin .gg-btn span, .barre-flottante .gg-btn span { pointer-events: none; }
.barre-flottante { position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); display: none; }
.barre-flottante a { text-decoration: none; }
@media (max-width: 899px) { .barre-flottante { display: flex; } }
.gg-pop { position: absolute; }
.gg-mark.is-new { animation: gg-mark-in var(--duration-base) var(--ease-out); }
@keyframes gg-mark-in { from { background: transparent; } }

/* ---------- Lecteur audio / vidéo ---------- */
.lecteur .gg-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.espace-vitesse { width: 52px; }
.aide-transcription { margin: 0; padding: 8px 16px 12px; }
.gg-line.is-new span { animation: gg-mark-in var(--duration-base) var(--ease-out); }

/* ---------- Surlignages ---------- */
.groupe-surlignages { display: grid; gap: var(--space-2); padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.titre-groupe { font: var(--text-headline); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.etat { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font: 600 12px/16px var(--font-sans); }
.etat--ok { background: var(--success-soft); color: var(--success); }
.etat--echec { background: var(--danger-soft); color: var(--danger); }
.etat--attente { background: var(--surface-sunken); color: var(--ink-muted); }
.passage { margin: 0; display: flex; align-items: flex-start; gap: var(--space-2); font: var(--text-summary); }
.passage .gg-mark { flex: 1; cursor: default; }
.retirer { flex: none; }

/* ---------- Réglages ---------- */
.reglages a.gg-row { text-decoration: none; color: inherit; }
.sources summary { cursor: pointer; padding: var(--space-2) 0; }
.sources h3 { margin: var(--space-4) 0 var(--space-2); }

/* ---------- Notifications ---------- */
.apercus { display: grid; gap: var(--space-3); justify-items: start; }

/* ---------- Chercher ---------- */
.recherche { display: flex; gap: var(--space-2); }
.recherche input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: var(--text-body); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 12px); display: grid; gap: 8px; justify-items: center;
  width: min(92vw, 440px); pointer-events: none; }
.toasts > * { pointer-events: auto; }
.page-lire .toasts { bottom: 90px; }
@media (min-width: 900px) { .toasts { left: auto; right: 24px; transform: none; bottom: 24px; justify-items: end; } }

/* ---------- Bouton et états ---------- */
.gg-btn, a.gg-tag, a.gg-row, a.gg-side__item { text-decoration: none; }
.gg-btn.is-loading .gg-icon { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; } }

/* ---------- Lecture sur ordinateur : texte en pleine largeur (demande de Louis du 26/11) ---------- */
@media (min-width: 900px) {
  .ecran.lecture { max-width: none; }
  .ecran.lecture .gg-read, .ecran.lecture .gg-sum, .ecran.lecture .gg-video, .ecran.lecture .gg-audio { max-width: none; }
}

/* ---------- Connexion ---------- */
.page-connexion { min-height: 100dvh; display: grid; place-items: center; background: var(--paper); }
.connexion { width: min(360px, calc(100vw - 32px)); display: grid; justify-items: center; gap: var(--space-4); padding: var(--space-8) 0; }
.connexion__titre { font: 600 28px/34px var(--font-serif); color: var(--ink); margin: 0; }
.connexion__form { width: 100%; display: grid; gap: var(--space-3); }
.connexion__champ { height: 52px; padding: 0 16px; border-radius: var(--radius-md, 12px); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 400 17px/22px var(--font-sans); }
.connexion__champ:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.connexion__erreur { margin: 0; color: var(--danger); font: 500 14px/20px var(--font-sans); }
.resume-ia { margin: var(--space-2) 0 0; }
