/* ==========================================================================
   Portfolio Shots — shortcode styles
   Rendered by [shot id="…"]:

   <div class="shot-wrap [extra classes from class attr]">
     <div class="shot [shot--static]" tabindex="0" [style] [data-speed]>
       <div class="shot__chrome" aria-hidden="true">
         <span class="shot__title">Purell — Early Years</span>  <!-- optional -->
         <span class="shot__dots"> 3 × <span class="shot__dot"> </span>
       </div>
       <div class="shot__frame">
         <img …>   <!-- wp_get_attachment_image output, srcset included -->
       </div>
     </div>
     <div class="shot__hint">…</div>   <!-- unless disabled / static -->
   </div>

   Designed for a #f5f3f0 page background — warm-tinted borders & shadows.
   ========================================================================== */

/* Tokens are scoped to the wrapper rather than :root so they can't
   collide with theme or plugin variables of the same name. Override them
   per card with an inline style, or site-wide with a rule of your own:
   .shot-wrap { --shot-frame-height: 640px; } */
.shot-wrap {
  /* Warm shadow ink — brown-tinted so it doesn't look muddy on cream */
  --shot-ink: 60, 50, 40;
  --shot-radius: 12px;
  --shot-frame-height: 560px;   /* visible crop of the tall screenshot */
  --shot-scroll-duration: 6s;   /* hover scroll speed — longer = calmer */
  /* Warm paper: lighter than a #f5f3f0 page but in the same temperature
     family, so the card stays elevated without fighting the background */
  --shot-chrome-bg: #faf8f5;
  /* Fade tint as RGB triplet — decoupled from the chrome so dark-site
     cards can retint the gradient independently via an extra class */
  --shot-fade: 250, 248, 245;
  --shot-border: 1px solid rgba(var(--shot-ink), 0.08);
}

/* --------------------------------------------------------------------------
   1. The card: border, radius, layered warm shadow
   -------------------------------------------------------------------------- */
.shot {
  border: var(--shot-border);
  border-radius: var(--shot-radius);
  background: var(--shot-chrome-bg);
  box-shadow:
    0 1px 2px rgba(var(--shot-ink), 0.04),
    0 8px 24px rgba(var(--shot-ink), 0.08),
    0 24px 48px rgba(var(--shot-ink), 0.06);
  overflow: hidden; /* clips image + chrome to the radius */
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}

/* Slight lift of the whole card on hover (optional — delete if too much) */
.shot:hover {
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px rgba(var(--shot-ink), 0.04),
    0 12px 32px rgba(var(--shot-ink), 0.10),
    0 32px 64px rgba(var(--shot-ink), 0.08);
}

/* --------------------------------------------------------------------------
   2. Browser chrome bar (title centered, buttons right)
   -------------------------------------------------------------------------- */
.shot__chrome {
  position: relative; /* anchors the absolutely-centered title */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  min-height: 38px;
  background: var(--shot-chrome-bg);
  border-bottom: 1px solid rgba(var(--shot-ink), 0.07);
}

.shot__dots {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto; /* pushes the button group to the right */
}

.shot__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(var(--shot-ink), 0.15); /* quiet, monochrome dots */
  flex-shrink: 0;
}

/* Prefer classic traffic lights? Uncomment:
.shot__dots .shot__dot:nth-child(1) { background: #f6635c; }
.shot__dots .shot__dot:nth-child(2) { background: #f5bd4f; }
.shot__dots .shot__dot:nth-child(3) { background: #63c554; }
*/

/* Title: true-centered regardless of the dots on the right.
   Prefer it left-aligned instead? Delete position/left/transform and
   max-width below — the flex layout will place it at the left edge. */
.shot__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 140px); /* keep clear of the dots */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(var(--shot-ink), 0.6);
  user-select: none;
}

/* --------------------------------------------------------------------------
   3. Scroll-within-frame
   The frame is a fixed-height window; the tall screenshot slides up inside
   it on hover, then returns when the pointer leaves.
   -------------------------------------------------------------------------- */
