/* programme.css — le Programme officiel, rubrique de Préparer (préfixe g-),
   et la recherche ⌘K (préfixe k-).
   Programme : le plan est le texte de la discipline, ses domaines à la suite,
   une carte chacun (comme les matières des progressions : un bandeau à son
   nom, à l'encre de la discipline, puis une ligne par entrée) ; la
   discipline, les âges et la recherche sont dans la barre de Préparer ; un
   objectif choisi a sa fiche à droite (sa ligne reste marquée). Un programme
   à soi a le même plan, écrit sur place.
   Le texte officiel se lit : corps 15 px, interligne large, rien en couleur
   hormis la page du texte officiel et ce que la recherche surligne.
   Aucune ombre. */

/* ————— dans la barre ————— */
.g-choix-discipline { max-width: 220px; }
.g-choix-discipline > .tronque { min-width: 0; }
.g-choix-ages { max-width: 220px; }
.g-choix-ages > .tronque { min-width: 0; }

/* ————— le texte : une tête par discipline, puis une carte par domaine ————— */
.g-liste { display: flex; flex-direction: column; gap: 22px; min-width: 0; padding-bottom: 14px; }
.g-bilan { padding: 4px 2px 0; font-size: 14px; color: var(--encre-2); }
.g-discipline { display: flex; flex-direction: column; gap: 12px; min-width: 0; scroll-margin-top: calc(var(--p-haut, 106px) + 12px); }
/* la tête d'une discipline : une tête de section (base.css), son point devant le titre */
.g-prog-tete .tete-section-titre { align-items: center; }
.g-prog-nom { border: none; background: none; color: inherit; font: inherit; padding: 2px 6px; margin-left: -6px; border-radius: var(--rayon-s); text-align: left; }
.g-prog-nom:hover { background: var(--creux-2); }

