/* Nseem El Khair — Gallery v2 (gallery2.php): instant prints + film strip.
   Builds on home-v4.css (tokens, header, buttons, footer, reveals) and products.css (crumbs). */

/* Colours follow the rest of the site: night hero with the red glow → paper sheet → night sheet,
   red / salmon / blush accents. */
.g2 { --tape: #ffd4ceb3; }

.g2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; margin-bottom: clamp(36px, 5vw, 70px); }
.g2-head > div { display: grid; gap: clamp(14px, 1.8vw, 22px); }
.g2-head h2 { font-size: clamp(2.8rem, 7vw, 6.4rem); line-height: .9; letter-spacing: -.04em; }
.g2-head__note { font-family: var(--font-accent); font-style: italic; font-size: clamp(1.2rem, 1.8vw, 1.6rem); color: var(--ink-soft); }
.g2-head--light { color: #fff; }
.g2-head--light .g2-head__note { color: var(--muted); }

/* ═════════ An instant print ═════════ */
.g2-print {
  --r: 0deg;
  position: relative; display: block; padding: 12px 12px 0; background: #fff; color: var(--ink);
  box-shadow: 0 1px 2px #0000001a, 0 22px 40px -26px #3a1a14a6;
  rotate: var(--r); transition: rotate .6s var(--ease), translate .6s var(--ease), box-shadow .5s;
}
.g2-print__img { display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--paper-2); }
.g2-print__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
.g2-print__cap {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 4px 18px;
  font-family: var(--font-accent); font-style: italic; font-size: clamp(1.25rem, 1.7vw, 1.55rem); line-height: 1.1;
}
.g2-print__cap small { font-family: var(--font-body); font-style: normal; font-size: .72rem; font-weight: 700; letter-spacing: .12em; color: var(--red); white-space: nowrap; }
.g2-print__tape {   /* a strip of tape holding the print */
  position: absolute; left: 50%; top: -12px; z-index: 2; width: 92px; height: 26px; translate: -50% 0; rotate: calc(var(--r) * -1.6);
  background: var(--tape); box-shadow: 0 1px 2px #0000001f;
  -webkit-mask-image: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
          mask-image: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
}

