/* Obturateur (Lezieu, refait le 06/11 d'après Dondre Green) : le viseur, les dossiers et les vues entre crochets, la grille, la vue « Une à une »,
   et la visionneuse habillée à son image. Les couleurs et les typos sont celles de la mise en page : --fond, --texte (--b-bg, --b-ink),
   --serif (--b-fd, les titres en italique), --sans (--b-ft, les petites capitales). */

/* les coins du viseur, dessinés par huit dégradés : --cr la longueur d'un coin, --cr-l son épaisseur */
/* :where : ces règles communes ne passent jamais devant celles de chaque élément (le choisi, le survol) */
:where(.ob-nav button, .ob-ph, .lb.peau-viseur .lb-top button, .lb.peau-viseur .lb-bot button)::after,
:where(.ob-coins, .ob-visee, .ob-mire, .po-coins, .po-visee) {
  --cl: linear-gradient(currentColor 0 0);
  background: var(--cl) top left / var(--cr) var(--cr-l), var(--cl) top left / var(--cr-l) var(--cr), var(--cl) top right / var(--cr) var(--cr-l), var(--cl) top right / var(--cr-l) var(--cr),
    var(--cl) bottom left / var(--cr) var(--cr-l), var(--cl) bottom left / var(--cr-l) var(--cr), var(--cl) bottom right / var(--cr) var(--cr-l), var(--cl) bottom right / var(--cr-l) var(--cr);
  background-repeat: no-repeat;
}
:where(.ob-nav button, .ob-ph, .lb.peau-viseur .lb-top button, .lb.peau-viseur .lb-bot button)::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s ease-in-out; --cr: 5px; --cr-l: 1px; }

.m-viseur { padding: 0; cursor: default; --ob-m: max(20px, 3.05cqw); --ob-nt: clamp(20px, 2.2cqw, 34px); }
/* les quatre coins du cadre (80 px, 2 px, à 15 px des bords sur 1440) */
.ob-coins { position: absolute; z-index: 7; inset: clamp(8px, 1.05cqw, 15px); pointer-events: none; --cr: clamp(36px, 5.6cqw, 80px); --cr-l: 2px; }

/* les dossiers à gauche, les vues à droite ; celui qui est choisi entre crochets */
.ob-nav { position: absolute; z-index: 6; left: var(--ob-m); right: var(--ob-m); top: var(--ob-nt); display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 30px;
  font: 400 13px/1 var(--sans); text-transform: uppercase; letter-spacing: .01em; pointer-events: none; }
.ob-dossiers, .ob-vues { display: flex; flex-wrap: wrap; gap: 0 5px; pointer-events: auto; min-width: 0; }
.ob-vues { flex: none; justify-content: flex-end; }
.ob-nav button { position: relative; background: none; border: 0; padding: 8px 7px; margin: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; white-space: nowrap; }
.ob-nav button[aria-pressed=true]::after { opacity: 1; }
@media (hover: hover) { .ob-nav button:hover::after { opacity: .45; } .ob-nav button[aria-pressed=true]:hover::after { opacity: 1; } }

/* la grille : quatre colonnes, chaque photo entière au milieu de sa case carrée, son numéro dessous */
.ob-grille { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; overscroll-behavior: auto;
  padding: calc(var(--ob-nt) + 30px + clamp(36px, 6.3cqw, 91px)) var(--ob-m) clamp(70px, 8cqw, 120px); }
.ob-grille::-webkit-scrollbar { display: none; }
.ob-cases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(34px, 4cqw, 60px) 1.7cqw; }
.ob-case { margin: 0; min-width: 0; }
.ob-boite { aspect-ratio: 1; display: grid; place-items: center; min-width: 0; }
.ob-ph { position: relative; display: block; max-width: 100%; max-height: 100%; cursor: pointer; }
.ob-ph::after { inset: -12px; --cr: 10px; }
@media (hover: hover) { .ob-ph:hover::after { opacity: 1; } }
.ob-ph img { display: block; width: 100%; height: 100%; object-fit: cover; background: color-mix(in srgb, var(--texte) 6%, transparent); }
.ob-case figcaption { margin-top: clamp(10px, 1.2cqw, 18px); text-align: center; font: italic 400 clamp(17px, 1.67cqw, 26px)/1.1 var(--serif); font-variant-numeric: lining-nums; }
.ob-ph .ob-x { z-index: 2; }
.ob-une .ob-x-une { position: absolute; z-index: 13; transition: opacity .3s; }
.ob-une.bouge .ob-x-une { opacity: 0; pointer-events: none; }

