/* Nestor Gamiette, Tòtò — feuille de style.
   Deux couleurs : le vert des feuilles de bananier, le beige du sable.
   Pour les modifier : variables ci-dessous. */

@font-face { font-family: "Alegreya"; src: url("../fonts/alegreya.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("../fonts/alegreya-italique.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --vert: #1f3b2a;          /* feuille de bananier, à l'ombre */
  --vert-profond: #16291e;
  --vert-feuille: #4f7a5b;  /* filets, survols */
  --sable: #e7dcc5;         /* sable sec */
  --sable-clair: #efe7d6;
  --encre: #1b261f;         /* texte sur le sable */
  --encre-douce: #4d5a50;
  --sur-vert: #e7dcc5;      /* texte sur le vert */
  --sur-vert-doux: #b9c2ae;
  --serif: "Alegreya", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;
  --gouttiere: clamp(18px, 5vw, 56px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--sable);
  color: var(--encre);
  font: 400 1.1875rem/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.evitement { position: absolute; left: 12px; top: -80px; z-index: 50; background: var(--sable); color: var(--encre); padding: 10px 16px; font-family: var(--sans); }
.evitement:focus { top: 12px; }

/* ---------- Ouverture : le grand vert ---------- */
.ouverture {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(40px, 8vh, 96px) var(--gouttiere);
  background: var(--vert);
  color: var(--sur-vert);
  overflow: hidden;
  isolation: isolate;
}
.ouverture-centre {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 22rem);
  align-items: end;
  column-gap: clamp(32px, 4vw, 56px);
}
.portrait {
  margin: 0;
  padding: 12px 12px 40px;           /* tirage : marge plus large en bas */
  background: var(--sable-clair);
  box-shadow: 0 2px 3px rgb(0 0 0 / .25), 0 30px 60px -20px rgb(0 0 0 / .55);
  transform: rotate(-1.2deg);
}
.portrait img {
  height: clamp(320px, 62vh, 600px);
  width: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
h1 { font-weight: 400; line-height: 1; }
.nom {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: .01em;
  color: var(--sur-vert);
}
.surnom {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(6rem, 13vw, 10.5rem);
  line-height: .92;
  letter-spacing: -.02em;
  margin: .08em 0 .12em -.04em;
  color: var(--sable-clair);
}
.date-depart { font-size: 1.25rem; color: var(--sur-vert-doux); }
.lien-ceremonie {
  display: inline-block;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--vert-feuille);
  font-family: var(--sans);
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--sur-vert);
  text-decoration: underline;
  text-decoration-color: var(--vert-feuille);
  text-underline-offset: .28em;
}
.lien-ceremonie:hover { text-decoration-color: currentColor; }

/* ---------- Mosaïque : tirages posés sur le vert (grand écran seulement) ---------- */
.mosaique { display: none; }
@media (min-width: 1100px) and (min-height: 640px) {
  .mosaique {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 720px minmax(0, 1fr);
    column-gap: 44px;
    padding: 0 40px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 88%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 88%, transparent 100%);
  }
  .mosaique-col { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
  .mosaique-col-1 { grid-column: 1; padding-top: 6vh; }
  .mosaique-col-3 { grid-column: 3; padding-top: 14vh; }
  .mosaique-col-2, .mosaique-col-4 { display: none; }
  .mosaique img {
    width: min(var(--l), 240px);
    margin-left: calc((100% - min(var(--l), 240px)) * var(--x));
    aspect-ratio: var(--r);
    object-fit: cover;
    padding: 6px 6px 18px;
    background: var(--sable-clair);
    box-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 18px 36px -14px rgb(0 0 0 / .5);
    transform: rotate(var(--rot));
    cursor: zoom-in;
    animation: flotter calc(var(--d) * 2) ease-in-out var(--delai) infinite;
    will-change: transform;
  }
}
@media (min-width: 1680px) and (min-height: 640px) {
  .mosaique { grid-template-columns: repeat(2, minmax(0, 1fr)) 880px repeat(2, minmax(0, 1fr)); column-gap: 32px; }
  .mosaique-col-2, .mosaique-col-4 { display: flex; }
  .mosaique-col-1 { grid-column: 1; padding-top: 10vh; }
  .mosaique-col-2 { grid-column: 2; padding-top: 3vh; }
  .mosaique-col-3 { grid-column: 4; padding-top: 6vh; }
  .mosaique-col-4 { grid-column: 5; padding-top: 15vh; }
}
/* Téléphone : trois tirages seulement, à droite du portrait, qui bougent à peine. */
@media (max-width: 760px) {
  .mosaique {
    position: absolute; z-index: 1;
    top: 44px; right: -18px;
    width: calc(100% - min(64vw, 300px) - var(--gouttiere) - 26px);
    display: flex; flex-direction: column; align-items: flex-end; gap: 18px;
  }
  .mosaique-col { display: contents; }
  .mosaique-col-4, .mosaique img:not(:first-child) { display: none; }
  .mosaique img {
    width: min(100%, 132px);
    aspect-ratio: var(--r);
    object-fit: cover;
    padding: 4px 4px 12px;
    background: var(--sable-clair);
    box-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 24px -10px rgb(0 0 0 / .5);
    transform: rotate(var(--rot));
    animation: flotter-doux calc(var(--d) * 2) ease-in-out var(--delai) infinite;
  }
  .mosaique-col-2 img { margin-right: 14px; }
}
@keyframes flotter-doux {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(var(--rot)); }
  50% { transform: translate3d(calc(max(var(--dx), var(--dx) * -1) * .35), calc(var(--dy) * .4), 0) rotate(calc(var(--rot) + var(--bascule) * .5)); }
}
@keyframes flotter {
  /* Boucle en forme de huit couché : la photo dérive puis revient, sans à-coup. */
  0%, 100% { transform: translate3d(0, 0, 0) rotate(var(--rot)); }
  25% { transform: translate3d(calc(var(--dx) * .6), var(--dy), 0) rotate(calc(var(--rot) + var(--bascule))); }
  50% { transform: translate3d(var(--dx), calc(var(--dy) * .2), 0) rotate(var(--rot)); }
  75% { transform: translate3d(calc(var(--dx) * .4), calc(var(--dy) * -.7), 0) rotate(calc(var(--rot) - var(--bascule))); }
}
.mouvement-arrete .mosaique img { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .mosaique img { animation: none !important; } }

