/* Photo gallery: /gallery, /gallery/<category>, and the homepage
   "Recent work" strip. Data: /website/data/gallery.json, written by
   scripts/sync-photos.mjs. Behavior: /website/gallery.js. Tokens come from
   /brand/colors_and_type.css (paper #fdfcf8, steel blue #4c6b8a, sky #9cd2e4). */

/* site.css pads every <section> 84px; these set their own spacing. */
.gallery-hero, .gallery, .gallery-cat { padding: 0; }
.gallery-hero { background: var(--bg-dusk); color: var(--fg-on-dark, #eef2f6); position: relative; }
.gallery-hero::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--horizon); }
.gallery-hero .wrap { padding-top: 64px; padding-bottom: 48px; }
.gallery-hero .overline { color: var(--sky-300); }
.gallery-hero h1 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(34px, 5.4vw, 56px); line-height: 1.02; letter-spacing: 0.005em; margin-top: 12px; }
.gallery-hero .tag { font-family: var(--font-serif); font-style: italic; font-size: clamp(17px, 2.2vw, 21px);
  color: rgba(238,242,246,0.86); margin-top: 14px; max-width: 640px; }

.gallery-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.gallery-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(156,210,228,0.35); color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.gallery-tabs a span { font-family: var(--font-mono); font-size: 11px; color: var(--sky-300); }
.gallery-tabs a:hover { border-color: var(--sky-300); }
.gallery-tabs a[aria-current="page"] { background: var(--sky-300); border-color: var(--sky-300); color: var(--ink); }
.gallery-tabs a[aria-current="page"] span { color: var(--steel-700); }

.gallery { background: var(--paper); }
.gallery .wrap { padding-top: 48px; padding-bottom: 72px; }
.gallery-cat + .gallery-cat { margin-top: 56px; }
.gallery-cat h2 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(24px, 3vw, 32px); color: var(--fg1); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gallery-cat h2 a { color: inherit; text-decoration: none; }
.gallery-cat h2 a:hover { color: var(--steel-blue); }
.gallery-cat .count { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--steel-500); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.gallery-grid figure { margin: 0; }
.gallery-grid button { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--paper-3); overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; }
.gallery-grid button:focus-visible { outline: 3px solid var(--sky-400); outline-offset: 2px; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.gallery-grid button:hover img { transform: scale(1.03); }
.gallery-grid figcaption { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--steel-500);
  margin-top: 6px; }

.gallery-empty { max-width: 620px; color: var(--fg2); font-size: 16px; line-height: 1.6; }
.gallery-empty .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.gallery-back { display: inline-block; margin-top: 26px; font-weight: 600; color: var(--steel-600); }

/* Static copy below the photos (readable without JavaScript) */
.gallery-about { padding: 0; background: var(--paper-2); border-top: 1px solid var(--divider); }
.gallery-about .wrap { padding-top: 44px; padding-bottom: 52px; }
.gallery-about h2 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 22px; color: var(--fg1); }
.gallery-about p { color: var(--fg2); font-size: 15.5px; line-height: 1.6; margin-top: 12px; max-width: 68ch; }
.gallery-about a { color: var(--steel-600); font-weight: 600; }

/* Lightbox */
.gallery-box { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1600px); max-height: 96vh; }
.gallery-box::backdrop { background: rgba(11,16,21,0.92); }
.gallery-box figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.gallery-box img { max-width: min(96vw, 1600px); max-height: calc(96vh - 56px); width: auto; height: auto; display: block; }
.gallery-box figcaption { color: #eef2f6; font-size: 14px; margin-top: 10px; text-align: center; padding: 0 56px; }
.gallery-box .gb-btn { position: fixed; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3); background: rgba(20,30,42,0.7); color: #fff; font-size: 22px; cursor: pointer; }
.gallery-box .gb-prev { left: 14px; }
.gallery-box .gb-next { right: 14px; }
.gallery-box .gb-close { top: 16px; right: 16px; transform: none; }
.gallery-box .gb-btn:hover { border-color: var(--sky-300); }

/* Homepage strip: hidden until there are photos to show */
.gallery-strip { background: var(--paper-2); border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.gallery-strip .gallery-grid { margin-top: 34px; }
.gallery-strip .strip-cta { margin-top: 26px; }

@media (max-width: 760px) {
  .gallery-hero .wrap { padding-top: 40px; padding-bottom: 32px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery-box .gb-prev, .gallery-box .gb-next { top: auto; bottom: 14px; transform: none; }
  .gallery-box figcaption { padding: 0 8px 56px; }
}
@media (prefers-reduced-motion: reduce) { .gallery-grid img { transition: none; } }
