/* ============================================================
   Galleries_Test — Bottega53-style editorial gallery experience
   Faithful structural recreation: justified couple grid →
   loading % transition → horizontal-scroll story gallery.
   Editorial black-on-white treatment per the reference.
   ============================================================ */

:root {
  --gt-ink: #111110;
  --gt-paper: #ffffff;
  --gt-muted: #8a8782;
  --gt-line: rgba(17,17,16,0.12);
  --gt-display: "Bodoni Moda", "Cormorant Garamond", Georgia, serif;
  --gt-label: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #0a0a0a;
  color: var(--gt-ink);
  font-family: var(--gt-label);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#root { height: 100vh; }

/* ---------- vertical UI labels (BACK / MENU / CREDITS / CONTACT) ---------- */
.gt-vlabel {
  position: fixed; z-index: 80;
  font-family: var(--gt-label); font-weight: 800;
  font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference; cursor: pointer; user-select: none;
  background: none; border: 0;
  transition: opacity 220ms ease;
}
.gt-vlabel:hover { opacity: 0.6; }
.gt-vlabel.tl { top: 30px; left: 30px; writing-mode: vertical-rl; transform: rotate(180deg); }
.gt-vlabel.tr { top: 30px; right: 30px; writing-mode: vertical-rl; }
.gt-vlabel.bl { bottom: 30px; left: 30px; writing-mode: vertical-rl; transform: rotate(180deg); }
.gt-vlabel.br { bottom: 30px; right: 30px; writing-mode: vertical-rl; }

.gt-wordmark {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%); z-index: 80;
  text-align: center; cursor: pointer; user-select: none;
  color: #fff; mix-blend-mode: difference;
}
.gt-wordmark .name { font-family: var(--gt-label); font-weight: 800; font-size: 24px; letter-spacing: 0.01em; line-height: 0.9; }
.gt-wordmark .sub { font-family: var(--gt-label); font-weight: 700; font-size: 8px; letter-spacing: 0.42em; margin-top: 3px; }

/* ============================================================
   GRID VIEW — justified rows of couple tiles
   ============================================================ */
.gt-grid-view { height: 100vh; overflow-y: auto; overflow-x: hidden; background: #0a0a0a; transition: filter 520ms ease; }
.gt-grid-view.dim { filter: brightness(0.26) grayscale(0.4); }
.gt-grid-inner { padding: 0; }
.gt-grid-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 14px 40px; gap: 30px;
}
.gt-grid-head h1 {
  font-family: var(--gt-display); font-weight: 500; font-style: italic;
  font-size: clamp(40px, 6vw, 92px); letter-spacing: -0.01em; line-height: 0.92;
}
.gt-grid-head .meta { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gt-muted); text-align: right; line-height: 1.8; }

.gt-rows { display: flex; flex-direction: column; gap: 5px; }
.gt-row { display: flex; gap: 5px; height: 46vh; }
.gt-tile {
  position: relative; overflow: hidden; cursor: pointer; background: #161616;
  flex: 1 1 0;
}
.gt-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 900ms cubic-bezier(0.2,0,0.2,1), filter 600ms; display: block; }
.gt-tile:hover img { transform: scale(1.04); }
.gt-tile .gt-tile-cap {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  opacity: 0; transition: opacity 320ms ease; color: #fff;
  background: rgba(17,17,16,0.28);
}
.gt-tile:hover .gt-tile-cap { opacity: 1; }
.gt-tile .gt-tile-cap .names { font-family: var(--gt-display); font-style: italic; font-weight: 500; font-size: clamp(20px, 2vw, 34px); line-height: 1.02; }
.gt-tile .gt-tile-cap .place { font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase; margin-top: 12px; }
.gt-tile .gt-tile-cap .open { font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase; margin-top: 28px; opacity: 0.8; display: flex; align-items: center; gap: 7px; }

/* ============================================================
   LOADING VIEW — counting percentage
   ============================================================ */