/* ═════════ Hero ═════════ */
.g2-hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(760px circle at 78% 30%, #ad203170, transparent 62%),
    radial-gradient(520px circle at 8% 100%, #ff827d22, transparent 70%),
    var(--night);
  padding: clamp(118px, 13vw, 160px) 0 calc(clamp(64px, 8vw, 110px) + var(--R));
}
.g2-hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.g2-hero__copy { display: grid; justify-items: start; gap: clamp(14px, 1.8vw, 22px); }
.g2-hero__title { font-size: clamp(2.8rem, 6.6vw, 6.6rem); line-height: .9; letter-spacing: -.04em; max-width: 12ch; }
.g2-hero__lead { max-width: 42ch; color: #e8e0db; font-size: clamp(1.02rem, 1.3vw, 1.2rem); }
.g2-hero__jump { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

.g2-pile { position: relative; display: block; height: clamp(360px, 36vw, 500px); }
.g2-print--pile {
  position: absolute; left: 50%; top: 50%; width: clamp(190px, 18vw, 250px); padding: 10px 10px 0;
  translate: calc(-50% + (var(--k) - 1) * 56%) calc(-50% + (var(--k) - 1) * 4%);
}
.g2-print--pile .g2-print__cap { font-size: 1.1rem; padding: 10px 2px 14px; }
.g2-pile:hover .g2-print--pile:nth-child(1) { translate: calc(-50% - 74%) -56%; rotate: -12deg; }
.g2-pile:hover .g2-print--pile:nth-child(2) { translate: calc(-50% + 74%) -44%; rotate: 11deg; }
.g2-pile:hover .g2-print--pile:nth-child(3) { translate: -50% -52%; rotate: 0deg; }

/* ═════════ Photos — 3 × 3 prints on the paper sheet ═════════ */
.g2-photos {
  position: relative; z-index: 2; margin-top: calc(-1 * var(--R)); border-radius: var(--R) var(--R) 0 0;
  background: var(--paper); color: var(--ink); padding: clamp(80px, 10vw, 130px) 0 calc(clamp(80px, 10vw, 130px) + var(--R));
}
.g2-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 5vw, 70px) clamp(24px, 3.4vw, 52px); }
.js .g2-grid > li[data-reveal] { transition-delay: calc(var(--d) * 90ms); }
.g2-photo:hover, .g2-photo:focus-visible { rotate: 0deg; translate: 0 -8px; box-shadow: 0 1px 2px #0000001a, 0 36px 60px -30px #3a1a14cc; outline: none; }
.g2-photo:focus-visible { box-shadow: 0 0 0 3px var(--red), 0 36px 60px -30px #3a1a14cc; }
.g2-photo:hover .g2-print__img img { transform: scale(1.05); }
@media (max-width: 1020px) { .g2-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .g2-grid { grid-template-columns: 1fr; padding-inline: 8px; } }

/* ═════════ Videos — film-strip frames, 4 + 3 centred ═════════ */
.g2-videos {
  position: relative; z-index: 3; margin-top: calc(-1 * var(--R)); border-radius: var(--R) var(--R) 0 0;
  background: var(--night); color: #fff; padding: clamp(80px, 10vw, 130px) 0 clamp(72px, 9vw, 120px);
}
.g2-reels { --cols: 4; --gap: clamp(14px, 1.8vw, 24px); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.g2-reels > li { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.js .g2-reels > li[data-reveal] { transition-delay: calc(var(--d) * 90ms); }
.g2-frame {
  position: relative; display: grid; gap: 8px; width: 100%; padding: 14px 22px; border-radius: 6px; text-align: left;
  background: #231e1c;
  box-shadow: inset 0 0 0 1px #ffffff12, 0 30px 50px -30px #000;
  transition: transform .6s var(--ease), box-shadow .4s;
}
.g2-frame::before, .g2-frame::after {   /* sprocket holes, drawn as rounded slots down both edges */
  content: ""; position: absolute; top: 8px; bottom: 8px; width: 8px;
  background: repeating-linear-gradient(180deg, #0b0908 0 9px, transparent 9px 16px);
  border-radius: 2px;
}
.g2-frame::before { left: 7px; }
.g2-frame::after { right: 7px; }
.g2-frame:hover, .g2-frame:focus-visible { transform: translateY(-8px); box-shadow: inset 0 0 0 1px #ffffff12, 0 0 0 3px var(--red), 0 40px 60px -30px #000; }
.g2-frame__screen { position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 4px; background: #000; }
.g2-frame__screen img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.05); transition: transform 1.1s var(--ease); }
.g2-frame:hover .g2-frame__screen img { transform: scale(1.05); }
.g2-frame__play {
  position: absolute; left: 50%; top: 50%; width: clamp(54px, 5vw, 66px); height: clamp(54px, 5vw, 66px); translate: -50% -50%;
  display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #fff;
  box-shadow: 0 0 0 6px #ffffff33, 0 14px 30px -10px #000; transition: scale .4s var(--ease), background-color .25s;
}
.g2-frame__play svg { margin-left: 3px; }
.g2-frame:hover .g2-frame__play, .g2-frame:focus-visible .g2-frame__play { scale: 1.1; background: var(--red-bright); }
.g2-frame__meta { display: flex; justify-content: space-between; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .72rem; letter-spacing: .14em; color: var(--blush); }
@media (max-width: 1020px) { .g2-reels { --cols: 3; } }
@media (max-width: 640px)  { .g2-reels { --cols: 2; } .g2-frame { padding: 10px 18px; } .g2-frame::before { left: 5px; } .g2-frame::after { right: 5px; } }
@media (max-width: 360px)  { .g2-reels { --cols: 1; } .g2-reels > li { max-width: 280px; } }

/* ═════════ Lightboxes ═════════ */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0908f5; color: #fff; overflow: hidden; }
.lightbox::backdrop { background: #0b0908cc; }
.lightbox[open] { display: grid; place-items: center; animation: lbIn .3s var(--ease); }
@keyframes lbIn { from { opacity: 0; } }
html.has-lightbox { overflow: hidden; }
.lightbox { --pad-y: clamp(64px, 7vw, 88px); }
.lightbox--photo { --pad-b: 150px; }
.lightbox__frame { width: 100%; height: 100%; display: grid; place-items: center; padding: var(--pad-y) clamp(12px, 8vw, 110px); }
.lightbox--photo .lightbox__frame { padding-bottom: var(--pad-b); }
.lightbox__img { max-width: 100%; max-height: calc(100dvh - var(--pad-y) - var(--pad-b, var(--pad-y))); width: auto; height: auto; object-fit: contain; border: 10px solid #fff; border-bottom-width: 26px; opacity: 0; transition: opacity .35s; }
.lightbox__img.is-ready { opacity: 1; }
.lightbox__video { display: block; height: calc(100dvh - 2 * var(--pad-y)); width: auto; max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; background: #000; border-radius: 10px; }
.lightbox__caption { position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.lightbox__count { font-size: .78rem; font-weight: 700; letter-spacing: .12em; color: var(--salmon); }
.lightbox__name { font-family: var(--font-accent); font-style: italic; font-size: 1.4rem; color: #f0ebe7; }
.lightbox__strip { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; gap: 8px; max-width: calc(100vw - 24px); overflow-x: auto; padding: 4px; scrollbar-width: none; }
.lightbox__strip button { flex: none; width: 46px; height: 62px; overflow: hidden; border: 3px solid #fff; opacity: .45; transition: opacity .25s, transform .3s var(--ease); }
.lightbox__strip button:hover { opacity: .85; }
.lightbox__strip button.is-on { opacity: 1; transform: translateY(-3px); }
.lightbox__strip img { width: 100%; height: 100%; object-fit: cover; }
.lightbox__btn { position: absolute; z-index: 2; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #ffffff1a; color: #fff; transition: background-color .25s, color .25s; }
.lightbox__btn:hover { background: #fff; color: var(--ink); }
.lightbox__close { top: 18px; right: 18px; background: var(--red); }
.lightbox__close:hover { background: var(--red-bright); color: #fff; }
.lightbox__prev { left: clamp(10px, 2vw, 28px); top: 50%; transform: translateY(-50%); }
.lightbox__next { right: clamp(10px, 2vw, 28px); top: 50%; transform: translateY(-50%); }

/* ═════════ Responsive ═════════ */
@media (max-width: 899px) {
  .g2-hero__grid { grid-template-columns: 1fr; }
  .g2-pile { height: 340px; }
  .g2-print--pile { width: 170px; }
}
@media (max-width: 480px) {
  .g2-print--pile { width: 150px; translate: calc(-50% + (var(--k) - 1) * 40%) calc(-50% + (var(--k) - 1) * 4%); }
  .g2-pile:hover .g2-print--pile:nth-child(1) { translate: calc(-50% - 40%) -54%; }
  .g2-pile:hover .g2-print--pile:nth-child(2) { translate: calc(-50% + 40%) -46%; }
}
@media (max-width: 640px) {
  .lightbox { --pad-y: 76px; }
  .lightbox--photo { --pad-b: 170px; }
  .lightbox__frame { padding: var(--pad-y) 10px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 104px; transform: none; width: 44px; height: 44px; }
  .lightbox__caption { bottom: 116px; }
}
@media (prefers-reduced-motion: reduce) {
  .g2-print { transition: none; }
}
