/* === Contenu général commun à toutes les pages === */
:root {
  color-scheme: light;
  --color-background: #f5efe6;
  --color-header: #f7efe4;
  --color-surface: #fffaf3;
  --color-surface-strong: #ffffff;
  --color-text: #11100e;
  --color-text-secondary: #2f6264;
  --color-muted: #665e54;
  --color-border: #ddd0c0;
  --color-border-strong: #bfa58f;
  --color-accent: #c95f32;
  --color-accent-deep: #94401e;
  --color-accent-soft: #efdece;
  --shadow-image: 0 18px 38px rgba(43, 34, 27, 0.14);
  --content-width: 76rem;
  --text-width: 70rem;
  --block-width: 80rem;
  --gallery-column-min: 16.5rem;
  --content-media-width: min(300px, 42%);
  --event-media-width: 76rem;
  --map-width: min(42rem, 58%);
  --header-top-height: clamp(8.5rem, 12.4vw, 11.25rem);
  --header-sticky-row-height: clamp(4.5rem, 5.2vw, 5rem);
  --header-height: calc(var(--header-top-height) + var(--header-sticky-row-height));
  --header-inline-padding: clamp(1.25rem, 4vw, 4.5rem);
}
::selection {
  background: var(--color-accent-soft);
  color: var(--color-text);
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;

  background: var(--color-background);

  scroll-behavior: smooth;
  overscroll-behavior: none;
}
html[lang="fr"] .site-header nav > .language-link::after {
  opacity: 0.55;
}
body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;

  overflow-x: clip;
  overscroll-behavior: none;

  background: var(--color-background);
  color: var(--color-text);
  font-family: "Trebuchet MS", Arial, sans-serif;
  line-height: 1.64;
  text-rendering: optimizeLegibility;
  text-align: justify;
}
body > * {
  min-width: 0;
}
a {
  color: var(--color-accent-deep);
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--color-accent);
}
iframe {
  max-width: 100%;
  display: block;
  border: 1px solid var(--color-border);
  aspect-ratio: 16 / 9;
  width: var(--content-media-width);
}
h1 {
  margin: 0 0 2.4rem;
  max-width: min(100%, 18ch);
  color: var(--color-accent-deep);
  font-size: clamp(2.5rem, 4.8vw, 4.5rem);
  line-height: 1.05;
  font-weight: 400;
  text-align: left;
}
h2 {
  margin: 0.55rem 0 0;
  color: var(--color-text-secondary);
  font-size: clamp(1.18rem, 1.8vw, 1.55rem);
  line-height: 1.2;
  font-weight: 700;
  text-align: left;
}
p {
  margin: 0 0 1.05rem;
  max-width: 68ch;
  color: var(--color-text);
}
img {
  padding: 0;
  border: 0;
  height: auto;

  background: transparent;
  box-shadow: none;
}

/* === Header === */
.site-header {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--header-top-height) minmax(var(--header-sticky-row-height), auto);
  align-content: start;
  width: 100%;
  min-width: 0;
  min-height: auto;
  padding: 0 var(--header-inline-padding);
  background: var(--color-header);
}
body.is-internal-page .site-header {
  position: sticky;
  top: calc(-1 * var(--header-top-height));
  box-shadow: 0 12px 28px rgba(45, 35, 25, 0.06);
}
.header-top {
  display: flex;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: var(--header-top-height);
  overflow: hidden;
}
.header-top > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(22rem, 50vw);
  height: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.header-top > a img {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.header-sticky-row {
  position: relative;
  display: flex;
  grid-row: 2;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: var(--header-sticky-row-height);
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 0.35rem clamp(1.6rem, 3.1vw, 3.15rem);
}
.site-header nav a[data-navigation] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.25rem 0.02rem;
  border-bottom: 2px solid transparent;
  color: var(--color-text);
  font-size: clamp(1.55rem, 2.45vw, 2.28rem);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 160ms ease, color 160ms ease;
}
.site-header nav a[data-navigation]:is(.active, [aria-current="page"]) {
  color: var(--color-accent-deep);
  border-bottom-color: var(--color-accent);
  outline: none;
}
.site-header nav > a:is([href="/fr/"], [href="/en/"]) {
  order: 1;
}
.site-header nav > a[href*="/gallery/"] {
  order: 2;
}
.site-header nav > a[href*="/events/"] {
  order: 3;
}
.site-header nav > a[href*="/about/"] {
  order: 4;
}
.site-header nav > a[href*="/contact/"] {
  order: 5;
}
.language-switch {
  position: absolute !important;
  top: 50%;
  right: 0;
  z-index: 100;
  display: flex !important;
  align-items: center;
  gap: 0.42rem;
  color: var(--color-text);
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: right;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateY(-50%);
  min-width: max-content;
}
.language-link {
  font-size: 0;
}
.language-link::before {
  content: "EN";
}
.language-link::after {
  content: "FR";
}
.language-link::before,
.language-link::after {
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
}
.language-link::after {
  margin-left: 0.42rem;
}
.language-switch__link {
  color: var(--color-muted);
  text-decoration: none;
}
.language-switch__link:focus-visible {
  color: var(--color-accent-deep);
  outline: none;
}
.language-switch__link[aria-current="true"] {
  color: var(--color-text);
  pointer-events: none;
}

