/* Gallery page — round 4 "Rearrange" entrance on the dark palette (tokens from base.css). Sections are transparent over
   the page colour; photos carry soft shadows. Everything moves vertically. Classes are g- prefixed. */

/* ---------- 1–2 · floating set: scattered → "What we wire." ---------- */
.g-ra { position: relative; height: calc(var(--g-vh, 3.1) * 100vh); height: calc(var(--g-vh, 3.1) * 100svh); }
.g-ra__stick { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.g-ra__photos { position: absolute; inset: 0; contain: layout size; }
.g-ph { position: absolute; left: 0; top: 0; width: 100px; height: 100px; padding: 0; border-radius: 14px; overflow: hidden; background: var(--glass); box-shadow: 0 34px 60px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .06); will-change: transform, width, height, opacity; pointer-events: none; }
.g-ph img { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; transition: transform .9s var(--ease), filter .6s var(--ease); filter: saturate(.92); }
.g-ra.is-grid .g-ph:not([data-x]) { pointer-events: auto; cursor: pointer; }
.g-ra.is-grid .g-ph:not([data-x]):hover img { transform: scale(1.05); filter: saturate(1.05); }
/* soft vignette so the headline reads over the floating photos */
.g-ra__stick::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: var(--w0, 1);
  background: radial-gradient(42% 36% at 50% 50%, color-mix(in srgb, var(--page) 78%, transparent) 0%, transparent 100%); }
.g-ra__stick::before { content: ''; position: absolute; inset: auto 0 0; height: var(--feather); z-index: 2; pointer-events: none; background: linear-gradient(transparent, var(--page)); opacity: var(--wb, 0); }

.g-txt { position: absolute; z-index: 3; opacity: 0; will-change: opacity, transform; pointer-events: none; }
.g-txt.live { pointer-events: auto; }
.g-txt--0 { left: 50%; top: 50%; width: min(820px, calc(100% - 2 * var(--gut))); translate: -50% -50%; text-align: center; display: flex; flex-direction: column; align-items: center; }
.g-txt--1 { left: var(--gut); top: calc(var(--hd) + clamp(20px, 4vh, 44px)); }
.g-h { font-weight: 300; font-size: clamp(40px, 4.4vw, 68px); line-height: 1; letter-spacing: -.035em; color: var(--ink); }
.g-h--xl { font-weight: 200; font-size: clamp(64px, min(9vw, 15vh), 150px); line-height: .92; letter-spacing: -.05em; text-shadow: 0 10px 60px rgba(3, 6, 13, .8); }
.g-p { margin: 16px 0 0; font-size: clamp(16px, 1.25vw, 19px); color: var(--tx2); }
.g-txt--0 .g-p { margin-top: 22px; text-shadow: 0 2px 20px rgba(3, 6, 13, .9); }
.g-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }

.g-labs { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.g-lab { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 44px; font-size: clamp(16px, 1.3vw, 20px); letter-spacing: -.015em; color: var(--ink); opacity: 0; will-change: transform, opacity; }
.g-lab svg { flex: none; width: 34px; height: 34px; padding: 9px; border-radius: 50%; border: 1px solid var(--edge2); color: var(--tx2); transition: background .3s, color .3s, border-color .3s, transform .4s var(--ease); }
.g-lab.live { pointer-events: auto; }
.g-lab:hover svg { background: var(--ice2); color: #0a1630; border-color: var(--ice2); transform: translateY(2px) rotate(90deg); }
.g-cue { position: absolute; left: 50%; bottom: 26px; z-index: 3; width: 1px; height: 46px; background: rgba(255, 255, 255, .12); overflow: hidden; opacity: var(--w0, 1); }
.g-cue span { position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--ice); animation: g-cue 2.2s var(--ease) infinite; }
@keyframes g-cue { to { top: 110%; } }

/* ---------- 3 · every category, straight down ---------- */
.g-all { position: relative; z-index: 1; padding-top: clamp(30px, 5vw, 80px); padding-bottom: clamp(60px, 8vw, 120px); }
.g-all__in { display: grid; grid-template-columns: clamp(200px, 17vw, 250px) minmax(0, 1fr); gap: clamp(28px, 4vw, 70px); align-items: start; }
.g-rail { position: sticky; top: calc(var(--hd) + 40px); }
.g-rail ol { display: flex; flex-direction: column; gap: 4px; }
.g-rail a { display: flex; align-items: center; gap: 12px; height: 32px; font-size: 15px; color: var(--tx3); transition: color .35s var(--ease); white-space: nowrap; }
.g-rail a i { flex: none; width: 14px; height: 1.5px; background: currentColor; transition: width .45s var(--ease), background .35s var(--ease), box-shadow .35s; }
.g-rail a:hover, .g-rail a.on { color: var(--ink); }
.g-rail a.on i { width: 30px; background: var(--ice); box-shadow: 0 0 10px rgba(156, 194, 255, .6); }

.g-sec { padding-bottom: clamp(70px, 9vw, 140px); scroll-margin-top: calc(var(--hd) + 24px); }
.g-sec__top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'h btns' 'p btns'; align-items: end; column-gap: 24px; margin-bottom: clamp(22px, 2.6vw, 34px); }
.g-sec__h { grid-area: h; font-weight: 300; font-size: clamp(36px, 4vw, 64px); line-height: 1; letter-spacing: -.035em; }
.g-sec__p { grid-area: p; margin-top: 10px; font-size: 16.5px; color: var(--tx2); }
.g-sec__btns { grid-area: btns; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.g-sec__btns .lnk { margin-left: 4px; }

.g-grid { display: grid; gap: 14px; }
.g-grid--1 { grid-template-columns: 1fr; }
.g-grid--1 .g-fig__b { aspect-ratio: 16 / 8; }
.g-grid--2 { grid-template-columns: 1.35fr 1fr; }
.g-grid--2 .g-fig__b { aspect-ratio: 4 / 3.2; }
.g-grid--4 { grid-template-columns: 1fr 1fr; }
.g-grid--4 .g-fig__b { aspect-ratio: 16 / 10; }
.g-grid--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-grid--6 .g-fig__b { aspect-ratio: 4 / 3; }
.g-grid--6 .g-fig:first-child { grid-column: span 2; grid-row: span 2; }
.g-grid--6 .g-fig:first-child .g-fig__b { aspect-ratio: auto; height: calc(100% - 34px); }
.g-fig { margin: 0; opacity: var(--e, 0);
  transform: translate3d(calc(var(--dx) * (1 - var(--e, 0)) * 1px), calc(var(--dy) * (1 - var(--e, 0)) * 1px), 0) rotate(calc(var(--r) * (1 - var(--e, 0)) * 1deg)) scale(calc(.84 + var(--e, 0) * .16)); will-change: transform, opacity; }
.g-fig__b { display: block; width: 100%; padding: 0; border-radius: 22px; overflow: hidden; background: var(--glass); box-shadow: 0 34px 60px -36px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .05); cursor: zoom-in; }
.g-fig__b img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease), filter .6s; filter: saturate(.92); }
.g-fig__b:hover img { transform: scale(1.05); filter: saturate(1.05); }
.g-fig figcaption { margin-top: 12px; font-size: 14px; color: var(--tx2); }
.g-back { display: none; }

