/*
 * Site vitrine - styles propres au site.
 * Couleurs, polices, en-tête, menu, cartes et tableaux viennent de la
 * charte (https://charte.arcpontoise.fr/), chargée avant ce fichier.
 */

/* Brand link in the header keeps the header colours */
header.site .marque {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
}

/* Gallery covers (<arc-couverture>) fill the box they are given */
arc-couverture {
  display: block;
  overflow: hidden;
  background: var(--pale);
}

arc-couverture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Long-form text: readable line length, images and tables that fit */
.texte .zoom {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.texte img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 32rem;
  margin: 1rem auto;
  border-radius: var(--radius, 6px);
}

/* Drawings (SVG) are made for a light background, whatever the theme */
.texte img[src$=".svg"] {
  box-sizing: border-box;
  padding: 1rem;
  background: #fff;
}

/* Tables may be wider than the text column, up to the page width: centred
   on the column, scrolling only when the screen is really too narrow */
.texte table {
  display: block;
  width: max-content;
  max-width: min(64rem, 100vw - 2rem);
  margin: 1rem 0;
  margin-left: 50%;
  overflow-x: auto;
  transform: translateX(-50%);
}

.texte blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--card);
}

.illustration {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
}

/* Article cards */
.cartes-articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.carte-article h3 {
  margin: 0.2rem 0 0.5rem;
  font-size: 1.1rem;
}

.carte-article p {
  margin: 0;
}

.carte-article .discret {
  margin-bottom: 0.2rem;
}

/* Questions fréquentes */
.faq details {
  margin-bottom: 0.75rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
}

.faq details[open] summary {
  margin-bottom: 0.75rem;
}

/* Photo galleries (js/arc-galerie.js) */
.galerie-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.galerie-grille button {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.galerie-grille img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
}

.galerie-liste {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.galerie-liste a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.galerie-liste img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
}

.galerie-liste h2 {
  margin: 0.5rem 0 0.2rem;
  font-size: 1.1rem;
}

.galerie-visionneuse {
  max-width: 96vw;
  max-height: 96vh;
  padding: 0;
  border: 0;
  background: #000;
}

.galerie-visionneuse::backdrop {
  background: rgb(0 0 0 / 85%);
}

.galerie-visionneuse img {
  display: block;
  max-width: 96vw;
  max-height: calc(96vh - 3rem);
  margin: 0 auto;
}

.galerie-commandes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  gap: 0.5rem;
  padding: 0.4rem;
}

.galerie-commandes button {
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid rgb(255 255 255 / 40%);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

/* --- Coaches (gabarit equipe) --------------------------------------------- */

.equipe {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  grid-auto-flow: dense;
  align-items: start;
  gap: 1rem;
  margin: 1.5rem 0;
}

.encadrant {
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--card);
  transition: box-shadow 0.2s ease;
}

.encadrant:hover,
.encadrant[open] {
  box-shadow: 0 8px 24px rgb(9 19 45 / 12%);
}

.encadrant-tete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.encadrant-tete::-webkit-details-marker {
  display: none;
}

