/* ==========================================================================
   USCB Photo Regards : feuille de style du site
   Sommaire
     1. Réglages généraux (couleurs, police, marges)   5. Galeries et vues (petite / moyenne / grande / rivière / carré)
     2. Base : page, titres, liens                      6. Pages : textes, citation, thèmes, membres, contact
     3. En-tête, logo et menu (dont menu burger)        7. Page d'accueil (diaporama, actualités)   8. Page d'ouverture (image avant l'accueil)
     4. Pied de page et visionneuse (lightbox)
   Pour changer une couleur ou une marge pour tout le site, modifier la section 1.
   ========================================================================== */


/* ==========================================================================
   1. RÉGLAGES GÉNÉRAUX
   ========================================================================== */
:root {
  color-scheme: dark;

  /* Police : fine, sans empattement, déjà présente sur l'ordinateur du visiteur (rien à télécharger) */
  --sans: "Helvetica Neue", "Segoe UI", "Roboto", system-ui, -apple-system, Arial, sans-serif;
  --serif: Georgia, "Palatino Linotype", Palatino, "Book Antiqua", serif;   /* citations */

  /* Couleurs */
  --paper:  #000;       /* fond des pages */
  --ink:    #ececec;    /* texte */
  --muted:  #a0a8a6;    /* texte secondaire (dates, légendes) */
  --mat:    #1a1a1a;    /* fond derrière les photos */
  --accent: #7cc0bd;    /* liens dans les textes, menu actif */
  --lien:       #ff5a4f;   /* liens de navigation : « Lire la suite... », « Tous les membres », « Voir la galerie » */
  --lien-hover: #ff9a90;

  /* Marge gauche/droite de la page : plus petite = photos et textes plus près du bord */
  --marge: clamp(.6rem, 1.6vw, 1.2rem);

  /* Trait fin de séparation */
  --trait: color-mix(in srgb, var(--ink) 18%, transparent);
}


/* ==========================================================================
   2. BASE
   ========================================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 300 17px/1.6 var(--sans);
}

main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 1.8rem var(--marge) 3rem;
}

/* Titres */
h1 { font: 300 clamp(2rem, 5vw, 3.4rem)/1.1 var(--sans); margin: 0 0 .6rem; max-width: 30ch; }
h2 { font: 300 1.5rem var(--sans); margin: 2.5rem 0 .8rem; }

/* Titres des textes .txt (Markdown) : « ## Titre » donne un titre de section, « ### Sous-titre » un sous-titre bien distinct (rouge, en capitales) */
main h3 { margin: 2.2rem 0 .7rem; padding-bottom: .35rem; font: 400 1.5rem/1.25 var(--sans); border-bottom: 1px solid var(--trait); }
main h4 { margin: 2rem 0 .6rem; font: 600 .95rem/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--lien); }
.about > :first-child, .actu h2 + h3, .citation > :first-child { margin-top: .4rem; }
.citation h3, .citation h4 { font-family: var(--sans); font-style: normal; }
strong, b { font-weight: 600; }

/* Textes */
.intro, .meta { color: var(--muted); max-width: 60ch; }
.empty { color: var(--muted); }
main ul, main ol { max-width: 65ch; padding-left: 1.3rem; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--accent); color: var(--muted); max-width: 60ch; }
blockquote p { margin: .3rem 0; }

/* Liens dans les textes */
main p a, .actu a, .about a { color: var(--accent); }

/* Liens de navigation : tous identiques (rouge, sans cadre ; plus clair et souligné au survol) */
.more, .enter a, main p.meta a {
  color: var(--lien);
  text-decoration: none;
  transition: color .2s;
}
.more:hover, .more:focus-visible,
.enter a:hover, .enter a:focus-visible,
main p.meta a:hover, main p.meta a:focus-visible {
  color: var(--lien-hover);
  text-decoration: underline;
  text-underline-offset: .25em;
}

/* Contour au clavier */
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Ancres (« Aller à : 2024 · 2025 ») : ne pas passer sous la barre des vues */
section[id] { scroll-margin-top: 4.5rem; }


/* ==========================================================================
   3. EN-TÊTE, LOGO ET MENU
   ========================================================================== */
header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--marge);
  border-bottom: 1px solid var(--trait);
}

/* Logo + titre « USCB Photo Regards » */
.brand { display: flex; align-items: center; gap: 1rem; color: var(--ink); text-decoration: none; }
.brand img { display: block; height: 76px; width: auto; }
.brand-t { font: 300 1.5rem/1.1 var(--sans); letter-spacing: .03em; white-space: nowrap; }
.brand-t small { display: block; margin-top: .2rem; font: 300 .8rem var(--sans); letter-spacing: .04em; color: var(--muted); }