.gt-loading {
  position: fixed; inset: 0; z-index: 60; background: var(--gt-paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: gtFade 360ms ease;
}
@keyframes gtFade { from { opacity: 0; } to { opacity: 1; } }
.gt-loading .lname { font-family: var(--gt-display); font-style: italic; font-weight: 500; font-size: clamp(26px, 3.4vw, 52px); text-align: center; line-height: 1.0; margin-bottom: 46px; }
.gt-loading .lplace { font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gt-muted); margin-bottom: 60px; }
.gt-loading .pct {
  font-family: var(--gt-display); font-weight: 500; font-variant-numeric: tabular-nums;
  font-size: clamp(64px, 11vw, 160px); line-height: 0.8; letter-spacing: -0.03em;
}
.gt-loading .bar { width: min(360px, 60vw); height: 1px; background: var(--gt-line); margin-top: 40px; position: relative; overflow: hidden; }
.gt-loading .bar i { position: absolute; inset: 0 auto 0 0; background: var(--gt-ink); transition: width 60ms linear; }

/* ============================================================
   GALLERY VIEW — premium horizontal editorial scroll
   ============================================================ */
.gt-gallery {
  position: fixed; inset: 0; z-index: 30; background: var(--gt-paper);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  animation: gtFade 500ms ease;
}
.gt-gallery::-webkit-scrollbar { display: none; }

/* track: album spreads — the title page is full-bleed, then photo pages
   flow with even white gaps. No outer left padding so the opening spread
   sits flush against the viewport. */
.gt-track {
  display: flex; height: 100vh; align-items: center;
  gap: 4vw; padding: 0 8vw 0 0;
  width: max-content;
}

/* every panel hugs its content */
.gt-panel { flex: 0 0 auto; height: 100vh; display: flex; align-items: center; }

/* the image card — sized by the photo's own aspect ratio so NOTHING crops.
   Width follows --ar at a fixed height band; extreme panoramas get clamped
   by max-width (the only case where a sliver of crop is possible). */
.gt-card {
  position: relative; overflow: hidden; background: #f3f2f0;
  flex: 0 0 auto;
  height: 80vh; width: calc(80vh * var(--ar, 1.5)); max-width: 90vw;
}
.gt-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* solo pages — portraits stand a little taller, landscapes a little lower */
.p-solo .gt-card.land { height: 78vh; width: calc(78vh * var(--ar, 1.5)); }
.p-solo .gt-card.port { height: 86vh; width: calc(86vh * var(--ar, 0.75)); }

/* facing pair — two photos sharing a spread at the same height */
.p-pair { display: flex; gap: 4vw; }
.p-pair .gt-card { height: 74vh; width: calc(74vh * var(--ar, 0.75)); }

/* title spread — white left half with centred names, full-bleed cover right */
.p-title { width: 100vw; height: 100vh; align-items: stretch; }
.p-title .titleblock {
  flex: 0 0 45%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 0 4vw;
}
.p-title .titleblock .eyebrow {
  font-family: var(--gt-label); font-weight: 700; font-size: 12px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--gt-ink);
}
.p-title .titleblock h2 {
  font-family: var(--gt-display); font-weight: 500;
  font-size: clamp(52px, 6.2vw, 118px); line-height: 1.0; letter-spacing: -0.015em;
  margin: 30px 0; text-wrap: balance;
  /* the centred flex column sizes children at max-content — without this
     cap long names refuse to wrap and run off the viewport edge */
  max-width: 100%;
}
.p-title .titleblock h2 em { font-style: italic; }
.p-title .titleblock h2 .amp { font-style: italic; font-weight: 400; font-size: 0.55em; vertical-align: middle; color: var(--gt-ink); }
.p-title .titleblock .sub {
  font-family: var(--gt-label); font-weight: 600; font-size: 10px;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--gt-muted);
}
.p-title .cover { position: relative; flex: 1; overflow: hidden; background: #f3f2f0; }
.p-title .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* NEXT PROJECT transition */
.p-next { gap: 4vw; padding: 0 2vw; cursor: pointer; }
.p-next .next-text { width: 40vw; max-width: 560px; }
.p-next .next-eyebrow {
  font-family: var(--gt-label); font-weight: 700; font-size: 11px;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--gt-muted);
}
.p-next h3 {
  font-family: var(--gt-display); font-weight: 500;
  font-size: clamp(64px, 9vw, 168px); line-height: 0.86; letter-spacing: -0.03em;
  margin: 20px 0 0;
}
.p-next .next-line {
  height: 1px; background: var(--gt-ink); width: 0;
  margin: 34px 0 26px;
  transition: width 700ms cubic-bezier(0.2,0,0.2,1);
}
.p-next:hover .next-line { width: 100%; }
.p-next .next-name {
  font-family: var(--gt-display); font-style: italic; font-weight: 500;
  font-size: clamp(24px, 2.4vw, 38px); line-height: 1.05;
}
.p-next .next-place {
  font-family: var(--gt-label); font-weight: 600; font-size: 11px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gt-muted); margin-top: 12px;
}
.p-next .gt-card { height: 66vh; width: calc(66vh * 0.8); }
.p-next .gt-card img { transition: transform 900ms cubic-bezier(0.2,0,0.2,1); }
.p-next:hover .gt-card img { transform: scale(1.04); }
.p-next .next-go {
  position: absolute; right: 22px; bottom: 22px;
  width: 54px; height: 54px; border-radius: 999px; background: var(--gt-paper);
  display: flex; align-items: center; justify-content: center; color: var(--gt-ink);
  transform: translateX(6px); opacity: 0; transition: opacity 320ms ease, transform 320ms ease;
}
.p-next:hover .next-go { opacity: 1; transform: translateX(0); }
.p-next .next-go svg { width: 22px; height: 22px; }

