/* Gallery components. Structure replicates the reference gallery (two-column
   cluster grid, hero plus square thumb row, masonry project view, lightbox);
   the design language is M2's, taken from site.css tokens. */

.gwrap{max-width:1580px;margin:0 auto;padding:0 34px}
.gwrap.proj{max-width:var(--maxw);padding-top:56px;padding-bottom:80px}

/* ── Two-column cluster grid ─────────────────────────────── */
.pgrid{display:grid;grid-template-columns:1fr 1fr;column-gap:56px;row-gap:0;align-items:start}
.gcluster{display:block;padding:76px 0;border-top:1px solid var(--line);position:relative}
.pgrid .gcluster:nth-child(-n+2){border-top:0}
.gcluster-link{display:block}
.gcluster-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:24px}
.gcluster-head h2{font-size:clamp(1.6rem,3vw,2.3rem);font-weight:800;letter-spacing:-.015em;transition:color .25s}
.gcount{display:block;margin-top:8px;font-size:.72rem;letter-spacing:.16em;text-transform:uppercase;font-weight:700;color:var(--muted-2)}
.gcta-link{font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;font-weight:700;color:var(--rust);display:inline-flex;align-items:center;gap:9px;white-space:nowrap}
.gcta-link svg{width:15px;height:15px;transition:transform .25s}
.gcluster-link:hover .gcta-link svg{transform:translateX(6px)}
.gcluster-link:hover .gcluster-head h2,.gcluster-link:hover .gname-col h2{color:var(--rust)}
.gcluster-body{display:flex;flex-direction:column;gap:12px}
.ghero{width:100%;overflow:hidden;background:var(--cream)}
.ghero img{display:block;width:100%;height:auto;transition:transform .7s ease}
.gcluster-link:hover .ghero img{transform:scale(1.02)}
.gtiles{display:flex;flex-wrap:wrap;gap:12px}
.gtile{flex:1 1 150px;aspect-ratio:1/1;min-width:110px;position:relative;overflow:hidden;background:var(--cream)}
.gtile img{width:100%;height:100%;object-fit:cover;transition:transform .7s ease}
.gcluster-link:hover .gtile img{transform:scale(1.045)}

/* ── Portrait-hero variant: name column beside the hero column ── */
.gcluster-split{display:flex;gap:32px;align-items:center}
.gname-col{flex:0 0 30%;min-width:0}
.gname-col h2{font-size:clamp(1.6rem,3vw,2.2rem);font-weight:800;letter-spacing:-.015em;margin:12px 0 10px;transition:color .25s}
.gname-col .gcount{margin-bottom:16px}
.ghero-col{flex:1;display:flex;flex-direction:column;gap:12px;min-width:0}
.ghero-col .gtiles{flex-wrap:nowrap}
.ghero-col .gtile{flex:1 1 90px;min-width:70px}

/* ── Project view ────────────────────────────────────────── */
.phero-proj .backlink{display:inline-block;margin-top:22px;font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;font-weight:700;color:var(--white);border-bottom:2px solid var(--rust-l);padding-bottom:4px}
.phero-proj .backlink:hover{color:var(--rust-l)}
.subhead{display:flex;align-items:center;gap:16px;margin:56px 0 24px}
.subhead span{font-size:.72rem;letter-spacing:.24em;text-transform:uppercase;font-weight:700;color:var(--muted)}
.subhead::after{content:"";flex:1;height:1px;background:var(--line)}
/* Column count is emitted per block as --mc, capped so a short set never leaves
   an empty column the way a fixed count would. */
.masonry{columns:var(--mc,4);column-gap:14px}
.masonry .mitem{display:block;width:100%;padding:0;border:0;background:var(--cream);margin-bottom:14px;position:relative;overflow:hidden;break-inside:avoid;font:inherit;color:inherit;text-align:left}
.masonry img{width:100%;height:auto;transition:transform .6s ease}
.masonry .mitem:hover img{transform:scale(1.05)}
.con .masonry img{filter:grayscale(.2)}
.con .masonry .mitem:hover img{filter:grayscale(0)}

/* ── Lightbox ────────────────────────────────────────────── */
#lb{position:fixed;inset:0;z-index:1200;background:rgba(6,6,8,.95);display:none;align-items:center;justify-content:center;padding:30px}
#lb.open{display:flex}
#lb img{max-width:92vw;max-height:88vh}
#lb .x{position:absolute;top:20px;right:26px;font-size:2.4rem;color:var(--white);cursor:pointer;line-height:1}
#lb .arw{position:absolute;top:50%;transform:translateY(-50%);color:var(--white);cursor:pointer;padding:12px 20px;user-select:none}
#lb .arw svg{width:34px;height:34px;stroke:var(--white);fill:none;stroke-width:2}
#lb .prev{left:6px}#lb .next{right:6px}
#lb .lb-id{position:absolute;left:22px;bottom:18px;font-size:.62rem;letter-spacing:.16em;text-transform:uppercase;font-weight:700;color:rgba(255,255,255,.62);user-select:all}

@media(max-width:1000px){
  .masonry{columns:var(--mc-md,3)}
}
@media(max-width:960px){
  .pgrid{grid-template-columns:1fr}
  .pgrid .gcluster:nth-child(-n+2){border-top:1px solid var(--line)}
  .pgrid .gcluster:first-child{border-top:0}
}
@media(max-width:800px){
  .gcluster-split{flex-direction:column;align-items:stretch;gap:18px}
  .gname-col{width:100%}
  .ghero-col .gtile{flex-basis:70px;min-width:56px}
}
@media(max-width:640px){
  .gwrap{padding:0 20px}
  .gcluster{padding:52px 0}
  .gcluster-body,.gtiles,.ghero-col{gap:10px}
  /* Four preview tiles must stay on one line. As flex items they were 4x90px
     plus gaps against a 390px content box, so the fourth wrapped and then grew
     to full width, matching the hero. */
  .gtiles{display:grid;grid-template-columns:repeat(4,1fr)}
  .gtile{flex:none;min-width:0}
  .ghero-col .gtile{flex-basis:70px;min-width:56px}
  .gcluster-head{flex-direction:column;align-items:flex-start;gap:10px}
  .masonry{columns:var(--mc-sm,2);column-gap:10px}
  .masonry .mitem{margin-bottom:10px}
}