/* Menu */
nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
nav a { color: var(--ink); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
nav a:hover, nav a[aria-current] { border-color: var(--accent); }

/* Menu burger : écrans étroits. Sans JavaScript, le menu complet reste visible. */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 44px; height: 44px;
  padding: 11px 9px;
  margin-left: auto;
  background: none;
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  cursor: pointer;
}
.burger span { display: block; height: 2px; background: var(--ink); transition: transform .2s, opacity .2s; }
.burger[aria-expanded=true] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded=true] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded=true] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
.js .brand { min-width: 0; }

@media (max-width: 1240px) {
  .js .burger { display: flex; }
  .js nav { display: none; flex-basis: 100%; flex-direction: column; gap: 0; background: var(--paper); border-top: 1px solid var(--trait); }
  .js nav.open { display: flex; }
  .js nav a { padding: .85rem .2rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
  .js nav a[aria-current] { color: var(--accent); }
  .js .home nav, .home.js nav { background: rgba(0, 0, 0, .88); }
}

/* Téléphone : en-tête plus compact */
@media (max-width: 640px) {
  header { gap: .6rem 1rem; }
  .js .brand { flex: 1 1 0; }
  .brand { gap: .7rem; }
  .brand img { height: 50px; }
  .brand-t { font-size: 1.1rem; white-space: normal; }
  .brand-t small { display: none; }
}


/* ==========================================================================
   4. PIED DE PAGE ET VISIONNEUSE (clic sur une photo)
   ========================================================================== */
footer { padding: 1.5rem var(--marge); color: var(--muted); font-size: .9rem; border-top: 1px solid var(--trait); }

#lb { position: fixed; inset: 0; z-index: 9; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; background: rgba(10, 12, 12, .94); }
#lb.on { display: flex; }
#lb img { max-width: 96vw; max-height: 84vh; }
#lb p { margin: .8rem 0 0; color: #ddd; }
#lb button { position: absolute; padding: .6rem 1rem; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; }
#lb .x { top: .5rem; right: .5rem; }
#lb .p { left: .3rem; top: 50%; }
#lb .n { right: .3rem; top: 50%; }


/* ==========================================================================
   5. GALERIES ET CHOIX DE LA VUE
   ========================================================================== */

/* Une photo (vignette cliquable) ; le titre apparaît au survol */
.ph { position: relative; display: block; overflow: hidden; aspect-ratio: 3/2; background: var(--mat); color: #fff; text-decoration: none; }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.ph:hover img { transform: scale(1.03); }
.ph span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2rem .9rem .7rem;
  font-size: .9rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  opacity: 0;
  transition: opacity .25s;
}
.ph:hover span, .ph:focus-visible span { opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); grid-auto-flow: dense; gap: .5rem; }
.gal { gap: 4px; margin-top: .4rem; }
.gal .ph span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barre de choix de la vue : des boutons sans cadre, le bouton actif est grisé */
.vues {
  position: sticky; top: 0; z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .1rem;
  padding: .3rem 0;
  background: var(--paper);
}
.vues span { margin-right: .4rem; color: var(--muted); font-size: .9rem; }
.vues button { padding: .15rem .6rem; font: inherit; font-size: .9rem; color: var(--muted); background: none; border: 0; cursor: pointer; }
.vues button:hover { color: var(--ink); }
.vues button[aria-pressed=true] { color: var(--ink); background: color-mix(in srgb, var(--ink) 16%, transparent); }

/* Vue « rivière » (par défaut) : rangées de même hauteur, proportions d'origine, remplissage complet gauche-droite.
   --r = proportions de la photo (calculées par le script) ; --h = hauteur visée d'une rangée. */
.v-riviere .gal { display: flex; flex-wrap: wrap; --h: 150px; }
.v-riviere .gal .ph { flex: var(--r) 1 calc(var(--r) * var(--h)); min-width: 0; aspect-ratio: var(--r); }
.v-riviere .gal::after { content: ""; flex: 1000000 1 0; }   /* la dernière rangée ne s'étire pas */

/* Vues petite / moyenne / grande / carré : grille régulière ; --s = largeur minimale d'une vignette */
.v-petite .gal, .v-moyenne .gal, .v-grande .gal, .v-carre .gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--s), 1fr)); }
.v-petite  .gal { --s: 120px; }
.v-moyenne .gal { --s: 200px; }
.v-grande  .gal { --s: 320px; }
.v-carre   .gal { --s: 170px; }
.v-petite .gal .ph, .v-moyenne .gal .ph, .v-grande .gal .ph { aspect-ratio: 3/2; }
.v-carre .gal .ph { aspect-ratio: 1; }

