/* Pages des spectacles du festival — gabarit commun à toutes les compagnies.
   Même habillage que l'accueil (style.css) : papier, rouge du titre, Garamond et Franklin.
   Ordre : ouverture photographique, fiche, texte, représentation, compagnie,
   le même jour, téléchargement, spectacle précédent / suivant. */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-v33-latin-variable.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Libre Franklin";
  src: url("/assets/fonts/libre-franklin-v20-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ecart-logos: clamp(1.5rem, 4vw, 3rem); /* même écart entre tous les logos du pied */
  --papier: #e3d8c2;
  --papier-clair: #ece4d3;
  --encre: #1b1712;
  --gris: #5c5245;
  --filet: rgb(43 30 21 / .25);
  --rouge: #e41624;
  --rouge-texte: #b5101c;
  /* Types du programme : couleurs du flyer, assombries pour le petit texte sur papier */
  --t-spectacle: #b5101c;
  --t-atelier: #7a5216;
  --t-manege: #415726;
  --t-conference: #34506a;
  --titrage: "EB Garamond", Garamond, "Times New Roman", serif;
  --labeur: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --gouttiere: clamp(1rem, 4vw, 4.5rem);
  --colonne: 800px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--labeur);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
.nowrap { white-space: nowrap; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }

/* Libellé en petites capitales espacées : un seul réglage pour toute la page */
.bandeau-lien, .fiche dt, .type, .origine, .suite-sens, .soutien {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.type-spectacle  { color: var(--t-spectacle); }
.type-atelier    { color: var(--t-atelier); }
.type-manege     { color: var(--t-manege); }
.type-conference { color: var(--t-conference); }
.type-karaoke, .type-parade { color: var(--t-spectacle); }

/* ---------------------------------------------------------------
   Bandeau : le titre du festival ramène à l'accueil
   --------------------------------------------------------------- */
.bandeau {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: clamp(.75rem, 2vw, 1.25rem) var(--gouttiere);
  color: #fff;
}
.bandeau-titre { display: block; width: clamp(7rem, 14vw, 10rem); border-radius: 4px; }
.bandeau-titre img { filter: drop-shadow(0 1px 6px rgb(0 0 0 / .45)); }
.bandeau-lien { margin-top: .4rem; text-decoration: none; border-bottom: 2px solid var(--rouge); padding-bottom: .15rem; text-shadow: 0 1px 8px rgb(0 0 0 / .5); }
.bandeau-lien:hover { border-bottom-color: #fff; }

/* ---------------------------------------------------------------
   Ouverture : photographie pleine largeur, titre posé en bas à gauche
   La photo est recadrée en hauteur, parce qu'elle porte le titre.
   --------------------------------------------------------------- */
.ouverture {
  position: relative;
  display: grid;
  /* Format 3/2, plafonné à la hauteur de l'écran : le titre reste visible quelle
     que soit la photo (portrait ou paysage), recadrée pour remplir. */
  height: clamp(22rem, 66.667vw, 100svh);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--encre);
  color: #fff;
}
.ouverture-photo {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--cadrage, 50% 35%);
}
.ouverture::after {
  content: "";
  grid-area: 1 / 1;
  background: linear-gradient(to bottom, rgb(0 0 0 / .45), rgb(0 0 0 / 0) 22% 40%, rgb(0 0 0 / .72));
}
/* Photo portrait : on garde le haut de l'image (visages) */
.ouverture-photo.cadrage-haut { object-position: 50% 15%; }
/* Sujet qui touche le haut de la photo (Les Voyageurs du ciel) : rien n'est coupé en haut */
.ouverture-photo.cadrage-sommet { object-position: 50% 0; }
/* Sans photo : titre à l'encre sur le papier, le logo du festival reste au-dessus */
.ouverture.sans-photo { height: auto; grid-template-rows: auto; background: var(--papier-clair); color: var(--encre); padding-top: clamp(6rem, 14vw, 9rem); border-bottom: 1px solid var(--filet); }
.ouverture.sans-photo::after { display: none; }
.ouverture.sans-photo .ouverture-texte { text-shadow: none; }
.ouverture.sans-photo .ouverture-cie { color: var(--rouge-texte); }
.ouverture-texte {
  grid-area: 1 / 1;
  z-index: 1;
  align-self: end;
  width: 100%;
  max-width: calc(var(--colonne) + 2 * var(--gouttiere));
  margin: 0 auto;
  padding: 0 var(--gouttiere) clamp(1.5rem, 5vw, 3rem);
  text-shadow: 0 1px 12px rgb(0 0 0 / .35);
}
.ouverture-texte p { margin: 0; }
.ouverture h1 {
  margin: .3rem 0 0;
  font-family: var(--titrage);
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.08; /* les jambages (p, J, g) ne touchent pas la ligne suivante */
  text-wrap: balance;
}
.ouverture-cie { margin-top: 1.2rem !important; font-family: var(--titrage); font-size: clamp(1.2rem, 2.8vw, 1.6rem); }
.ouverture-quand { margin-top: 1rem !important; font-weight: 600; line-height: 1.4; }

