@import url("/photo-grid.css");

.project-page .gallery {
  margin: clamp(98px, 9vw, 130px) var(--gutter) clamp(36px, 5vw, 72px);
}
.project-opening {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--gutter);
}
.project-opening.single { grid-template-columns: minmax(0, 1fr); }
.photo { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery img, .gallery video { display: block; width: auto; max-width: 100%; height: auto; max-height: 76svh; margin-inline: auto; }
.gallery video { background: #f5f5f5; }
.project-intro-grid { margin: 30px 2% 36px 50%; font-size: 14px; line-height: 1.45; }
.project-intro-grid h1 { margin: 0; font-size: inherit; font-weight: 700; text-transform: uppercase; }
.project-intro-grid p { margin: 0; }
.back-at-title .project-intro-grid { position: relative; }
.back-at-title .project-intro-grid .back-arrow {
  top: calc(.725em - 22px);
  left: calc(-50% / .48);
  width: auto;
  justify-items: start;
  background: transparent;
}
.back-at-title .project-intro-grid .back-arrow svg { margin-left: -3px; }

.intro > p { color: #767676; }
.project-description { margin-top: 20px; }
.project-description p + p { margin-top: .7em; }
@media (max-width: 680px) {
  .project-opening { grid-template-columns: minmax(0, 1fr); }
  .project-intro-grid { margin-inline: calc(16px - var(--gutter)); }
  .back-at-title .project-intro-grid { padding-left: 44px; }
  .back-at-title .project-intro-grid .back-arrow { left: calc(var(--gutter) - 16px); }
}

.viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: white; }
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: rgb(220 220 220 / .55); backdrop-filter: blur(7px); }
.viewer-frame { position: relative; }
.viewer-frame img { display: block; width: auto; height: auto; max-width: min(78vw, 1100px, var(--native-width,1100px)); max-height: min(74dvh, var(--native-height,1000px)); }
.viewer-counter {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: var(--gutter);
  margin: 0; color: #222; font-size: 14px; font-variant-numeric: tabular-nums;
}
.viewer button {
  position: fixed; z-index: 1; display: grid; place-items: center;
  width: clamp(44px, 5vw, 72px); height: 48px;
  padding: 4px; border: 0; background: transparent; color: #222; cursor: pointer;
}
.viewer button svg { width: 100%; height: 100%; }
.viewer button:focus-visible { outline: none; }
.viewer button:focus-visible svg { stroke-width: 2.5; }
.photo:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.viewer .viewer-close { width: 48px; top: max(5px, env(safe-area-inset-top)); right: var(--gutter); }
.viewer .viewer-prev, .viewer .viewer-next { top: 50%; transform: translateY(-50%); }
.viewer-prev { left: var(--gutter); }
.viewer-next { right: var(--gutter); }
@media (max-width: 680px) { .viewer-frame img { max-width: min(88vw, var(--native-width,1100px)); } }

@media (prefers-reduced-motion: no-preference) {
  .viewer[open]::backdrop { animation: soften .24s ease-out; }
  @keyframes soften { from { opacity: 0; } to { opacity: 1; } }
}

.viewer button[hidden] { display: none; }

@media (min-width: 681px) {
  .gallery :is(.photo-row:not(.solo), .project-opening:not(.single)) .photo img:where(:not(.aligned-crop)) { width: 100%; object-fit: contain; }
  .gallery .photo-row.portraits { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gallery .photo-row.portraits:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.project-facts { display: grid; gap: 4px; margin: 20px 0 0; }
.project-facts div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 12px; }
.project-facts dt { color: #767676; }
.project-facts dd { margin: 0; }
.viewer-frame img { cursor: zoom-in; transition: transform .45s cubic-bezier(.16,1,.3,1); will-change: transform; }
.viewer.is-zoomed .viewer-frame img { cursor: zoom-out; transition: transform .45s cubic-bezier(.16,1,.3,1), transform-origin .12s linear; }
.viewer[open] { animation: viewer-in .35s cubic-bezier(.16,1,.3,1) both; }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
.viewer[open] .viewer-frame { animation: viewer-frame-in .5s cubic-bezier(.16,1,.3,1) both; }
@keyframes viewer-frame-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .viewer[open], .viewer[open] .viewer-frame { animation: none; } .viewer-frame img { transition: none; } }

/* Visionneuse : commandes autour de la photo */
.viewer-media { overflow: hidden; }
.viewer .viewer-close { position: absolute; top: auto; bottom: 100%; right: -10px; width: 40px; height: 40px; margin-bottom: 4px; z-index: 2; }
.viewer .viewer-prev, .viewer .viewer-next { position: absolute; top: 50%; transform: translateY(-50%); width: clamp(44px, 4vw, 60px); }
.viewer .viewer-prev { left: auto; right: 100%; margin-right: clamp(10px, 1.6vw, 26px); }
.viewer .viewer-next { right: auto; left: 100%; margin-left: clamp(10px, 1.6vw, 26px); }
.viewer-bar { position: absolute; top: 100%; left: 0; right: 0; margin-top: 10px; display: flex; justify-content: center; align-items: center; gap: 10px; color: #222; font-size: 14px; }
.viewer .viewer-counter { position: static; margin: 0; color: inherit; }
.viewer .viewer-zoom { position: static; width: 22px; height: 22px; padding: 0; transform: none; }
.viewer .viewer-zoom svg { width: 18px; height: 18px; }
.viewer.is-zoomed .viewer-zoom .zoom-plus { display: none; }
.viewer button:hover { color: #fff; background: var(--red); }
@media (max-width: 680px) {
  .viewer .viewer-prev, .viewer .viewer-next { top: 100%; transform: none; margin: 4px 0 0; width: 44px; height: 32px; }
  .viewer .viewer-prev { right: auto; left: 0; }
  .viewer .viewer-next { left: auto; right: 0; }
  .viewer .viewer-close { right: -6px; }
  .viewer-frame img { max-width: calc(100vw - 2 * var(--gutter)); }
}

/* Médias générés par l’Atelier */
.media-video { position: relative; min-width: 0; background: #f2f2f2; }
.media-video video { display: block; width: 100%; height: 100%; }
.media-sound { position: absolute; bottom: 5px; left: 5px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; padding: 0; color: #fff; filter: drop-shadow(0 1px 2px #000b); }
.media-sound[aria-pressed="true"] .sound-off, .media-sound[aria-pressed="false"] .sound-on { display: none; }
.photo { position: relative; }
.photo .media-overlay { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: cover; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .photo .media-overlay { animation: media-switch 2.4s steps(1, end) infinite; }
  @keyframes media-switch { 50% { opacity: 0; } }
}
.project-opening.just-grid video[controls] { background: #000; }

/* ---- Transcription façon théâtre ---- */
.project-transcript { margin-top: 1.45em; }
.project-transcript p + p { margin-top: .9em; }
.project-transcript .speaker { display: block; font-style: normal; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.project-transcript em { font-style: italic; }
