/* Through My Lens — gallery page. Same design language as landing/style.css:
   the drawn art carries the layout, CSS only places it. */

@font-face {
  font-family: "Bebas Neue";
  src: url("../assets/fonts/BebasNeue.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #c10000;
  --mosaic-w: 1541;      /* images_woutline.svg is 1541x894; the design space
                            extends to 12020 tall for the extra CSS-built rows */
  --mosaic-h: 12020;
  --bebas: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

html { background: #050505; scroll-behavior: smooth; }

body {
  margin: 0;
  color: #fff;
  background: #050505;
  font-family: Impact, "Arial Narrow", sans-serif;
  overflow-x: hidden;
}

/* ---- Fixed backdrop: grunge fillings under the landing sidebar art ---- */

.fixed-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #050505;
}

.fixed-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/landingpage/remplissage/FullRedGrunge.png") center/cover;
  opacity: 0.13;
}

.fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fill-whitegrudge { opacity: 0.45; }
.fill-whitepoints { opacity: 0.8; }
.fill-redgrudge   { opacity: 0.9; }

.red-shard {
  position: absolute;
  background: var(--red);
  opacity: 0.8;
  transform: rotate(-24deg);
  z-index: 1;
}
.shard-one { width: 600px; height: 115px; right: -260px; bottom: 40px; }
.shard-two { width: 430px; height: 70px;  right: -210px; top: 200px; }

/* ---- Pointing hand: same system as the landing page, but in viewport px
   because this page scrolls. script.js sets --hx/--hy to the fingertip
   target; transform-origin sits on the fingertip. ---- */

.hand {
  position: fixed;
  width: 7.03vw;
  aspect-ratio: 650 / 881;
  --hx: 5vw;
  --hy: 2vh;
  --hr: -18deg;
  --hs: 0.85;
  /* fingertip sits at 48.6% / 2.2% of the artwork box */
  left: calc(var(--hx) - 0.486 * 7.03vw);
  top:  calc(var(--hy) - 0.022 * 7.03vw * 881 / 650);
  transform: rotate(var(--hr)) scale(var(--hs));
  transform-origin: 48.6% 2.2%;
  will-change: left, top, transform;
  transition: left 0.72s cubic-bezier(0.22, 0.72, 0.18, 1),
              top 0.72s cubic-bezier(0.22, 0.72, 0.18, 1),
              transform 0.58s cubic-bezier(0.22, 0.72, 0.18, 1);
  filter: drop-shadow(4px 6px 0 rgba(0, 0, 0, 0.55));
  pointer-events: none;
  z-index: 9;
}

/* While the page scrolls the hand re-anchors every frame: no glide, it must
   track its control exactly. */
.hand.no-glide { transition: none; }

/* ---- Page column ---- */

.gallery-page {
  position: relative;
  z-index: 4;
  margin: 0 auto;
  width: 100%;
  max-width: 1520px;
  min-height: 100vh;
  padding: 12px 28px 16px;
}

.gallery-header {
  position: relative;
  max-width: 1450px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

/* Mask logo: back to the landing page */
.home-mask {
  flex: 0 0 auto;
  width: clamp(130px, 13vw, 230px);
  transform: rotate(-4deg);
}
.home-mask img {
  display: block;
  width: 100%;
  filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.6));
}

/* Double green stars crash into the title's tail, like the mock.
   Anchored to the title's right edge so they track the Y at any width. */
.green-stars {
  position: absolute;
  left: calc(100% - 52px);
  top: -34px;
  width: clamp(120px, 11vw, 190px);
  z-index: 1;
  transform: rotate(4deg);
  pointer-events: none;
}

.title {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  transform: rotate(-2deg);
}

.title-photo { width: clamp(180px, 16.5vw, 320px); }

/* GALLERY is wider art than PHOTO (922:333 vs 681:323): scale for equal height */
.title-gallery {
  width: clamp(230px, 22vw, 420px);
  transform: rotate(1.5deg) translateY(4px);
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.6));
}

/* The sentence sits in a white jagged-outline box in the mock */
.sentence-box {
  display: block;
  position: relative;
  z-index: 2; /* paints over the green-stars arrow tip */
  padding: 12px 16px;
  border: 3px solid #fff;
  background: rgba(5, 5, 5, 0.6);
  transform: rotate(-2deg);
  clip-path: polygon(1.5% 7%, 98% 0, 100% 88%, 95% 100%, 3% 95%, 0 22%);
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.55);
}

.sentence {
  display: block;
  width: clamp(140px, 13vw, 230px);
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.5));
}

/* Header CTAs: punk paper-cut buttons drawn as inline SVG (see gallery.html) —
   white tilted panel, thick black border, offset black shadow, spikes,
   splatter, Bebas label + thick chevron. Transparent background. */
