/* ============================================================
 * Kelid Tehran 70.0.0 — s70-gallery.css
 * Gallery elevation: cinematic frame treatment — film-frame
 * hairline, glass frame-number chip, refined captions.
 * Enqueued AFTER corp-sections-b.css; matching selectors win ties.
 * Mobile-first, 390px master. Restrained motion: hover zoom only
 * on fine pointers; r-stagger reveal handled elsewhere.
 * ============================================================ */

/* ---------- film frame ---------- */
.cb2-gallery .cb2-gitem{
  border-radius:18px;
  background:linear-gradient(165deg,rgba(255,255,255,.05),rgba(255,255,255,.015));
  transition:border-color 200ms var(--cb2-ease),transform 200ms var(--cb2-ease);
}
.cb2-gallery .cb2-gitem__thumb{
  background:var(--kt-surface1);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.05); /* film-frame hairline */
}
.cb2-gallery .cb2-gitem__thumb img{filter:saturate(.94);transition:transform 260ms var(--cb2-ease),filter 260ms var(--cb2-ease)}

/* ---------- frame number chip: REMOVED (markup deleted 71.3.58) ----------
   70.0.0 loop7 (critique C-GAL-1): the decorative ordinal chip
   (aria-hidden in markup) stamped a gold pill + backdrop-blur on EVERY
   frame — pure ornament that never earned its pixels, plus a per-frame
   compositing cost on mobile. Luxury grids don't number their frames.
   71.3.58: the display:none spans were deleted from section-gallery.php
   (-9 nodes); the display:none rule below is no longer needed. */

/* ---------- captions ---------- */
.cb2-gallery .cb2-gitem__cap{padding:14px 16px 15px}
.cb2-gallery .cb2-gitem__title{
  margin:0 0 3px;font-size:14.5px;font-weight:800;line-height:1.9;
  color:var(--cb2-ink);text-wrap:balance;
}
.cb2-gallery .cb2-gitem__desc{
  margin:0;font-size:12.5px;line-height:1.95;color:var(--cb2-muted);
}

/* ---------- more link: quiet, centered, 48px touch ---------- */
.cb2-gallery .cb2-gallery__more{margin-block-start:22px}
.cb2-gallery .cb2-gallery__more .cb2-quiet-link{
  font-size:14.5px;min-height:48px;
  border-block-end:1px solid transparent;
  transition:opacity 180ms var(--cb2-ease),border-color 180ms var(--cb2-ease);
}
.cb2-gallery .cb2-gallery__more .cb2-quiet-link:focus-visible{
  outline:2px solid var(--cb2-gold-ink);outline-offset:4px;border-radius:8px;
}

@media(min-width:640px){
  .cb2-gallery .cb2-gallery__grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
  .cb2-gallery .cb2-gitem--wide{grid-column:span 2}
  .cb2-gallery .cb2-gitem--wide .cb2-gitem__thumb{aspect-ratio:21/10}
}

/* ---------- loop9: desktop bento mosaic (≥1024px only) ----------
   Bento canon applied: ONE oversized feature cell per grid (the first
   figure = gallery-smart «عیب‌یابی قفل هوشمند»), varied spans, tight
   16px gutters, asymmetric rhythm. Default row auto-flow is KEPT —
   grid-auto-flow:dense is FORBIDDEN (it would reorder visual vs DOM
   and break tab order), so DOM order = visual order = tab order.
   This block RESTORES the 4-col desktop layout that corp-sections-b.css
   declared at 1024px (s70's 640px 3-col rule currently wins it).
   Slot math with all 9 files rendered: 2×2 feature (4 slots) + 8 singles
   = 12 slots = 3 full rows. The wide night span is NEUTRALIZED here —
   keeping it would spend 13 slots and tail one orphan figure on row 4.
   Fewer-files case: the grid degrades to an ordinary auto-flow grid
   (feature stays :first-child of whatever renders) — no gaps, no dense. */
@media(min-width:1024px){
  .cb2-gallery .cb2-gallery__grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
  .cb2-gallery .cb2-gitem:first-child{grid-column:span 2;grid-row:span 2}
  /* feature thumb fills the 2-row track; caption stays BELOW the image
     (existing caption pattern) — no text/image collision possible */
  .cb2-gallery .cb2-gitem:first-child{display:flex;flex-direction:column}
  .cb2-gallery .cb2-gitem:first-child .cb2-gitem__thumb{flex:1 1 auto;aspect-ratio:auto;min-height:0}
  .cb2-gallery .cb2-gitem--wide{grid-column:span 1}
  .cb2-gallery .cb2-gitem--wide .cb2-gitem__thumb{aspect-ratio:4/3}
}

/* ---------- 71.3.18: gallery tidy (owner order «اینجا هم مرتب کن») ----------
   Tablet (640–1024px, 3 cols): neutralize the wide night span. 8 singles + one
   2-slot wide = 10 slots, which can never fill 3-col rows and always strands an
   orphan; span 1 gives a clean 3×3 grid. (Desktop bento already neutralizes it;
   mobile 2-col is fixed by the DOM reorder in section-gallery.php.)
   Even caption rhythm: reserve two desc lines so paired cards align. */
@media(min-width:640px) and (max-width:1023.98px){
  .cb2-gallery .cb2-gitem--wide{grid-column:span 1}
  .cb2-gallery .cb2-gitem--wide .cb2-gitem__thumb{aspect-ratio:4/3}
}
.cb2-gallery .cb2-gitem__desc{min-height:3.9em}

/* ---------- hover (fine pointers only) ---------- */
@media(hover:hover) and (pointer:fine){
  .cb2-gallery .cb2-gitem:hover{
    border-color:var(--cb2-gold-line);
    transform:translateY(-3px);
  }
  .cb2-gallery .cb2-gitem:hover .cb2-gitem__thumb img{
    transform:scale(1.05);filter:saturate(1);
  }
  .cb2-gallery .cb2-gallery__more .cb2-quiet-link:hover{
    opacity:1;border-block-end-color:var(--cb2-gold-line);
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion:reduce){
  .cb2-gallery .cb2-gitem,
  .cb2-gallery .cb2-gitem__thumb img,
  .cb2-gallery .cb2-gallery__more .cb2-quiet-link{transition:none}
  .cb2-gallery .cb2-gitem:hover{transform:none}
  .cb2-gallery .cb2-gitem:hover .cb2-gitem__thumb img{transform:none}
}