/* === Footer === */
.site-footer {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto auto auto auto;
  align-items: center;
  column-gap: 0.4rem;
  row-gap: 0.25rem;
  padding: 1rem var(--header-inline-padding);
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  background: var(--color-header);
  font-size: 0.92rem;
}
.site-footer p {
  margin: 0;
}
.site-footer p:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
}
.site-footer p:nth-of-type(2) {
  grid-column: 1;
  grid-row: 2;
}
.site-footer p:nth-of-type(3) {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0 2rem;
}
.site-footer p a {
  display: inline;
  width: auto;
  height: auto;
  white-space: nowrap;
}
.site-footer > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
}
.site-footer > a:nth-of-type(1) {
  grid-column: 3;
}
.site-footer > a:nth-of-type(2) {
  grid-column: 4;
}
.site-footer > a:nth-of-type(3) {
  grid-column: 5;
}
.site-footer > a {
  grid-row: 1 / span 2;
}
.site-footer > a img {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

/* === Page d’accueil + feature page + media list === */
body.is-home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("/pictures/Arriere-plan-accueil.png") center top / cover no-repeat;
  pointer-events: none;
}
body.is-home-page > * {
  position: relative;
  z-index: 1;
}
body.is-home-page #main-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
}
body.is-home-page .feature-page {
  position: relative;
  max-width: none;
  min-height: calc(100svh + var(--header-height) + 10rem);
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body.is-home-page .feature-page::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: clamp(6rem, 16vh, 12rem);
  background: linear-gradient(to bottom, rgba(245, 239, 230, 0), var(--color-background));
  pointer-events: none;
}
body.is-home-page .feature-page > div {
  display: none;
}
.feature-page {
  position: relative;
  min-height: min(34rem, 68vh);
  padding: clamp(1.5rem, 4vw, 3rem) clamp(0rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem) 0;
}
.feature-page p {
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
}

.media-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: 100%;
}
.media-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, var(--event-media-width));
  column-gap: clamp(1.25rem, 4vw, 3rem);
  row-gap: 0.45rem;
  align-items: center;
  align-content: center;
  min-height: 9.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  width: 100%;
  max-width: 100%;
}
.media-list > div:last-child {
  border-bottom: 1px solid var(--color-border);
}
.media-list .righted {
  width: 100%;
  max-width: var(--event-media-width);
  margin: 0;
  grid-column: 2;
  grid-row: 1 / span 6;
  justify-self: end;
}
.media-list .righted ~ :is(h2, h3, h4, h5, h6, p, a, li, ul, ol) {
  grid-column: 1;
}
.media-list > div > :is(h2, h3, h4, h5, h6, p, a, ul, ol) {
  margin-bottom: 0;
}

