/* ===========================================================================
   AL-SAEED ECONOMIC GROUP  —  pages/p-gallery.css
   ---------------------------------------------------------------------------
   Gallery. The fourteenth distinct visual key:
     Home             teal filled eyebrow, expanding six-panel strip
     About            gold filled eyebrow, timeline on one rule
     Chairman         gold-on-dark eyebrow, letter on the dark ground
     Leadership       outlined eyebrow, portrait grid with no card boxes
     Sectors          rule-and-label eyebrow, alternating full-width rows
     Sector detail    dark filled eyebrow pill, one page as a tab set
     Companies        underlined eyebrow, filterable directory of crest cards
     Projects         vertical bar eyebrow, staggered grid, caption plates
     Project detail   bracketed eyebrow, long-form copy beside a sticky rail
     Global Presence  flanking rules, two-column evidence comparison
     Sustainability   diamond marker, quadrant and an empty report table
     News             highlighter band, front page and a date-first archive
     News detail      corner ticks, no banner, a measured column with breakouts
     Gallery          a 2x2 DOT GRID glyph ahead of the label - a compound
                      mark, where every earlier one is a single shape - and
                      each album drawn as a STACK OF PRINTS: the cover photo
                      with two empty plates fanned out behind it, which fan
                      further on hover.

   This is the first page since Sectors whose content is entirely real. The
   design supplies fourteen photographs and they group themselves: six sector
   panels, five project photographs with the design's own captions, and three
   of the group itself. Three albums, and every count on the page is a count
   of files that exist.
   =========================================================================== */

.page-gallery{
  --eyebrow-fg:var(--teal-dp);
  --page-bg:var(--white);
  /* the fan direction. Transforms have no logical axis, so the sign is set
     once here and flipped for RTL rather than repeated per rule. */
  --fan:1;
  /* must be >= the largest hover offset below, or the plates escape again */
  --fan-room:2.25rem;
}
/* dir lives on <html> and .page-gallery is the <body>, so one descendant
   selector is enough */
[dir="rtl"] .page-gallery{--fan:-1}

/* The fourteenth eyebrow treatment: four dots in a square. One element and
   three box-shadows rather than four, and the only compound glyph on the
   site - a grid, which is what a gallery is. */
.page-gallery .eyebrow{
  background:none;box-shadow:none;border:0;border-radius:0;
  padding:0;gap:.625rem;
  color:var(--eyebrow-fg);
}
.page-gallery .eyebrow::before{
  content:"";flex:0 0 auto;
  width:.1875rem;height:.1875rem;
  background:currentColor;
  box-shadow:
    .3125rem 0 0 currentColor,
    0 .3125rem 0 currentColor,
    .3125rem .3125rem 0 currentColor;
  /* the glyph is 8px tall against a 11px cap height, so it needs lifting to
     sit on the label's optical centre rather than its baseline */
  transform:translateY(-.09375rem);
  margin-inline-end:.1875rem;
}
.page-gallery .eyebrow--onDark{color:var(--gold-lt)}

/* ---------------------------------------------------------------------------
   OPENING
   --------------------------------------------------------------------------- */
.holdings{background:var(--white)}
.holdings__text{
  color:var(--ink-2);font-size:var(--fs-lg);
  max-width:min(48rem,100%);margin:var(--s-3) 0 0;
}
/* what the gallery actually holds, as three counts of real files */
.counts{
  display:flex;flex-wrap:wrap;gap:var(--s-2) var(--s-4);
  margin:clamp(1.75rem,1.25rem + 2vw,2.5rem) 0 0;
  padding:0;list-style:none;
}
.counts li{
  display:flex;align-items:baseline;gap:.5rem;
  padding-inline-start:var(--s-2);
  border-inline-start:.1875rem solid var(--gold);
}
.counts b{
  font-family:var(--ff-head, inherit);font-weight:700;
  font-size:clamp(1.25rem,1.05rem + .8vw,1.625rem);
  color:var(--ink);font-variant-numeric:tabular-nums;
}
.counts span{font-size:var(--fs-sm);color:var(--muted)}

/* ---------------------------------------------------------------------------
   THE ALBUMS, AS STACKS OF PRINTS
   ---------------------------------------------------------------------------
   `clip` on the band: the plates fan out past the album's own box on hover,
   and without this a hover near the edge would widen the document.
   --------------------------------------------------------------------------- */