/* une à une : les photos côte à côte, celle du milieu nette dans le viseur */
.ob-une { position: absolute; inset: 0; touch-action: pan-y; }
.m-viseur:not([data-obvue=une]) .ob-une, .m-viseur[data-obvue=une] .ob-grille { visibility: hidden; pointer-events: none; }
.ob-piste { position: absolute; inset: 0; }
.ob-pan { position: absolute; left: 0; top: 0; margin: 0; transform-origin: 50% 50%; will-change: transform, filter; cursor: pointer; background: color-mix(in srgb, var(--texte) 6%, transparent); }
.ob-pan img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ob-visee { position: absolute; z-index: 12; pointer-events: none; --cr: clamp(12px, 1.25cqw, 18px); --cr-l: 1px; transition: opacity .4s ease-in-out; }
.ob-leg { position: absolute; z-index: 12; left: 50%; translate: -50% 0; width: min(84%, 640px); text-align: center; pointer-events: none; transition: opacity .45s ease-in-out; }
.ob-leg h3 { margin: 0; font: italic 400 clamp(24px, 2.64cqw, 42px)/1.02 var(--serif); text-wrap: balance; overflow-wrap: anywhere; }
.ob-leg p { margin: 10px 0 0; font: 400 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; }
.ob-une.bouge :is(.ob-visee, .ob-leg) { opacity: 0; transition-duration: .2s; }
.ob-aide { position: absolute; z-index: 12; left: 50%; bottom: clamp(18px, 3cqw, 28px); translate: -50% 0; margin: 0; font: 400 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; opacity: .8; pointer-events: none; white-space: nowrap; }

/* le petit viseur qui se resserre au milieu quand on ouvre une photo */
.ob-mire { position: absolute; z-index: 9; left: 0; top: 0; width: 0; height: 0; opacity: 0; pointer-events: none; --cr: 9px; --cr-l: 1px; }

