/* Compositions de pages (inspirées des grands sites associatifs : bandes, « à la une »,
   photos à étiquette, rangées alternées), dessinées avec la charte Terre Fragile. */

:root {
  --grain: url("../img/textures/papier-grain.webp");
  --hauteur-bord: 40px;
}
.tf-visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête collant ---------- */
.tf-entete {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-block: var(--espace-3);
  background: var(--papier) var(--grain) repeat;
  background-size: 400px 400px;
  transition: box-shadow 0.2s ease, padding 0.2s ease;
}
.tf-entete[data-replie] { padding-block: 6px; box-shadow: 0 1px 0 rgba(40, 38, 34, 0.06), 0 6px 18px rgba(40, 38, 34, 0.08); }
.tf-entete__inner { gap: var(--espace-5); }
.tf-entete__logo img { width: 124px; height: 124px; transition: width 0.2s ease, height 0.2s ease; }
.tf-entete[data-replie] .tf-entete__logo img { width: 76px; height: 76px; }
.tf-entete .tf-nav { margin-inline: auto; }
.tf-entete .tf-nav ul { gap: var(--espace-5); }
.tf-nav a { font-weight: 800; font-size: 16.5px; }
.tf-nav__mobile { display: none; }
.tf-entete__actions { display: flex; gap: var(--espace-3); flex: none; }
.tf-entete__actions .tf-btn { padding: 11px 20px 12px; font-size: 15px; }
@media (max-width: 1180px) {
  .tf-entete .tf-nav ul { gap: var(--espace-4); }
  .tf-nav a { font-size: 15.5px; }
  .tf-entete__don { display: none; }
}
@media (max-width: 1020px) {
  .tf-entete .tf-nav { margin-left: auto; margin-right: 0; }
  .tf-entete .tf-nav ul { display: none; }
  .tf-entete .tf-nav[data-ouvert] ul {
    display: flex; flex-direction: column; position: absolute; left: var(--espace-4); right: var(--espace-4); top: 100%;
    gap: 0; padding: var(--espace-4) var(--espace-5); background: var(--papier-blanc); border-radius: var(--rayon-m); box-shadow: var(--ombre-feuille);
  }
  .tf-nav__mobile { display: block; }
  .tf-nav__bouton { display: inline-flex; }
  .tf-entete__logo img { width: 96px; height: 96px; }
}
@media (max-width: 640px) {
  .tf-entete__logo img, .tf-entete[data-replie] .tf-entete__logo img { width: 68px; height: 68px; }
  .tf-entete__actions .tf-btn { padding: 10px 14px 11px; }
}

/* ---------- Bouton blanc (sur une bande de couleur) ---------- */
.tf-btn--blanc { background: var(--papier-blanc); color: var(--encre); }
.tf-bande--corail .tf-btn--blanc { color: var(--corail-fonce); }
.tf-bande--petrole .tf-btn--blanc, .tf-pied .tf-btn--blanc { color: var(--petrole); }

/* ---------- Bandes aux bords déchirés ---------- */
.tf-bande {
  --bande: var(--teinte);
  position: relative;
  background: var(--grain) 0 0 / 400px 400px repeat, var(--bande);
  background-blend-mode: multiply, normal;
  margin-block: var(--hauteur-bord);
}
.tf-bande::before,
.tf-bande::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--hauteur-bord);
  background: inherit;
  background-blend-mode: inherit;
  -webkit-mask: url("../img/textures/masque-bord.webp") center bottom / 100% 100% no-repeat;
  mask: url("../img/textures/masque-bord.webp") center bottom / 100% 100% no-repeat;
  pointer-events: none;
}
.tf-bande::before { bottom: calc(100% - 1px); }
.tf-bande::after { top: calc(100% - 1px); transform: scale(-1, -1); }
.tf-bande--corail { --bande: var(--corail-fonce); color: var(--papier-blanc); }
.tf-bande--petrole { --bande: var(--petrole); color: var(--papier-blanc); }
.tf-bande--emeraude { --bande: var(--emeraude-fonce); color: var(--papier-blanc); }
.tf-bande--ciel { --bande: var(--ciel); color: var(--papier-blanc); }
.tf-bande + .tf-bande { margin-top: calc(var(--hauteur-bord) * 2); }

