/* v3 : la galerie, six vignettes sur une grille propre : deux rangees de trois a la meme hauteur (une claire, une sombre), deux seulement legerement inclinees (<= 1.5 deg),
   quelques mots a l'encre (Caveat) poses au-dessus, sans fleche. Les notes (ecriture a l'entree, reaction au survol / tap) sont animees par v2-grille.js (inchange).
   La lecture des videos est geree par v3-gallery.js. Charge apres style.css, a la place de v2-gallery.css. */
@font-face { font-family: 'Caveat'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/caveat-600-sub.woff2) format('woff2'); }
.below { overflow-x: clip; }

.m { position: relative; margin: 0; }
.m > video { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; background: #E9DFD2; }
.m > video:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.note { display: none; position: absolute; z-index: 5; width: 0; height: 0; rotate: var(--r, -3deg); font-style: normal; color: var(--ink); pointer-events: none; }
.nt .note { display: block; }
.note.red { color: var(--fast); }
.note .t { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: grid; justify-items: center; white-space: nowrap; pointer-events: auto; cursor: default;
  font: 600 clamp(26px, 2.5vw, 36px)/1 "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; letter-spacing: 0; font-kerning: none;
  padding: 2px 6px 4px; margin: -2px -6px -4px; text-shadow: 0 0 6px var(--paper), 0 0 3px var(--paper); }
.note .t > span { grid-area: 1 / 1; font: inherit; color: inherit; }
.note .b { opacity: 0; }
.m.alt .note .a:not(:only-child) { opacity: 0; }
.m.alt .note .b { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .nt-anim .m:not(.in) .note .t { clip-path: inset(-6px 100% -6px -6px); }
  .m .note .t { transition: clip-path .7s cubic-bezier(.3, .6, .3, 1) var(--d, 0s), translate .25s ease-out; clip-path: inset(-6px -6px -6px -6px); }
  .m .note .a, .m .note .b { transition: opacity .2s; }
  .m:hover .note .t, .m:focus-within .note .t { translate: 0 -3px; }
}
.m > .ar { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 4; }

/* ---------- la grille : deux rangees centrees, toutes les cartes a la hauteur --h (2:3 -> 0.667 h de large, 16:9 -> 1.778 h) ---------- */
#gallery.gallery { position: relative; max-width: 1240px; margin: 0 auto; padding: 120px 24px 70px; }
#gallery .phones { display: flex; flex-direction: column; align-items: stretch; gap: 104px; margin: 0; }   /* style.css .phones : grille de 4, align-items: start, 2e enfant decale de 48 px : on remet a plat */
#gallery .phones > .g-row { margin-top: 0; }
#gallery .g-row { --gap: 28px; --h: min(365px, calc((100vw - 24px - 48px - 2 * var(--gap)) / 3.12)); display: flex; justify-content: center; align-items: flex-start; gap: var(--gap); }
#gallery .g-row > .m { flex: none; height: var(--h); aspect-ratio: 2 / 3; rotate: var(--rot, 0deg); }
#gallery .g-row > .m.wide { aspect-ratio: 16 / 9; }
#gallery .g-dark > .m:nth-child(2) { order: 2; } #gallery .g-dark > .m.wide { order: 1; }   /* le 16:9 au milieu de la rangee sombre (a la fin du HTML pour le mobile) */
#gallery .m > video { width: 100%; height: 100%; aspect-ratio: auto; object-position: center; border-radius: 22px; box-shadow: 0 22px 50px -22px rgba(40, 25, 15, .5); }
.tilt-a { --rot: -1.2deg; }
.tilt-b { --rot: 1deg; }

@media (max-width: 820px) {
  .note .t { font-size: 24px; }
  #gallery.gallery { padding: 96px 16px 40px; }
  #gallery .phones { gap: 76px; }
  #gallery .g-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 68px 14px; }
  #gallery .g-row > .m { height: auto; width: 100%; }
  #gallery .g-light > .m:nth-child(3) { grid-column: 1 / -1; width: calc(50% - 7px); justify-self: center; }
  #gallery .g-dark > .m, #gallery .g-dark > .m:nth-child(2), #gallery .g-dark > .m.wide { order: 0; }
  #gallery .g-dark > .m.wide { grid-column: 1 / -1; }
}
