/* Gallery — full-bleed photo hero (TMJ hero idiom: anthracite overlay,
   off-white heading, sand lede), intro strip, pill filters,
   dense mosaic grid. Backdrop is the first frame of the current view;
   solid anthracite when the archive is empty/unavailable. */
.gx-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 68vh;
  background: var(--color-bg-dark) center / cover no-repeat;
  padding: var(--space-10) 0 var(--space-8);
  overflow: hidden;
}
.gx-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tmj-anthracite) 15%, transparent) 0%, color-mix(in srgb, var(--tmj-anthracite) 38%, transparent) 55%, color-mix(in srgb, var(--tmj-anthracite) 88%, transparent) 100%);
}
.gx-hero .container { position: relative; z-index: 1; }
.gx-eyebrow {
  margin: 0 0 var(--space-3);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tmj-sand);
}
.gx-hero h1 { font-size: var(--text-hero); color: var(--tmj-off-white); margin: 0 0 var(--space-3); max-width: 900px; }
.gx-lede { font-size: var(--text-lede); color: var(--tmj-sand); max-width: 680px; margin: 0; }

/* Intro strip — quote voice + live archive stats, sand keyline below. */
.gx-intro { background: var(--color-bg); border-bottom: 1px solid var(--color-border); padding: var(--space-8) 0 var(--space-7); }
.gx-intro-in { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-7); }
.gx-intro h2 { font-size: var(--text-pullquote); margin: 0; max-width: 20ch; }
.gx-intro-body p { font-size: var(--text-small); color: var(--color-text-secondary); margin: 0; max-width: 680px; }

.gx-archive { background: var(--color-bg); padding: var(--space-6) 0 var(--space-8); }

/* Filters as pills (documented departure from the editorial text-filter
   idiom: a dense mosaic needs one compact control row). Links stay plain
   ?cat= for crawlability; active is an anthracite fill. Static row — the
   sticky site header already owns the viewport top. */
.gx-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.gx-pills a {
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
}
.gx-pills a:hover { border-color: var(--color-text); }
.gx-pills a[aria-current="true"] { background: var(--tmj-anthracite); border-color: var(--tmj-anthracite); color: var(--tmj-off-white); }
.gx-pills span { opacity: 0.6; font-size: var(--text-caption); }
/* Archive strip — viewer-only extra photos. Hidden for single-photo stories. */
.gx-thumbs { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-3); margin-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
.gx-thumbs a, .gx-thumbs button { flex: 0 0 auto; border: 2px solid transparent; background: none; padding: 0; cursor: pointer; border-radius: var(--radius-sm); line-height: 0; }
.gx-thumbs [aria-current="true"] { border-color: var(--tmj-yellow); }
.gx-thumbs img { display: block; width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }
.gx-meta .gx-count { margin: 0 0 var(--space-2); }
.gx-showing { margin: 0 0 var(--space-4); font-size: var(--text-caption); color: var(--color-text-secondary); }
.gx-empty a { color: var(--color-text); font-weight: 700; }

.gx-empty { font-size: var(--text-lede); color: var(--color-text-secondary); max-width: 680px; }

/* Mosaic gallery — 6 tracks desktop / 4 tablet / 2 mobile with short fixed
   rows (150px-class content minimums, documented per governance rule 2),
   so every tile stays compact and the page reads as a gallery, not an
   article archive. Featured tiles anchor at 2x2; nothing spans wider.
   Radius-md, not lg: dense mosaic at lg rounds reads noisy — documented.
   No captions below the frame: title + category live as a bottom overlay,
   revealed on hover/focus, always visible on touch layouts. */
.gx-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 150px;
  gap: var(--space-3);
  grid-auto-flow: dense;
}
.gx-card { margin: 0; position: relative; }
.span-2x2 { grid-column: span 2; grid-row: span 2; }
.span-2x1 { grid-column: span 2; }
.span-1x2 { grid-row: span 2; }
.gx-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-secondary);
}
.gx-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-frame:hover img { transform: scale(1.045); }
.gx-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: linear-gradient(transparent, color-mix(in srgb, var(--tmj-anthracite) 82%, transparent));
  color: var(--tmj-off-white);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-frame:hover .gx-cap, .gx-frame:focus-visible .gx-cap { opacity: 1; transform: none; }