.albums-band{background:var(--cream);overflow-x:clip}
.albums{
  display:grid;gap:clamp(2.5rem,2rem + 3vw,4rem) var(--gutter);
  grid-template-columns:1fr;
  margin:clamp(2rem,1.5rem + 2.5vw,3.5rem) 0 0;
  padding:0;list-style:none;
}
@media (min-width:48rem){ .albums{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:62rem){ .albums{grid-template-columns:repeat(3,minmax(0,1fr))} }

.album{display:block}

/* the stack. Two pseudo-elements are the plates behind the cover; the cover
   itself is the <picture>, lifted above them. */
/* The stack reserves the room the plates fan into, rather than letting them
   escape its own box. Left to escape, the fan from one album poked into the
   next column as soon as the gutter shrank below the fan distance - the
   gutter's clamp bottoms out at 16px and the plates reach 32px on hover - and
   on the last column it ran at the container edge, where the band's
   overflow-x:clip cut it and made that one album look different from the other
   two. Logical insets, so the reserved side is the trailing one either way. */
.album__stack{
  position:relative;margin:0;
  padding-inline-end:var(--fan-room);
  padding-bottom:var(--fan-room);
}
.album__stack::before,
.album__stack::after{
  content:"";position:absolute;z-index:0;
  inset-block:0 var(--fan-room);
  inset-inline:0 var(--fan-room);
  background:var(--gold-tint);
  border:.0625rem solid var(--gold);
  border-radius:var(--r-md);
  box-shadow:0 .375rem 1rem rgba(20,17,5,.14);
  transition:transform var(--dur) var(--ease);
}
.album__stack::before{
  transform:translate(calc(.6875rem * var(--fan)),.6875rem) rotate(calc(2deg * var(--fan)));
}
.album__stack::after{
  transform:translate(calc(1.375rem * var(--fan)),1.375rem) rotate(calc(4deg * var(--fan)));
}
.album:hover .album__stack::before,
.album:focus-visible .album__stack::before{
  transform:translate(calc(1.0625rem * var(--fan)),1.0625rem) rotate(calc(3.25deg * var(--fan)));
}
.album:hover .album__stack::after,
.album:focus-visible .album__stack::after{
  transform:translate(calc(2rem * var(--fan)),2rem) rotate(calc(6.5deg * var(--fan)));
}

.album__stack picture{
  display:block;position:relative;z-index:1;
  width:100%;aspect-ratio:4/3;
  border-radius:var(--r-md);overflow:hidden;
  box-shadow:var(--sh-2);
}
.album__stack img{
  width:100%;height:100%;object-fit:cover;
  object-position:var(--focus, 50% 50%);
  transition:transform var(--dur-slow) var(--ease);
}
.album:hover .album__stack img{transform:scale(1.04)}

/* the count, sitting on the cover's leading corner */
.album__count{
  position:absolute;z-index:2;
  top:var(--s-2);inset-inline-start:var(--s-2);
  padding:.375rem .75rem;
  font-family:var(--ff-head, inherit);font-weight:700;
  font-size:var(--fs-xs);color:var(--white);
  background:rgba(20,17,5,.72);
  border-radius:var(--r-pill);
  font-variant-numeric:tabular-nums;
}

.album__body{margin-top:var(--s-3)}
.album__name{
  margin:0;font-size:var(--fs-h4);line-height:1.25;color:var(--ink);
  transition:color var(--dur-fast) var(--ease);
}
.album:hover .album__name{color:var(--gold-dk)}
.album__text{
  margin:.5rem 0 0;font-size:var(--fs-sm);color:var(--muted);
}
.album__more{
  display:inline-flex;align-items:center;gap:.5rem;
  margin-top:var(--s-2);
  font-family:var(--ff-head, inherit);
  font-size:var(--fs-sm);font-weight:600;color:var(--ink);
}
.album__more svg{
  width:1rem;height:1rem;flex:0 0 auto;
  fill:none;stroke:var(--gold-btn);stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round;
  transition:transform var(--dur-fast) var(--ease);
}
.album:hover .album__more{color:var(--gold-dk)}
.album:hover .album__more svg{transform:translateX(calc(.1875rem * var(--fan)))}

/* ---------------------------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .album__stack::before,
  .album__stack::after,
  .album__stack img,
  .album__name,
  .album__more svg{transition:none}
  .album:hover .album__stack::before,
  .album:hover .album__stack::after{transform:none}
  .album:hover .album__stack img{transform:none}
}
