/* Crown Slabs — GALLERY
   ══════════════════════════════════════════════════════════
   The plate grid, the filter chips and the lightbox. Loaded
   after styles.css and pages.css on gallery.html only.

   The page shell — .pg__head / .pg__body / .pg__tail — is in
   pages.css, shared with every other interior page. Only the
   components that exist nowhere else are here, which is also
   why this is its own file rather than a third section of
   pages.css: the gallery and the contact page are worked on
   separately and neither should be able to overwrite the
   other's components.

   Nothing here restates a token, a type step, a button or the
   plate frame's colours beyond what a <button> needs to stop
   looking like a control.                                  */

/* The page ends on the grid now that the hand-back band is
   gone, so the body pays for the air the tail used to put
   between the last plate and the footer's rule. */
.pg__body{padding-bottom:clamp(72px,9vw,124px)}

/* ══ FILTER BAR ════════════════════════════════════════════
   Chips carry the header nav's language — caps at a hairline
   weight, the current one lit rather than filled, so pressing
   one never repaints a block of colour into the page.      */
.gal__bar{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;
  gap:16px 24px;margin-bottom:clamp(26px,3.4vw,40px);
}
.gal__filters{display:flex;flex-wrap:wrap;gap:8px}
.chip{
  appearance:none;background:oklch(0.30 0.03 62 / .16);
  border:1px solid var(--hair);border-radius:2px;
  height:38px;padding:0 16px;cursor:pointer;
  font-size:.6875rem;letter-spacing:.16em;text-transform:uppercase;color:var(--ink-3);
  transition:color var(--t-micro),border-color var(--t-micro),background var(--t-micro);
}
.chip:hover{color:var(--ink);border-color:oklch(0.885 0.062 84 / .45)}
.chip.is-on{
  color:var(--void);border-color:transparent;
  background:linear-gradient(180deg,oklch(0.99 0 0),oklch(0.90 0.012 50));
}
.gal__count{
  font-family:var(--mono);font-size:.6875rem;letter-spacing:.14em;
  text-transform:uppercase;color:var(--ink-3);
}
/* Five chips do not fit one line on a phone, and once they wrap
   the count is thrown to the far side of a two-line row with
   nothing beside it. Stack it under them instead, where it reads
   as the answer to the chip that was just pressed. */
@media(max-width:599px){
  .gal__bar{flex-direction:column;align-items:flex-start;gap:14px}
  .chip{height:34px;padding:0 13px;font-size:.625rem;letter-spacing:.14em}
}

/* ══ THE GRID ══════════════════════════════════════════════
   Two up on a phone, three from 760. A wide plate spans two
   columns: full width of the grid on a phone, two thirds of
   the row above it.

   Filtering is a class, never a re-order — see gallery.js. */
.gal{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:clamp(16px,2.2vw,30px);align-items:start;
}
/* Three across only from 900. A tablet in portrait is a wide
   screen by pixel count and a narrow one by hand: three columns
   at 768 put a 215px plate on a 768px screen — smaller, in real
   terms, than the two-up on a phone. Two columns there give the
   same plate 350px. */
@media(min-width:900px){.gal{grid-template-columns:repeat(3,minmax(0,1fr))}}
.gal__i{margin:0;display:flex;flex-direction:column;gap:12px;min-width:0}
.gal__i[data-w="wide"]{grid-column:span 2}
.gal__i.is-off{display:none}

/* The button IS the plate: the same hairline frame and machined
   2px radius as every delivered shot on the homepage, which is
   why the .plate colours are repeated here rather than the class
   being reused — a <button> has to have its own appearance,
   padding and border zeroed first, and .plate carries none of
   that. Cropping is what keeps a mixed set of portrait and
   landscape sources reading as one catalogue; the cut-outs and
   the fit drawing are the exceptions and are shown whole
   (data-fit="contain").                                    */
.gal__open{
  appearance:none;padding:0;cursor:zoom-in;display:block;width:100%;
  position:relative;overflow:hidden;border-radius:2px;
  border:1px solid oklch(0.32 0.03 62 / .55);
  background:var(--void);
  box-shadow:0 1px 0 oklch(1 0 0 / .05) inset, 0 18px 40px -26px oklch(0.06 0.02 65);
  aspect-ratio:4/5;
  transition:transform 340ms var(--expo),border-color 340ms var(--expo),box-shadow 340ms var(--expo);
}
.gal__i[data-w="wide"] .gal__open{aspect-ratio:16/10}
.gal__open picture{display:contents}
.gal__open img{width:100%;height:100%;object-fit:cover;object-position:50% 46%;
  transition:transform 640ms var(--expo)}
.gal__i[data-fit="contain"] .gal__open img{object-fit:contain;padding:clamp(10px,2vw,22px)}

/* the same lift and specular sweep the grails shelf uses, so a
   plate here behaves like a plate there */
.gal__open::after{
  content:"";position:absolute;inset:0;width:32%;pointer-events:none;z-index:2;
  background:linear-gradient(105deg,transparent,oklch(0.99 0 0 / .16),transparent);
  transform:translateX(-170%) skewX(-12deg);
}
/* Behind (hover:hover): a tap on a touch screen leaves :hover
   latched on the plate that was tapped, so the lift and the
   specular sweep would still be on it when the viewer closes.
   Keyboard focus keeps both — it is a real, reversible state. */