@media (max-width: 640px) {
  .v-riviere .gal { --h: 100px; }
  .v-petite  .gal { --s: 90px; }
  .v-moyenne .gal { --s: 140px; }
}


/* ==========================================================================
   6. PAGES : TEXTES, CITATION, THÈMES, ACTUALITÉS, CONTACT
   ========================================================================== */

/* Fichiers PDF déposés dans un dossier : liste sous le descriptif, petite icône + nom du fichier */
.docs { list-style: none; margin: .4rem 0 1.4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; }
.docs a { display: inline-flex; align-items: center; gap: .45rem; font-size: .95rem; }
.docs .pdf { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; flex: none; }

/* Descriptif (descriptif.txt) : cadre translucide en forme de citation, pleine largeur */
.citation {
  position: relative;
  margin: .8rem 0 1.2rem;
  padding: 1rem 2.4rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 0 solid rgba(255, 255, 255, .16);   /* 0 = sans cadre ; mettre 1px pour un fin liseré */
  border-radius: 6px;
  font: italic 300 1.05rem/1.4 var(--sans);   /* police fine (graisse 300) ; pour du plus classique : var(--serif) à la place de var(--sans), graisse 400 */
  letter-spacing: .01em;
  color: #cfe3e1;
}
.citation p { margin: .3rem 0; }
.citation a { color: var(--accent); }
.citation::before, .citation::after { position: absolute; font: italic 2.6rem/1 var(--serif); color: var(--accent); opacity: .7; }
.citation::before { content: "\201C"; left: .6rem; top: .5rem; }
.citation::after  { content: "\201D"; right: .8rem; bottom: -.3rem; }
@media (max-width: 640px) { .citation { padding: .9rem 1.8rem; font-size: .95rem; } }

/* Actualités (page Actus) */
.actu { max-width: 65ch; padding: 1rem 0; border-top: 1px solid var(--trait); }
.actu h2 { margin: .2rem 0; }
.actu time { color: var(--muted); font-size: .9rem; }
.actu p { margin: .4rem 0; }
.actu-img { display: block; max-width: min(100%, 720px); margin: .6rem 0 .8rem; aspect-ratio: auto; }   /* image img_NNN d'un billet */
.actu-img img { display: block; width: 100%; height: auto; }
.actu-img span { display: none; }

/* Qui sommes-nous et Contact : texte justifié (césure automatique en français) */
.about { max-width: 70ch; }
.about p, .about li { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.about-ph { margin: 0 0 1.5rem; }
.about-ph img { display: block; width: 100%; height: auto; }

/* Tuiles des thèmes et des membres */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); gap: 1rem; margin-top: 1.5rem; }
.theme { display: block; color: var(--ink); text-decoration: none; }
.theme img { display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover; background: var(--mat); }
.theme span { display: block; padding: .4rem 0; font-size: .95rem; line-height: 1.3; }
.theme small { display: block; color: var(--muted); font-size: .85rem; }
.theme:hover span, .theme:focus-visible span { text-decoration: underline; }
.theme .noimg { display: grid; place-items: center; aspect-ratio: 3/2; background: var(--mat); font: 300 3rem var(--sans); color: var(--muted); }   /* tuile sans photo : initiale */


/* ==========================================================================
   7. PAGE D'ACCUEIL : diaporama en fond, slogan, actualités
   ========================================================================== */

/* Diaporama plein écran derrière la page (images tirées au hasard, 10 s) */
.slider { position: fixed; inset: 0; z-index: -1; background: #000; }
.slider div { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease; }
.slider div.on { opacity: 1; }
.slider::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .3) 35%, rgba(0, 0, 0, .3) 60%, rgba(0, 0, 0, .7)); }   /* voile pour la lisibilité */
@media (prefers-reduced-motion: reduce) { .slider div, .burger span { transition: none; } }

