/* Sections de l'invitation : hero, programme, lieu, réponse, pied de page. */

/* ---------- Accessibilité ---------- */
.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -3rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--ivory);
  color: var(--olive);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Sélecteur de langue ---------- */
.lang-switch {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.5rem);
  inset-inline-end: clamp(0.75rem, 3vw, 2rem);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--taupe-dark);
}

.lang-switch button {
  padding: 0.5rem 0.4rem; /* zone de toucher suffisante */
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 400ms var(--ease-out), border-color 400ms var(--ease-out);
}

.lang-switch button[aria-pressed="true"] {
  color: var(--anthracite);
  border-bottom-color: var(--olive);
}

.lang-switch button:hover {
  color: var(--olive);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  justify-items: center;
  padding: clamp(3rem, 8vw, 4.5rem) var(--gutter) clamp(4rem, 10vw, 6rem);
  text-align: center;
}

.hero__art {
  display: block;
  /* Plus large que la colonne de texte : déborde dans les marges sur mobile */
  width: min(calc(100% + 2 * var(--gutter)), 46rem);
}

/* Les bords sont peints dans l'image elle-même (tools/paint-edges.swift). */
.hero__art img {
  display: block;
  width: 100%;
  height: auto;
}

/* Aquarelles peintes : le grain du papier du site passe aussi sur la peinture,
   limité à la zone peinte (l'image elle-même sert de masque). */
.hero__art,
.place__art {
  position: relative;
}

.hero__art::after,
.place__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--paper-grain);
  -webkit-mask: var(--paint) center / 100% 100% no-repeat;
  mask: var(--paint) center / 100% 100% no-repeat;
  pointer-events: none;
}

.hero__art  { --paint: url("../assets/img/mairie-facade-lavis-640.avif"); }
.place__art { --paint: url("../assets/img/mairie-jardin-lavis-640.avif"); }
.place__art--salon { --paint: url("../assets/img/salon-cocktail-640.avif"); }

.hero__text {
  display: grid;
  justify-items: center;
  margin-top: clamp(-2.5rem, -4vw, -1rem);
}

/* Écusson : signature discrète au-dessus de l'aquarelle, sans la toucher */
.crest {
  display: block;
}

.crest img {
  display: block;
  width: 100%;
  height: auto;
}

.hero__crest {
  position: relative;
  z-index: 1; /* reste au-dessus du lavis transparent du haut de l'aquarelle */
  width: clamp(7.5rem, 30vw, 9rem);
  /* Le haut de l'aquarelle est un lavis presque transparent : on la remonte sous l'écusson */
  margin-bottom: clamp(-2.25rem, -5vw, -1rem);
}

.hero__names {
  margin-top: 0; /* droit, comme le monogramme de l'écusson */
}

.hero__invite {
  margin: 1.25rem 0 0;
  max-width: 25rem;
  font-style: italic;
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  color: var(--taupe-dark);
  text-wrap: balance;
}

.hero__sep {
  margin-block: 1.75rem 1.5rem;
}

.hero__date {
  font-size: clamp(0.875rem, 2.8vw, 1rem);
}

.hero__place {
  margin: 0.4rem 0 0;
  font-style: italic;
  font-size: 1.125rem;
}

.hero__cta {
  margin-top: 2.5rem;
}

/* Apparition progressive : l'aquarelle, puis le texte ligne à ligne */
.hero__crest,
.hero__art,
.hero__text > * {
  opacity: 0;
  animation: rise-in 1400ms var(--ease-out) forwards;
}

.hero__art {
  animation-name: wash-in;
  animation-duration: 2200ms;
  animation-delay: 400ms;
}

.hero__crest    { animation-delay: 100ms; }
.hero__names    { animation-delay: 1000ms; }
.hero__invite   { animation-delay: 1400ms; }
.hero__sep      { animation-delay: 1650ms; }
.hero__date     { animation-delay: 1850ms; }
.hero__place    { animation-delay: 2000ms; }
.hero__cta      { animation-delay: 2300ms; }