.portrait {
  display: grid;
  place-items: center;
  width: 7rem;
  height: 7rem;
  overflow: hidden;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.encadrant-nom {
  font-weight: 700;
}

.encadrant ul,
.encadrant p {
  margin: 0;
  padding: 0 1.25rem 1.25rem 2.25rem;
  font-size: 0.95rem;
}

.encadrant p {
  padding-left: 1.25rem;
}

/* An opened card takes two columns: portrait next to the name, text below */
.encadrant[open] {
  grid-column: span 2;
}

.encadrant[open] .encadrant-tete {
  flex-direction: row;
  justify-content: flex-start;
  gap: 1.25rem;
  text-align: left;
}

.encadrant[open] .encadrant-nom {
  font-size: 1.25rem;
}

/* Phones: two coaches per row, smaller portraits */
@media (width <= 600px) {
  .equipe {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .encadrant-tete {
    padding: 0.9rem 0.5rem;
  }

  .portrait {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 1.4rem;
  }

  .encadrant ul,
  .encadrant p {
    padding: 0 0.75rem 1rem 1.6rem;
  }
}

/* --- Section pages: a card per sub-page (gabarit rubrique) --------------- */

.rubrique-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.rubrique-carte {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rubrique-carte:hover {
  box-shadow: 0 8px 24px rgb(9 19 45 / 12%);
  transform: translateY(-3px);
}

.rubrique-carte arc-couverture,
.rubrique-sans-photo {
  display: block;
  height: 10rem;
  background: var(--pale);
}

.rubrique-carte arc-couverture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rubrique-sans-photo {
  background: linear-gradient(135deg, var(--blue), var(--accent));
}

.rubrique-texte {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem 1.2rem;
}

.rubrique-texte b {
  font-size: 1.15rem;
}

.rubrique-texte span {
  color: var(--gray);
  font-size: 0.95rem;
}

/* --- Timeline (gabarit frise): periods and dated steps ------------------- */

.frise h2 {
  margin-top: 2.5rem;
}

.frise h3 {
  position: relative;
  margin: 2rem 0 0.5rem;
  padding-left: 1.75rem;
  color: var(--accent);
}

.frise h3::before {
  position: absolute;
  top: 0.3em;
  left: 0;
  width: 0.9rem;
  height: 0.9rem;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  content: "";
}

.frise h3 ~ p,
.frise h3 ~ blockquote {
  margin-left: 0.6rem;
  padding-left: 1.15rem;
  border-left: 2px solid var(--border);
}

/* --- Roy and bureau, by decade (gabarit roys) ---------------------------- */

.decennies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.decennies a {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.decennies a:hover {
  background: var(--hover);
}

.decennie {
  scroll-margin-top: 5rem;
}

.annees {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.annee,
.evenement {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--card);
}

.annee-titre,
.annee-roy,
.annee-jeunes,
.annee-bureau,
.annee-bureau-inchange {
  margin: 0;
}

.annee-titre b {
  color: var(--accent);
  font-size: 1.4rem;
}

.annee-titre span,
.annee-jeunes,
.annee-bureau-inchange,
.annee-bureau dt {
  color: var(--gray);
  font-size: 0.85rem;
}

.annee-roy {
  margin: 0.3rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.annee-roy span {
  margin-right: 0.3rem;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  background: var(--accent);
  color: var(--card);
  font-size: 0.75rem;
  text-transform: uppercase;
  vertical-align: 0.15em;
}

.annee-bureau,
.annee-bureau-inchange {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.annee-bureau div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.annee-bureau dd {
  margin: 0;
  text-align: right;
}

.evenement {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-color: var(--accent);
  background: var(--pale);
}

.evenement b {
  color: var(--accent);
}

/* --- Places with a map (gabarit acces) ----------------------------------- */

.lieu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
  margin: 2rem 0;
}

.lieu-texte h2 {
  margin-top: 0;
}

.lieu-adresse {
  font-weight: 600;
}

.lieu-carte {
  width: 100%;
  height: 20rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
}

/* Wide screens: the text next to a larger map, beyond the text column */
@media (width > 900px) {
  .lieu {
    grid-template-columns: 1fr 1.6fr;
    width: min(64rem, 100vw - 2rem);
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

/* Image viewer of the text pages (js/arc-zoom.js) */
.zoom-image {
  background: #fff;
}

.zoom-image[src$=".svg"] {
  width: min(92vw, 44rem);
  height: auto;
}

.zoom-commandes {
  justify-content: flex-end;
}

/* Back to top: fades in once the page is scrolled, where supported */
html {
  scroll-padding-top: 1rem;
}

.retour-haut {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  display: grid;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 4px 14px rgb(0 0 0 / 25%);
  color: #fff;
  font-size: 1.4rem;
  place-items: center;
  text-decoration: none;
}

.retour-haut:hover,
.retour-haut:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
}

@supports (animation-timeline: scroll()) {
  .retour-haut {
    animation: retour-haut linear both;
    animation-range: 0 60vh;
    animation-timeline: scroll(root);
  }
}

@keyframes retour-haut {
  from {
    opacity: 0;
    visibility: hidden;
  }

  to {
    opacity: 1;
    visibility: visible;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* --- Page titles ---------------------------------------------------------- */

@media screen {
  main:not(.accueil) h1 { font-size: clamp(2.2rem, 5vw, 3.25rem); }
}

/* --- Home page ------------------------------------------------------------ */

/* Full-width bands inside the page, and the wide content column */
body { overflow-x: clip; }

main.accueil {
  max-width: none;
  padding: 0;
}

.pleine-largeur {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.contenu-large {
  box-sizing: border-box;
  max-width: 1240px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.bouton-plein,
.bouton-contour,
.bouton-sombre {
  display: inline-flex;
  align-items: center;
  min-height: 3.25rem;
  padding: 0 1.6rem;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
}

.bouton-plein {
  background: var(--accent);
  color: var(--on-accent);
}

.bouton-contour {
  border: 1.5px solid rgb(255 253 251 / 70%);
  background: rgb(255 253 251 / 10%);
  color: #fffdfb;
}

.bouton-sombre {
  background: #0d1838;
  color: #fffdfb;
}

/* Photo, title and call to action */
.hero {
  display: flex;
  align-items: flex-end;
  min-height: min(80vh, 44rem);
  overflow: hidden;
  background: var(--bg);
  color: #fffdfb;
}

.hero-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--pale);
}

.hero .hero-photo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 60%;
}

.hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgb(13 24 56 / 15%), rgb(13 24 56 / 85%));
  content: "";
}

.hero-texte {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
}

.hero .hero-texte h1 {
  max-width: 14ch;
  margin: 0;
  color: #fffdfb;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1.02;
}

.hero-chapo {
  max-width: 52ch;
  margin: 1.5rem 0 2rem;
  color: rgb(255 253 251 / 88%);
  font-size: 1.25rem;
}

/* Wide screens: the text sits in the sky, left of the archer's bow */
@media (width > 900px) {
  .hero {
    align-items: flex-start;
    min-height: min(86vh, 48rem);
  }

  .hero::after {
    background: linear-gradient(rgb(13 24 56 / 75%), rgb(13 24 56 / 25%) 60%, rgb(13 24 56 / 60%));
  }

  .hero-texte {
    padding: 3.5rem max(1.5rem, 38%) 4rem 1.5rem;
  }

  .hero .hero-texte h1 {
    max-width: 22ch;
    font-size: clamp(2.4rem, 4.4vw, 3.8rem);
  }

  .hero-chapo {
    margin: 1rem 0 1.5rem;
    font-size: 1.15rem;
  }
}

/* Key figures */
.chiffres-cles {
  border-bottom: 1px solid var(--border);
  background: var(--card);
  color: #fffdfb;
}

.chiffres-cles ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.5rem;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 2rem;
  padding-bottom: 2rem;
  list-style: none;
}

.chiffres-cles b {
  display: block;
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chiffres-cles span {
  color: var(--accent);
  font-weight: 600;
}

/* Sections below */
.section-accueil { padding-top: 4.5rem; }

.section-accueil h2 {
  margin-top: 0;
  font-size: clamp(2.2rem, 4vw, 3rem);
}

.titre-section {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.75rem;
}

.titre-section h2 { margin: 0; }
.section-accueil .titre-section a { font-weight: 700; }

/* Disciplines: one wide tile, two small ones and a tall one */
.tuiles-disciplines {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 16rem;
  gap: 1rem;
}

.tuile-discipline {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 24px;
}

.tuile-discipline-1 { grid-column: span 2; }

.tuile-discipline-4 {
  grid-row: 1 / span 2;
  grid-column: 3;
}

.tuile-discipline arc-couverture {
  height: 100%;
  transition: transform 0.4s ease;
}

.tuile-discipline:hover arc-couverture { transform: scale(1.05); }

.tuile-discipline span {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  padding: 0.7rem 1.1rem;
  border-radius: 14px;
  background: #0d1838;
  color: #fffdfb;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

/* Captain's word */
.capitaine .texte {
  padding: 2.5rem;
  border-radius: 28px;
  background: var(--card);
}

.capitaine .texte blockquote {
  border-left-color: var(--accent);
  background: var(--bg);
}

/* Latest news */
.actus {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.actu {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow: hidden;
  padding-bottom: 1.5rem;
  border-radius: 24px;
  background: var(--card);
  color: #fffdfb;
  text-decoration: none;
}

.actus .actu arc-couverture {
  height: 12.5rem;
  margin-bottom: 0.75rem;
}

.actu time,
.actu b { padding: 0 1.5rem; }

.actu time {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.actu b {
  font-size: 1.3rem;
  line-height: 1.3;
}

/* Call to action */
.appel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 4.5rem;
  margin-bottom: 2rem;
  padding: 3rem 2.5rem;
  border-radius: 28px;
  background: var(--accent);
  color: var(--on-accent);
}

.appel h2 {
  max-width: 18ch;
  margin: 0;
  color: var(--on-accent);
  font-size: 2.5rem;
  line-height: 1.05;
}

@media (width <= 760px) {
  .contenu-large {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .tuiles-disciplines {
    grid-template-columns: 1fr;
    grid-auto-rows: 13rem;
  }

  .tuile-discipline-1,
  .tuile-discipline-4 {
    grid-row: auto;
    grid-column: auto;
  }

  .capitaine .texte { padding: 1.5rem; }
}

/* Scroll-driven effects, without JavaScript: browsers lacking support, and
   visitors who asked for less motion, simply get the still page. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .section-accueil,
    .appel {
      animation: apparition linear both;
      animation-range: entry 0% cover 25%;
      animation-timeline: view();
    }

    /* Depth: the home photo drifts slower than the page */
    .hero .hero-photo img {
      animation: hero-photo linear both;
      animation-range: 0 100vh;
      animation-timeline: scroll(root);
    }
  }
}

@keyframes apparition {
  from {
    opacity: 0;
    transform: translateY(2.5rem);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes hero-photo {
  to { transform: translateY(30%) scale(1.08); }
}
