/* La galerie en liste (la plus récente d'abord) et la visionneuse. Sert aussi d'alternative accessible à la table. */

[data-mode="table"] .list { display: none; }
.list {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(88px + env(safe-area-inset-top)) clamp(16px, 4vw, 48px) calc(56px + env(safe-area-inset-bottom)); color: var(--g-cream);
  background-color: var(--g-green);
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px), radial-gradient(ellipse at center, transparent 50%, rgba(10, 24, 14, .45));
  background-size: 7px 7px, 100% 100%; background-attachment: local, fixed;
}
.list:focus { outline: none; }
.list__count { margin: 0 0 20px; font-size: .95rem; font-weight: 500; }
.list__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .list__grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); } }
@media (min-width: 900px) { .list__grid { gap: 26px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.list__more { height: 1px; }

.card {
  position: relative; display: block; width: 100%; padding: 10px 10px 46px; background: var(--g-paper); text-align: left; cursor: pointer; color: var(--g-caption);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 12px 22px -10px rgba(0, 0, 0, .6); transition: translate .25s ease, rotate .25s ease;
}
.card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #cbb9a8; }
.card__name { position: absolute; left: 12px; right: 64px; bottom: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; }
.card time { position: absolute; right: 12px; bottom: 16px; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--g-time); }
@media (hover: hover) { .card:hover { translate: 0 -4px; rotate: -.8deg; } }

/* ---------- Visionneuse ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(10, 22, 14, .93); touch-action: pan-y; }
.viewer[hidden] { display: none; }
.viewer__fig { margin: 0; padding: 14px 14px 62px; position: relative; background: var(--g-paper); box-shadow: 0 30px 60px rgba(0, 0, 0, .6); }
.viewer__fig img { -webkit-user-drag: none; user-select: none; display: block; max-width: min(84vw, 520px); max-height: 66dvh; min-width: 200px; min-height: 200px; object-fit: contain; background: #cbb9a8; }
.viewer__fig figcaption { position: absolute; left: 16px; right: 16px; bottom: 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 17px; font-weight: 500; color: var(--g-caption); }
.viewer__fig figcaption span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__fig small { flex: none; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--g-time); }
.viewer button { position: absolute; width: var(--g-hit); height: var(--g-hit); border-radius: 50%; background: rgba(251, 240, 230, .16); color: var(--g-cream); font: 500 28px/1 var(--font); cursor: pointer; }
.viewer button:hover { background: rgba(251, 240, 230, .3); }
.viewer__close { top: max(16px, env(safe-area-inset-top)); right: 16px; }
.viewer__nav { top: 50%; translate: 0 -50%; }
.viewer__nav--prev { left: 12px; }
.viewer__nav--next { right: 12px; }
@media (max-width: 600px) { .viewer__nav { top: auto; bottom: max(22px, env(safe-area-inset-bottom)); translate: none; } .viewer__nav--prev { left: calc(50% - 64px); } .viewer__nav--next { right: calc(50% - 64px); } }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { translate: none; rotate: none; } }
