/* =========================================================================
   Alif — feuille de style unique du site
   1. Jetons de couleur et remise à zéro
   2. Base typographique et accessibilité
   3. En-tête et navigation
   4. Pied de page
   5. Blocs de page (hero, page-hero, sections)
   6. Composants (cartes, galerie, formulaires, encarts)
   7. Adaptations mobiles
   ========================================================================= */

/* 1. Jetons -------------------------------------------------------------- */

:root {
  --sand: #F1E6D3;
  --card: #FBF3E7;
  --terracotta: #C1603C;
  --olive: #5B3A2A;
  --ink: #2B241C;
  --muted: #7A6E5C;
  --body-text: #4E4536;
  --border-soft: #E4D6BC;
  --danger: #A33A28;
  --success: #3F6B4A;
  --radius-card: 22px;
  --radius-panel: 26px;
  --content-width: 1160px;
  --gutter: 48px;
}

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

/* 2. Base ---------------------------------------------------------------- */

body {
  background: var(--sand);
  color: var(--ink);
  font-family: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: 'Domine', Georgia, 'Times New Roman', serif;
  font-weight: 700;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

ul {
  list-style: none;
}

/* Anneau de focus visible au clavier, invisible à la souris. */
:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--card);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 0 0 14px 0;
  font-weight: 700;
}

.skip-link:focus {
  left: 0;
}

.text-link {
  color: var(--terracotta);
  font-weight: 700;
}

.empty-state {
  background: var(--card);
  border-radius: 18px;
  padding: 20px 24px;
  color: var(--muted);
  font-size: 15px;
}

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

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--gutter);
}

.site-nav .brand img {
  height: 50px;
  width: auto;
  display: block;
}

.site-nav .links {
  display: flex;
  gap: 6px;
  font-size: 14px;
  flex-wrap: wrap;
}

.site-nav .links a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
}

.site-nav .links a:hover {
  background: rgba(251, 243, 231, .6);
}

.site-nav .links a.active {
  background: var(--card);
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ink);
}

.menu-toggle svg {
  width: 26px;
  height: 26px;
  display: block;
}

.mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 24px 20px;
}

.mobile-menu[hidden] {
  display: none;
}

.mobile-menu a {
  display: block;
  padding: 13px 16px;
  border-radius: 14px;
  text-decoration: none;
  font-size: 16px;
  color: var(--ink);
}

.mobile-menu a.active {
  background: var(--card);
  font-weight: 700;
}

@media (min-width: 821px) {
  .mobile-menu {
    display: none;
  }
}

/* 4. Pied de page -------------------------------------------------------- */

footer {
  background: var(--olive);
  color: #EDE7D8;
  padding: 44px var(--gutter);
  border-radius: 32px 32px 0 0;
  max-width: var(--content-width);
  margin: 0 auto;
  font-size: 13px;
}

footer .row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

footer strong {
  color: #fff;
  font-family: 'Domine', Georgia, serif;
}

footer a {
  text-decoration: none;
  color: #EDE7D8;
}

footer a:hover {
  text-decoration: underline;
}

footer .footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

footer .footer-social {
  display: flex;
  gap: 10px;
}

footer .footer-social a {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

footer .footer-social a:hover {
  background: rgba(255, 255, 255, .24);
}

footer .footer-social svg {
  width: 14px;
  height: 14px;
  stroke: #EDE7D8;
}

footer .footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}

footer .footer-legal {
  color: #C9BFA8;
  font-size: 12px;
}

footer .footer-legal:hover {
  color: #EDE7D8;
}

/* 5. Blocs de page ------------------------------------------------------- */

section {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter) 44px;
}

.page-hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px var(--gutter) 44px;
}

.page-hero .eyebrow,
.hero-text .eyebrow {
  color: var(--terracotta);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.page-hero h1 {
  font-size: 40px;
}

.hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 30px var(--gutter) 44px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-photos {
  position: relative;
  height: 420px;
}

.hero-photos img {
  position: absolute;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 20px 40px rgba(43, 36, 28, .18);
}

.hero-photos .p1 {
  width: 78%;
  height: 340px;
  top: 0;
  left: 0;
}

.hero-photos .p2 {
  width: 52%;
  height: 220px;
  bottom: 0;
  right: 0;
  border: 6px solid var(--sand);
}

.hero-text h1 {
  font-size: 42px;
  line-height: 1.2;
  margin-bottom: 18px;
}

.hero-text p {
  color: var(--body-text);
  font-size: 16px;
  max-width: 44ch;
  margin-bottom: 28px;
}

h2.section-title {
  font-size: 28px;
  margin-bottom: 26px;
}

/* 6. Composants ---------------------------------------------------------- */

.btn {
  background: var(--terracotta);
  color: #FBF3E7;
  font-weight: 700;
  padding: 15px 30px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  border: none;
  display: inline-block;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: #A94F2F;
}

.btn.ghost {
  background: transparent;
  border: 2px solid var(--terracotta);
  color: var(--terracotta);
  padding: 13px 28px;
}

.btn.ghost:hover {
  background: rgba(193, 96, 60, .1);
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.action-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 26px 22px;
}

.action-card .circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--olive);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Domine', Georgia, serif;
  font-weight: 700;
  margin-bottom: 14px;
}