/* ---------- Corps : la lettre et le programme, sur le sable ---------- */
.corps {
  display: grid;
  grid-template-columns: minmax(0, 34rem) minmax(0, 23rem);
  justify-content: center;
  align-items: start;
  column-gap: clamp(48px, 8vw, 120px);
  row-gap: 72px;
  padding: clamp(72px, 12vw, 144px) var(--gouttiere);
}
.lettre { font-size: 1.3125rem; line-height: 1.62; }
.lettre p + p { margin-top: .8em; }
.lettre a {
  color: var(--vert-profond); text-decoration: none; font-weight: 500;
  background: rgb(79 122 91 / .22); padding: .04em .32em .08em; margin: 0 -.06em;
  border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: background-color .15s, color .15s;
}
.lettre a:hover { background: var(--vert); color: var(--sur-vert); }
.lettre a:focus-visible { outline: 2px solid var(--vert); outline-offset: 2px; }
.lettre .ouverture-lettre { font-variant-caps: small-caps; letter-spacing: .03em; }
.signature { margin-top: 1.6em !important; font-style: italic; }

.corps > .hommage { grid-column: 1; grid-row: 1; }
.corps > .pratique { grid-column: 2; grid-row: 1; }
/* Le programme : un encart vert, bien visible, sur le sable de la page. */
.programme {
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.5;
  background: var(--vert); color: var(--sur-vert);
  padding: 8px clamp(22px, 3vw, 32px);
}
.rubrique { padding: 24px 0 26px; }
.rubrique + .rubrique { border-top: 1px solid rgb(231 220 197 / .22); }
dt {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 1.875rem; line-height: 1.1; color: var(--sable-clair);
  margin-bottom: 10px;
}
dd p + p { margin-top: 8px; }
.quand { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; color: var(--sable-clair); }
address { font-style: normal; margin-top: 8px; font-size: 1.125rem; color: var(--sur-vert); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 18px; }
.action {
  font: inherit;
  color: var(--sable-clair);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgb(231 220 197 / .5);
  text-underline-offset: .25em;
}
.action:hover { text-decoration-color: currentColor; }
.action-principale, .action-cadre {
  display: inline-block;
  padding: 11px 18px;
  font-weight: 500;
  text-decoration: none;
}
.action-principale { background: var(--sable-clair); color: var(--vert-profond); }
.action-principale:hover { background: #fff; }
.action-cadre { box-shadow: inset 0 0 0 1.5px var(--sable); color: var(--sable-clair); margin-top: 14px; }
.action-cadre:hover { background: rgb(231 220 197 / .12); }
.programme a:focus-visible, .programme button:focus-visible { outline: 2px solid var(--sable-clair); outline-offset: 3px; }
.etapes { list-style: none; margin: 14px 0 12px; padding: 0; }
.etapes li { position: relative; padding: 0 0 10px 22px; }
.etapes li::before { content: ""; position: absolute; left: 3px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--sable); }
.etapes li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 1.15em; bottom: -.15em; width: 1px; background: rgb(231 220 197 / .35); }
.a-preciser { color: var(--sur-vert-doux); }
.copie-statut { min-height: 1.5em; margin-top: 6px !important; font-size: .95rem; color: var(--sur-vert-doux); }

