/*
  Andrea Corazziari — pianiste
  Feuille de style finale.

  Direction artistique : sobriété, beaucoup de blanc, photo d'accueil
  dominante, typographie à empattements pour les titres, palette neutre
  avec un seul accent discret (bronze), aucune animation gratuite.

  Paire typographique : EB Garamond (titres, marque) et Spectral (texte de
  lecture), deux serifs auto-hébergées et complémentaires ; sans-serif
  système pour le repérage (navigation, dates, libellés, boutons, tableau
  admin) — comme un programme de concert imprimé oppose le nom de l'œuvre
  à la logistique de la soirée. Georgia reste le repli si les polices ne
  chargent pas.
*/

/* ---------- Polices ---------- */

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/statique/fonts/eb-garamond-latin-400-600.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/statique/fonts/eb-garamond-italic-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/statique/fonts/spectral-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/statique/fonts/spectral-latin-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/statique/fonts/spectral-italic-400.woff2') format('woff2');
}

/* ---------- Fondations ---------- */

:root {
  --encre: #1c1b18;
  --encre-douce: #4a463d;
  --gris: #6b6459;
  --fond: #faf8f4;
  --fond-alt: #f1ece1;
  --ligne: #ddd3bd;
  --accent: #8a6d3b;
  --accent-texte: #6a5430;
  --accent-fonce: #58431f;
  --blanc: #ffffff;
  --erreur-fond: #f8e8e6;
  --erreur-texte: #7a2320;
  --erreur-ligne: #d9b3ae;
  --rayon: 3px;
  --ombre: 0 1px 3px rgba(28, 27, 24, .09);
  --police-titre: 'EB Garamond', Georgia, 'Times New Roman', Times, serif;
  --police-texte: 'Spectral', Georgia, 'Times New Roman', Times, serif;
  --police-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--police-texte);
  font-size: 1.125rem;
  color: var(--encre);
  background: var(--fond);
  line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-texte); }
a:hover, a:focus-visible { color: var(--encre); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--blanc);
}

h1, h2, h3 {
  font-family: var(--police-titre);
  font-weight: 400;
  color: var(--encre);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.6rem);
  margin: 0 0 .5rem;
  letter-spacing: -.01em;
}

h2 {
  font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--ligne);
}

h3 { font-size: 1.15rem; margin: 0 0 .3rem; }

p { margin: 0 0 1.2rem; }

/* Petits libellés en capitales espacées (dates, méta, nav, boutons) */
.libelle,
.navigation a,
.lieu,
time,
.pagination a,
.bouton,
button,
.pied,
.table-admin th {
  font-family: var(--police-ui);
}

/* ---------- En-tête et navigation ---------- */

.entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--ligne);
}

.marque {
  font-family: var(--police-titre);
  font-style: italic;
  font-size: 1.45rem;
  color: var(--encre);
  text-decoration: none;
  letter-spacing: .01em;
}
.marque:hover, .marque:focus-visible { color: var(--accent-texte); }

.navigation {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.5rem;
}

.navigation a {
  color: var(--encre-douce);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-bottom: .3rem;
  border-bottom: 2px solid transparent;
}

.navigation a:hover,
.navigation a:focus-visible { color: var(--encre); }

.navigation a[aria-current] {
  color: var(--encre);
  border-bottom-color: var(--accent);
}

@media (max-width: 640px) {
  .entete {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 1.25rem 1.5rem;
    gap: .85rem;
  }
  .navigation { justify-content: center; gap: .5rem 1.1rem; }
}

/* ---------- Structure générale ---------- */

.contenu {
  margin: 0 auto;
  padding: 2.5rem 2rem 4.5rem;
}

.contenu--large { max-width: 62rem; }

/* colonne de lecture : événement, contact, 404 — la mesure idéale
   pour la prose est de 60 à 75 caractères, pas la largeur des grilles */
.contenu--prose { max-width: 42rem; }

/* l'affiche d'un événement déborde de la colonne de texte,
   comme le fait le héros de l'accueil, pour garder de la présence */