/* ---------- En-tête de section (titre souligné à gauche, lien à droite) ---------- */
.tf-tete-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--espace-4) var(--espace-6);
  flex-wrap: wrap;
  margin-bottom: var(--espace-7);
}
.tf-tete-section__titre {
  padding-bottom: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M3 7 C 30 2, 52 11, 82 6 S 130 2, 160 7 S 190 5, 197 6' fill='none' stroke='%237ea625' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") left bottom / min(100%, 220px) 12px no-repeat;
}
.tf-tete-section__intro { max-width: var(--largeur-texte); margin: calc(var(--espace-5) * -1) 0 var(--espace-7); }
.tf-lien-tout {
  font-weight: 800;
  font-size: 16px;
  color: var(--encre);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--papier-ombre);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.tf-lien-tout::after { content: " →"; }
.tf-lien-tout:hover { color: var(--corail-fonce); border-color: var(--corail); }

/* ---------- Photo à étiquette ---------- */
.tf-carte-photo { display: block; position: relative; color: inherit; text-decoration: none; margin-bottom: 22px; }
.tf-carte-photo__cadre {
  display: block;
  overflow: hidden;
  border-radius: 12px 5px 14px 6px / 6px 14px 5px 12px;
  box-shadow: var(--ombre-feuille);
  background: var(--papier-ombre);
  aspect-ratio: 16 / 9;
}
.tf-carte-photo--grande .tf-carte-photo__cadre { aspect-ratio: 2 / 1; }
.tf-carte-photo__cadre img { display: block; width: 100%; height: 100%; object-fit: cover; transition: scale 0.5s ease; }
a.tf-carte-photo:hover .tf-carte-photo__cadre img { scale: 1.035; }
.tf-etiquette {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -20px;
  margin: 0;
  font-family: "Blushes Espace", Blushes, var(--font-titre);
  font-weight: 900;
  font-size: 26px;
  line-height: 1.32;
  rotate: -1.2deg;
  transform-origin: left bottom;
}
.tf-carte-photo--grande .tf-etiquette { font-size: 38px; left: 28px; bottom: -24px; max-width: 70%; }
.tf-etiquette span {
  background: var(--ton-encre, var(--corail-fonce));
  color: var(--papier-blanc);
  padding: 2px 12px 4px;
  border-radius: 5px 12px 4px 10px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  box-shadow: 0 2px 4px rgba(40, 38, 34, 0.16);
}
a.tf-carte-photo:hover .tf-etiquette span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.tf-alaune__resume, .tf-grille-photos__item .tf-alaune__resume { margin-top: var(--espace-5); }
.tf-alaune__resume p { margin: 0; }

/* « Ton » des étiquettes : texte blanc lisible sur chaque teinte */
.tf-ton--corail { --ton-encre: var(--corail-fonce); }
.tf-ton--ciel { --ton-encre: var(--ciel); }
.tf-ton--petrole { --ton-encre: var(--petrole); }

/* ---------- À la une ---------- */
.tf-alaune { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--espace-7); align-items: start; }
.tf-alaune__texte { padding: var(--espace-6) var(--espace-5) 0; max-width: 640px; }
.tf-alaune__texte p { margin: 0 0 var(--espace-5); }
.tf-alaune__cote { display: grid; gap: var(--espace-7); }

/* ---------- Grille de photos ---------- */
.tf-grille-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--espace-8) var(--espace-6); }
.tf-grille-photos--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Rangée photo + texte ---------- */
.tf-section--rangee { padding-block: var(--espace-8); }
.tf-rangee { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--espace-8); align-items: center; }
.tf-rangee--inverse .tf-rangee__photo { order: 2; }
.tf-rangee__photo { margin: 0; }
.tf-rangee__photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; box-shadow: var(--ombre-feuille); rotate: -1deg; }
.tf-rangee--inverse .tf-rangee__photo img { rotate: 1deg; }
.tf-rangee__texte .titre-2 { margin-bottom: var(--espace-5); }
.tf-rangee__texte .tf-prose { margin-bottom: var(--espace-6); }