.cta-stack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.contact-btn {
  width: clamp(190px, 17vw, 290px);
  transform: rotate(-2.5deg);
}

.book-btn {
  width: clamp(230px, 20.5vw, 350px);
  transform: rotate(1.6deg);
}

.contact-btn svg,
.book-btn svg { display: block; width: 100%; height: auto; overflow: visible; }
.contact-btn:focus,
.book-btn:focus { outline: none; }

/* ---- Filters: punk paper-cut tags, drawn by punkButton() in script.js ---- */

.filters {
  max-width: 1450px;
  margin: 8px auto 0;
  display: flex;
  flex-wrap: wrap;         /* nine tags now — let the row break like scattered stickers */
  justify-content: center;
  align-items: center;
  gap: 14px 20px;
}

.filters button {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.18s ease;
}

.filters button svg {
  display: block;
  height: clamp(36px, 3vw, 54px);
  width: auto;
  overflow: visible;
}

/* Alternate hand-placed tilts, like the drawn tags */
.filters button:nth-child(odd)  { transform: rotate(-2deg); }
.filters button:nth-child(even) { transform: rotate(1.5deg); }

/* Active tag flips to black panel / white print */
.filters button.active { transform: translateY(-3px) rotate(2deg) scale(1.06); }
.filters button.active .tp-panel { fill: #000; }
.filters button.active .tp-text  { fill: #fff; }
.filters button.active .tp-chev  { stroke: #fff; }

.filters button:focus { outline: none; }

/* ---- Mosaic: photos live on the white boxes of images_woutline.svg ----
   Slot geometry comes from script.js in 1541x894 design px via --x/--y/--w/--h. */

.mosaic {
  position: relative;
  max-width: 1380px;
  margin: 6px auto 0;
  /* script.js overrides --mosaic-h on #gallery when a filter repacks the
     photos at the top, so the page shrinks to just the matching rows */
  aspect-ratio: var(--mosaic-w) / var(--mosaic-h);
}

.mosaic-frames,
.mosaic-tape {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 7.667%; /* 894 / 11660 — the drawn SVG covers the top band only */
  pointer-events: none;
}

.mosaic-frames { filter: drop-shadow(7px 9px 0 rgba(0, 0, 0, 0.55)); }

.mosaic-tape { z-index: 3; opacity: 0.9; }

/* A filter hides the drawn collage art instantly (no fade: the shrinking
   container would squash the SVG mid-transition) */
.mosaic.filtered .mosaic-frames,
.mosaic.filtered .mosaic-tape { visibility: hidden; }

.photo-card {
  position: absolute;
  left:   calc(var(--x) * 100% / var(--mosaic-w));
  top:    calc(var(--y) * 100% / var(--mosaic-h));
  width:  calc(var(--w) * 100% / var(--mosaic-w));
  height: calc(var(--h) * 100% / var(--mosaic-h));
  margin: 0;
  z-index: 1;
  cursor: zoom-in;
  background: #0a0a0a; /* black interior — the drawn white box reads as the frame */
  transform: rotate(var(--rot, 0deg));
  transition: left 0.55s cubic-bezier(0.22, 0.72, 0.18, 1),
              top 0.55s cubic-bezier(0.22, 0.72, 0.18, 1),
              transform 0.18s ease, opacity 0.3s ease, visibility 0.3s;
}

.photo-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Red tag: hangs off the frame's bottom-left corner. It deliberately
   overshoots the frame — the chaotic sticker look — so nothing here (nor on
   the card) may clip it. */
.photo-card figcaption {
  position: absolute;
  z-index: 2;
  bottom: -11px;
  left: -14px;
  padding: 5px 14px 4px;
  background: var(--red);
  font-family: var(--bebas);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: clamp(13px, 1.2vw, 21px);
  line-height: 1;
  transform: rotate(-3deg);
  clip-path: polygon(3% 0, 100% 8%, 92% 100%, 0 91%);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.5);
}

/* Empty slot: black box + red tag, exactly like the mock's placeholders */
.photo-card.placeholder { cursor: default; }
.photo-card.placeholder img { display: none; }

/* Extra frames below the drawn SVG: CSS-built white frames that read like
   the drawn boxes (white border, jagged edge, hard shadow). `.framed` is the
   same frame, put on drawn-band photos while a filter repacks them at the
   top (their drawn SVG box is hidden then). The jagged clip lives on a
   ::before layer, not the card itself, so the red figcaption tag can hang
   over the frame edge without being cut off. */
.photo-card.extra,
.photo-card.framed {
  background: none;
  padding: 9px;
  filter: drop-shadow(7px 9px 0 rgba(0, 0, 0, 0.55));
}

.photo-card.extra::before,
.photo-card.framed::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  clip-path: polygon(0.9% 2.4%, 99.1% 0%, 100% 97.2%, 1.6% 100%);
}

.photo-card.extra img,
.photo-card.framed img { position: relative; }

/* Filtered out: the whole card — photo, tag and frame — disappears */
.photo-card.is-out {
  opacity: 0;
  visibility: hidden;
  transform: rotate(var(--rot, 0deg)) scale(0.92);
  pointer-events: none;
}

/* ---- Footer: social ad (left), layered workbadge (center), frame life (right) ---- */

footer {
  position: relative;
  max-width: 1450px;
  margin: auto;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Barcode + social buttons, brought over from the landing page's lower ad */
.footer-ad {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-42%);
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-ad .barcode {
  width: clamp(120px, 11vw, 185px);
  transform: rotate(-3deg);
}

.social-row { display: flex; align-items: center; gap: 14px; }

.social-btn {
  position: relative;
  width: clamp(44px, 4vw, 62px);
  aspect-ratio: 60 / 58;
  filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.55));
}

