/* Horizontal gallery · Scroll Story Kit
   Static (no JS, reduced motion): a native sideways scroller with snap points. On wide screens the whole row fits;
   on narrow ones it scrolls sideways. The row is a labelled region you can focus and scroll with the arrow keys.
   Motion: the section pins for --sk-hgal-len of scroll and the row slides sideways with progress. horizontal-gallery.js
   measures the travel once (again on resize) into --sk-hgal-shift, writes the count, and brings a focused card on screen. */
.sk-hgal { --sk-hgal-len: 460vh; counter-reset: sk-hgal; }
.sk-hgal-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 40px; }
.sk-hgal-copy { max-width: 760px; }
/* decoration that only shows with motion: tucked away (never display:none, so its box stays put) */
:root:not(.sk-on) .sk-hgal-count { position: absolute; width: 1px; height: 1px; overflow: clip; clip-path: inset(50%); white-space: nowrap; }
.sk-hgal-view { max-width: var(--sk-max); margin: 40px auto 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; border-radius: var(--sk-radius); }
.sk-hgal-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 14px; margin: 0; padding: 4px 0 14px; list-style: none; }
.sk-hgal-card { position: relative; display: flex; flex-direction: column; padding: 10px 10px 20px; border-radius: var(--sk-radius); background: var(--sk-surface); box-shadow: var(--sk-shadow-sm); scroll-snap-align: start; counter-increment: sk-hgal; }
.sk-hgal-art { margin: 0 0 14px; }
.sk-hgal-art svg { display: block; width: 100%; height: auto; border-radius: var(--sk-radius-sm); }
.sk-hgal-card .sk-h3 { padding: 0 6px; font-size: clamp(1.05rem, .95rem + .45vw, 1.3rem); }
.sk-hgal-card .sk-h3::before { content: counter(sk-hgal, decimal-leading-zero); display: block; margin-bottom: 6px; font: 700 var(--sk-size-kicker)/1 var(--sk-font-mono); letter-spacing: 0; color: var(--sk-accent-text); }
.sk-hgal-card .sk-text { margin: 6px 0 0; padding: 0 6px; font-size: var(--sk-size-small); line-height: 1.5; }
.sk-hgal-link { color: inherit; text-decoration: none; }
.sk-hgal-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--sk-radius); }
.sk-hgal-card:hover .sk-hgal-link { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.sk-hgal-card:has(.sk-hgal-link:focus-visible) { box-shadow: 0 0 0 3px var(--sk-focus), var(--sk-shadow-sm); }

@media (max-width: 760px) {
  .sk-hgal-view { margin: 28px calc(-1 * var(--sk-gutter)) 0; border-radius: 0; scroll-padding-inline: var(--sk-gutter); }
  .sk-hgal-track { width: max-content; grid-auto-columns: min(70vw, 280px); padding-inline: var(--sk-gutter); }
}

/* motion */
:root.sk-on .sk-hgal { height: var(--sk-hgal-len); padding: 0; }
:root.sk-on .sk-hgal-pin {
  --sk-hgal-k: clamp(0, (var(--sk-p) - .06) / .88, 1);
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: center; gap: clamp(22px, 4.5svh, 48px);
  padding: 0 var(--sk-gutter);
}
:root.sk-on .sk-hgal-head { width: 100%; }
:root.sk-on .sk-hgal-count { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 4px 10px; margin: 0; font-family: var(--sk-font-mono); color: var(--sk-ink-2); }
:root.sk-on .sk-hgal-now { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); font-weight: 700; line-height: 1; color: var(--sk-ink); }
:root.sk-on .sk-hgal-bar { grid-column: 1 / -1; position: relative; width: 100%; min-width: 120px; height: 3px; border-radius: 3px; background: var(--sk-line); overflow: clip; }
:root.sk-on .sk-hgal-bar::after { content: ""; position: absolute; inset: 0; background: var(--sk-accent); transform-origin: 0 50%; transform: scaleX(var(--sk-hgal-k)); }
:root.sk-on .sk-hgal-view { max-width: none; margin: 0 calc(-1 * var(--sk-gutter)); overflow: visible; scroll-snap-type: none; border-radius: 0; }
:root.sk-on .sk-hgal-track {
  --sk-hgal-w: min(78vw, 340px, calc((100svh - 320px) * .72));
  position: relative; display: flex; gap: clamp(14px, 2vw, 28px); width: max-content;
  padding: 6px max(var(--sk-gutter), (100% - var(--sk-max)) / 2);
  transform: translate3d(calc(var(--sk-hgal-k) * var(--sk-hgal-shift, 0px) * -1), 0, 0);
  will-change: transform;
}
:root.sk-on .sk-hgal-card { flex: 0 0 var(--sk-hgal-w); width: var(--sk-hgal-w); transition: transform var(--sk-step) var(--sk-ease), box-shadow var(--sk-step) var(--sk-ease); }
:root.sk-on .sk-hgal-card:hover, :root.sk-on .sk-hgal-card:focus-within { transform: translateY(-6px); }
:root.sk-on .sk-hgal-card .sk-h3::before { display: inline; margin: 0 10px 0 0; }
:root.sk-on .sk-hgal-art { overflow: clip; border-radius: var(--sk-radius-sm); }
/* the art drifts a little inside its frame as the row travels, so the row reads as depth, not a flat strip */
:root.sk-on .sk-hgal-art svg { transform: scale(1.08) translateX(calc((.5 - var(--sk-hgal-k)) * 5%)); }

@media (max-width: 760px) {
  :root.sk-on .sk-hgal-pin { justify-content: center; gap: 20px; }
  :root.sk-on .sk-hgal-head { flex-wrap: nowrap; align-items: end; gap: 16px; }
  :root.sk-on .sk-hgal-copy .sk-h2 { font-size: clamp(1.6rem, 1rem + 3vw, 2.2rem); }
  :root.sk-on .sk-hgal-count { flex: none; }
  :root.sk-on .sk-hgal-bar { min-width: 64px; }
  /* on phones each card in turn sits in the middle of the screen */
  :root.sk-on .sk-hgal-track { padding-inline: calc((100% - var(--sk-hgal-w)) / 2); }
}
@media (prefers-reduced-motion: reduce) {
  .sk-hgal-card { transition: none !important; }
}