@keyframes wash-in {
  from { opacity: 0; filter: blur(6px); transform: scale(1.015); }
  to   { opacity: 1; filter: none; transform: none; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Sections ---------- */
.section {
  max-width: 40rem;
  margin-inline: auto;
  padding: clamp(4rem, 10vw, 6.5rem) var(--gutter);
  text-align: center;
  border-top: 1px solid color-mix(in srgb, var(--champagne) 70%, transparent);
}

.section__title {
  margin: 0.75rem 0 2.5rem;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.15;
}

/* ---------- Programme ---------- */
/* Frise illustrée : horaire · repère sur le filet · illustration · intitulé.
   Le filet est dessiné par .timeline::before, placé et déroulé par js/timeline.js
   (sans JavaScript, tout est simplement affiché, sans filet). */
.section--programme {
  max-width: 46rem;
}

.timeline {
  --art: 9.5rem;
  position: relative;
  display: grid;
  gap: clamp(2.25rem, 6vw, 3.25rem);
  max-width: 42rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  text-align: start;
}

.timeline::before {
  content: "";
  position: absolute;
  left: var(--rail-x, 0);
  top: var(--rail-top, 0);
  width: 1px;
  height: var(--rail-h, 0);
  background: linear-gradient(to bottom, transparent, var(--taupe) 12%, var(--taupe) 88%, transparent);
  opacity: 0.75;
  transform: scaleY(var(--rail-progress, 1));
  transform-origin: top;
  pointer-events: none;
}

.timeline__item {
  display: grid;
  grid-template-columns: 4.5rem 1rem var(--art) minmax(0, 19rem);
  justify-content: center;
  grid-template-areas: "time mark art text";
  align-items: center;
  column-gap: clamp(1rem, 3vw, 1.75rem);
}

.timeline__time {
  grid-area: time;
  justify-self: end;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.3em;
  white-space: nowrap;
  color: var(--olive);
}

/* Repère : petit losange, filet olive, cœur ivoire qui se teinte de champagne */
.timeline__mark {
  grid-area: mark;
  justify-self: center;
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  border: 1px solid var(--olive);
  background: var(--ivory);
  transform: rotate(45deg);
}

.timeline__art {
  grid-area: art;
  display: block;
  width: var(--art);
  aspect-ratio: 10 / 9;
}

.timeline__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timeline__text {
  grid-area: text;
}

.timeline__title {
  margin: 0;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
}

.timeline__desc {
  margin: 0.45rem 0 0;
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--taupe-dark);
  text-wrap: pretty;
}

/* Lieu de l'étape : petite mention en capitales, sous la description */
.timeline__place {
  margin: 0.6rem 0 0;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--olive);
}

/* Smartphone : le filet passe à gauche, l'horaire rejoint l'intitulé */
@media (max-width: 39.99rem) {
  .timeline {
    --art: clamp(5.25rem, 26vw, 6.5rem);
  }

  .timeline__item {
    /* Colonnes de largeur fixe : la frise reste centrée et les repères alignés */
    grid-template-columns: 0.75rem var(--art) minmax(0, 14.5rem);
    justify-content: center;
    grid-template-areas:
      "mark art time"
      "mark art text";
    grid-template-rows: auto auto;
    column-gap: 1rem;
    row-gap: 0.3rem;
  }

  .timeline__mark { grid-row: 1 / span 2; }
  .timeline__art { grid-row: 1 / span 2; }
  .timeline__time { justify-self: start; align-self: end; }
  .timeline__text { align-self: start; }

  /* Textes plus longs : l'illustration s'aligne en haut, à côté de l'intitulé */
  .timeline__art,
  .timeline__mark { align-self: start; margin-top: 0.4rem; }
  .timeline__mark { margin-top: calc(0.4rem + var(--art) * 0.45); }

  .timeline__title {
    font-size: 1.3rem;
  }

  .timeline__desc {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .timeline__place {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
  }
}

/* Apparition au défilement (activée par js/timeline.js) */
.timeline--animated .timeline__mark {
  opacity: 0;
  transform: rotate(45deg) scale(0.3);
  transition: opacity 600ms var(--ease-out), transform 900ms var(--ease-out), background-color 900ms var(--ease-out);
}

.timeline--animated .timeline__art {
  opacity: 0;
  transform: translateY(0.9rem) scale(0.97);
  transition: opacity 1400ms var(--ease-out) 150ms, transform 1800ms var(--ease-out) 150ms;
}

.timeline--animated .timeline__time,
.timeline--animated .timeline__text {
  opacity: 0;
  transform: translateY(0.6rem);
  transition: opacity 1100ms var(--ease-out) 450ms, transform 1300ms var(--ease-out) 450ms;
}

.timeline--animated .timeline__text {
  transition-delay: 600ms;
}

.timeline--animated .is-visible .timeline__mark {
  opacity: 1;
  transform: rotate(45deg) scale(1);
  background-color: var(--champagne);
}

.timeline--animated .is-visible .timeline__art,
.timeline--animated .is-visible .timeline__time,
.timeline--animated .is-visible .timeline__text {
  opacity: 1;
  transform: none;
}

/* ---------- Lieu ---------- */
.place__art {
  display: block;
  width: min(100%, 32rem);
  margin: 0 auto 2.5rem;
}

.place__art img {
  display: block;
  width: 100%;
  height: auto;
}

.place__address {
  font-style: normal;
  font-size: 1.25rem;
  line-height: 1.5;
}

.place__access {
  display: grid;
  gap: 1rem;
  margin: 2rem 0 2.25rem;
}

.place__access dt {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--taupe-dark);
}

.place__access dd {
  margin: 0.2rem 0 0;
  text-wrap: balance;
}

/* Itinéraire de la mairie : juste sous son adresse */
.place__route-main {
  margin-top: 1.25rem;
}