/* ============================================================
   GALLERY-VIEW CHROME — centered wordmark + corners
   ============================================================ */
.gv-corner {
  position: fixed; top: 32px; z-index: 80;
  font-family: var(--gt-label); font-weight: 800;
  font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference; cursor: pointer; user-select: none;
  background: none; border: 0; transition: opacity 220ms ease;
}
.gv-corner:hover { opacity: 0.55; }
.gv-back { left: 34px; }
.gv-menu { right: 34px; }
.gv-wordmark {
  position: fixed; top: 28px; left: 50%; transform: translateX(-50%); z-index: 80;
  text-align: center; cursor: pointer; user-select: none;
  color: #fff; mix-blend-mode: difference;
}
.gv-wordmark .name { font-family: var(--gt-label); font-weight: 800; font-size: 21px; letter-spacing: 0.02em; line-height: 0.9; }
.gv-wordmark .sub { font-family: var(--gt-label); font-weight: 700; font-size: 8px; letter-spacing: 0.42em; margin-top: 4px; }
.gv-counter {
  position: fixed; bottom: 32px; left: 34px; z-index: 80;
  font-family: var(--gt-label); font-weight: 800; font-size: 14px; letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums; color: #fff; mix-blend-mode: difference;
}
.gv-counter span { font-weight: 600; opacity: 0.6; }
.gv-credits {
  position: fixed; bottom: 32px; right: 34px; z-index: 80;
  writing-mode: vertical-rl;
  font-family: var(--gt-label); font-weight: 800; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference; cursor: default; user-select: none;
}