/* ---------------------------------------------------------------
   Colonne de lecture
   --------------------------------------------------------------- */
.colonne {
  max-width: calc(var(--colonne) + 2 * var(--gouttiere));
  margin: 0 auto;
  padding: 0 var(--gouttiere) clamp(2rem, 6vw, 4rem);
}

/* Fiche : paires libellé / valeur sur une ligne, filet dessous */
.fiche {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--encre);
}
.fiche dt { color: var(--gris); }
.fiche dd { margin: .1rem 0 0; font-weight: 600; }

.bloc { padding-top: clamp(2rem, 5vw, 3rem); }
.bloc p { margin: 0 0 1rem; max-width: 64ch; }
.bloc h2 {
  margin: 0 0 .9rem;
  font-family: var(--titrage);
  font-weight: 500;
  font-size: clamp(1.45rem, 3.4vw, 1.9rem);
  line-height: 1.15;
}
.bloc h2::before { content: ""; display: block; width: 34px; height: 3px; margin-bottom: .9rem; background: var(--rouge); }
.chapeau {
  font-family: var(--titrage);
  font-size: clamp(1.25rem, 2.8vw, 1.5rem);
  line-height: 1.35;
}
.origine { color: var(--gris); margin-top: -.4rem !important; }

/* Distribution : rôle à gauche, noms à droite, comme une feuille de salle */
.distribution { margin: 0; max-width: 64ch; }
.distribution div {
  display: grid;
  grid-template-columns: minmax(7rem, 14rem) 1fr;
  gap: 1rem;
  align-items: center; /* le nom au milieu de la case, face à un rôle sur deux lignes */
  padding: .6rem 0;
  border-top: 1px solid var(--filet);
}
.distribution div:last-child { border-bottom: 1px solid var(--filet); }
.distribution dt { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); }
.distribution dd { margin: 0; font-weight: 600; }

.liens a {
  font-weight: 600;
  text-decoration-color: var(--rouge);
  text-decoration-thickness: 2px;
  text-underline-offset: .25em;
}
.liens a:hover { color: var(--rouge-texte); }
.liens a[target="_blank"]::after { content: " ↗"; }
.poids { margin-left: .4rem; font-weight: 400; color: var(--gris); }

/* Compagnie : présentation et petite carte du Nivernais (contour repris de
   cnma58.fr). La compagnie de la page en rouge, les autres compagnies du
   festival en or. */
/* La carte prend toute la hauteur du bloc, du filet rouge au dernier lien,
   sans dépasser la largeur de sa case : posée en absolu dans une case que
   la ligne de la grille étire à la hauteur du texte. */
.avec-carte { display: grid; grid-template-columns: 1fr clamp(7rem, 16vw, 12rem); gap: clamp(1rem, 4vw, 2.5rem); align-items: stretch; }
.avec-carte > div > :last-child { margin-bottom: 0; }
.carte-case { display: flex; flex-direction: column; justify-content: center; }
.carte { display: block; width: 100%; height: auto; overflow: visible; }
/* Crédit de la carte (licence libre) : il apparaît au survol de la carte
   (et au clavier) ; sur écran tactile, sans survol, il reste affiché. */