.gal__open:focus-visible,
.gal__open:is(:hover){
  transform:translateY(-6px);
  border-color:oklch(0.885 0.062 84 / .55);
  box-shadow:0 1px 0 oklch(1 0 0 / .07) inset,
             0 30px 60px -26px oklch(0.06 0.02 65),
             0 20px 46px -20px oklch(0.86 0.13 215 / .28);
}
.gal__open:focus-visible::after{animation:sweep 760ms var(--expo) forwards}
@media(hover:none){
  .gal__open:hover{transform:none;border-color:oklch(0.32 0.03 62 / .55);
    box-shadow:0 1px 0 oklch(1 0 0 / .05) inset, 0 18px 40px -26px oklch(0.06 0.02 65)}
  .gal__open:hover img{transform:none}
  .gal__i:hover figcaption b{color:var(--ink)}
}
@media(hover:hover){
  .gal__open:hover::after{animation:sweep 760ms var(--expo) forwards}
  .gal__open:hover img{transform:scale(1.04)}
}

.gal__i figcaption{display:flex;flex-direction:column;gap:5px;min-width:0}
.gal__i figcaption b{
  font-family:var(--display);font-weight:400;font-size:.9375rem;letter-spacing:.01em;
  color:var(--ink);transition:color var(--t-micro);
}
.gal__i figcaption span{
  font-family:var(--mono);font-size:.625rem;letter-spacing:.16em;
  text-transform:uppercase;color:var(--ink-3);
}
.gal__i:hover figcaption b{color:var(--champagne)}
.gal__empty{color:var(--ink-3);font-size:.9375rem;padding:40px 0}
.gal__empty[hidden]{display:none}

/* the reveal fires per figure; stagger it across a row */
.gal__i:nth-child(3n+2){animation-delay:80ms}
.gal__i:nth-child(3n+3){animation-delay:160ms}

/* ══ LIGHTBOX ══════════════════════════════════════════════
   Built on the homepage viewer's frame: the same scrim, the
   same close button, the same page lock. What is new is paging
   — arrows, keys and swipe move through whatever the filter is
   currently showing, so the viewer never walks into a plate
   the grid behind it has hidden.                           */
.lb{
  position:fixed;inset:0;z-index:var(--z-zoom);display:grid;place-items:center;
  opacity:0;transition:opacity 260ms var(--expo);
}
.lb[hidden]{display:none}
.lb.is-in{opacity:1}
.lb__scrim{position:absolute;inset:0;background:oklch(0.06 0.014 62 / .94);backdrop-filter:blur(10px)}
.lb__panel{
  position:relative;z-index:1;width:min(1360px,96vw);
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;
  column-gap:clamp(8px,2vw,26px);row-gap:18px;
  transform:translateY(10px);transition:transform 320ms var(--expo);
}
.lb.is-in .lb__panel{transform:none}
.lb__x{position:absolute;top:0;right:0;transform:translateY(-140%)}
.lb__nav{
  appearance:none;background:oklch(0.30 0.03 62 / .22);
  border:1px solid var(--hair);border-radius:2px;color:var(--ink-2);
  width:46px;height:74px;display:grid;place-items:center;cursor:pointer;
  transition:color var(--t-micro),border-color var(--t-micro),background var(--t-micro),opacity var(--t-micro);
}
.lb__nav svg{width:15px;height:15px}
.lb__nav:hover,.lb__nav:focus-visible{color:var(--champagne);border-color:var(--champagne)}
/* one plate in the filtered set: there is nowhere to page to */
.lb__nav[disabled]{opacity:.25;cursor:default}
.lb__nav[disabled]:hover{color:var(--ink-2);border-color:var(--hair)}
.lb__stage{
  margin:0;display:flex;align-items:center;justify-content:center;min-width:0;
  outline:0;touch-action:pan-y;
}
.lb__stage picture{display:contents}
.lb__stage img{
  width:auto;max-width:100%;max-height:min(74svh,860px);object-fit:contain;
  border:1px solid oklch(0.32 0.03 62 / .55);border-radius:2px;background:var(--void);
  box-shadow:0 30px 80px -40px oklch(0.02 0 0);
}
.lb__cap{
  grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:baseline;
  justify-content:space-between;gap:8px 24px;
}
.lb__t{font-family:var(--display);font-size:1.0625rem;letter-spacing:.01em;color:var(--ink)}
.lb__m{
  display:flex;gap:18px;font-family:var(--mono);font-size:.6875rem;
  letter-spacing:.16em;text-transform:uppercase;color:var(--ink-3);
}
.lb__n{color:var(--champagne);font-weight:400}

/* On a phone the side buttons would eat the plate, so they drop
   under it as a pair and the swipe carries most of the paging. */
@media(max-width:699px){
  .lb__panel{grid-template-columns:minmax(0,1fr);width:92vw}
  .lb__stage{grid-column:1;grid-row:1}
  .lb__nav{height:52px}
  .lb__nav--prev{grid-column:1;grid-row:2;justify-self:start}
  .lb__nav--next{grid-column:1;grid-row:2;justify-self:end}
  .lb__cap{grid-row:3}
  .lb__x{transform:translateY(-130%)}
  .lb__stage img{max-height:62svh}
}

/* A landscape phone is 390px tall: the plate, two buttons and a
   caption cannot each have their own band. Give the image what
   is left after the chrome and tighten the caption onto one
   line. Keyed on height, not width — an iPad in landscape is
   1024 wide and only 768 tall. */
@media(max-height:560px){
  .lb__stage img{max-height:calc(100svh - 190px)}
  .lb__nav{height:44px}
  .lb__panel{row-gap:12px}
  .lb__cap{font-size:.9375rem}
  .lb__t{font-size:.9375rem}
}

@media(prefers-reduced-motion:reduce){
  .gal__open,.gal__open img,.lb,.lb__panel{transition:none}
  .gal__open:hover,.gal__open:hover img{transform:none}
  .gal__open:hover::after,.gal__open:focus-visible::after{animation:none}
}