.gx-cap .gx-cat {
  margin: 0;
  font-size: var(--text-fine);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tmj-sand);
}
/* Sheet-bar share (popup + standalone) — ghost circle beside Close. */
.gx-bar-act {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.gx-sharebtn {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-sharebtn:hover { background: var(--color-bg-secondary); }
.gx-sharebtn:focus-visible { outline: 3px solid var(--tmj-yellow); outline-offset: 2px; }
.gx-sharebtn svg { width: 16px; height: 16px; }
/* Standalone page: View-all replaces Close in the bar (same destination). */
.gx-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-weight: 700;
  font-size: var(--text-small);
  text-decoration: none;
  white-space: nowrap;
  transition: background 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-all:hover { background: var(--color-bg-secondary); }
.gx-all:focus-visible { outline: 3px solid var(--tmj-yellow); outline-offset: 2px; }
/* Per-story share — sibling of the frame anchor (never nested), same
   reveal idiom as the caption: hover/focus-within on desktop, always on touch. */
.gx-share {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--tmj-sand);
  color: var(--tmj-anthracite);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-card:hover .gx-share, .gx-card:focus-within .gx-share { opacity: 1; transform: none; }
.gx-share:hover { background: var(--tmj-yellow); }
.gx-share:focus-visible { outline: 3px solid var(--tmj-yellow); outline-offset: 2px; opacity: 1; transform: none; }
.gx-share svg { width: 16px; height: 16px; }
/* Featured marker — sand pill, anthracite text (13.4:1), the one chip that
   explains why a tile anchors the mosaic at 2x2. */
.gx-feat {
  align-self: flex-start;
  font-size: var(--text-fine);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tmj-anthracite);
  background: var(--tmj-sand);
  border-radius: var(--radius-pill);
  padding: 2px var(--space-2);
}
.gx-cap-title {
  font-size: var(--text-caption);
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Story viewer — fullscreen split: photograph left, story right. The overlay
   itself never scrolls; only the details column may scroll internally on short
   screens. One overlay, two drivers: the server-rendered ?photo= fallback
   (no JS) and the JS dialog share these classes. z-60 sits above the sticky
   header (50) so the sheet owns the viewport. */
.gx-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--tmj-anthracite);
  overflow: hidden;
  padding: 0;
}
.gx-lightbox[hidden] { display: none; }
.gx-sheet {
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  background: var(--color-bg);
  display: grid;
  /* Breathing split (documented motion exception): the photograph column
     widens when the story collapses and yields when it expands — one
     transition carries the whole viewer, nothing else animates. */
  grid-template-columns: 1.7fr 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  transition: grid-template-columns 350ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-sheet.story-open { grid-template-columns: 1.15fr 1fr; }
.gx-bar { grid-column: 2; grid-row: 1; display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
.gx-count { margin: 0; font-size: var(--text-small); color: var(--color-text-secondary); }
.gx-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font-size: var(--text-body);
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.gx-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--color-text);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
/* Stage: the photograph cell. Thumbs float over its bottom-right corner on a
   quiet dark chip — no separate strip area anywhere. */
.gx-stage {
  grid-column: 1;
  grid-row: 1 / -1;
  position: relative;
  min-height: 0;
  background: var(--color-bg-dark);
}
.gx-photo {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}
.gx-stage .gx-thumbs {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  max-width: calc(100% - var(--space-6));
  margin: 0;
  border: 0;
  background: color-mix(in srgb, var(--tmj-anthracite) 78%, transparent);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
}
.gx-stage .gx-thumbs img { width: 40px; height: 30px; }
.gx-meta {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-6) var(--space-6);
}
.gx-meta .gx-cat {
  margin: 0 0 var(--space-1);
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}
.gx-meta h2 { font-size: var(--text-h3); margin: 0 0 var(--space-2); }
/* Story expander — compact by default on phones, full on desktop (JS sets
   the initial state; no-JS renders open via the attribute). */
.gx-more { margin-top: var(--space-2); }
.gx-more > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-weight: 700;
  font-size: var(--text-small);
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
}
.gx-more > summary::-webkit-details-marker { display: none; }
.gx-more > summary::after { content: "↓"; color: var(--tmj-terracotta); font-weight: 700; }
.gx-more[open] > summary::after { content: "↑"; }
.gx-story { font-size: var(--text-body); max-width: 680px; overflow-wrap: anywhere; }
/* Editorial signature, reused from story prose: terracotta drop-cap opens the
   visual story. Same 3.74em exception, same meaning (people/stories accent). */
