/* Dear Prelude storefront — homepage gallery.
 * A stationary ivory page. Only the endless row of website previews travels sideways. */

.view-gallery { display: flex; flex-direction: column; background: var(--paper); overflow: hidden; }

/* ---------- Header ---------- */
.g-head { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: clamp(18px, 3.2vh, 30px) var(--gutter) 0; }
.g-logo { display: inline-flex; align-items: center; text-decoration: none; font-family: var(--font-display); letter-spacing: var(--track-display); font-size: 1.5rem; line-height: 1; }
.g-logo img { height: var(--logo-h, 26px); width: auto; }

/* ---------- The travelling row ---------- */
.track {
  --gap: clamp(30px, 5vw, 92px);                      /* space between previews */
  --step: clamp(10px, 3.5vh, 34px);                   /* depth of the vertical stagger, when one is set */
  --pw: min(30vw, calc((100vh - 320px) * var(--ratio-n, .6667)));   /* preview width */
  flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden;
  column-gap: var(--gap); row-gap: var(--step);       /* read by gallery.js; they do not lay anything out */
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
  perspective: 1300px; perspective-origin: 50% 44%;   /* the room the previews travel through; matches DEPTH in gallery.js */
}
@supports (height: 100dvh) { .track { --pw: min(30vw, calc((100dvh - 320px) * var(--ratio-n, .6667))); } }
.track.is-dragging { cursor: grabbing; }
.track:focus-visible { outline-offset: -4px; }

.item { position: absolute; left: 50%; top: calc(50% - 26px); width: max(var(--pw), 160px); margin-left: calc(max(var(--pw), 160px) / -2); will-change: transform; backface-visibility: hidden; }
.item[hidden] { display: none; }
.item-link { display: block; text-decoration: none; color: var(--ink); -webkit-user-drag: none; }
.item-link:focus-visible { outline-offset: 10px; }

.item-frame {
  position: relative; display: block; aspect-ratio: var(--ratio, 2/3); overflow: hidden; background: var(--paper-deep);
  outline: 1px solid rgba(47, 43, 38, .07); outline-offset: -1px;
  /* the nearer a preview is to the centre, the further it lifts off the page */
  box-shadow: 0 calc(14px + 26px * var(--near, 0)) calc(26px + 44px * var(--near, 0)) calc(-20px - 10px * var(--near, 0)) rgba(74, 58, 36, calc(.1 + .3 * var(--near, 0)));
}
.item-frame img { width: 100%; height: 100%; object-fit: var(--fit, cover); object-position: var(--focus, 50% 0%); transition: transform 1.6s var(--ease); }
/* distance: previews further back take on a little of the paper, like objects seen through air */
.item-frame::after { content: ''; position: absolute; inset: 0; background: var(--paper); opacity: calc(var(--far, 0) * .42); pointer-events: none; }

.item-caption { transition: opacity .5s var(--ease); }
/* the caption hangs beneath the preview without affecting its height, so every preview sits on the same line
   whether its name takes one line or two */
.item-caption { position: absolute; left: 0; right: 0; top: 100%; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding-top: 16px; }
.item-name { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(1.375rem, 1.9vw, 1.75rem); line-height: 1.15; }
.item-go { display: inline-flex; align-items: center; gap: 10px; font-size: .8125rem; letter-spacing: var(--track-text); color: var(--soft); transition: color .5s var(--ease); white-space: nowrap; }
.item-go::before { content: ''; width: 22px; height: 1px; background: currentColor; transition: width .6s var(--ease); }

/* coming soon: shown, but not a link (no pointer, no hover response, no arrow line) */
.item-link.is-soon { cursor: inherit; }
.item-link.is-soon .item-go::before { display: none; }

@media (hover: hover) {
  .track:not(.is-dragging) a.item-link:hover .item-frame img { transform: scale(1.025); }
  a.item-link:hover .item-go, a.item-link:focus-visible .item-go { color: var(--ink); }
  a.item-link:hover .item-go::before { width: 40px; }
}

/* Entrance: previews rise into place once, on arrival. */
.item-link { transition: opacity 1.1s var(--ease) var(--delay, 0s), transform 1.3s var(--ease) var(--delay, 0s); }
html.js .item:not(.is-seen) .item-link { opacity: 0; transform: translateY(28px); }

/* Leaving for, or returning from, a product page: the chosen preview is carried by the flyer (app.js). */
.track.is-parting .item:not(.is-chosen) .item-link { opacity: 0; transform: scale(.93); transition: opacity .5s var(--ease), transform .9s var(--ease); }
.track.no-anim .item-link, .track.no-anim .item-caption { transition: none !important; }
.item.is-chosen .item-frame { visibility: hidden; }
.item.is-chosen .item-caption { opacity: 0; }

/* ---------- Signature line and the discreet position indicator ---------- */
.g-nav { flex: none; position: relative; z-index: 5; display: flex; align-items: flex-end; gap: 10px; padding: 0 var(--gutter) clamp(10px, 2vh, 20px); pointer-events: none; }
.g-nav button { pointer-events: auto; }
.g-tagline { margin-right: auto; font-size: clamp(2.75rem, 4.6vw, 4.75rem); color: var(--ink); transform: translateY(-.12em); }
.g-ticks, .g-nav button { align-self: center; }
.g-ticks { display: flex; align-items: center; gap: 9px; height: 20px; margin-right: 8px; }
.g-ticks span { width: 1px; height: 7px; background: var(--soft); opacity: .55; transition: height .6s var(--ease), opacity .6s var(--ease), background .6s var(--ease); }
.g-ticks span.is-on { height: 17px; opacity: 1; background: var(--ink); }
.g-nav button { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink); }
.g-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1; }

/* ---------- Phones and portrait screens: same row, one preview in focus with its neighbours either side ---------- */
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .track { --pw: min(64vw, calc((100vh - 300px) * var(--ratio-n, .6667))); --gap: 30px; --step: 12px; }
  @supports (height: 100dvh) { .track { --pw: min(64vw, calc((100dvh - 300px) * var(--ratio-n, .6667))); } }
  .g-tagline { font-size: 1.75rem; white-space: nowrap; }
  .g-nav button { display: none; }
  .g-ticks { margin-right: 0; }
  .item-caption { flex-direction: column; gap: 6px; padding-top: 12px; }
}
@media (max-height: 460px) {
  .g-tagline { font-size: 1.75rem; }
  .track { --step: 0px; }
}