.g-cartes { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.g-carte { display: flex; flex-direction: column; min-width: 0; overflow: clip; scroll-margin-top: calc(var(--p-haut, 106px) + 12px); }
/* le bandeau d'un domaine : son nom à l'encre de la discipline, sur la craie */
.g-domaine { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px 6px 14px; background: var(--creux-2); }
.g-domaine-titre { min-width: 0; font-family: var(--police-titre); font-weight: 700; font-size: 17px; line-height: 1.25; }
button.g-domaine-titre { border: none; background: none; color: inherit; padding: 2px 6px; margin-left: -6px; border-radius: var(--rayon-s); text-align: left; }
button.g-domaine-titre:hover { background: var(--voile-bandeau); }
.g-domaine-titre:not(.encre) { color: var(--encre); }
.g-domaine-compte { font-size: 13px; font-weight: 700; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.g-domaine .g-sur-bandeau { background: var(--voile-bandeau); border: none; color: var(--encre); }
.g-domaine .g-sur-bandeau:hover { background: var(--feuille); }

/* une entrée : une ligne de la carte, qui se déplie */
.g-entree { border-top: 1px solid var(--trait); scroll-margin-top: calc(var(--p-haut, 106px) + 12px); }
.g-entree[data-ouvert] { background: var(--creux); }
.g-entree-tete { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.g-entree-bascule {
  flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px;
  min-height: 46px; padding: 12px 8px 10px 14px;
  border: none; background: none; border-radius: 0; text-align: left;
}
.g-entree-tete:has(> .g-entree-bascule:hover) { background: var(--creux); }
.g-entree[data-ouvert] .g-entree-tete:has(> .g-entree-bascule:hover) { background: var(--creux-2); }
.g-entree-titre.vide { color: var(--encre-3); }
.g-plus { flex: none; color: var(--encre-3); }
.g-entree-bascule > svg { margin-top: 3px; color: var(--encre-3); transition: transform 120ms; }
.g-entree-bascule[aria-expanded='true'] > svg { transform: rotate(90deg); }
.g-entree-bascule .pousse { display: flex; flex-direction: column; gap: 2px; }
.g-entree-titre { font-weight: 700; line-height: 1.3; }
.g-entree-bascule small { font-size: 13px; color: var(--encre-3); }
.g-extrait { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

/* repère : la page du texte officiel */
.g-page {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 28px; min-width: 44px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--trait-fort); background: var(--feuille);
  font-size: 13px; font-weight: 700; color: var(--encre-2); text-decoration: none; white-space: nowrap;
}
.g-page:hover { border-color: var(--accent-bord); color: var(--accent-texte); }

.g-entree-corps { padding: 0 16px 14px 40px; display: flex; flex-direction: column; gap: 18px; }

/* ————— un programme à soi : les noms s'écrivent sur place, le texte s'édite en clair ————— */
.g-saisie-nom.champ { flex: 1; min-width: 0; height: 34px; padding: 0 8px; font-weight: 700; }
.g-saisie-domaine.champ { font-family: var(--police-titre); font-size: 17px; max-width: 520px; }
.g-saisie-programme.champ { font-family: var(--police-titre); font-size: 17px; font-weight: 700; height: 34px; max-width: 520px; margin-left: -8px; }
.g-entree-saisie { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; }
.g-entree-saisie > svg { flex: none; color: var(--encre-3); transform: rotate(90deg); }
.g-entree-texte { gap: 10px; }
.g-entree-texte .editeur-riche { background: var(--feuille); border-radius: var(--rayon-m); }
.g-entree-texte .g-gestes { margin-top: 0; }
.g-pied { display: flex; gap: 8px; }
.g-vide { padding-top: 40px; }
.g-section { display: flex; flex-direction: column; gap: 6px; }
.g-section + .g-section { border-top: 1px solid var(--trait); padding-top: 14px; }
.g-age { display: flex; align-items: center; gap: 8px; }
.g-inter { margin: 10px 0 2px; font-size: 13px; font-weight: 700; color: var(--encre-2); letter-spacing: 0.01em; }
.g-section > .g-inter:first-child, .g-age + .g-inter { margin-top: 2px; }
.g-objectifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.g-objectifs li { display: flex; align-items: flex-start; gap: 10px; padding: 3px 0 3px 2px; line-height: 1.5; border-radius: var(--rayon-s); }
.g-objectifs li::before { content: ''; flex: none; width: 5px; height: 5px; margin-top: 9px; border-radius: 999px; background: var(--encre-3); }
.g-objectifs li.g-puce { margin-left: 18px; }
.g-objectifs li.g-puce::before { width: 6px; height: 1.5px; margin-top: 11px; border-radius: 0; }
/* un objectif se choisit : sa ligne entière est le bouton, sa fiche s'ouvre à côté */
.g-objectifs li:has(> .g-obj) { padding: 0; }
.g-objectifs li:has(> .g-obj)::before { margin-top: 13px; margin-left: 2px; }
.g-obj {
  flex: 1; min-width: 0; padding: 4px 8px; margin-left: -6px;
  border: 1px solid transparent; border-radius: var(--rayon-s); background: none;
  text-align: left; line-height: 1.5; color: inherit; font: inherit;
}
.g-obj:hover { background: var(--feuille); border-color: var(--trait); }
.g-objectifs li[aria-current='true'] > .g-obj { background: var(--accent-doux); border-color: var(--accent-bord); }
.g-liste-exemples li { color: var(--encre-2); }
.g-exemples-bascule { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 4px; }
.g-exemples { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: var(--rayon-m); background: var(--feuille); border: 1px solid var(--trait); }
.g-gestes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.g-liste mark, .k-liste mark { background: var(--avert-doux); color: inherit; border-radius: 3px; padding: 0 1px; }
.g-visee { animation: g-visee 2.4s ease-out; }
@keyframes g-visee { 0%, 35% { background: var(--accent-doux); outline: 4px solid var(--accent-doux); } 100% { outline: 4px solid transparent; } }

/* ————— la fiche d'un objectif ————— */
.g-surtitre { display: flex; align-items: center; gap: 8px; min-width: 0; }
.g-surtitre > .tronque { flex: 0 1 auto; min-width: 0; }
.g-surtitre-page { flex: none; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.g-fiche-usage { min-height: 40px; padding: 4px 6px; }
.g-fiche-usage > svg { color: var(--encre-3); flex: none; }
.g-fiche-sous { margin-top: 6px; }

/* ce que vise « Préparer un bloc », « Mettre dans une progression » (dans leur fenêtre) */
.g-vise { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--rayon-m); background: var(--creux); font-weight: 700; line-height: 1.4; }
.g-vise small { font-weight: 400; font-size: 13px; color: var(--encre-3); }

/* ————— étroit : le texte pleine largeur ————— */
@media (max-width: 899px) {
  .g-liste { padding: 0 12px 14px; }
  .g-prog-tete .tete-section-meta { display: none; }
  .g-prog-tete .bouton span { display: none; }
  .g-carte { border-radius: var(--rayon-m); }
  .g-domaine .bouton.petit { height: 36px; }
  .g-entree-bascule { padding-left: 10px; min-height: 52px; }
  .g-entree-corps { padding: 0 10px 14px 12px; }
  .g-page { height: 36px; }
  .g-obj { padding: 8px 8px; }
  .g-gestes .bouton { flex: 1 1 auto; }
}

/* ————— la recherche (⌘K) ————— */
dialog.feuille.k-recherche { height: min(86dvh, 640px); }
.k-tete { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--trait); }
.k-champ { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; color: var(--encre-3); }
.k-champ input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--encre); font-size: 17px; }
.k-liste { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 12px; display: flex; flex-direction: column; gap: 1px; }
.k-groupe { padding: 12px 10px 4px; font-size: 12px; font-weight: 700; color: var(--encre-3); }
.k-resultat {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: var(--rayon-m); background: none; text-align: left;
}
.k-resultat[aria-selected='true'] { background: var(--accent-doux); border-color: var(--accent-bord); }
.k-resultat .tuile { width: 32px; height: 32px; }
.k-resultat .ligne-texte > :first-child { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.k-resultat > svg:last-child { color: var(--encre-3); opacity: 0; }
.k-resultat[aria-selected='true'] > svg:last-child { opacity: 1; }
@media (max-width: 599px) {
  dialog.feuille.k-recherche { height: calc(100dvh - 40px); }
  .k-tete { padding-top: 6px; }
  .k-resultat { min-height: 54px; }
}