.gx-story::first-letter {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 3.74em;
  line-height: 0.9;
  float: left;
  margin: var(--space-1) var(--space-2) 0 0;
  color: var(--tmj-terracotta);
}
.gx-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.gx-tags span {
  font-size: var(--text-small);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
}
.gx-facts { display: grid; gap: var(--space-2); margin: var(--space-4) 0 0; padding: 0; }
.gx-facts div { display: grid; grid-template-columns: 160px 1fr; gap: var(--space-3); font-size: var(--text-small); }
.gx-facts dt { color: var(--color-text-secondary); }
.gx-facts dd { margin: 0; overflow-wrap: anywhere; }
.gx-step { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: var(--space-4); position: sticky; bottom: 0; background: var(--color-bg); padding-bottom: var(--space-2); }

/* Reactions — one quiet question, three word-pills. Sand at rest; the chosen
   feeling fills terracotta (people/emotion accent). A 150ms bump is the only
   motion in the viewer. */
.gx-react { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.gx-react-q { margin: 0 0 var(--space-2); font-size: var(--text-small); color: var(--color-text-secondary); }
.gx-react-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.gx-react-row button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.gx-react-row button b { font-weight: 700; }
.gx-react-row button:hover { border-color: var(--tmj-terracotta); }
.gx-react-row button.is-mine { background: var(--tmj-terracotta); border-color: var(--tmj-terracotta); color: var(--tmj-off-white); }
.gx-react-row button.gx-bump { animation: gx-bump 200ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes gx-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.gx-react-static { margin: var(--space-4) 0 0; font-size: var(--text-small); color: var(--color-text-secondary); }

/* Gallery CTA rhythm + ghost pairing. .btn-ghost is intentionally NOT global
   (scoped per page across the site); this scopes it to the gallery card with
   the exact box of the global .btn-accent it sits beside (8px 32px, radius-sm,
   body bold, 44px+ touch), inverting on hover like its siblings. */
.gx-cta { background: var(--color-bg); padding: 0 0 var(--space-8); }
.gx-cta .cta-row { align-items: center; }
.gx-cta .btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--tmj-anthracite);
  border-radius: var(--radius-sm);
  color: var(--tmj-anthracite);
  font-size: var(--text-body);
  font-weight: 700;
  text-decoration: none;
  transition: background 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gx-cta .btn-ghost:hover { background: var(--tmj-anthracite); color: var(--tmj-off-white); }

@media (max-width: 980px) {
  .gx-intro-in { grid-template-columns: 1fr; gap: var(--space-4); }
  .gx-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 130px; }
}

@media (max-width: 767px) {
  .gx-hero { min-height: 60vh; }
  .gx-intro { padding: var(--space-7) 0 var(--space-6); }
  .gx-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; gap: var(--space-2); }
  /* Touch layout: captions always visible, no hover to reveal them. */
  .gx-cap { opacity: 1; transform: none; }
  .gx-share { opacity: 1; transform: none; }
  /* Stacked viewer: bar, photograph, thumbs, scrolling story. The photo row
     breathes inverse to the story: tall when compact, yielding when open. */
  .gx-sheet { grid-template-columns: 1fr; grid-template-rows: auto 62vh minmax(0, 1fr); grid-template-rows: auto 62dvh minmax(0, 1fr); transition: grid-template-rows 350ms cubic-bezier(0.22, 1, 0.36, 1); }
  .gx-sheet.story-open { grid-template-columns: 1fr; grid-template-rows: auto 30vh minmax(0, 1fr); grid-template-rows: auto 30dvh minmax(0, 1fr); }
  .gx-bar { grid-column: 1; grid-row: 1; }
  .gx-stage { grid-column: 1; grid-row: 2; }
  .gx-meta { grid-column: 1; grid-row: 3; }
  .gx-facts div { grid-template-columns: 1fr; gap: 0; }
  .gx-meta { padding: var(--space-4) var(--space-4) var(--space-5); }
}

@media (prefers-reduced-motion: reduce) {
  .gx-frame img, .gx-go, .gx-sheet { transition: none; }
  .gx-react-row button.gx-bump { animation: none; }
}