.credit-carte { margin: .4rem 0 0 !important; font-size: .62rem; line-height: 1.3; color: var(--gris); text-align: center; }
.credit-carte { opacity: 0; transition: opacity .25s ease; }
.carte-case:hover .credit-carte, .carte-case:focus-within .credit-carte { opacity: 1; }
@media (hover: none) { .credit-carte { opacity: 1; } }
.credit-carte a { color: inherit; text-decoration: none; }
.credit-carte a:hover { color: var(--rouge-texte); }
@media (max-width: 600px) {
  .avec-carte { grid-template-columns: 1fr 5.5rem; }
}
.carte-contour { fill: rgb(212 175 55 / .18); stroke: #800020; stroke-width: 5; stroke-linejoin: round; }
.carte-autre { fill: #d4af37; stroke: #800020; stroke-width: 3; }
.carte-ici { fill: var(--rouge); stroke: #fff; stroke-width: 4; }
.carte-nom { font-family: var(--labeur); font-weight: 700; fill: var(--rouge-texte); paint-order: stroke; stroke: var(--papier); stroke-width: 7px; stroke-linejoin: round; }

/* Le même jour : programme de la journée, le spectacle de la page marqué */
.creneaux { list-style: none; margin: 0 0 1rem; padding: 0; }
.creneaux li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding: .75rem 0;
  border-top: 1px solid var(--filet);
}
.creneaux li:last-child { border-bottom: 1px solid var(--filet); }
.heure { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quoi .type { margin-right: .15rem; }
.quoi a { font-weight: 600; text-decoration-color: var(--rouge); text-underline-offset: .2em; }
.quoi a:hover { color: var(--rouge-texte); }
.creneaux li.ici .heure, .creneaux li.ici strong { color: var(--rouge-texte); }
.sur-place { color: var(--gris); }

/* ---------------------------------------------------------------
   Spectacle précédent / suivant, dans l'ordre du programme
   --------------------------------------------------------------- */
.suite {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: calc(var(--colonne) + 2 * var(--gouttiere));
  margin: 0 auto;
  padding: 1.5rem var(--gouttiere) clamp(3rem, 7vw, 5rem);
}
.suite a { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; }
.suite-suiv { text-align: right; margin-left: auto; }
.suite-sens { color: var(--gris); }
.suite-prec .suite-sens::before { content: "← "; }
.suite-suiv .suite-sens::after { content: " →"; }
.suite-titre { font-family: var(--titrage); font-size: clamp(1.15rem, 2.6vw, 1.4rem); line-height: 1.2; }
.suite a:hover .suite-titre { color: var(--rouge-texte); text-decoration: underline 2px var(--rouge); text-underline-offset: .2em; }

/* ---------------------------------------------------------------
   Pied de page (identique à l'accueil)
   --------------------------------------------------------------- */
.pied {
  padding: clamp(2.5rem, 6vw, 4rem) var(--gouttiere) 3rem;
  background: var(--papier-clair);
  border-top: 3px solid var(--rouge);
  text-align: center;
}
.porteur { margin: 0 auto 1.5rem; max-width: 40rem; font-family: var(--titrage); font-size: clamp(1.15rem, 2.4vw, 1.4rem); }
.porteur { text-wrap: balance; }
.porteur a { text-decoration: none; } /* cliquable, sans soulignement : rouge au survol */
.porteur a:hover { color: var(--rouge-texte); }
.soutien { margin: 0 0 1rem; color: var(--gris); }
.logos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem var(--ecart-logos);
}
.logos-porteurs { margin-bottom: clamp(2rem, 5vw, 3rem) !important; }
/* Chaque logo a une case de même taille : il y est centré et réduit pour y
   tenir. Cases égales, donc écarts égaux ; chaque ligne est centrée. */
.logos li { width: var(--case-l); }
.logos a { display: block; border-radius: 4px; }
.logos img { width: 100%; height: var(--case-h); object-fit: contain; }
:root { --case-l: clamp(5.5rem, 14vw, 9rem); --case-h: clamp(3.4rem, 7.5vw, 5rem); }
/* Téléphone : quatre soutiens en deux lignes de deux plutôt que trois et un */
@media (max-width: 520px) {
  .logos:not(.logos-porteurs) { max-width: calc(2 * var(--case-l) + var(--ecart-logos)); margin-inline: auto; }
}
.logos a img { transition: translate .25s ease, filter .25s ease; }
.logos a:hover img { translate: 0 -3px; filter: drop-shadow(0 .3rem .4rem rgb(60 30 10 / .18)); }
@media (prefers-reduced-motion: reduce) { .logos a img { transition: none; } }

/* Téléphone : la fiche en deux colonnes régulières */
@media (max-width: 520px) {
  .fiche { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------
   Page Ateliers : un bloc par atelier, puis les temps forts
   --------------------------------------------------------------- */
.intro-ateliers { margin: 1.5rem 0 0; padding-bottom: 1.5rem; border-bottom: 1px solid var(--encre); font-weight: 600; }
.anime { margin: .7rem 0 0 !important; font-size: .9rem; color: var(--gris); }
.anime a { color: inherit; text-decoration-color: var(--rouge); text-underline-offset: .2em; }
.anime a:hover { color: var(--rouge-texte); }
.quand { margin: 0 0 .9rem !important; font-weight: 700; }
.fiche-atelier { border-top: 1px solid var(--filet); border-bottom: 1px solid var(--filet); padding: .9rem 0; }
.atelier-photo { position: relative; margin: 1.25rem 0 0; width: 100%; max-width: 32rem; }
.atelier-photo img { width: 100%; border-radius: 4px; }
.temps-fort { padding: .9rem 0; border-top: 1px solid var(--filet); }
.temps-fort:last-child { border-bottom: 1px solid var(--filet); }
.temps-fort h3 { margin: 0 0 .2rem; font-family: var(--titrage); font-weight: 500; font-size: clamp(1.2rem, 2.6vw, 1.45rem); }
.temps-fort p { margin: 0 0 .3rem; }
.atelier, .temps-fort { scroll-margin-top: 1rem; }
.acces { margin-top: .6rem; color: var(--gris); }
.acces::before { content: "♿ "; }

/* Une séance : titre sur la première ligne, compagnie et âge dessous */
.quoi .titre-ligne { display: block; }
.quoi .detail { display: block; margin-top: .1rem; font-size: .9em; color: var(--gris); }

/* Programme : chaque ligne entière est un lien, sans soulignement */
.creneaux li { display: block; padding: 0; }
.creneaux .ligne { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: .75rem; align-items: baseline; padding: .6rem .5rem .6rem 0; color: inherit; text-decoration: none; }
.creneaux a.ligne::after { content: "→"; color: var(--rouge); opacity: .55; transition: opacity .2s ease, translate .2s ease; }
.creneaux a.ligne:hover, .creneaux a.ligne:focus-visible { background: rgb(255 255 255 / .35); }
.creneaux a.ligne:hover::after, .creneaux a.ligne:focus-visible::after { opacity: 1; translate: .2rem 0; }
.creneaux a.ligne:hover strong { color: var(--rouge-texte); }
.creneaux a.ligne:focus-visible { outline: 2px solid var(--encre); outline-offset: -2px; border-radius: 4px; }
.creneaux li.ici .ligne { background: rgb(255 255 255 / .35); }
.creneaux li.ici strong, .creneaux li.ici .heure { color: var(--rouge-texte); }
@media (prefers-reduced-motion: reduce) { .creneaux a.ligne::after { transition: none; } }
.creneaux .heure { white-space: normal; hyphens: manual; }

/* Conseils Google (modern-web-guidance) :
   - visually-stable-font-fallbacks : la police de secours prend la même
     hauteur d'x que la police du site, le texte ne saute pas au chargement ;
   - improve-text-layout-and-legibility : titres équilibrés, pas de mot
     seul en fin de paragraphe ni de titre de spectacle. */
body { font-size-adjust: from-font; }
h1, h2, h3, h4, .quoi .titre-ligne { text-wrap: balance; }
p { text-wrap: pretty; }

/* Mentions légales, crédits, confidentialité : discret, tout en bas */
.mentions { margin-top: clamp(2rem, 5vw, 3rem); padding-top: 1.25rem; border-top: 1px solid rgb(43 30 21 / .15); font-size: .72rem; line-height: 1.6; color: var(--gris); opacity: .85; }
.mentions p { margin: .2rem auto; max-width: 60rem; text-wrap: balance; }
.mentions a { color: inherit; text-decoration: none; }
.mentions a:hover { color: var(--rouge-texte); }

/* Crédit photo : discret, dans le coin bas à droite de l'image */
.credit {
  position: absolute; right: .6rem; bottom: .45rem; z-index: 2; margin: 0;
  font-size: .68rem; letter-spacing: .02em; color: rgb(255 255 255 / .72);
  text-shadow: 0 1px 3px rgb(0 0 0 / .6); pointer-events: none;
}

/* Bouton rond de partage (partage.js) : téléphone seulement, flottant en bas à droite.
   Discret : papier clair, filet, pas de rouge. Caché sur ordinateur (souris). */
.partage {
  position: fixed; z-index: 20;
  right: calc(1rem + env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: grid; place-items: center;
  width: 3rem; height: 3rem; padding: 0;
  border: 1px solid var(--filet); border-radius: 50%;
  background: var(--papier-clair); color: var(--encre);
  box-shadow: 0 2px 10px rgb(43 30 21 / .18);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.partage[hidden] { display: none; }
.partage svg { fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.partage:active { background: var(--papier); }
.partage:focus-visible { outline: 2px solid var(--encre); outline-offset: 3px; }
.partage-menu {
  position: fixed; z-index: 20;
  right: calc(1rem + env(safe-area-inset-right));
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  background: var(--papier-clair); border: 1px solid var(--filet); border-radius: 4px;
  box-shadow: 0 2px 10px rgb(43 30 21 / .18);
  font-family: var(--labeur); font-size: 1rem;
}
.partage-menu a { padding: .8rem 1.4rem; color: var(--encre); text-decoration: none; }
.partage-menu a + a { border-top: 1px solid var(--filet); }
.partage-menu a:focus-visible { outline-offset: -3px; }
/* Le bouton ne cache pas les dernières lignes du pied de page */
@media (hover: none) { .pied { padding-bottom: calc(3rem + 4rem); } }
@media (hover: hover) and (pointer: fine) { .partage, .partage-menu { display: none; } }
