/* ============================================================
   Gallery pages — ימי צילום/UGC · B-Roll · דוגמנות
   Extends styles.css (same tokens); RTL throughout.
   ============================================================ */

.gallery-page{ background:var(--white); }

/* header sits solid on gallery pages — there is no full-bleed hero behind it */
.gal-header{
  background:rgba(255,255,255,.9);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  box-shadow:0 1px 0 var(--line);
  padding:12px 0;
}

/* ---------- hero ---------- */
.gal-hero{
  position:relative; overflow:hidden;
  background:var(--cream);
  padding:calc(var(--header-h) + 46px) 0 44px;
  text-align:center;
}
.gal-hero .container{ position:relative; z-index:2; }
.gal-hero h1{ font-size:clamp(1.9rem, 5vw, 3.2rem); margin-bottom:14px; }
.gal-lead{
  max-width:620px; margin:0 auto;
  color:var(--ink-2); font-size:clamp(1rem, 1.8vw, 1.1rem);
}
.gal-stats{
  margin:22px 0 0; color:var(--ink-3); font-size:.94rem;
}
.gal-stats b{ color:var(--tan); font-weight:600; }
.gal-stats .sep{ margin:0 10px; opacity:.5; }

.back-link{
  display:inline-flex; align-items:center; gap:7px;
  margin-bottom:24px; padding:8px 16px;
  border-radius:999px; background:#fff; border:1px solid var(--line);
  font-size:.88rem; color:var(--ink-2);
  box-shadow:var(--shadow-sm);
  transition:transform .25s ease, border-color .25s ease, color .25s ease;
}
.back-link svg{ width:16px; height:16px; }
.back-link:hover{ transform:translateX(4px); border-color:rgba(196,164,132,.4); color:var(--tan); }