.shot__frame {
  height: var(--shot-frame-height);
  overflow: hidden;
  position: relative;
}

/* Persistent "there's more" cue: bottom fade. Also softens the hard
   crop line where the screenshot gets cut mid-content. Eased stops
   remove the visible onset line; the 0.97 ceiling leaves a whisper of
   the screenshot showing so the edge never reads as a hard wall.
   Fades away on hover/focus as the scrolling reveals the rest. */
.shot__frame::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 88px;
  background: linear-gradient(
    to bottom,
    rgba(var(--shot-fade), 0)    0%,
    rgba(var(--shot-fade), 0.15) 35%,
    rgba(var(--shot-fade), 0.45) 62%,
    rgba(var(--shot-fade), 0.75) 85%,
    rgba(var(--shot-fade), 0.92) 100%
  );
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.shot:hover .shot__frame::after,
.shot:focus-within .shot__frame::after {
  opacity: 0;
}

.shot__frame img {
  display: block;
  width: 100%;
  height: auto;      /* natural height — must be taller than the frame */
  max-width: none;   /* neutralise theme img max-width clamps */
  transform: translateY(0);
  transition: transform var(--shot-scroll-duration) cubic-bezier(0.33, 0, 0.2, 1);
  will-change: transform;
}

.shot:hover .shot__frame img,
.shot:focus-within .shot__frame img {
  /* Slide until the bottom of the image meets the bottom of the frame */
  transform: translateY(calc(-100% + var(--shot-frame-height)));
}

/* Keyboard access: unlinked cards carry tabindex="0"; linked cards use
   the anchor as the focus stop instead (see .shot-link below) */
