/* ══════════════════════════════════════
   ZOE YANG — Contact Sheet Magnifier (/zoe)
   Dense sheet of tiny frames + cursor loupe
   ══════════════════════════════════════ */

.contact-sheet-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--line-faint);
  margin-top: 10px;
}
/* Until the script swaps in the press-and-hold wording ([data-touch]),
   the hover hint would mislead a touch screen — keep it hidden there */
@media (hover: none), (pointer: coarse) {
  .contact-sheet-hint:not([data-touch]) { display: none; }
}

.contact-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 4px;
  padding: 0 var(--section-padding) 120px;
}

/* The sheet frames. They carry .masonry-item so studio inline editing can
   find them, which drags in the album-grid reveal defaults — retuned here
   to a tighter rise suited to 76px frames. */
.contact-sheet .cs-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  min-height: 0;
  transform: translateY(6px);
  /* press-and-hold summons the loupe — never the callout or a selection */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.contact-sheet .cs-tile.revealed { transform: none; }

.contact-sheet .cs-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  /* rest the sheet slightly dim, like frames waiting under the loupe */
  filter: brightness(0.82) saturate(0.92);
  transition: opacity var(--dur-reveal) var(--ease-out),
              filter var(--dur-control) var(--ease-out);
}
.contact-sheet .cs-tile.loaded img { opacity: 1; }

/* The album grids scale tiles up on hover; at this density the loupe is
   the magnification — the frame itself only brightens to full. */
.contact-sheet .cs-tile:hover img,
.contact-sheet .cs-tile.touch-hover img { transform: none; }
.contact-sheet .cs-tile.cs-active img,
.contact-sheet .cs-tile:hover img { filter: brightness(1) saturate(1); }

.contact-sheet .cs-tile:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}

/* ── The loupe ──
   A fixed 0×0 anchor moved with translate3d; the glass hangs centered off
   it so the JS never has to subtract half-sizes. */
.cs-loupe {
  --loupe-size: clamp(220px, 26vw, 340px);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1500; /* above the dock (970), below the lightbox (3000) */
  pointer-events: none;
  will-change: transform;
}

.cs-loupe-glass {
  position: absolute;
  left: calc(var(--loupe-size) / -2);
  top: calc(var(--loupe-size) / -2);
  width: var(--loupe-size);
  height: var(--loupe-size);
  border-radius: 50%;
  overflow: hidden;
  background: var(--glass-bg-solid);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--elev-3);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity var(--dur-control) var(--ease-out),
              transform var(--dur-control) var(--ease-out);
}
.cs-loupe.on .cs-loupe-glass {
  opacity: 1;
  transform: scale(1);
}

/* The frame's tiny thumb, blown up and blurred — holds the circle while
   the 800w tier loads, then the sharp image fades in over it */
.cs-loupe-under {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(6px);
  transform: scale(1.06); /* pull the blur's soft edge outside the circle */
}

.cs-loupe-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms ease;
}
.cs-loupe-img.ready { opacity: 1; }

/* Curved-glass light: a soft catchlight up top, weight at the bottom */
.cs-loupe-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%,
    rgba(255, 255, 255, 0.13),
    rgba(255, 255, 255, 0.03) 38%,
    transparent 58%);
  box-shadow: inset 0 -20px 44px rgba(0, 0, 0, 0.30),
              inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Frame counter under the glass, like edge markings on film */
.cs-loupe-tag {
  position: absolute;
  top: calc(var(--loupe-size) / 2 + 12px);
  left: 0;
  transform: translateX(-50%);
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--text-mid);
  background: var(--glass-bg-solid);
  backdrop-filter: var(--glass-blur-light);
  -webkit-backdrop-filter: var(--glass-blur-light);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-control) var(--ease-out);
}
.cs-loupe.on .cs-loupe-tag { opacity: 1; }

/* Touch: the glass rides above the finger, so keep it small enough that
   lifting it never pushes it off a phone screen */
@media (pointer: coarse) {
  .cs-loupe { --loupe-size: min(200px, 55vw); }
}

@media (max-width: 768px) {
  .contact-sheet {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 3px;
    padding: 0 8px 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-sheet .cs-tile { transform: none; transition: opacity var(--dur-reveal) ease; }
  .cs-loupe-glass { transform: none; transition: opacity var(--dur-control) ease; }
}