/* ---------- filter chips ---------- */
.chips-wrap{
  /* --header-real is measured by gallery.js; the header shrinks on scroll, so a
     static offset leaves a transparent band or tucks the bar underneath */
  position:sticky; top:calc(var(--header-real, 64px) - 1px); z-index:40;
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
  padding:12px 0;
}
.chips{
  display:flex; gap:8px; overflow-x:auto; padding-bottom:2px;
  scrollbar-width:thin; scrollbar-color:var(--sand) transparent;
}
.chips::-webkit-scrollbar{ height:5px; }
.chips::-webkit-scrollbar-thumb{ background:var(--sand); border-radius:99px; }
.chip{
  flex:0 0 auto; display:inline-flex; align-items:center; gap:7px;
  padding:8px 16px; border-radius:999px; cursor:pointer;
  font-family:inherit; font-size:.88rem; color:var(--ink-2);
  background:#fff; border:1px solid var(--line);
  transition:background-color .2s ease, color .2s ease, border-color .2s ease;
  white-space:nowrap;
}
.chip:hover{ border-color:rgba(196,164,132,.45); color:var(--tan); }
.chip.is-active{ background:var(--tan); border-color:var(--tan); color:#fff; }
.chip-n{
  font-size:.74rem; padding:1px 7px; border-radius:99px;
  background:rgba(0,0,0,.06); color:var(--ink-2);
}
.chip.is-active .chip-n{ background:rgba(255,255,255,.26); color:#fff; }

/* ---------- grids ---------- */
main.container{ padding-top:34px; padding-bottom:60px; }

.grid-video{
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fill, minmax(196px, 1fr));
  /* wide (16:9) tiles span two columns; dense backfills the hole they leave */
  grid-auto-flow:dense;
}
.grid-photo{ columns:4 210px; column-gap:14px; }
.grid-photo .tile{ break-inside:avoid; margin-bottom:14px; width:100%; }

.tile{
  position:relative; display:block; padding:0; cursor:pointer;
  border:0; border-radius:var(--radius); overflow:hidden;
  background:var(--sand); box-shadow:var(--shadow-sm);
  transition:transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s ease;
}
.grid-video .tile{ aspect-ratio:9 / 16; }
/* a 16:9 poster in a 9:16 slot would show a ~32% centre strip */
.grid-video .tile-wide{ aspect-ratio:16 / 9; grid-column:span 2; }
.tile img{ width:100%; height:100%; object-fit:cover; display:block; }
.grid-photo .tile img{ height:auto; aspect-ratio:var(--ar); }
.tile:hover{ transform:translateY(-5px); box-shadow:0 18px 40px rgba(61,43,31,.18); }
.tile::after{
  content:""; position:absolute; inset:0;
  /* deep enough that a white caption clears 4.5:1 even over a high-key frame */
  background:linear-gradient(to top,
    rgba(24,20,18,.88) 0%, rgba(24,20,18,.66) 16%, rgba(24,20,18,.24) 34%, rgba(24,20,18,0) 52%);
  opacity:1; transition:opacity .3s ease; pointer-events:none;
}
.tile:hover::after{ opacity:1; }

.tile-cap{
  position:absolute; inset-inline:12px; inset-block-end:11px; z-index:2;
  color:#fff; font-size:.84rem; font-weight:500; text-align:start;
  text-shadow:0 1px 4px rgba(0,0,0,.4);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.tile-play{
  position:absolute; inset-block-start:50%; inset-inline-start:50%;
  transform:translate(50%, -50%);
  width:48px; height:48px; border-radius:50%; z-index:2;
  display:grid; place-items:center;
  background:rgba(255,255,255,.9); box-shadow:0 4px 16px rgba(0,0,0,.24);
  transition:transform .3s ease, background-color .25s ease;
}
.tile-play svg{ width:22px; height:22px; fill:var(--espresso);
  /* the play triangle always points right (media glyphs are not mirrored),
     so this optical nudge must be physical — margin-inline-start would
     push it the wrong way under RTL */
  margin-left:2px; }
.tile:hover .tile-play{ transform:translate(50%, -50%) scale(1.12); background:#fff; }

/* ---------- hover / long-press preview ---------- */
.tile-preview{
  position:absolute; inset:0; z-index:1;
  width:100%; height:100%; object-fit:cover;
  opacity:0; transition:opacity .28s ease;
  pointer-events:none; background:#000;
}
/* the clip still plays under reduced motion — only the crossfade is dropped */
@media (prefers-reduced-motion: reduce){
  .tile-preview{ transition:none; }
}
.tile.is-previewing .tile-preview{ opacity:1; }
/* the poster stays underneath, so a failed play just shows it again */
.tile.is-previewing .tile-play{ opacity:0; transform:translate(50%,-50%) scale(.85); }
.tile-play{ transition:transform .3s ease, background-color .25s ease, opacity .25s ease; }
/* keep the caption legible over moving footage */
.tile.is-previewing::after{ opacity:1; }

/* a long press must not select text or flash the iOS callout */
.tile{
  -webkit-touch-callout:none;
  -webkit-user-select:none; user-select:none;
}

.tile[hidden]{ display:none; }
.empty{ text-align:center; color:var(--ink-3); padding:60px 0; }

/* ---------- lightbox ---------- */
.lb[hidden]{ display:none; }   /* display:flex below would otherwise defeat [hidden] */
.lb{
  position:fixed; inset:0; z-index:200;
  background:rgba(24,20,18,.94);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  display:flex; align-items:center; justify-content:center;
  padding:64px 76px 78px;
  animation:lbin .22s ease;
}
@keyframes lbin{ from{ opacity:0 } to{ opacity:1 } }

.lb-stage{
  position:relative;
  max-width:100%; max-height:100%;
  display:flex; align-items:center; justify-content:center;
}
.lb-stage img{
  max-width:100%; max-height:100%;
  object-fit:contain;
  border-radius:var(--radius); box-shadow:0 30px 80px rgba(0,0,0,.5);
}
.lb-stage iframe{
  border:0; border-radius:var(--radius);
  box-shadow:0 30px 80px rgba(0,0,0,.5);
  background:#000;
}
.lb-spin{
  position:absolute; width:34px; height:34px; border-radius:50%;
  border:3px solid rgba(255,255,255,.22); border-top-color:#fff;
  animation:spin .8s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg) } }

.lb-close,.lb-nav{
  position:absolute; z-index:3; cursor:pointer;
  display:grid; place-items:center;
  border:1px solid rgba(255,255,255,.2); border-radius:50%;
  background:rgba(255,255,255,.1); color:#fff;
  transition:background-color .22s ease, transform .22s ease;
}
.lb-close{ inset-block-start:18px; inset-inline-end:18px; width:44px; height:44px; }
.lb-close svg{ width:20px; height:20px; fill:currentColor; }
.lb-nav{
  position:absolute; inset-block-start:50%; transform:translateY(-50%);
  width:50px; height:50px;
}
.lb-nav svg{ width:24px; height:24px; }
/* dir="rtl": inline-start IS the right edge, inline-end the left one.
   Previous belongs on the right (back), next on the left (forward) — which
   also makes each chevron point outward, and matches ArrowLeft = advance. */
.lb-prev{ inset-inline-start:16px; }
.lb-next{ inset-inline-end:16px; }
.lb-close:hover,.lb-nav:hover{ background:rgba(255,255,255,.24); }
.lb-nav:hover{ transform:translateY(-50%) scale(1.07); }
.lb-nav[disabled]{ opacity:.28; cursor:default; }
.lb-nav[disabled]:hover{ background:rgba(255,255,255,.1); transform:translateY(-50%); }

.lb-bar{
  position:absolute; inset-block-end:18px; inset-inline:0;
  display:flex; align-items:center; justify-content:center; gap:16px;
  color:rgba(255,255,255,.82); font-size:.9rem; padding-inline:20px;
}
.lb-meta{
  display:flex; align-items:center; gap:12px; margin:0;
  min-width:0; justify-content:center;
}
.lb-cap{ font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lb-count{ color:rgba(255,255,255,.5); font-variant-numeric:tabular-nums;
  direction:ltr; unicode-bidi:isolate; }  /* keep "1 / 69" from bidi-flipping */

body.lb-open{ overflow:hidden; }

/* ---------- bottom CTA ---------- */
.gal-cta{
  padding:72px 0; text-align:center;
  background:linear-gradient(135deg, rgba(196,164,132,.13), rgba(232,213,196,.22));
  border-top:1px solid rgba(196,164,132,.16);
}
.gal-cta h2{ margin-bottom:10px; }
.gal-cta p{ margin:0 0 26px; color:var(--ink-2); }
.gal-cta-btns{ display:flex; gap:14px; justify-content:center; flex-wrap:wrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px){
  .grid-photo{ columns:3 170px; }
}
@media (max-width: 780px){
  .gal-hero{ padding-top:calc(var(--header-h) + 34px); }
  /* top padding must clear the close button (18px inset + 44px tall) */
  .lb{ padding:74px 10px 96px; }
  /* in-flow inside .lb-bar so they cannot overlay the photo; RTL flex order
     already puts prev (first child) on the right */
  .lb-nav{
    position:static; transform:none; inset:auto;
    width:44px; height:44px; flex:0 0 auto;
  }
  .lb-nav:hover{ transform:none; }
  .lb-bar{ inset-block-end:22px; gap:12px; }
  .lb-meta{ flex-direction:column; gap:2px; }
}
@media (max-width: 360px){
  .container{ padding-inline:14px; }
  /* 320px viewport: 3 x 90 + 2 x 10 gap = 290 <= 292 available.
     No override for .grid-video here — the repeat(3, 1fr) below applies at
     every width up to 560, and the !important this rule used to carry would
     have beaten it. */
  .grid-photo{ columns:3; }
}
@media (max-width: 560px){
  /* Three across on a phone, the way a profile grid reads: more of the work
     visible at a glance and less scrolling through 69 tiles. An explicit
     repeat(3, 1fr) rather than auto-fill, so it is always three regardless of
     how narrow the screen is. Everything else about the tiles — the rounded
     corners, captions, gaps, shadows and the masonry flow on the photo grid —
     is deliberately unchanged. */
  .grid-video{ grid-template-columns:repeat(3, 1fr); gap:10px; }
  .grid-photo{ columns:3; column-gap:10px; }
  .grid-photo .tile{ margin-bottom:10px; }
  .tile-play{ width:40px; height:40px; }
  .tile-play svg{ width:18px; height:18px; }
  .tile-cap{ font-size:.76rem; inset-inline:9px; inset-block-end:8px; }
}

@media (prefers-reduced-motion: reduce){
  .lb{ animation:none; }
  .lb-spin{ animation:none; }
}