.shot:focus-visible {
  outline: 2px solid rgba(var(--shot-ink), 0.5);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   3c. Link wrapper — [shot link="…"] / [shot link="lightbox"]
   Block-level anchor around the card. The hint stays outside the link.
   -------------------------------------------------------------------------- */
.shot-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.shot-link:focus-visible {
  outline: 2px solid rgba(var(--shot-ink), 0.5);
  outline-offset: 3px;
  border-radius: var(--shot-radius);
}

/* Keyboard focus on the link triggers the same scroll preview as hover */
.shot-link:focus-visible .shot:not(.shot--static) .shot__frame img {
  transform: translateY(calc(-100% + var(--shot-frame-height)));
}

.shot-link:focus-visible .shot .shot__frame::after {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   3b. One-time "peek" hint
   Transition-based (NOT a keyframe animation) so it can never conflict
   with the hover scroll: the JS adds .shot--peek (slide down), swaps it
   for .shot--peek-return (slide back), and cancels both on hover — the
   hover transition then retargets smoothly from wherever the peek was.
   -------------------------------------------------------------------------- */
.shot--peek .shot__frame img {
  transform: translateY(-44px);
  transition-duration: 0.9s;
  transition-timing-function: ease-in-out;
}

.shot--peek-return .shot__frame img {
  transition-duration: 0.9s;
  transition-timing-function: ease-in-out;
}

/* --------------------------------------------------------------------------
   4. Responsive + accessibility
   -------------------------------------------------------------------------- */

/* Touch devices have no hover, so the scroll-within-frame effect can't
   trigger. Instead, drop the fixed-height window entirely and show the
   full-page screenshot at its natural height. (hover: none) targets touch
   devices regardless of screen width — phones AND tablets — which is more
   reliable than breakpoint widths. */
@media (hover: none) {
  .shot__frame {
    height: auto;
  }
  .shot__frame img {
    transition: none;
    will-change: auto;
  }
  .shot:hover .shot__frame img,
  .shot:focus-within .shot__frame img {
    transform: none;
  }
  /* Full-height display isn't cropped — no "more below" cue needed */
  .shot__frame::after {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   5. Static mode — [shot height="auto"]
   Full natural height, no hover scroll, no gradient: just the framed
   chrome ornament. The card-lift hover is kept; add
   .shot--static:hover { transform: none; box-shadow: inherit; }
   in your own CSS if you want the card fully inert.
   -------------------------------------------------------------------------- */
.shot--static .shot__frame {
  height: auto;
}

.shot--static .shot__frame img {
  transition: none;
}

.shot--static:hover .shot__frame img,
.shot--static:focus-within .shot__frame img {
  transform: none;
}

.shot--static .shot__frame::after {
  display: none;
}

/* --------------------------------------------------------------------------
   6. "Hover to scroll" hint below the card
   Output by the shortcode (hint attribute). Hidden on touch devices,
   where there's no hover to hint at.
   -------------------------------------------------------------------------- */
.shot__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: rgba(var(--shot-ink), 0.45);
  user-select: none;
}

.shot__hint svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* Subtle scroll-wheel motion inside the mouse icon */
.shot__hint svg line {
  animation: shot-wheel 2s ease-in-out infinite;
}

@keyframes shot-wheel {
  0%, 100% { transform: translateY(0);   opacity: 1; }
  50%      { transform: translateY(3px); opacity: 0.35; }
}

@media (hover: none) {
  .shot__hint {
    display: none;
  }
}

/* Small-screen chrome tweaks */
@media (max-width: 480px) {
  .shot__chrome { padding: 10px 12px; }
  .shot__title { font-size: 11.5px; max-width: calc(100% - 110px); }
}

/* --------------------------------------------------------------------------
   7. Lightbox overlay — [shot link="lightbox"]
   Plugin-native, dependency-free. The image renders at readable width
   and scrolls vertically, which suits full-page captures far better
   than fit-to-screen lightboxes.
   -------------------------------------------------------------------------- */
.shotbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.shotbox[hidden] {
  display: none;
}

.shotbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 20, 17, 0.93); /* warm near-black */
}

.shotbox__scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 56px 16px 72px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.shotbox__img {
  display: block;
  width: min(1100px, 94vw);
  height: auto;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease; /* pairs with .shotbox--loading below */
}

/* Loading spinner: shown while the full-size image downloads; the image
   fades in when ready so half-painted JPEGs never flash. */
.shotbox__spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: shotbox-spin 0.8s linear infinite;
}

.shotbox--loading .shotbox__spinner {
  opacity: 1;
  transition: opacity 0.2s ease 0.15s; /* slight delay: cached loads never flash it */
}

.shotbox--loading .shotbox__img {
  opacity: 0;
}

@keyframes shotbox-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .shotbox__spinner { animation: none; } /* static ring still indicates loading */
  .shotbox__img { transition: none; }
}

.shotbox__close,
.shotbox__nav {
  position: fixed;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.shotbox__close:hover,
.shotbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.shotbox__close:focus-visible,
.shotbox__nav:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.shotbox__close {
  top: 16px;
  right: 16px;
}

.shotbox__nav--prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.shotbox__nav--next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.shotbox__counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  letter-spacing: 0.03em;
  user-select: none;
}

/* Single lightbox card on the page: no gallery chrome */
.shotbox--single .shotbox__nav,
.shotbox--single .shotbox__counter {
  display: none;
}

@media (max-width: 480px) {
  .shotbox__scroll { padding: 52px 8px 64px; }
  .shotbox__img { width: 100%; border-radius: 6px; }
  .shotbox__nav--prev { left: 8px; }
  .shotbox__nav--next { right: 8px; }
}

/* Respect reduced motion: no scrolling, no lift, no peek, no wheel motion */
@media (prefers-reduced-motion: reduce) {
  .shot,
  .shot__frame img,
  .shot__hint svg line {
    transition: none;
    animation: none;
  }
  .shot--peek .shot__frame img {
    transform: none;
  }
  .shot:hover { transform: none; }
  .shot:hover .shot__frame img,
  .shot:focus-within .shot__frame img {
    transform: none;
  }
}