/* Petit lien d'itinéraire sous chaque adresse de parking */
.place__route {
  display: block;
  width: fit-content;
  margin: 0.3rem auto 0;
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 400;
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  transition: color 400ms var(--ease-out);
}

.place__route:hover {
  color: var(--anthracite);
}

/* Mini séparateur avant le cocktail : le motif du site (filets et losange), en réduit */
.place__reception::before {
  content: "";
  display: block;
  width: 4.5rem;
  height: 8px;
  margin: 0.75rem auto 1.5rem;
  background: var(--taupe);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 8'%3E%3Cpath d='M0 4h28M44 4h28' stroke='%23000'/%3E%3Cpath d='M36 1l3 3-3 3-3-3z' fill='none' stroke='%23000'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 8'%3E%3Cpath d='M0 4h28M44 4h28' stroke='%23000'/%3E%3Cpath d='M36 1l3 3-3 3-3-3z' fill='none' stroke='%23000'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* Aquarelle du salon : entre l'intitulé « Cocktail » et son adresse */
.place__access .place__salon {
  margin: 0.75rem 0 1rem;
}

.place__salon .place__art {
  margin: 0 auto;
}

/* Apparition au défilement, dans l'esprit de la frise du programme */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(0.9rem) scale(0.97);
  transition: opacity 1400ms var(--ease-out) 150ms, transform 1800ms var(--ease-out) 150ms;
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Solution de repli (parking) : sous l'adresse principale, plus discrète */
.place__access .place__alt {
  margin-top: 0.75rem;
}

.place__alt-lead {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--taupe-dark);
}

/* Information à venir : en italique, plus discrète */
.place__pending {
  font-style: italic;
  color: var(--taupe-dark);
}

/* ---------- Réponse (RSVP) ---------- */
.rsvp__deadline {
  margin: -1.5rem 0 2.5rem;
  font-style: italic;
  color: var(--taupe-dark);
}

.rsvp {
  display: grid;
  gap: 1.5rem;
  max-width: 28rem;
  margin-inline: auto;
  text-align: start;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label {
  padding: 0;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--taupe-dark);
}

/* Champs : cadre fin, fond taupe translucide qui laisse voir le grain du papier,
   angles à peine arrondis. Pas de verre dépoli, pas d'ombre portée. */
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  min-height: 3.25rem; /* cible tactile confortable */
  padding: 0.8rem 1rem;
  border: 1px solid rgba(164, 154, 139, 0.6); /* --taupe */
  border-radius: 3px;
  background-color: rgba(164, 154, 139, 0.09);
  color: var(--anthracite);
  font: inherit;
  font-size: 1.125rem; /* ≥ 16 px : évite le zoom automatique sur iPhone */
  line-height: 1.4;
  transition: border-color 300ms var(--ease-out), background-color 300ms var(--ease-out),
    box-shadow 300ms var(--ease-out);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--taupe);
  font-style: italic;
}

.field textarea {
  resize: vertical;
}

/* Listes déroulantes : flèche fine dessinée, à la place de celle du système */
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236F665A' stroke-width='1.1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.75rem auto;
  cursor: pointer;
}

/* Tant que rien n'est choisi, l'invite reste en teinte discrète */
.field select:invalid {
  color: var(--taupe-dark);
  font-style: italic;
}

.field select option {
  color: var(--anthracite);
  font-style: normal;
}

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

/* Sélection : la teinte se réchauffe (champagne) et le cadre passe à l'olive */
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--olive);
  background-color: rgba(214, 198, 172, 0.22); /* --champagne */
  box-shadow: 0 0 0 1px rgba(83, 91, 73, 0.35);
}

.field [aria-invalid="true"] {
  border-color: #8A3B2E;
}

.field__error {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: #8A3B2E; /* brique sourde, 7,0:1 sur l'ivoire */
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.rsvp__when-yes {
  display: grid;
  gap: 1.5rem;
}

.rsvp__when-yes[hidden] {
  display: none;
}

.rsvp__submit {
  justify-self: center;
  margin-top: 0.75rem;
}

.rsvp__submit[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.rsvp__privacy {
  margin: -0.5rem 0 0;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--taupe-dark);
}

.rsvp__status {
  margin: 0;
  min-height: 1.5em;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: #8A3B2E;
}

.rsvp__thanks {
  max-width: 28rem;
  margin-inline: auto;
  animation: rise-in 1200ms var(--ease-out);
}

.rsvp__thanks:focus {
  outline: none;
}

.rsvp__thanks-title {
  margin-bottom: 1rem;
}

/* Champ piège invisible pour les humains */
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Pied de page ---------- */
.footer {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 4rem var(--gutter) 5rem;
  text-align: center;
  border-top: 1px solid color-mix(in srgb, var(--champagne) 70%, transparent);
}

.footer__crest {
  width: 7rem;
  margin-inline: auto;
}

.footer__date {
  font-size: 0.875rem;
}

.noscript {
  max-width: 28rem;
  margin: 0 auto 3rem;
  padding-inline: var(--gutter);
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.875rem;
}