/* === Pages internes === */
body:not(.is-home-page) #main-content {
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6.5rem) clamp(1.25rem, 5vw, 5rem);
}
.page {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  display: flow-root;
  min-width: 0;
  max-width: var(--text-width);
  margin: 0 auto;
  overflow-wrap: break-word;
}
.page > :not(:last-child) {
  margin-bottom: 2rem;
}
.page > div:not(.gallery-filters):not(.image-grid) {
  display: grid;
  grid-template-columns: minmax(0, var(--content-media-width)) minmax(0, 1fr);
  column-gap: clamp(1.25rem, 4vw, 3rem);
  row-gap: 0.45rem;
  align-items: start;
  max-width: min(100%, var(--block-width));
}
.page > div:not(.gallery-filters):not(.image-grid):has(> :is(img, iframe).righted) {
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--content-media-width));
}
.page > div:not(.gallery-filters):not(.image-grid):has(> .wide-embed.righted) {
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--map-width));
}
.page > div:not(.gallery-filters):not(.image-grid) > :first-child {
  margin-top: 0;
}
.page > div:not(.gallery-filters):not(.image-grid) > :last-child {
  margin-bottom: 0;
}
.page > div:not(.gallery-filters):not(.image-grid) > :not(.lefted):not(.centered):not(.righted) {
  grid-column: 1 / -1;
}
.div > .lefted ~ :not(.lefted):not(.centered):not(.righted),
.page > div:not(.gallery-filters):not(.image-grid) > .lefted ~ :not(.lefted):not(.centered):not(.righted) {
  grid-column: 2;
}
.div > .righted ~ :not(.lefted):not(.centered):not(.righted),
.page > div:not(.gallery-filters):not(.image-grid) > .righted ~ :not(.lefted):not(.centered):not(.righted) {
  grid-column: 1;
}
.page > div:not(.gallery-filters):not(.image-grid) > .lefted {
  grid-column: 1;
  justify-self: start;
  margin-left: 0;
  margin-right: 0;
}
.page > div:not(.gallery-filters):not(.image-grid) > .centered {
  grid-column: 1 / -1;
  justify-self: center;
}
.page > div:not(.gallery-filters):not(.image-grid) > .righted {
  grid-column: 2;
  justify-self: stretch;
  margin-left: 0;
  margin-right: 0;
}
.page > div:not(.gallery-filters):not(.image-grid) > :is(img, iframe).lefted,
.page > div:not(.gallery-filters):not(.image-grid) > :is(img, iframe).righted {
  width: 100%;
  max-width: 100%;
  grid-row: 1 / span 20;
}
.page > div:not(.gallery-filters):not(.image-grid) > :is(img, iframe).righted {
  justify-self: end;
}