.contenu--prose .evenement .affiche {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

@media (max-width: 640px) {
  .contenu { padding: 1.75rem 1.25rem 3.5rem; }
}

@media (max-width: 900px) {
  body.page-biographie .contenu { max-width: 42rem; }
}

.pied {
  text-align: center;
  padding: 2.25rem 1.5rem;
  font-size: .8rem;
  letter-spacing: .04em;
  color: var(--gris);
  border-top: 1px solid var(--ligne);
}

/* ---------- Accueil ----------
   La photo place Andrea dans le tiers droit du cadre ; le tiers gauche,
   occupé par une statue floue, est une zone calme. Plutôt que de forcer
   un recadrage centré, la composition assume ce déséquilibre : le titre
   se pose dans cet espace libre, sur une colonne ivoire pleine hauteur
   dont seul le bord droit se fond dans la photo — la photo semble émerger
   de la page plutôt qu'un bandeau posé dessus. Sur grand écran, en-tête +
   scène + pied tiennent dans la hauteur de l'écran, sans défilement. */

body.page-accueil {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

body.page-accueil .entete,
body.page-accueil .pied {
  flex: 0 0 auto;
}

body.page-accueil .contenu {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}

.scene-accueil {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  min-height: 26rem;
}

.scene-accueil .hero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 30%;
}

.accueil-texte {
  position: relative;
  z-index: 1;
  width: min(28rem, 56%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem clamp(1.5rem, 6vw, 4.5rem);
  background: linear-gradient(90deg, var(--fond) 0%, var(--fond) 66%, rgba(250, 248, 244, 0) 100%);
}

body.page-accueil h1 { margin: 0 0 .6rem; }

.sous-titre {
  font-family: var(--police-ui);
  font-size: .85rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-texte);
  margin: 0;
  position: relative;
  padding-bottom: 1.5rem;
}

.sous-titre::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 3rem;
  height: 2px;
  background: var(--accent);
}

/* En dessous de 900px, la superposition manque de place : la scène
   revient à un empilement classique (photo, puis titre en dessous). Le
   sans-scroll n'est visé que sur desktop, comme demandé. */
@media (max-width: 899px) {
  body.page-accueil {
    display: block;
    min-height: 0;
  }

  body.page-accueil .contenu {
    display: block;
    padding: 0 0 3.5rem;
    text-align: center;
  }

  .scene-accueil {
    position: static;
    display: block;
    min-height: 0;
    overflow: visible;
  }

  .scene-accueil .hero {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-position: 72% 28%;
  }

  .accueil-texte {
    position: static;
    z-index: auto;
    width: auto;
    background: none;
    padding: 2rem 1.25rem 0;
    text-align: center;
  }

  .sous-titre { margin: 0 auto; }

  .sous-titre::after {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 640px) {
  body.page-accueil .contenu { padding-bottom: 2.5rem; }
}

/* ---------- Biographie ---------- */

body.page-biographie h1 { margin-bottom: 1.75rem; }

.portrait-figure { margin: 0 0 2rem; text-align: center; }

.portrait {
  width: 100%;
  height: 22rem;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--rayon);
}

.texte-biographie p {
  margin-bottom: 1.2rem;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

@media (min-width: 900px) {
  /* mise en page « profil de magazine » : portrait en colonne, texte en regard */
  body.page-biographie .contenu {
    display: grid;
    grid-template-columns: 17.5rem 1fr;
    align-items: start;
    column-gap: 3.25rem;
  }
  body.page-biographie h1 { grid-column: 1 / -1; }
  body.page-biographie .portrait-figure { margin-bottom: 0; }
  body.page-biographie .portrait { height: 26rem; position: sticky; top: 2rem; }
}

/* ---------- Actualités / liste d'événements ---------- */

.liste-evenements {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem 2.5rem;
}

@media (min-width: 900px) {
  .liste-evenements { grid-template-columns: repeat(2, 1fr); }
}

.liste-evenements li { display: flex; flex-direction: column; }

.liste-evenements a {
  text-decoration: none;
  color: inherit;
}

.liste-evenements li > a:first-child {
  display: block;
  margin-bottom: 1rem;
  border-radius: var(--rayon);
  overflow: hidden;
  background: var(--fond-alt);
}

.liste-evenements img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform .35s ease;
}

.liste-evenements li > a:first-child:hover img,
.liste-evenements li > a:first-child:focus-visible img {
  transform: scale(1.035);
}

.liste-evenements time {
  display: block;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-texte);
  margin-bottom: .35rem;
}

.liste-evenements h3 {
  font-size: 1.2rem;
  margin-bottom: .3rem;
}

.liste-evenements h3 a:hover,
.liste-evenements h3 a:focus-visible { color: var(--accent-texte); }

.liste-evenements .lieu {
  margin: 0;
  font-size: .85rem;
  color: var(--gris);
}

/* Événement sans affiche : ligne de programme (date | titre) plutôt
   qu'une carte vide — la convention d'un programme de saison imprimé. */
.liste-evenements li.programme {
  grid-column: 1 / -1;
  padding: 1rem 0;
  border-bottom: 1px solid var(--ligne);
}

.liste-evenements li.programme:first-child { padding-top: 0; }

.liste-evenements li.programme time { margin-bottom: .3rem; }

.liste-evenements li.programme h3 { margin-bottom: .2rem; }

@media (min-width: 640px) {
  .liste-evenements li.programme {
    display: grid;
    grid-template-columns: 9rem 1fr;
    align-items: baseline;
    column-gap: 1.5rem;
  }
  .liste-evenements li.programme time { margin-bottom: 0; }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin: 2.5rem 0 0;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .4rem;
  text-decoration: none;
  font-size: .85rem;
  color: var(--encre-douce);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
}