@media (max-width: 960px) {
  .corps { grid-template-columns: minmax(0, 34rem); row-gap: 64px; }
  .pratique { position: static; }
  .corps > .hommage, .corps > .pratique { grid-column: auto; grid-row: auto; }
}

/* ---------- Souvenirs : retour au vert, comme les pages d'un album ---------- */
.souvenirs {
  background: var(--vert);
  color: var(--sur-vert);
  padding: clamp(64px, 10vw, 120px) var(--gouttiere) 0;
}
.souvenirs-entete { max-width: 1280px; margin: 0 auto clamp(28px, 4vw, 48px); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px; }
.souvenirs h2 { font-style: italic; font-weight: 500; font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1; color: var(--sable-clair); }
.galerie {
  --ligne-h: 150px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (min-width: 600px) { .galerie { --ligne-h: 210px; gap: 12px; } }
@media (min-width: 1100px) { .galerie { --ligne-h: 260px; gap: 16px; } }
.galerie::after { content: ""; flex: 999 1 0; }
/* Rangées justifiées : chaque photo garde ses proportions, sans recadrage. */
.galerie li { flex: var(--r) 1 calc(var(--r) * var(--ligne-h)); min-width: 0; }
.galerie a { display: block; aspect-ratio: var(--r); background: var(--vert-profond); cursor: zoom-in; }
.galerie a:focus-visible { outline-color: var(--sable-clair); }
.galerie img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.galerie a:hover img { opacity: .88; }
.legende { margin-top: 6px; font-family: var(--sans); font-size: .95rem; color: var(--sur-vert-doux); line-height: 1.35; }

.pied {
  max-width: 1280px;
  margin: clamp(64px, 9vw, 112px) auto 0;
  padding: 24px 0 32px;
  border-top: 1px solid rgb(231 220 197 / .2);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--sur-vert-doux);
}
.pied a { text-decoration-color: rgb(231 220 197 / .35); }
.pied a:hover { color: var(--sur-vert); text-decoration-color: currentColor; }

/* ---------- Visionneuse ---------- */
.visionneuse {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--vert-profond);
  color: var(--sur-vert);
  overflow: hidden;
}
.visionneuse::backdrop { background: var(--vert-profond); }
.visionneuse[open] { display: grid; place-items: center; }
.visionneuse-cadre { display: grid; justify-items: center; gap: 12px; padding: 64px 76px 56px; max-width: 100%; max-height: 100%; }
.visionneuse-image {
  max-width: min(100%, 1400px);
  max-height: calc(100svh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.visionneuse-legende { max-width: 60ch; text-align: center; font-family: var(--sans); font-size: 1.05rem; }
.visionneuse-legende:empty { display: none; }
.visionneuse-compteur { position: absolute; top: 22px; left: 24px; font-family: var(--sans); font-size: 1rem; color: var(--sur-vert-doux); font-variant-numeric: tabular-nums; }
.visionneuse-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--sur-vert-doux);
  cursor: pointer;
}
.visionneuse-btn:hover { color: var(--sable-clair); }
.visionneuse-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.visionneuse-fermer { top: 10px; right: 10px; }
.visionneuse-prec { left: 12px; top: 50%; translate: 0 -50%; }
.visionneuse-suiv { right: 12px; top: 50%; translate: 0 -50%; }

/* ---------- Téléphone et petites tablettes ---------- */
@media (max-width: 760px) {
  .ouverture { min-height: auto; place-items: start; padding-top: 36px; padding-bottom: 56px; }
  .ouverture-centre { grid-template-columns: 1fr; row-gap: 28px; }
  .portrait { justify-self: start; padding: 8px 8px 26px; }
  .portrait img { height: auto; width: min(64vw, 300px); }
  .surnom { font-size: clamp(5rem, 26vw, 7.5rem); }
  .nom { font-size: 1.3rem; }
  .lettre { font-size: 1.1875rem; }
  .visionneuse-cadre { padding: 64px 8px 88px; }
  .visionneuse-image { max-height: calc(100svh - 170px); }
  .visionneuse-prec, .visionneuse-suiv { top: auto; bottom: 18px; translate: none; }
  .visionneuse-prec { left: calc(50% - 64px); }
  .visionneuse-suiv { right: calc(50% - 64px); }
}

/* ---------- Impression ---------- */
@media print {
  .mosaique, .actions, .visionneuse, .evitement, .souvenirs { display: none !important; }
  .ouverture { min-height: auto; background: none; color: #000; }
  .surnom, .nom, .date-depart, .lien-ceremonie { color: #000; }
  .programme, .programme dt, .quand, address, .action { background: none; color: #000; }
  .pratique { position: static; }
  .corps > .hommage, .corps > .pratique { grid-column: auto; grid-row: auto; }
}