/* === Gallery + image-grid + modal === */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--gallery-column-min)), 1fr));
  gap: clamp(1rem, 2.2vw, 1.65rem);
  align-items: start;
  max-width: none;
}
.image-grid > * {
  margin-bottom: 0;
}
.image-grid > div {
  max-width: none;
}
.image-grid img {
  display: block;
  width: 100%;
  max-width: none;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
  cursor: zoom-in;
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.image-grid img[hidden] {
  display: none;
}
.image-grid img:focus-visible {
  box-shadow: 0 22px 42px rgba(43, 34, 27, 0.18);
  transform: translateY(-0.18rem);
}
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  max-width: 100%;
  gap: 1rem;
  margin: 0 0 1rem;
}
.gallery-filter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 2rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid;
  border-color: var(--color-border-strong);
  border-radius: 0.25rem;
  background: var(--color-header);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1.1;
  white-space: nowrap;
}
.gallery-filter:focus-visible,
.gallery-filter:hover,
.gallery-filter[aria-pressed="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent-deep);
}
.gallery-modal-open {
  overflow: hidden;
}
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 4rem);
  overscroll-behavior: contain;
}
.gallery-modal[hidden] {
  display: none;
}
.gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 17, 16, 0.78);
}
.gallery-modal__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(0.5rem, 1.4vw, 0.9rem);
  width: min(100%, 72rem);
  padding: clamp(0.45rem, 1.2vw, 0.7rem);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
  overflow: auto;
  overscroll-behavior: contain;
}
.gallery-modal__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface-strong);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
}
.gallery-modal__close:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent-deep);
  outline: none;
}
.gallery-modal__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.gallery-modal__image {
  align-self: start;
  justify-self: start;
  width: 100%;
  object-fit: contain;
  padding: 0;
  position: sticky;
  top: 0;
}
.gallery-modal__details {
  align-self: start;
  margin-top: 0;
}
.gallery-modal__details dt {
  margin-top: 0.8rem;
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.gallery-modal__details dd {
  margin: 0.1rem 0 0;
  color: var(--color-text);
  font-size: 0.94rem;
  line-height: 1.42;
  white-space: pre-line;
}

/* === Customizable par l'admin === */
.centered,
.righted {
  display: block;
}
.lefted {
  margin-left: 0;
  margin-right: auto;
}
.centered {
  margin-left: auto;
  margin-right: auto;
}
.righted {
  margin-left: auto;
  margin-right: 0;
}
.wide-embed.righted {
  width: 100%;
  max-width: 100%;
  height: clamp(22rem, 48vw, 34rem);
}

@media (min-width: 901px) {
  /* === Gallery + image-grid + modal === */
        .gallery-modal__close {
          top: 0;
          right: 0;
        }
        .gallery-modal__image {
          grid-column: 1;
          grid-row: 1;
          max-height: calc(84vh - 2rem);
          transform: translateX(-0.75rem);
        }
        .gallery-modal__details {
          grid-column: 2;
          grid-row: 1;
        }
        .gallery-modal__dialog {
          grid-template-columns: minmax(18rem, 42%) minmax(0, 1fr);
          max-height: min(84vh, 50rem);
        }

  /* === Reste === */
        body {
          font-size: 18px;
        }
}

@media (max-width: 900px) {
  /* === Contenu général commun à toutes les pages === */
        :root {
          --header-top-height: clamp(5.9rem, 23vw, 7.5rem);
          --header-sticky-row-height: 3.5rem;
          --header-height: calc(var(--header-top-height) + var(--header-sticky-row-height));
        }

  /* === Header === */
        .header-top > a {
          width: min(22rem, 58vw);
        }
        .site-header nav {
          min-height: auto;
          padding: 0;
          gap: 0.25rem clamp(0.55rem, 2.1vw, 0.85rem);
          justify-content: center;
        }
        .site-header nav a[data-navigation] {
          min-height: 1.8rem;
          font-size: clamp(0.84rem, 3.3vw, 1rem);
        }
        .site-header nav > .language-link,
        .site-header nav > .language-link::before,
        .site-header nav > .language-link::after {
          font-size: 0.9rem;
        }
        .site-header {
          grid-template-rows: var(--header-top-height) minmax(var(--header-sticky-row-height), auto);
          width: calc(100% - 3rem);
          min-height: auto;
          margin: 1.4rem auto 0;
          padding: 0 0.9rem;
          border-radius: 0.9rem 0.9rem 0 0;
        }
        .header-sticky-row {
          min-height: var(--header-sticky-row-height);
        }
        .language-switch {
          right: 0;
          z-index: 20;
          margin: 0;
          padding: 0.12rem 0.18rem;
          background: var(--color-header);
          font-size: 0.9rem;
        }

  /* === Footer === */
        .site-footer {
          width: calc(100% - 3rem);
          margin: 0 auto 1.4rem;
          padding: 0.9rem 1rem;
        }

  /* === Page d’accueil + feature page + media list === */
        body.is-home-page {
          background: #333333;
        }
        body.is-home-page::before {
          inset: 0 1.5rem;
        }
        body.is-home-page #main-content {
          width: calc(100% - 3rem);
          margin: 0 auto;
        }
        .media-list > div {
          display: block;
        }
        .feature-page {
          min-height: 24rem;
          padding-right: 0;
        }

  /* === Pages internes === */
        .div,
        .page > div:not(.gallery-filters):not(.image-grid) {
          display: block;
        }
        .page > div:not(.gallery-filters):not(.image-grid) > :is(img, iframe).lefted,
        .page > div:not(.gallery-filters):not(.image-grid) > :is(img, iframe).righted {
          display: block;
          width: 100%;
          max-width: 28rem;
          margin: 1rem 0 1.2rem;
        }
        .page h1 {
          margin-bottom: 1.5rem;
        }
        .div > :is(img, iframe).lefted,
        .div > :is(img, iframe).righted,
        .page iframe {
          width: 100%;
          max-width: 100%;
          margin: 1rem 0 1.2rem;
        }

  /* === Gallery + image-grid + modal === */
        .gallery-modal {
          padding: 0.75rem;
        }
        .gallery-modal__dialog {
          grid-template-columns: 1fr;
          max-height: 92vh;
        }
        .gallery-modal__image {
          max-height: 64vh;
          position: static;
        }
        .image-grid {
          grid-template-columns: 1fr;
          gap: 1.1rem;
        }

  /* === Reste === */
        body {
          font-size: 17px;
        }
        body.is-internal-page #main-content,
        body:not(.is-home-page) #main-content {
          padding: 2.35rem 1.15rem;
        }
        .wide-embed.righted {
          width: 100%;
          max-width: none;
          height: clamp(20rem, 70vh, 30rem);
        }
}

@media (max-width: 620px) {
  /* === Header === */
        .header-top > a {
          width: min(17rem, 52vw);
        }
        .site-header nav {
          flex-wrap: nowrap;
          justify-content: flex-start;
          gap: 0.25rem 0.45rem;
          padding-right: 3.2rem;
        }
        .site-header nav a[data-navigation] {
          min-height: 1.55rem;
          font-size: clamp(0.78rem, 3.2vw, 0.9rem);
        }
        .site-header nav > .language-link,
        .site-header {
          max-width: calc(100vw - 3rem);
        }
        .language-switch {
          font-size: 0.85rem;
        }

  /* === Footer === */
        .site-footer {
          grid-template-columns: 1fr repeat(3, 2.1rem);
          row-gap: 0.35rem;
        }
        .site-footer p:nth-of-type(3) {
          grid-column: 1 / -1;
          grid-row: 3;
          margin: 0;
        }
        .site-footer > a:nth-of-type(1) {
          grid-column: 2;
        }
        .site-footer > a:nth-of-type(2) {
          grid-column: 3;
        }
        .site-footer > a:nth-of-type(3) {
          grid-column: 4;
        }
}