.pagination a:hover,
.pagination a:focus-visible {
  border-color: var(--accent);
  color: var(--encre);
}

.pagination a[aria-current] {
  background: var(--encre);
  border-color: var(--encre);
  color: var(--blanc);
}

/* ---------- Page d'un événement ---------- */

.evenement .meta {
  font-family: var(--police-ui);
  font-size: .85rem;
  letter-spacing: .04em;
  color: var(--gris);
  margin-bottom: 1.75rem;
}

.evenement .affiche {
  width: 100%;
  max-height: 30rem;
  object-fit: cover;
  margin-bottom: 1.75rem;
}

.evenement .corps p { margin-bottom: 1.2rem; }

/* ---------- Médias : galerie et vidéos ---------- */

.galerie {
  list-style: none;
  padding: 0;
  margin: 0 0 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.galerie li { border-radius: var(--rayon); overflow: hidden; }

.galerie img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform .35s ease;
}

.galerie a:hover img,
.galerie a:focus-visible img { transform: scale(1.04); }

.videos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .videos { grid-template-columns: repeat(2, 1fr); }
}

.video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin-bottom: 0;
  background: var(--fond-alt);
  border-radius: var(--rayon);
  overflow: hidden;
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Formulaires (contact + admin) ---------- */

.erreur {
  background: var(--erreur-fond);
  color: var(--erreur-texte);
  border: 1px solid var(--erreur-ligne);
  border-radius: var(--rayon);
  padding: .85rem 1.1rem;
  font-size: .95rem;
  margin: 0 0 1.5rem;
}

.formulaire {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 34rem;
  margin: 0 0 2rem;
}

.formulaire label {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  font-family: var(--police-ui);
  font-size: .85rem;
  letter-spacing: .02em;
  color: var(--encre-douce);
}

.formulaire .aide {
  font-weight: 400;
  color: var(--gris);
}

.formulaire input,
.formulaire textarea {
  font-family: var(--police-texte);
  font-size: 1rem;
  color: var(--encre);
  background: var(--blanc);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: .65rem .75rem;
}

.formulaire input:focus-visible,
.formulaire textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 109, 59, .18);
}

.formulaire textarea { resize: vertical; min-height: 8rem; font-family: var(--police-texte); }

.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .deux-colonnes { grid-template-columns: 1fr 1fr; }
}

/* ---------- Boutons ---------- */

.bouton,
.formulaire button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--blanc);
  background: var(--encre);
  border: 1px solid var(--encre);
  border-radius: var(--rayon);
  padding: .75rem 1.5rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.bouton:hover, .bouton:focus-visible,
.formulaire button:hover, .formulaire button:focus-visible,
button:hover, button:focus-visible {
  background: var(--accent-fonce);
  border-color: var(--accent-fonce);
  color: var(--blanc);
}

/* le formulaire de déconnexion s'affiche en ligne à côté du bouton d'ajout */
form[action="/admin/logout"] { display: inline; }
form[action="/admin/logout"] button {
  background: transparent;
  color: var(--encre-douce);
  border-color: var(--ligne);
}
form[action="/admin/logout"] button:hover,
form[action="/admin/logout"] button:focus-visible {
  color: var(--encre);
  border-color: var(--encre);
  background: transparent;
}

/* ---------- Admin : tableau des événements ---------- */

.table-admin {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: .92rem;
}

.table-admin th {
  text-align: left;
  font-size: .75rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--gris);
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--ligne);
}

.table-admin td {
  padding: .75rem;
  border-bottom: 1px solid var(--ligne);
  vertical-align: middle;
}

.table-admin tr.a-venir td { background: var(--fond-alt); }

.table-admin tbody tr:hover td { background: rgba(138, 109, 59, .08); }

.table-admin form { margin: 0; }

.table-admin button {
  background: transparent;
  color: var(--erreur-texte);
  border-color: var(--erreur-ligne);
  padding: .4rem .8rem;
  font-size: .72rem;
}

.table-admin button:hover,
.table-admin button:focus-visible {
  background: var(--erreur-fond);
  border-color: var(--erreur-texte);
  color: var(--erreur-texte);
}

@media (max-width: 640px) {
  .table-admin { font-size: .82rem; }
  .table-admin th:nth-child(3),
  .table-admin td:nth-child(3) { display: none; }
}

/* ---------- Contact : fond topographique ----------
   Clin d'œil aux cartes de montagne chères à Andrea : courbes de niveau
   très pâles (SVG généré par scripts/generer-carte.mjs) derrière le
   formulaire. Les champs, sur fond blanc, restent parfaitement lisibles. */

body.page-contact {
  background-image: url('/statique/images/carte-contact.svg');
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
}

/* l'en-tête et le pied restent sur fond uni : la carte n'est visible
   qu'entre les deux, derrière le formulaire. */
body.page-contact .entete,
body.page-contact .pied {
  background: var(--fond);
}

/* ---------- Accessibilité : moins de mouvement ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; }
}
