/* Gallery-only surfaces share the accepted 4B.1 width and premium tokens. */
.gallery-page {
  --gallery-max: 1240px;
  --gallery-gutter: clamp(16px, 3.125vw, 40px);
  --gallery-frame: #b49360;
  font-family: var(--premium-font-body);
}
html[data-theme="dark"] .gallery-page { --gallery-frame: #aa8548; }
.gallery-main { width: min(var(--gallery-max), calc(100% - 2 * var(--gallery-gutter))); margin: 0 auto; padding: 44px 0 56px; }
.gallery-main [hidden] { display: none !important; }
.gallery-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.gallery-eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; color: var(--gold-text); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0; }
.gallery-eyebrow::before { content: ''; width: 28px; height: 1px; background: currentColor; }
.gallery-intro h1 { margin: 0; color: var(--ink); font: 500 50px/1.15 var(--premium-font-display); letter-spacing: 0; }
.gallery-intro h1 em { color: var(--gold-text); font-style: normal; }
.gallery-description { max-width: 64ch; margin: 20px 0 30px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.gallery-categories { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 30px; }
.gallery-icon { flex-shrink: 0; width: 24px; height: 24px; pointer-events: none; }
.gallery-main button, .gallery-grid a { touch-action: manipulation; }
.gallery-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 112px;
  padding: 16px 10px;
  border: 1px solid var(--premium-edge);
  border-radius: var(--premium-radius-sm);
  color: var(--ink);
  background: var(--premium-surface);
  box-shadow: inset 0 1px 0 var(--premium-highlight), var(--premium-shadow);
  font: 500 22px/1.2 var(--premium-font-display);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: transform var(--premium-duration), box-shadow var(--premium-duration), border-color var(--premium-duration);
}
.gallery-category .gallery-icon { width: 30px; height: 30px; stroke-width: 1.5; color: var(--gold-text); }
.gallery-category[aria-pressed="true"] {
  border-color: var(--gold-text);
  background: linear-gradient(135deg, #a52b201b, transparent 75%), var(--premium-surface);
  box-shadow: inset 0 -3px 0 var(--gold-text), inset 0 1px 0 var(--premium-highlight), var(--premium-shadow);
}
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 0; margin: 0; list-style: none; }
.gallery-grid li { min-width: 0; }
.gallery-grid a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--premium-edge); border-radius: var(--premium-radius-sm); background: var(--panel); box-shadow: var(--premium-shadow); cursor: zoom-in; transition: border-color var(--premium-duration), box-shadow var(--premium-duration); }
.gallery-grid img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 220ms var(--premium-ease); }
.gallery-main :is(a, button):focus-visible { outline: 3px solid var(--premium-focus); outline-offset: 4px; }
.gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  margin: 0;
  border: 0;
  color: #f7eee3;
  background: transparent;
  overflow: hidden;
}
.gallery-viewer[open] { display: grid; grid-template-rows: 44px minmax(0, 1fr); gap: 18px; }
.gallery-viewer::backdrop { background: rgba(13, 11, 9, .88); backdrop-filter: blur(5px); }
.gallery-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 1380px; margin-inline: auto; gap: 12px; }
.gallery-count { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.gallery-zoom-tools { display: flex; gap: 8px; }
.gallery-viewer button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--gallery-frame); border-radius: var(--premium-radius-sm); color: var(--gold-text); background: var(--panel); box-shadow: var(--premium-shadow); cursor: pointer; transition: background var(--premium-duration), border-color var(--premium-duration); }
.gallery-viewer button:disabled { opacity: .45; cursor: default; }
.gallery-viewer button:focus-visible { outline-color: #edc779; }
.gallery-viewer [data-gallery-close] { justify-self: end; }
.gallery-stage { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 20px; align-items: center; width: 100%; min-height: 0; max-width: 1380px; margin-inline: auto; }
.gallery-canvas { display: flex; position: relative; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; overscroll-behavior: contain; }
.gallery-image { display: block; flex: 0 1 auto; width: auto; height: auto; max-width: 100%; max-height: 100%; border: 1px solid var(--gallery-frame); border-radius: var(--premium-radius-sm); box-shadow: 0 12px 32px #0005; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.gallery-canvas[data-zoomed="true"] { cursor: grab; }
.gallery-canvas[data-zoomed="true"]:active { cursor: grabbing; }
.gallery-image-error { position: absolute; inset: 50% 16px auto; margin: 0; text-align: center; color: #f7eee3; }
html.gallery-open { overflow: hidden; }
html.gallery-open body { position: fixed; top: var(--gallery-scroll-top); width: 100%; overflow: hidden; padding-right: var(--gallery-scrollbar, 0px); }
@media (hover: hover) and (pointer: fine) {
  .gallery-category:hover { transform: translateY(-2px); border-color: var(--gold-text); box-shadow: var(--premium-shadow-raised); }
  .gallery-grid a:hover { border-color: var(--gold-text); box-shadow: var(--premium-shadow-raised); }
  .gallery-grid a:hover img { transform: scale(1.025); }
  .gallery-viewer button:not(:disabled):hover { background: var(--premium-nav-active); }
}
@media (max-width: 1100px) {
  .gallery-categories { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .gallery-main { padding: 28px 0 36px; }
  .gallery-intro h1 { font-size: 36px; }
  .gallery-description { margin: 16px 0 24px; font-size: 14px; }
  .gallery-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
  .gallery-category { min-height: 96px; gap: 10px; padding: 14px 10px; font-size: 20px; }
  .gallery-category .gallery-icon { width: 28px; height: 28px; }
  .gallery-grid { gap: 12px; }
  .gallery-viewer { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .gallery-viewer[open] { gap: 12px; }
  .gallery-stage { grid-template-columns: 44px minmax(0, 1fr) 44px; grid-template-rows: minmax(0, 1fr) 44px; gap: 12px; }
  .gallery-canvas { grid-column: 1 / -1; grid-row: 1; }
  .gallery-prev { grid-column: 1; grid-row: 2; }
  .gallery-next { grid-column: 3; grid-row: 2; }
}
@media (max-width: 359px) { .gallery-intro h1 { font-size: 31px; } }
@media (prefers-reduced-motion: no-preference) {
  .gallery-viewer[open], .gallery-viewer[open]::backdrop { animation: gallery-in 150ms ease-out both; }
  .gallery-viewer.is-closing, .gallery-viewer.is-closing::backdrop { animation: gallery-out 150ms ease-in both; }
  @keyframes gallery-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes gallery-out { from { opacity: 1; } to { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .gallery-main *, .gallery-main *::before { animation: none !important; transition: none !important; } }
