/* 05 Work gallery */
.work { position: relative; }
.work-sticky { padding-block: var(--section-pad); }
.work-head { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; margin-bottom: clamp(32px, 4vw, 56px); }
.work-head .section-head { margin-bottom: 0; }
.work-track { display: flex; gap: clamp(16px, 2vw, 28px); overflow-x: auto; scroll-snap-type: x mandatory; padding-inline: max(var(--gutter), (100vw - var(--wrap)) / 2); padding-bottom: 20px; scrollbar-width: thin; scrollbar-color: var(--night-600) transparent; }
.work.is-pinned .work-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; grid-template-columns: 100%; align-content: center; padding-block: calc(var(--header-h) + 8px) 24px; overflow: clip; }
.work.is-pinned .work-track { overflow: visible; translate: calc(var(--tx, 0) * 1px) 0; will-change: translate; scroll-snap-type: none; }
.proj { flex: 0 0 auto; width: clamp(290px, 36vw, 520px); scroll-snap-align: center; display: grid; gap: 18px; text-decoration: none; color: inherit; }
.proj-pic { position: relative; aspect-ratio: 1.22; border-radius: 18px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, var(--night-700), var(--night-900) 70%); border: 1px solid var(--night-700); }
.proj-pic::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 32px 32px; }
.proj-pic img { position: absolute; inset: 6% 4% 0; width: 92%; height: 94%; object-fit: contain; object-position: bottom; transition: scale var(--dur-4) var(--ease-out), translate var(--dur-4) var(--ease-out); }
.proj:hover .proj-pic img { scale: 1.03; translate: 0 -6px; }
.proj-pic .num { position: absolute; top: 14px; left: 16px; font-family: var(--font-mono); font-size: .75rem; color: var(--night-300); z-index: 1; }
.proj-meta { display: grid; grid-template-columns: 1fr; gap: 6px 16px; align-items: start; }
/* explicit band colour so contrast checks resolve the off-screen cards of the pinned track */
.proj-meta, .proj-end { background-color: var(--bg, var(--night-950)); }
.proj-meta h3 { font-size: var(--step-2); }
.proj-meta p { grid-column: 1 / -1; color: var(--fg-2); font-size: 1rem; }
.proj .chips { grid-column: 1 / -1; }
.proj-end { flex: 0 0 auto; width: clamp(260px, 26vw, 360px); scroll-snap-align: center; border: 1px dashed var(--night-600); border-radius: 18px; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding: 32px; aspect-ratio: auto; }
.proj-end p { color: var(--fg-2); }
.work-bar { margin-top: 28px; height: 2px; background: var(--night-700); position: relative; }
.work-bar i { position: absolute; inset: 0; background: var(--amber-300); transform-origin: left; scale: var(--wp, 0) 1; }
.work:not(.is-pinned) .work-bar { display: none; }

/* block markup: each .proj is a group (image + meta group); the heading link covers the card */
.work-track { counter-reset: proj; }
.proj { position: relative; counter-increment: proj; }
.proj > * { margin: 0; }
.proj-pic { margin: 0; }
.proj-pic img { height: 94%; }
.proj-pic::after { content: counter(proj, decimal-leading-zero) " / " var(--total, ""); position: absolute; top: 14px; left: 16px; font-family: var(--font-mono); font-size: .75rem; color: var(--night-300); z-index: 1; }
.proj-meta h3 a { color: inherit; text-decoration: none; }
.proj-meta h3 a::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: 18px; }
.proj:has(h3 a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 6px; border-radius: 18px; }
.proj h3 a:focus-visible { outline: none; }
.proj-meta .chips { margin-top: 6px; }