/* Morceaux de scotch sur les photos posées */
.tf-scotch { position: relative; }
.tf-scotch::before,
.tf-scotch::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 96px;
  height: 30px;
  background: rgba(244, 238, 214, 0.78);
  box-shadow: 0 1px 2px rgba(40, 38, 34, 0.12);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent 0) , repeating-linear-gradient(0deg, #000 0 3px, transparent 3px 4px);
  -webkit-mask-composite: source-over;
}
.tf-scotch::before { top: -12px; left: 28px; rotate: -6deg; }
.tf-scotch::after { bottom: -12px; right: 32px; rotate: -4deg; }
.tf-scotch--droite::before { left: auto; right: 28px; rotate: 6deg; }
.tf-scotch--droite::after { right: auto; left: 32px; rotate: 4deg; }

/* ---------- Bande d'appel pleine couleur ---------- */
.tf-bande-appel { padding-block: var(--espace-8); }
.tf-bande-appel__inner { display: flex; align-items: center; justify-content: center; gap: var(--espace-7); text-align: left; }
.tf-bande-appel__dessin { width: 150px; height: auto; flex: none; rotate: -4deg; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.18)); }
.tf-bande-appel__phrase { color: var(--papier-blanc); font-size: 40px; line-height: 1.15; max-width: 22ch; margin: 0 0 var(--espace-6); }
.tf-bande-appel__texte { margin: calc(var(--espace-4) * -1) 0 var(--espace-6); max-width: 52ch; font-size: 18px; }

/* ---------- Thématiques cliquables ---------- */
.tf-theme__lien { display: flex; flex-direction: column; align-items: center; color: inherit; text-decoration: none; }
.tf-theme__lien:hover .tf-theme__dessin { rotate: 0deg; scale: 1.06; }
.tf-theme__lien:hover .tf-theme__titre { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--feuille); }
.tf-theme__dessin { transition: rotate 0.2s ease, scale 0.2s ease; }

/* ---------- Appel avec dessin ---------- */
.tf-appel { position: relative; max-width: 680px; width: 100%; box-sizing: border-box; }
.tf-appel--dessin { display: flex; align-items: center; gap: var(--espace-6); text-align: left; }
.tf-appel__dessin { width: 120px; height: auto; flex: none; rotate: -3deg; }

/* ---------- Agenda en colonnes ---------- */
.tf-liste-evenements--grille { max-width: none; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--espace-6); }
.tf-liste-evenements--grille .tf-evenement { align-items: start; }

/* ---------- Cartes article ---------- */
.tf-carte-article__cadre { display: block; overflow: hidden; border-radius: 12px 5px 14px 6px / 6px 14px 5px 12px; box-shadow: var(--ombre-feuille); margin-bottom: var(--espace-4); background: var(--papier-ombre); aspect-ratio: 3 / 2; }
.tf-carte-article__cadre .tf-carte-article__image { margin: 0; border-radius: 0; box-shadow: none; height: 100%; transition: scale 0.5s ease; }
.tf-carte-article__lien:hover .tf-carte-article__image { scale: 1.035; }

/* ---------- Frise chronologique ---------- */
.tf-frise { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; max-width: 900px; }
.tf-frise::before {
  content: "";
  position: absolute;
  left: 118px;
  top: 12px;
  bottom: 12px;
  width: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 120' preserveAspectRatio='none'%3E%3Cpath d='M5 0 C 2 20, 8 40, 5 60 S 2 100, 5 120' fill='none' stroke='%237ea625' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center top / 10px 120px repeat-y;
}
.tf-frise__etape { display: grid; grid-template-columns: 110px 1fr; gap: var(--espace-6); position: relative; padding-bottom: var(--espace-6); }
.tf-frise__etape::before {
  content: "";
  position: absolute;
  left: 116px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%;
  background: var(--ton-trait, var(--corail));
  box-shadow: 0 0 0 5px var(--papier);
}
.tf-frise__date {
  margin: 0;
  text-align: right;
  font-family: "Blushes Espace", Blushes, var(--font-titre);
  font-weight: 900;
  font-size: 30px;
  line-height: 1.1;
  color: var(--ton-encre, var(--corail-fonce));
}
.tf-frise__texte { padding-left: var(--espace-5); }
.tf-frise__texte p { margin: 0 0 var(--espace-3); }