.action-card h2,
.action-card h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.action-card p {
  font-size: 13px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
  margin-bottom: 44px;
}

.split img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius-panel);
}

.split h2 {
  font-size: 30px;
  margin-bottom: 16px;
}

.split p {
  color: var(--body-text);
  max-width: 48ch;
  margin-bottom: 12px;
}

.events h2 {
  font-size: 28px;
  margin-bottom: 28px;
}

.event-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.event-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 24px;
}

.event-card.past {
  opacity: .85;
}

.event-card .date {
  color: var(--terracotta);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.event-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.event-card p {
  font-size: 14px;
  color: var(--muted);
}

.event-card .event-location {
  margin-top: 8px;
  font-size: 13px;
  color: var(--olive);
  font-weight: 600;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.filter-row .filter {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
}

.filter-row .filter:hover {
  color: var(--ink);
}

.filter-row .filter.active {
  background: var(--terracotta);
  color: #fff;
  font-weight: 700;
}

.values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 44px;
}

.value-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 28px 24px;
}

.value-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.value-card p {
  font-size: 14px;
  color: var(--muted);
}

.team {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.team-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 24px;
  text-align: center;
}

.team-card .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--olive);
  color: #fff;
  font-family: 'Domine', Georgia, serif;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.team-card--vacant .avatar {
  background: #C9BFA8;
}

.team-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.team-card p {
  font-size: 13px;
  color: var(--muted);
}

.activity {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
  margin-bottom: 44px;
}

.activity.reverse .img {
  order: 2;
}

.activity img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: var(--radius-panel);
}

.activity .tag {
  color: var(--terracotta);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.activity h2 {
  font-size: 28px;
  margin-bottom: 14px;
}

.activity p {
  color: var(--body-text);
  max-width: 48ch;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.gallery-grid figure {
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
  margin: 0;
}

.gallery-grid img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.gallery-grid figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(0deg, rgba(43, 36, 28, .75), transparent);
}

.gallery-grid .tall {
  grid-row: span 2;
}

.gallery-grid .tall img {
  height: 540px;
}

.gallery-notice {
  margin-top: 26px;
  font-size: 14px;
  color: var(--muted);
  max-width: 64ch;
}

/* Mise en page à deux colonnes des pages contact et adhésion. */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-bottom: 44px;
  min-width: 0;
}

.layout > * {
  min-width: 0;
}

.layout p {
  color: var(--body-text);
  max-width: 46ch;
  margin-bottom: 14px;
}

/* Formulaires ------------------------------------------------------------ */

.form-panel {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 36px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.field-optional {
  font-weight: 400;
  text-transform: none;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--sand);
  color: var(--ink);
  font: inherit;
  padding: 0 16px;
  height: 46px;
}

.field textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 16px;
  resize: vertical;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--danger);
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.field-error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--danger);
  font-weight: 600;
}

/* Piège à robots : hors écran, mais accessible aux automates. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.alert {
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
}

.alert--success {
  background: rgba(63, 107, 74, .12);
  color: var(--success);
}

.alert--error {
  background: rgba(163, 58, 40, .12);
  color: var(--danger);
}

/* Encart de coordonnées et carte ---------------------------------------- */

.info-card {
  background: var(--card);
  border-radius: var(--radius-panel);
  padding: 36px;
}

.info-line {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 15px;
}

.info-line:first-of-type {
  border-top: 1px solid var(--border-soft);
}

.info-line a {
  color: var(--terracotta);
  text-decoration: none;
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-word;
}

.info-label {
  width: 88px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
  padding-top: 2px;
}

.map-block {
  border-radius: var(--radius-card);
  overflow: hidden;
  min-height: 220px;
  margin-top: 22px;
}

.map-block iframe {
  width: 100%;
  height: 220px;
  border: 0;
  display: block;
}

.social-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 20px 26px;
  flex-wrap: wrap;
}

.social-bar .label {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.social-bar .social-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.social-bar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--sand);
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, color .15s;
}

.social-bar a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.social-bar a:hover {
  background: var(--terracotta);
  color: #FBF3E7;
}

/* Mentions légales et pages d'erreur ------------------------------------- */

.notice {
  background: var(--card);
  border-radius: 18px;
  padding: 20px 24px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 40px;
}

.legal h2 {
  font-size: 20px;
  margin: 36px 0 12px;
}

.legal h2:first-child {
  margin-top: 0;
}

.legal p {
  font-size: 14px;
  color: var(--body-text);
  margin-bottom: 10px;
}

.legal .todo {
  color: var(--terracotta);
  font-weight: 600;
}

.error-explanation {
  color: var(--body-text);
  max-width: 60ch;
  margin-bottom: 24px;
}

.error-details {
  margin-top: 32px;
  background: var(--card);
  border-radius: 18px;
  padding: 18px 22px;
}