.home header { border-bottom-color: rgba(255, 255, 255, .15); }
.home footer { background: rgba(0, 0, 0, .5); border-top-color: rgba(255, 255, 255, .15); }
.home main { min-height: calc(100vh - 190px); }
.home .brand-t small { color: #cfd5d3; }

/* Slogan */
.home h1 { max-width: 34ch; margin-top: .4rem; font-size: clamp(1.9rem, 4.8vw, 3.3rem); text-shadow: 0 2px 14px rgba(0, 0, 0, .7); }
.home .enter a { display: inline-block; margin-top: 1rem; padding: .2rem 0; font-size: 1.15rem; }

/* Actualités : un bloc par billet, sur une colonne */
.news-home { margin-top: 2rem; }
.news-home h2 { margin: 0 0 .7rem; font-size: 1.2rem; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; max-width: 900px; }
.tile { display: flex; flex-direction: column; overflow: hidden; padding: .9rem 1.1rem; font-size: .92rem; background: rgba(0, 0, 0, .62); border: 1px solid rgba(255, 255, 255, .12); }
.tile time { color: var(--muted); font-size: .78rem; }
.tile h3 { margin: .2rem 0 .4rem; padding: 0; border: 0; font: 400 1rem var(--sans); }
.tile p { margin: 0 0 .7rem; color: #d6dbd9; line-height: 1.4; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }   /* 2 lignes de début de billet */
.tile .more { margin-top: auto; align-self: flex-start; padding: .2rem 0; font-size: .9rem; }
.tile-img { display: block; width: calc(100% + 2.2rem); height: 150px; margin: -.9rem -1.1rem .7rem; object-fit: cover; }


/* Pages de membres : photos en fond (diaporama de 5 s, même mécanisme que l'accueil) ; le contenu reste lisible par-dessus */
.fond .slider::after { background: rgba(0, 0, 0, .8); }   /* voile sur les photos de fond : plus la valeur est haute (max 1), moins l image est visible */
.fond header { border-bottom-color: rgba(255, 255, 255, .15); }
.fond footer { background: rgba(0, 0, 0, .5); border-top-color: rgba(255, 255, 255, .15); }
.fond main { min-height: calc(100vh - 190px); }
.fond h1, .fond h2, .fond .meta, .fond .theme span { text-shadow: 0 2px 12px rgba(0, 0, 0, .85); }
.fond .vues { background: rgba(0, 0, 0, .55); }


/* ==========================================================================
   8. PAGE D'OUVERTURE (intro_uscb.png, puis intro_bienvenue.png écrite en direct, avant l'accueil)
   Invisible par défaut ; intro.js l'affiche (classe intro-on sur <html>) une fois par visite.
   Chronologie : image 1 en fondu (0 à 2 s) ; « Bienvenue » s'écrit de 1,5 s à 3,5 s ; « Cliquer pour entrer » à 4 s.
   ========================================================================== */
#intro { display: none; }
.intro-on, .intro-on body { overflow: hidden; }
.intro-on #intro {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000;
  cursor: pointer;
  transition: opacity 1s ease;          /* disparition en fondu */
}
#intro:focus { outline: none; }

/* Les deux images sont superposées et doivent avoir les mêmes dimensions (même canevas) */
#intro .stage { position: relative; width: min(52vw, 780px); }   /* taille de l'ensemble (marges noires comprises) : 52vw = 52 % de la largeur de l'écran */
#intro .stage img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity 2s ease; }
#intro .stage img.bv { position: absolute; inset: 0; height: 100%; object-fit: contain; mix-blend-mode: screen; transition: none; }   /* « screen » : le noir devient transparent */
#intro.show .stage img { opacity: 1; }

/* « Bienvenue » s'écrit de gauche à droite : un masque dégradé balaie l'image */
#intro.show .stage img.bv {
  -webkit-mask-image: linear-gradient(to right, #000 17%, transparent 19%);
          mask-image: linear-gradient(to right, #000 17%, transparent 19%);
  -webkit-mask-size: 600% 100%;  mask-size: 600% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 25% 0;  mask-position: 25% 0;
  animation: ecrire 2s ease-in-out 1.5s forwards;   /* durée 2 s, démarre 1,5 s après l'apparition */
}
@keyframes ecrire {
  from { -webkit-mask-position: 25% 0; mask-position: 25% 0; }
  to   { -webkit-mask-position: 0 0;   mask-position: 0 0; }
}
#intro:not(.show) .stage img.bv { opacity: 0; }

#intro span { margin-top: 1.5rem; color: var(--muted); font-size: .9rem; letter-spacing: .08em; opacity: 0; transition: opacity 1.5s ease 4s; }
#intro.show span { opacity: 1; }
#intro.out { opacity: 0; pointer-events: none; }
@media (max-width: 640px) { #intro .stage { width: 90vw; } }
@media (prefers-reduced-motion: reduce) {
  .intro-on #intro, #intro .stage img, #intro span { transition: none; }
  #intro.show .stage img.bv { animation: none; -webkit-mask-image: none; mask-image: none; }
}