/* ---------- lightbox ---------- */
.g-lb { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 70px 80px 40px; background: rgba(3, 6, 13, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); opacity: 0; transition: opacity .35s var(--ease); }
.g-lb.on { opacity: 1; }
.g-lb[hidden] { display: none; }
.g-lb__fig { margin: 0; max-width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g-lb__fig img { max-width: 100%; max-height: calc(100vh - 170px); border-radius: 14px; object-fit: contain; box-shadow: 0 40px 80px -40px #000; }
.g-lb__fig figcaption { display: flex; align-items: baseline; gap: 14px; color: var(--tx2); font-size: 15px; }
.g-lb__fig b { font-weight: 500; color: var(--ink); }
.g-lb__fig em { font-style: normal; color: var(--tx3); font-size: 13px; }
.g-lb__x, .g-lb__nav { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; border: 1px solid var(--edge2); background: var(--glass); transition: background .3s; }
.g-lb__x:hover, .g-lb__nav:hover { background: rgba(255, 255, 255, .14); }
.g-lb__x { top: 18px; right: 18px; }
.g-lb__prev { left: 18px; top: 50%; translate: 0 -50%; }
.g-lb__next { right: 18px; top: 50%; translate: 0 -50%; }
.g-lb__nav[disabled] { opacity: .25; pointer-events: none; }

/* ---------- tablets ---------- */
@media (max-width: 1020px) {
  .g-all__in { grid-template-columns: 1fr; }
  .g-rail { display: none; }
  .g-sec__top { grid-template-columns: 1fr; grid-template-areas: 'h' 'p' 'btns'; }
  .g-sec__btns { justify-content: flex-start; margin-top: 18px; }
  .g-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--edge); font-size: 14px; color: var(--tx2); }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .g-h--xl { font-size: clamp(56px, 17vw, 80px); }
  .g-txt--0 .g-btns .btn--glass { display: none; }
  .g-txt--0 .g-btns .btn { width: 100%; }
  .g-txt--0 { width: calc(100% - 2 * var(--gut)); }
  .g-txt--1 { top: calc(var(--hd) + 14px); }
  .g-txt--1 .g-p { margin-top: 8px; font-size: 15px; }
  .g-h { font-size: clamp(36px, 10.5vw, 46px); }
  .g-lab { height: auto; font-size: 15px; font-weight: 500; text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
  .g-lab svg { display: none; }
  .g-cue { display: none; }
  .g-grid--2, .g-grid--4 { grid-template-columns: 1fr; }
  .g-grid--6 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .g-grid--6 .g-fig:first-child { grid-column: 1 / -1; grid-row: auto; }
  .g-grid--6 .g-fig:first-child .g-fig__b { aspect-ratio: 4 / 3; height: auto; }
  .g-grid--1 .g-fig__b { aspect-ratio: 4 / 3; }
  .g-grid--6 figcaption { font-size: 12.5px; }
  .g-fig__b { border-radius: 18px; }
  .g-lb { padding: 64px 12px 30px; }
  .g-lb__nav { top: auto; bottom: 18px; translate: none; }
  .g-lb__prev { left: calc(50% - 60px); } .g-lb__next { right: calc(50% - 60px); }
  .g-lb__fig img { max-height: calc(100vh - 220px); }
}

/* ---------- reduced motion: no pinned stage, everything in place ---------- */
.rm .g-ra { height: auto; }
.rm .g-ra__stick { position: relative; height: 100vh; }
.rm .g-fig { opacity: 1; transform: none; }
/* phones: a soft shade under the grid labels so they read on light photos */
@media (max-width: 760px) {
  .g-ph::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 45%, rgba(3, 6, 13, .72) 100%); opacity: var(--wb, 0); }
}