.error-details pre {
  margin-top: 12px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}

/* 7. Adaptations mobiles -------------------------------------------------- */

@media (max-width: 820px) {
  :root {
    --gutter: 24px;
  }

  .site-nav {
    padding: 18px 24px;
  }

  .site-nav .links {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  footer {
    padding: 36px 24px 30px;
    border-radius: 24px 24px 0 0;
  }

  footer .row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  footer .footer-brand {
    font-size: 14px;
  }

  footer .footer-social a {
    width: 38px;
    height: 38px;
  }

  footer .footer-social svg {
    width: 16px;
    height: 16px;
  }

  footer .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
  }

  footer .footer-links {
    flex-direction: column;
    gap: 8px;
  }
}

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

@media (max-width: 640px) {
  .hero,
  .actions,
  .split,
  .event-cards,
  .values,
  .team,
  .activity,
  .layout,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .hero-photos {
    height: 300px;
  }

  .hero-text h1 {
    font-size: 34px;
  }

  .page-hero h1 {
    font-size: 32px;
  }

  .activity.reverse .img {
    order: 0;
  }

  .gallery-grid .tall {
    grid-row: auto;
  }

  .gallery-grid .tall img {
    height: 260px;
  }

  .form-panel,
  .info-card {
    padding: 26px 22px;
  }
}

/* =========================================================================
   Visionneuse de la galerie
   ========================================================================= */

.gallery-lien {
  display: block;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: inherit;
}

.gallery-lien img {
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}

.gallery-lien:hover img,
.gallery-lien:focus-visible img {
  transform: scale(1.05);
}

.gallery-loupe {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(43, 36, 28, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s, transform .25s;
  backdrop-filter: blur(4px);
}

.gallery-loupe svg {
  width: 18px;
  height: 18px;
}

.gallery-lien:hover .gallery-loupe,
.gallery-lien:focus-visible .gallery-loupe {
  opacity: 1;
  transform: scale(1);
}

/* Sur écran tactile, il n'y a pas de survol : la loupe reste discrètement visible. */
@media (hover: none) {
  .gallery-loupe {
    opacity: .85;
    transform: scale(1);
  }
}

/* La page ne défile plus derrière la visionneuse ouverte. */
body.visionneuse-ouverte {
  overflow: hidden;
}

.visionneuse {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: contain;
}

.visionneuse::backdrop {
  /* --voile est ajusté par le script pendant le glissement vers le bas. */
  background: rgba(24, 19, 14, calc(.94 * var(--voile, 1)));
  backdrop-filter: blur(8px);
  animation: voile-entree .3s ease both;
}

@keyframes voile-entree {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.visionneuse-scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 84px 108px;
  touch-action: none;
}

.visionneuse-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  /* Le glissement au doigt est géré par le script, pas par le navigateur. */
  user-select: none;
  -webkit-user-drag: none;
}

.visionneuse-bouton {
  position: absolute;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, transform .18s;
  backdrop-filter: blur(4px);
}

.visionneuse-bouton:hover {
  background: rgba(255, 255, 255, .24);
}

.visionneuse-bouton:active {
  transform: scale(.92);
}

.visionneuse-bouton svg {
  width: 22px;
  height: 22px;
}

.visionneuse-fermer {
  top: 18px;
  right: 18px;
}

.visionneuse-precedent,
.visionneuse-suivant {
  top: 50%;
  margin-top: -23px;
}

.visionneuse-precedent { left: 18px; }
.visionneuse-suivant  { right: 18px; }

.visionneuse-barre {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 28px 22px;
  background: linear-gradient(0deg, rgba(24, 19, 14, .85), transparent);
  text-align: center;
  pointer-events: none;
}

.visionneuse-legende {
  font-family: 'Domine', Georgia, serif;
  font-size: 16px;
  margin-bottom: 4px;
}

.visionneuse-credit,
.visionneuse-compteur {
  font-size: 12px;
  color: rgba(255, 255, 255, .65);
}

.visionneuse-compteur {
  margin-top: 6px;
  letter-spacing: .08em;
}

/* Mobile : la photo occupe l'écran, les commandes descendent sous le pouce. */
@media (max-width: 700px) {
  .visionneuse-scene {
    padding: 64px 12px 132px;
  }

  .visionneuse-bouton {
    width: 52px;
    height: 52px;
  }

  .visionneuse-precedent,
  .visionneuse-suivant {
    top: auto;
    bottom: 18px;
    margin-top: 0;
  }

  .visionneuse-precedent { left: 22px; }
  .visionneuse-suivant  { right: 22px; }

  .visionneuse-barre {
    bottom: 84px;
    padding: 30px 20px 10px;
    background: none;
  }

  .visionneuse-legende {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-lien img,
  .gallery-loupe,
  .visionneuse-image,
  .visionneuse-bouton {
    transition: none;
  }

  .visionneuse::backdrop {
    animation: none;
  }

  .gallery-lien:hover img,
  .gallery-lien:focus-visible img {
    transform: none;
  }
}