.lay { position: absolute; object-fit: fill; display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workbadge { position: relative; width: clamp(220px, 22vw, 380px); transform: rotate(-3deg); }
.workbadge img { display: block; width: 100%; }
.wb-white { filter: drop-shadow(6px 7px 0 rgba(0, 0, 0, 0.6)); }
.wb-black { position: absolute; inset: 6% 9% auto 7%; width: 86%; }
.wb-text  { position: absolute; top: 34%; left: 30%; width: 40%; }

.framelife { /* far right, over the red starburst in the backdrop */
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-40%) rotate(-4deg);
  width: clamp(120px, 11.5vw, 190px);
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.6));
}

/* ---- Lightbox ---- */

dialog {
  width: min(1100px, 93vw);
  height: min(850px, 92vh);
  padding: 0;
  border: 0;
  background: transparent;
  color: white;
  overflow: visible;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.92); }
dialog figure { height: 100%; margin: 0; display: grid; place-items: center; }
dialog img {
  max-width: 100%;
  max-height: calc(100% - 45px);
  border: 5px solid white;
  box-shadow: 10px 10px var(--red);
}

/* Zoomed (click the photo or the +/− button): the photo blows up to the full
   dialog width and the figure scrolls down through it. */
dialog.zoomed figure {
  display: block;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
dialog.zoomed img {
  /* --zf is the shift+scroll zoom factor; 1 = fills the dialog width */
  width: calc(100% * var(--zf, 1));
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  cursor: grab; /* little gripping hand: drag to move around the photo */
  touch-action: pan-y;
}
dialog.zoomed.grabbing img { cursor: grabbing; }
dialog.zoomed figcaption { text-align: center; padding: 10px 0 16px; }
dialog figcaption { font-family: var(--bebas); letter-spacing: 1.5px; text-transform: uppercase; font-size: 25px; }
dialog button {
  position: absolute;
  z-index: 2;
  border: 3px solid white;
  background: #050505;
  color: #fff;
  font: 44px Impact;
  cursor: pointer;
}
.close { right: 0; top: 0; width: 50px; height: 50px; line-height: 35px; background: var(--red); }
dialog .zoom { right: 0; top: 58px; width: 50px; height: 50px; line-height: 38px; font-size: 38px; }
.previous, .next { top: 45%; width: 52px; height: 70px; }
.previous { left: -22px; }
.next { right: -22px; }

/* ---- Small screens: hand goes away, art stays ---- */

@media (max-width: 900px) {
  .hand { display: none; }
  .gallery-page { margin: 0; width: 100%; padding: 16px 14px 22px; }
  .contact-btn { width: 150px; }
  .book-btn { width: 185px; }
  .sentence-box { display: none; }
  .title { gap: 12px; }
  .title-photo { width: clamp(130px, 32vw, 240px); }
  .title-gallery { width: clamp(170px, 42vw, 315px); }
  .filters { flex-wrap: wrap; gap: 12px; }
  footer { gap: 24px; }
  .workbadge { width: 190px; }
  .framelife { width: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .hand, .photo-card, .filters button { transition: none; }
}

/* ---- Mentions légales / RGPD link (below the footer) ---- */

.legal-row { text-align: center; padding-top: 22px; }
.legal-row a {
  font-size: 15px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #fff;
  opacity: 0.55;
  text-decoration: none;
}

/* ---- Phones: header stacks, title fits the width ---- */

@media (max-width: 560px) {
  .gallery-header {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
  }
  .home-mask { width: 92px; }
  .title { gap: 8px; }
  .title-photo { width: clamp(100px, 30vw, 150px); }
  .title-gallery { width: clamp(130px, 39vw, 195px); }
  .green-stars { width: 84px; left: calc(100% - 30px); top: -22px; }
  .cta-stack {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
  }
}