/* ---------- Invitation (feuille + photo scotchée) ---------- */
.tf-invitation { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--espace-8); align-items: center; }
.tf-invitation__feuille { padding: var(--espace-7) var(--espace-7) var(--espace-6); }
.tf-invitation__feuille .titre-3 { margin-bottom: var(--espace-4); }
.tf-invitation__feuille .tf-btn { margin-top: var(--espace-2); }
.tf-invitation__note { font-size: 14px; color: var(--texte-doux); margin: var(--espace-6) 0 0; }
.tf-invitation__note a { color: var(--petrole); font-weight: 700; }
.tf-invitation__photo { margin: 0; }
.tf-invitation__photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; box-shadow: var(--ombre-feuille); rotate: 2deg; }

/* ---------- Carte interactive ---------- */
.tf-carte-ign { position: relative; border-radius: 12px 5px 14px 6px / 6px 14px 5px 12px; overflow: hidden; box-shadow: var(--ombre-feuille); background: var(--papier-blanc); aspect-ratio: 16 / 8; }
.tf-carte-ign iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tf-carte-ign__lien { margin: var(--espace-4) 0 0; text-align: right; font-size: 15px; }

/* ---------- Contacts (antennes) ---------- */
.tf-contacts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--espace-6); }
.tf-contact { padding: var(--espace-5) var(--espace-5) var(--espace-6); }
.tf-contact__region { font-size: 24px; line-height: 1.15; color: var(--ton-encre); margin-bottom: var(--espace-3); }
.tf-contact__nom { margin: 0; font-weight: 800; color: var(--encre); }
.tf-contact__email { color: var(--petrole); font-size: 15px; word-break: break-all; }
.tf-contacts__suite { margin-top: var(--espace-7); }

/* ---------- Feuilles illustrées ---------- */
.tf-feuilles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--espace-7); padding-top: var(--espace-6); }
.tf-feuilles__item { position: relative; padding: var(--espace-7) var(--espace-6) var(--espace-6); }
.tf-feuilles__dessin { position: absolute; top: -52px; right: 18px; width: 110px; height: auto; rotate: 4deg; }
.tf-feuilles__item .titre-3 { margin-bottom: var(--espace-3); padding-right: 100px; }

/* ---------- Membres ---------- */
.tf-grille-membres { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--espace-8) var(--espace-6); }
.tf-membre__portrait img { filter: grayscale(1) contrast(1.05); }
.tf-membre__texte { margin: 0; max-width: 30ch; color: var(--texte-doux); }