/* sur téléphone : les dossiers puis les vues, l'un sous l'autre ; une colonne ; les voisines dépassent des bords */
@container (max-width: 620px) {
  .m-viseur { --ob-m: 16px; --ob-nt: 14px; }
  .ob-nav { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 12px; }
  .ob-dossiers { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .ob-dossiers::-webkit-scrollbar { display: none; }
  .ob-vues { justify-content: flex-start; }
  .ob-nav button { padding: 7px 6px; }
  .ob-grille { padding-top: calc(var(--ob-nt) + 96px); }
  .ob-cases { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .ob-case figcaption { font-size: 18px; }
  .ob-leg h3 { font-size: clamp(24px, 8cqw, 34px); }
}

/* ---- la visionneuse de Lezieu, habillée par l'Obturateur : fond noir, textes crème, en petites capitales ; la photo dans le viseur,
   les voisines floues sur les côtés, le dossier et le numéro dessous ; les quatre coins du cadre */
.lb.peau-viseur { background: var(--po-fond); color: var(--po-texte); font-family: var(--po-typo); }
/* la barre du haut reste sans position : sur téléphone, Lezieu pose Télécharger et Partager en bas de la visionneuse, pas en bas de cette barre */
.lb.peau-viseur .lb-bot { z-index: 4; }
.lb.peau-viseur :is(.lb-top, .lb-bot) { color: var(--po-texte); font: 400 12px/1 var(--po-typo); text-transform: uppercase; letter-spacing: .02em; }
.lb.peau-viseur .lb-top { padding: clamp(18px, 2.4vw, 30px) clamp(30px, 3.4vw, 52px) 6px; }
.lb.peau-viseur :is(.lb-top, .lb-bot) button { position: relative; background: transparent; color: var(--po-texte); border: 0; border-radius: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; font-weight: 400; padding: 8px 8px; }
.lb.peau-viseur :is(.lb-top, .lb-bot) button:hover { background: transparent; }
@media (hover: hover) { .lb.peau-viseur :is(.lb-top, .lb-bot) button:hover::after { opacity: .5; } }
.lb.peau-viseur :is(.lb-top, .lb-bot) :is(button[aria-pressed=true], button.on)::after { opacity: 1; }
.lb.peau-viseur .lb-zoom { background: transparent; }
.lb.peau-viseur :is(.lb-name, .lb-pct, .lb-info .lb-name) { font-family: var(--po-typo); color: var(--po-texte); font-size: 12px; }
.lb.peau-viseur .lb-exif { color: color-mix(in srgb, var(--po-texte) 60%, transparent); text-transform: none; }
.lb.peau-viseur .lb-k { color: var(--po-texte); border-color: color-mix(in srgb, var(--po-texte) 35%, transparent); opacity: .6; }
.lb.peau-viseur .lb-x { border: 0 !important; }
.lb.peau-viseur .lb-x.lb-plein { border: 0 !important; }
.lb.peau-viseur .lb-bot { border-top: 0; padding-bottom: calc(clamp(16px, 2vw, 26px) + env(safe-area-inset-bottom, 0px)); }
.lb.peau-viseur .lb-bot .lb-tiroir { background: var(--po-fond); color: var(--po-texte); border: 0; }
.lb.peau-viseur .lb-bot :is(.lba, .lbd) { background: transparent; border: 0; color: var(--po-texte); }
.lb.peau-viseur .lb-bot :is(.lba, .lbd).on { background: transparent; color: var(--po-texte); }
.lb.peau-viseur .lb-bot .lba:is(.off, .ko).on { color: #F0707F; }
.lb.peau-viseur .lb-bot .lba.ok.on { color: #7CCB97; }
.lb.peau-viseur .lb-bot .lba.rt.on { color: #E8B062; }
/* fond blanc ou fond noir (08/11), choisi dans la visionneuse : il passe avant les couleurs de la galerie */
.lb.lb-blanc.peau-viseur { --po-fond: #FAFAF8 !important; --po-texte: #141414 !important; }
.lb.lb-noir.peau-viseur { --po-fond: #010101 !important; --po-texte: #FEFAE0 !important; }
.lb.lb-blanc.peau-viseur .lb-bot .lba:is(.off, .ko).on { color: #C8102E; }
.lb.lb-blanc.peau-viseur .lb-bot .lba.ok.on { color: #2C7A4B; }
.lb.lb-blanc.peau-viseur .lb-bot .lba.rt.on { color: #B7791F; }
.lb.peau-viseur .lb-bot .lbd kbd { background: color-mix(in srgb, var(--po-texte) 16%, transparent); }
.lb.peau-viseur .lb-nav { background: transparent; border: 0; color: var(--po-texte); backdrop-filter: none; }
.lb.peau-viseur .lb-view { margin: 0 clamp(56px, 9vw, 180px) clamp(70px, 10vh, 104px); }
.lb.peau-viseur .lb-fant { display: none; }
.po-coins { position: absolute; z-index: 1; inset: clamp(8px, 1.05vw, 15px); pointer-events: none; --cr: clamp(36px, 5.6vw, 80px); --cr-l: 2px; }
.po-voisins { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.po-voisins button { position: absolute; padding: 0; border: 0; margin: 0; background: color-mix(in srgb, var(--po-texte) 6%, transparent); pointer-events: auto; cursor: pointer; filter: blur(6px); opacity: .85; transition: opacity .4s; }
.po-voisins button[data-pov="-2"], .po-voisins button[data-pov="2"] { filter: blur(12px); opacity: .55; }
@media (hover: hover) { .po-voisins button:hover { opacity: 1; } }
@media (hover: none) { .po-voisins button { pointer-events: none; } }   /* au doigt : on glisse n'importe où, même en partant d'une voisine */
.po-voisins img { display: block; width: 100%; height: 100%; object-fit: cover; }
.po-fant { position: absolute; z-index: 1; pointer-events: none; object-fit: cover; }
.po-visee { position: absolute; z-index: 3; pointer-events: none; --cr: 18px; --cr-l: 1px; transition: opacity .4s ease-in-out; }
.po-leg { position: absolute; z-index: 3; left: 50%; translate: -50% 0; width: min(84%, 720px); text-align: center; pointer-events: none; transition: opacity .45s ease-in-out; }
.po-leg h3 { margin: 0; font: italic 400 clamp(22px, 2.3vw, 38px)/1.05 var(--po-titre); text-wrap: balance; text-transform: none; }
.po-leg p { margin: 8px 0 0; font: 400 11px/1 var(--po-typo); text-transform: uppercase; letter-spacing: .04em; }
.lb.peau-viseur.po-glisse :is(.po-visee, .po-leg) { opacity: 0; transition-duration: .2s; }
.lb.peau-viseur:is(.zoomed, .dessin) :is(.po-visee, .po-voisins, .po-leg, .po-fant) { opacity: 0; visibility: hidden; }
@media (max-width: 620px), (pointer: coarse) and (max-height: 500px) {
  .lb.peau-viseur .lb-top { padding: 14px 18px 4px; }
  .lb.peau-viseur .lb-view { margin: 0 0 76px; }
  .po-visee { --cr: 12px; }
}
/* l'aperçu téléphone de la Mise en page (.device.mobile) : les mêmes règles qu'un vrai téléphone (15/11) */
.device.mobile .lb.peau-viseur .lb-top { padding: 14px 18px 4px; }
.device.mobile .lb.peau-viseur .lb-view { margin: 0 0 76px; }
.device.mobile .po-visee { --cr: 12px; }

/* dans l'aperçu de la Mise en page (la visionneuse dans son cadre) */
.lb-dans.peau-viseur .lb-view { margin: 0 90px 84px; }
.lb-dans.peau-viseur .lb-exif { display: none; }   /* l'aperçu est étroit : la ligne de l'appareil passait sur le zoom */
.lb-dans.peau-viseur .po-coins { inset: 12px; --cr: 52px; }
@container (max-width: 620px) { .lb-dans.peau-viseur .lb-view { margin: 0 0 76px; } .lb-dans.peau-viseur .po-coins { inset: 8px; --cr: 36px; } }
