/*
  showcase.css - the photographs answer the page: they reveal as they scroll in, the large ones drift a little
  inside their frame while the page scrolls, every one zooms softly under the pointer or the keyboard, and a
  photograph that is not a link opens full screen (showcase.js adds the classes and the viewer).
  Photo boxes: .tile__media, .frame--photo (not the form on a photograph, not a hero), .club-shot__media,
  .pcard__media and the home rail's .rcard.
  Under prefers-reduced-motion, or <html data-motion="off">, nothing moves: photographs stand, hover only shows
  the cue, and the viewer opens without animating.
*/

:root {
  --sc-ease: cubic-bezier(.22, 1, .36, 1);
  /* the cue in a photograph's corner on hover and focus: a link's arrow, a viewer's expand mark */
  --sc-cue-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23fff'/%3E%3Cpath d='M14 20h11m-4.5-4.5L25 20l-4.5 4.5' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --sc-cue-zoom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23fff'/%3E%3Cpath d='M22 13h5v5m0-5-5.5 5.5M18 27h-5v-5m0 5 5.5-5.5' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --sc-shade: linear-gradient(to top, rgb(0 0 0 / .32), rgb(0 0 0 / 0) 55%);
}

/* ---------------------------------------------------------------- reveal on scroll (showcase.js: .sc-reveal, .is-in) */
html.sc-js .sc-reveal {
  clip-path: inset(6% 4% 6% 4% round var(--r-lg));
  opacity: 0;
  transition: clip-path 1100ms var(--sc-ease), opacity 700ms var(--sc-ease);
  transition-delay: calc(var(--sc-i, 0) * 90ms);
}
html.sc-js .sc-reveal.is-in { clip-path: inset(0 0 0 0 round var(--r-lg)); opacity: 1; }
html.sc-js .sc-reveal img { scale: calc(var(--sc-base, 1) + .12); transition: scale 1500ms var(--sc-ease); transition-delay: calc(var(--sc-i, 0) * 90ms); }
html.sc-js .sc-reveal.is-in img { scale: var(--sc-base, 1); }
@media print { html.sc-js .sc-reveal { clip-path: none; opacity: 1; } }

/* ---------------------------------------------------------------- drift: a large photograph moves a little inside its frame */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    html:not([data-motion="off"]) .sc-drift { --sc-base: 1.1; }
    html:not([data-motion="off"]) .sc-drift > img {
      scale: var(--sc-base);
      animation: sc-drift linear both; animation-timeline: view(); animation-range: cover 0% cover 100%;
    }
  }
}
@keyframes sc-drift { from { translate: 0 -4.5%; } to { translate: 0 4.5%; } }

/* ---------------------------------------------------------------- hover and focus */
:is(.tile__media, .frame--photo, .club-shot__media, .pcard__media)::after,
.rcard::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
  background: var(--sc-cue, none) no-repeat right 14px bottom 14px / 40px 40px, var(--sc-shade);
  opacity: 0; transition: opacity 300ms var(--sc-ease);
}
.rcard::after { background: var(--sc-cue-link) no-repeat right 20px top 20px / 40px 40px; }
a :is(.tile__media, .frame--photo, .pcard__media) { --sc-cue: var(--sc-cue-link); }
.sc-zoomable { --sc-cue: var(--sc-cue-zoom); cursor: zoom-in; }
.sc-zoomable:focus-visible { outline: 2px solid var(--action, var(--accent)); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  a:hover :is(.tile__media, .frame--photo, .pcard__media)::after,
  .sc-zoomable:hover::after, .rcard:hover::after { opacity: 1; }
}
a:focus-visible :is(.tile__media, .frame--photo, .pcard__media)::after,
.sc-zoomable:focus-visible::after, .rcard:focus-visible::after { opacity: 1; }

/* the zoom: a slow push in, settling back a little faster (motion.css has 1.03 on linked tiles; this is every photo) */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) :is(.tile__media, .frame--photo, .club-shot__media, .pcard__media, .rcard__media) > img {
    transition: transform 500ms var(--sc-ease), scale 1500ms var(--sc-ease), filter 400ms var(--sc-ease);
  }
  @media (hover: hover) and (pointer: fine) {
    html:not([data-motion="off"]) a:hover :is(.tile__media, .frame--photo, .pcard__media, .rcard__media) > img,
    html:not([data-motion="off"]) .sc-zoomable:hover > img {
      transform: scale(1.06); filter: saturate(1.08); transition-duration: 900ms, 1500ms, 400ms;
    }
  }
  html:not([data-motion="off"]) :is(a:focus-visible) :is(.tile__media, .pcard__media, .rcard__media) > img,
  html:not([data-motion="off"]) .sc-zoomable:focus-visible > img { transform: scale(1.06); }
}
/* the rail card's words lift a touch as its photograph pushes in */
.rcard__body { transition: translate 500ms var(--sc-ease); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .rcard:hover .rcard__body { translate: 0 -6px; }
}
/* a linked tile's title takes an underline with its photograph */
a.tile:is(:hover, :focus-visible) .tile__head > h3 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------------------------------------------------------------- the photo viewer (showcase.js builds it) */
.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(12 12 12 / .96); color: #f4f4f4; overflow: hidden; }
.lb::backdrop { background: transparent; }
.lb[open] { display: grid; grid-template-rows: 1fr auto; }
html:has(.lb[open]) { overflow: hidden; }
.lb__stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 64px 72px 16px; touch-action: pan-y; }
.lb__img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.lb__cap { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: baseline; justify-content: space-between; padding: 12px 72px 24px; font: 400 var(--t-small)/1.45 var(--font-text); }
.lb__alt { color: #f4f4f4; max-width: 80ch; }
.lb__meta { display: flex; gap: 16px; color: #a3a3a3; }
.lb__meta a { color: inherit; }
.lb__btn { position: absolute; z-index: 2; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 999px; border: 0;
  background: rgb(255 255 255 / .1); color: #fff; cursor: pointer; transition: background-color 150ms; }
.lb__btn:hover { background: rgb(255 255 255 / .2); }
.lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb__close { top: 12px; right: 12px; }
.lb__prev { left: 12px; top: 50%; translate: 0 -50%; }
.lb__next { right: 12px; top: 50%; translate: 0 -50%; }
.lb__btn[hidden] { display: none; }
@media (max-width: 639px) {
  .lb__stage { padding: 64px 8px 8px; }
  .lb__cap { padding: 8px 16px 20px; }
  .lb__prev, .lb__next { top: auto; bottom: 8px; translate: none; }
  .lb[open] { grid-template-rows: 1fr auto 64px; }
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .lb[open] { animation: lb-in 260ms var(--sc-ease); }
  html:not([data-motion="off"]) .lb__img.is-new { animation: lb-img 380ms var(--sc-ease); }
}
@keyframes lb-in { from { opacity: 0; } }
@keyframes lb-img { from { opacity: 0; scale: .97; } }
