/* A block's photograph that opens at a tap (blocks/parts/Opens.astro) and the
   screen it opens on (js/foto.js): dark, so the picture is the only light on
   it, the words of its card under it in the paper's colour. */

/* --- The photo on the page: it looks like what it does --- */
.foto-abrir {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: inherit;
  cursor: zoom-in;
}
.foto-abrir:focus-visible { outline: 2px solid var(--tinta); outline-offset: 3px; }
.foto-abrir-marca {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(251, 247, 238, 0.9);
  color: var(--tinta);
  box-shadow: 0 1px 4px rgba(38, 53, 95, 0.25);
  pointer-events: none;
}
.foto-abrir-marca:empty { display: none; }

/* --- The photo opened --- */
.foto-visor {
  --noche: rgb(17, 20, 32);
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--noche);
  color: var(--papel-claro);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  cursor: zoom-out;
}
.foto-visor::backdrop { background: rgb(17, 20, 32); }
/* the page's own lock on the pinch (base.css) lifts while a photo is open */
body:has(.foto-visor[open]) { touch-action: auto; }
/* and the page behind it holds still: a swipe that closes the photo or pans it
   would otherwise scroll the document, or pull it to refresh at its top */
html:has(.foto-visor[open]) { overflow: hidden; }

.foto-visor-hoja {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 100%;
  margin: 0;
  padding: calc(3.6rem + env(safe-area-inset-top)) 1rem calc(1.6rem + env(safe-area-inset-bottom));
}
.foto-visor-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  /* the words keep a place on the first screen under a picture */
  max-height: calc(100dvh - 13rem);
  object-fit: contain;
  background: var(--papel-hondo);
}
.foto-visor--alta .foto-visor-img {
  width: min(100%, var(--ancho));
  max-height: none;
}

.foto-visor-palabras {
  width: 100%;
  max-width: var(--ancho);
  font-size: 1rem;
  line-height: 1.45;
}
/* the card's lines keep their hand and their small capitals, not its paper */
.foto-visor-palabras * {
  max-width: none;
  margin: 0 0 0.4rem;
  padding: 0;
  background: none;
  color: inherit;
  transform: none;
  line-height: inherit;
}
.foto-visor-palabras .mano { font-size: 1.05rem; line-height: 1.7; }
.foto-visor-palabras .sello-texto { margin-top: 0.6rem; color: rgba(251, 247, 238, 0.7); }

.foto-visor-cerrar {
  position: fixed;
  top: calc(0.6rem + env(safe-area-inset-top));
  right: 0.6rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  /* dark under the cross, which a light scan may scroll beneath */
  background: rgba(17, 20, 32, 0.72);
  box-shadow: 0 0 0 1px rgba(251, 247, 238, 0.35);
  color: var(--papel-claro);
}
.foto-visor-cerrar:focus-visible { outline: 2px solid var(--papel-claro); outline-offset: 2px; }