/* ---------- Partenaires en timbres (pleine largeur) ---------- */
.tf-partenaires__timbres { list-style: none; margin: 0; padding: var(--espace-4) 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--espace-6); align-items: center; }
.tf-partenaire__lien {
  display: block;
  rotate: var(--penche, -2deg);
  filter: drop-shadow(0 2px 2px rgba(40, 38, 34, 0.14)) drop-shadow(0 7px 12px rgba(40, 38, 34, 0.1));
  transition: rotate 0.2s ease, translate 0.2s ease;
}
.tf-partenaire__lien:hover, .tf-partenaire__lien:focus-visible { rotate: 0deg; translate: 0 -3px; }
.tf-partenaire__papier {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 5 / 4;
  box-sizing: border-box;
  padding: 16%;
  background: var(--papier-blanc);
  -webkit-mask:
    linear-gradient(#000 0 0) center / calc(100% - 18px) calc(100% - 18px) no-repeat,
    radial-gradient(circle at 9px 9px, #0000 5.8px, #000 6.3px) -9px -9px / 18px 18px round;
  mask:
    linear-gradient(#000 0 0) center / calc(100% - 18px) calc(100% - 18px) no-repeat,
    radial-gradient(circle at 9px 9px, #0000 5.8px, #000 6.3px) -9px -9px / 18px 18px round;
}
.tf-partenaire__papier img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1); opacity: 0.8; transition: filter 0.2s ease, opacity 0.2s ease; }
.tf-partenaire__lien:hover img, .tf-partenaire__lien:focus-visible img { filter: none; opacity: 1; }
@media (max-width: 900px) { .tf-partenaires__timbres { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tf-partenaires__timbres { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--espace-5); } }

/* ---------- Pied de page ---------- */
.tf-pied { padding-top: var(--espace-6); }
.tf-pied__lettre { display: flex; align-items: center; justify-content: space-between; gap: var(--espace-6); flex-wrap: wrap; padding-bottom: var(--espace-7); margin-bottom: var(--espace-7); border-bottom: 1px solid rgba(255, 255, 255, 0.24); }
.tf-pied__lettre p { margin: var(--espace-2) 0 0; font-size: 17px; }
.tf-pied .tf-pied__lettre-titre { font-size: 36px; line-height: 1.1; margin: 0; }
.tf-pied__formulaire { display: flex; gap: var(--espace-3); flex: 1 1 420px; max-width: 520px; }
.tf-pied__formulaire input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 13px 20px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  color: var(--papier-blanc);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
}
.tf-pied__formulaire input::placeholder { color: rgba(255, 255, 255, 0.8); }
.tf-pied__formulaire input:focus-visible { outline: 3px solid var(--papier-blanc); outline-offset: 3px; }
.tf-pied__grille { grid-template-columns: 1fr 1.4fr 1fr; align-items: start; }
.tf-pied__asso p { margin: 0; max-width: 34ch; }
.tf-pied__liens { columns: 2; column-gap: var(--espace-6); display: block !important; }
.tf-pied__liens li { margin-bottom: var(--espace-2); break-inside: avoid; }
.tf-pied__soutien .tf-actions { gap: var(--espace-3); }
.tf-pied__bas { align-items: center; }
.tf-pied__infos { display: flex; flex-wrap: wrap; gap: var(--espace-2) var(--espace-6); }
.tf-pied__reseaux { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--espace-3); }
.tf-pied__reseaux a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); transition: background 0.15s ease; }
.tf-pied__reseaux a:hover { background: var(--corail-fonce); }
.tf-pied__reseaux svg { width: 17px; height: 17px; fill: var(--papier-blanc); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tf-alaune, .tf-rangee, .tf-invitation { grid-template-columns: 1fr; gap: var(--espace-7); }
  .tf-rangee--inverse .tf-rangee__photo { order: 0; }
  .tf-alaune__cote { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--espace-6); }
  .tf-grille-photos--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tf-grille-membres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tf-pied__grille { grid-template-columns: 1fr 1fr; }
  .tf-pied__asso { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  :root { --hauteur-bord: 26px; }
  .tf-alaune__cote, .tf-grille-photos, .tf-grille-photos--3, .tf-grille-membres { grid-template-columns: 1fr; }
  .tf-carte-photo--grande .tf-carte-photo__cadre { aspect-ratio: 4 / 3; }
  .tf-carte-photo--grande .tf-etiquette { font-size: 28px; left: 16px; max-width: calc(100% - 32px); }
  .tf-etiquette { font-size: 23px; left: 14px; right: 14px; }
  .tf-alaune__texte { padding-inline: 0; }
  .tf-bande-appel__inner { flex-direction: column; text-align: center; gap: var(--espace-5); }
  .tf-bande-appel__phrase { font-size: 30px; margin-inline: auto; }
  .tf-bande-appel__dessin { width: 110px; }
  .tf-appel--dessin { flex-direction: column; text-align: center; }
  .tf-frise::before { left: 8px; }
  .tf-frise__etape { grid-template-columns: 1fr; gap: var(--espace-2); padding-left: 36px; }
  .tf-frise__etape::before { left: 6px; top: 10px; }
  .tf-frise__date { text-align: left; font-size: 26px; }
  .tf-frise__texte { padding-left: 0; }
  .tf-invitation__feuille { padding: var(--espace-6) var(--espace-5) var(--espace-5); }
  .tf-pied__grille { grid-template-columns: 1fr; }
  .tf-pied .tf-pied__lettre-titre { font-size: 28px; }
  .tf-pied__formulaire { flex-direction: column; }
  .tf-feuilles__item .titre-3 { padding-right: 70px; }
  .tf-feuilles__dessin { width: 84px; top: -40px; }
  .tf-carte-ign { aspect-ratio: 4 / 5; }
}