/* autoscroll hint */
.gt-hint {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 79;
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: #fff; mix-blend-mode: difference;
  display: flex; align-items: center; gap: 10px; pointer-events: none;
  transition: opacity 400ms ease;
}
.gt-hint .dot { width: 5px; height: 5px; border-radius: 999px; background: #fff; }
.gt-hint.auto .dot { animation: gtPulse 1.1s ease-in-out infinite; }
@keyframes gtPulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ============================================================
   MENU OVERLAY  — harmonized with home_test aesthetic
   ============================================================ */
.gt-menu {
  position: fixed; inset: 0; z-index: 70; background: #000;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 7vw;
  animation: gtMenuIn 560ms cubic-bezier(0.2,0,0.2,1);
}
@keyframes gtMenuIn { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes gtRise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
.gt-menu .gt-menu-eyebrow {
  font-family: var(--gt-label); font-weight: 700; font-size: 11px; letter-spacing: 0.3em;
  text-transform: uppercase; color: rgba(255,255,255,0.45); margin-bottom: 40px;
  animation: gtRise 600ms cubic-bezier(0.2,0,0.2,1) both;
}
.gt-menu ul { list-style: none; }
.gt-menu li {
  display: flex; align-items: baseline; gap: 24px; cursor: pointer;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.12);
  transition: padding-left 320ms cubic-bezier(0.2,0,0.2,1);
  animation: gtRise 620ms cubic-bezier(0.2,0,0.2,1) both;
}
.gt-menu li:nth-child(1) { animation-delay: 0.08s; }
.gt-menu li:nth-child(2) { animation-delay: 0.14s; }
.gt-menu li:nth-child(3) { animation-delay: 0.20s; }
.gt-menu li:nth-child(4) { animation-delay: 0.26s; }
.gt-menu li:nth-child(5) { animation-delay: 0.32s; }
.gt-menu li:first-child { border-top: 1px solid rgba(255,255,255,0.12); }
.gt-menu li:hover { padding-left: 22px; }
.gt-menu li .idx { font-family: var(--gt-label); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; color: rgba(255,255,255,0.4); width: 34px; flex: 0 0 auto; transition: color 320ms ease; }
.gt-menu li .label {
  font-family: var(--gt-label); font-weight: 800; font-size: clamp(34px, 5.4vw, 82px);
  line-height: 1.04; letter-spacing: -0.02em; color: rgba(255,255,255,0.5);
  transition: color 340ms cubic-bezier(0.2,0,0.2,1);
}
/* isolated hover: only the hovered row brightens */
.gt-menu li:hover .label { color: #fff; }
.gt-menu li:hover .idx { color: #fff; }
.gt-menu li.active .label { color: #fff; }
.gt-menu li.active .idx { color: #fff; }
.gt-menu li .count {
  margin-left: auto; font-family: var(--gt-label); font-weight: 600; font-size: 12px;
  letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.4);
  font-variant-numeric: tabular-nums;
}
.gt-menu .gt-menu-foot {
  margin-top: 48px; display: flex; gap: 40px;
  font-family: var(--gt-label); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255,255,255,0.4);
  animation: gtRise 600ms cubic-bezier(0.2,0,0.2,1) both; animation-delay: 0.4s;
}

/* page number bottom-left */
.gt-page { position: fixed; bottom: 30px; left: 30px; z-index: 40; font-family: var(--gt-label); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; writing-mode: vertical-rl; transform: rotate(180deg); color: #fff; mix-blend-mode: difference; }

@media (max-width: 760px) {
  .gt-row { height: 32vh; }
  /* title spread stacks: names above, full-bleed cover below */
  .p-title { flex-direction: column; }
  .p-title .titleblock { flex: 0 0 auto; padding: 13vh 8vw 6vh; }
  .p-title .cover { width: 100vw; }
  /* favour faces: the full-bleed cover crops from the bottom, not the head */
  .p-title .cover img { object-position: 50% 28%; }

  /* Photo pages: the card container ALWAYS matches the photo's own aspect
     ratio (aspect-ratio + a single min()-driven dimension), so object-fit
     can never crop. The old fixed-height + max-width clamp cut heads and
     sides off whenever a card hit the viewport edge. */
  .gt-card,
  .p-solo .gt-card.land,
  .p-solo .gt-card.port {
    aspect-ratio: var(--ar, 1.5);
    height: auto; max-width: none;
    width: min(88vw, calc(64vh * var(--ar, 1.5)));
  }
  .p-pair { gap: 5vw; }
  .p-pair .gt-card { width: min(42vw, calc(46vh * var(--ar, 0.75))); }
  /* next-project stacks */
  .p-next { flex-direction: column; gap: 4vh; }
  .p-next .next-text { width: 78vw; }
  .p-next .gt-card { aspect-ratio: auto; height: 44vh; width: calc(44vh * 0.8); }
}

/* ============================================================
   PHONE — chrome (reused from home_test) clears status bar
   ============================================================ */
@media (max-width: 520px) {
  .gt-grid-view { -webkit-overflow-scrolling: touch; }
  /* Bottega-style 2-up mosaic: rows carry 2 tiles (JS), each tile is a tall
     4:5 crop, so covers fill the screen instead of floating as thin strips
     over a black void. */
  .gt-row { height: auto; gap: 3px; }
  .gt-rows { gap: 3px; }
  .gt-tile { aspect-ratio: 4 / 5; }
  /* a row with a single (leftover) tile becomes a full-width hero */
  .gt-tile:only-child { aspect-ratio: 4 / 4.4; }
  /* keep faces when the cover crops vertically */
  .gt-tile img { object-position: 50% 30%; }
  /* tile caption visible on touch */
  .gt-tile .gt-tile-cap { opacity: 1; background: linear-gradient(180deg, transparent 45%, rgba(10,10,10,0.55)); justify-content: flex-end; padding-bottom: 16px; }
  .gt-tile .gt-tile-cap .names { font-size: 18px; }
  .gt-tile .gt-tile-cap .place { margin-top: 6px; }
  .gt-tile .gt-tile-cap .open { display: none; }

  /* home-style chrome shrunk + pushed below the notch */
  .h-logo { top: 58px; left: 18px; }
  .h-logo .lname { font-size: 18px; }
  .h-logo .lsub { font-size: 7px; letter-spacing: 0.34em; }
  .h-chrome-label { font-size: 17px; letter-spacing: 0.03em; }
  .h-menu-btn { top: 58px; right: 18px; }
  .h-contact-btn { bottom: 26px; right: 18px; }
  .h-plus { width: 58px; height: 58px; bottom: 18px; left: 18px; }
  .h-plus svg line { stroke-width: 6; }

  /* "+" gallery-type list */
  .h-types .types-list { right: 20px; gap: 0; }
  .h-types .types-list .ty { font-size: 9vw; }

  /* MENU overlay reflow */
  .h-overlay .ov-logo { top: 58px; left: 18px; }
  .h-overlay .ov-close { top: 58px; right: 18px; font-size: 17px; }
  .mm-contact { top: 92px; right: 18px; left: 18px; text-align: left; }
  .mm-contact .big { font-size: 16vw; }
  .mm-socials { justify-content: flex-start; gap: 18px; }
  .mm-primary { left: 18px; bottom: 13vh; }
  .mm-primary .mm-item { font-size: 17vw; }
  .mm-secondary { display: none; }
  .mm-foot { left: 18px; bottom: 20px; gap: 18px; }

  /* gallery-view chrome — clear the notch, shrink type */
  .gv-corner { top: 56px; font-size: 12px; }
  .gv-back { left: 20px; }
  .gv-menu { right: 20px; }
  .gv-wordmark { top: 52px; }
  .gv-wordmark .name { font-size: 16px; }
  .gv-wordmark .sub { font-size: 7px; letter-spacing: 0.36em; }
  .gv-counter { bottom: 24px; left: 20px; font-size: 12px; }
  .gv-credits { bottom: 24px; right: 20px; font-size: 11px; }

  /* ----------------------------------------------------------
     Horizontal story → swipeable album pages.
     Every panel is exactly one viewport wide and snaps into
     place, so photos are always centred and symmetric — no more
     half-visible giant titles or misaligned card tops mid-scroll.
     ---------------------------------------------------------- */
  .gt-gallery { scroll-snap-type: x mandatory; }
  .gt-track { gap: 0; padding: 0; }
  .gt-panel {
    width: 100vw; justify-content: center;
    scroll-snap-align: start; scroll-snap-stop: always;
  }

  /* photo card: container ratio == photo ratio → zero cropping.
     Caps leave breathing room for the chrome above and below. */
  .gt-card,
  .p-solo .gt-card.land,
  .p-solo .gt-card.port {
    aspect-ratio: var(--ar, 1.5);
    height: auto; max-width: none;
    width: min(92vw, calc(66vh * var(--ar, 1.5)));
  }

  /* title page: names block clears the top chrome, cover fills the rest */
  .p-title { width: 100vw; }
  .p-title .titleblock { width: 100vw; padding: 13vh 7vw 4.5vh; }
  /* sized so even long double names ("Simona Gualtieri & Keita Balda")
     wrap inside the page instead of running off the right edge */
  .p-title .titleblock h2 { font-size: clamp(30px, 10vw, 48px); margin: 18px 0; }
  .p-title .titleblock .eyebrow { font-size: 10px; }

  /* next-project page */
  .p-next { width: 100vw; padding: 0; justify-content: center; gap: 3vh; }
  .p-next .next-text { width: 80vw; }
  .p-next h3 { font-size: 19vw; }
  .p-next .next-line { margin: 22px 0 18px; width: 100%; }
  .p-next .gt-card { aspect-ratio: auto; height: 34vh; width: calc(34vh * 0.8); }
  .p-next .next-go { opacity: 1; transform: none; width: 46px; height: 46px; }

  .gt-loading .pct { font-size: 26vw; }
  .gt-hint { bottom: 26px; font-size: 9px; }
}

/* iOS: use the dynamic viewport so Safari's collapsing toolbars never hide
   the bottom chrome or shift the vertical centring of story pages. */
@supports (height: 100dvh) {
  #root { height: 100dvh; }
  .gt-grid-view { height: 100dvh; }
  .gt-track, .gt-panel { height: 100dvh; }
  .p-title { height: 100dvh; }
}
