/* =========================================================
   Gallery — standalone styles
   All classes are prefixed "gl-" so they won't collide with
   your existing site CSS. Change the tokens below to match
   your brand.
   ========================================================= */

:root {
  /* Jiu-Jitsu Fever brand */
  --gl-bg: #f3efe4;
  --gl-surface: #faf8f2;
  --gl-ink: #1b2947;
  --gl-ink-soft: #4b5670;
  --gl-line: rgba(27, 41, 71, .16);
  --gl-accent: #b8831a;          /* gold */
  --gl-accent-ink: #ffffff;
  --gl-lb-bg: #141c30;           /* night */

  --gl-font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gl-font-display: "Shippori Mincho", Georgia, "Times New Roman", serif;
  --gl-font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --gl-radius: 2px;
  --gl-gap: clamp(0.5rem, 1.2vw, 1rem);
  --gl-max: 1120px;
  --gl-pad: 24px;
  --gl-nav-h: 66px;
  --gl-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base (scoped-light; safe to remove if your site has a reset) ---------- */
.gl-body {
  margin: 0;
  background: var(--gl-bg);
  color: var(--gl-ink);
  font-family: var(--gl-font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.gl-body *, .gl-body *::before, .gl-body *::after { box-sizing: border-box; }
.gl-body img { display: block; max-width: 100%; }
.gl-body button { font: inherit; color: inherit; }
.gl-body :focus-visible { outline: 2px solid var(--gl-accent); outline-offset: 3px; }

.gl-skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--gl-ink); color: #fff; padding: 0.5rem 0.9rem; border-radius: var(--gl-radius);
  text-decoration: none;
}
.gl-skip:focus { top: 1rem; }

/* ---------- Navigation ---------- */
.gl-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--gl-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--gl-line);
}
.gl-nav__inner {
  max-width: var(--gl-max); margin: 0 auto; padding: 0 var(--gl-pad);
  height: var(--gl-nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.gl-nav__brand {
  font-family: var(--gl-font-display); font-size: 1.35rem; font-weight: 500;
  color: var(--gl-ink); text-decoration: none; letter-spacing: -0.01em;
}
.gl-nav__list { display: flex; align-items: center; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.gl-nav__list a {
  display: inline-block; padding: 0.5rem 0.85rem; border-radius: 999px;
  color: var(--gl-ink-soft); text-decoration: none; font-weight: 500; font-size: 0.95rem;
  transition: color .2s, background-color .2s;
}
.gl-nav__list a:hover { color: var(--gl-ink); background: var(--gl-line); }

/* Dedicated gallery link — highlighted when it's the current page */
.gl-nav__link--gallery[aria-current="page"] {
  color: var(--gl-ink);
  position: relative;
}
.gl-nav__link--gallery[aria-current="page"]::after {
  content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0.25rem;
  height: 2px; background: var(--gl-accent); border-radius: 2px;
}
.gl-nav__list a.gl-nav__cta { background: var(--gl-ink); color: var(--gl-bg); margin-left: 0.5rem; }
.gl-nav__list a.gl-nav__cta:hover { background: var(--gl-accent); color: var(--gl-accent-ink); }

.gl-nav__toggle {
  display: none; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px; border-radius: var(--gl-radius);
}
.gl-nav__toggle span { display: block; width: 22px; height: 2px; background: var(--gl-ink); transition: transform .25s var(--gl-ease), opacity .2s; }
.gl-nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.gl-nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.gl-nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 760px) {
  .gl-nav__toggle { display: flex; }
  .gl-nav__menu {
    position: absolute; top: var(--gl-nav-h); left: 0; right: 0;
    background: var(--gl-bg); border-bottom: 1px solid var(--gl-line);
    padding: 0.5rem var(--gl-pad) 1rem;
    display: none;
  }
  .gl-nav__menu.is-open { display: block; }
  .gl-nav__list { flex-direction: column; align-items: stretch; gap: 0.15rem; }
  .gl-nav__list a { display: block; padding: 0.8rem 0.5rem; border-radius: var(--gl-radius); font-size: 1rem; }
  .gl-nav__link--gallery[aria-current="page"]::after { left: 0; right: auto; top: 0.8rem; bottom: 0.8rem; width: 3px; height: auto; }
  .gl-nav__link--gallery[aria-current="page"] { padding-left: 0.9rem; }
  .gl-nav__list a.gl-nav__cta { margin: 0.5rem 0 0; text-align: center; }
}

/* ---------- Intro ---------- */
.gl-main { max-width: var(--gl-max); margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) var(--gl-pad) 4rem; }
.gl-intro { max-width: 640px; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.gl-eyebrow { margin: 0 0 0.75rem; font-family: var(--gl-font-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gl-accent); }
.gl-title { margin: 0 0 0.75rem; font-family: var(--gl-font-display); font-weight: 600; font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 1; letter-spacing: -0.02em; }
.gl-lede { margin: 0; color: var(--gl-ink-soft); font-size: clamp(1rem, 1.6vw, 1.125rem); }

/* ---------- Filters ---------- */
.gl-filters {
  display: flex; gap: 0.5rem; margin-bottom: 0.75rem;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.gl-filters::-webkit-scrollbar { display: none; }
.gl-body .gl-filter {
  flex: 0 0 auto; cursor: pointer;
  padding: 0.7rem 1.1rem; border-radius: 0;
  border: 1px solid var(--gl-line); background: transparent;
  font-family: var(--gl-font-mono); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500; color: var(--gl-ink-soft);
  transition: background-color .2s, color .2s, border-color .2s;
}
.gl-filter:hover { border-color: var(--gl-ink-soft); color: var(--gl-ink); }
.gl-filter.is-active { background: var(--gl-ink); border-color: var(--gl-ink); color: var(--gl-bg); }
.gl-filter__count { margin-left: 0.3rem; opacity: 0.6; font-variant-numeric: tabular-nums; font-size: 0.85em; }
.gl-status { margin: 0 0 1.25rem; font-size: 0.85rem; color: var(--gl-ink-soft); }

/* ---------- Grid ---------- */
.gl-grid {
  /* Masonry columns: packs tightly at every width, no gaps */
  list-style: none; margin: 0; padding: 0;
  columns: 3 260px;
  column-gap: var(--gl-gap);
}
.gl-item {
  position: relative; break-inside: avoid; margin-bottom: var(--gl-gap);
  border-radius: var(--gl-radius); overflow: hidden; background: var(--gl-line);
  aspect-ratio: 4 / 3;
}
.gl-item[hidden] { display: none; }
.gl-item--tall { aspect-ratio: 3 / 4; }   /* portrait crop */
.gl-item--square { aspect-ratio: 1 / 1; }
.gl-item--wide { aspect-ratio: 16 / 10; }
.gl-item--natural { aspect-ratio: auto; }   /* whole photo, no crop */
.gl-item--natural .gl-item__btn img { height: auto; }
.gl-item.is-entering { animation: gl-in .45s var(--gl-ease) both; }
@keyframes gl-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.gl-item__btn {
  all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; position: relative;
}
.gl-item__btn:focus-visible { outline: 3px solid var(--gl-accent); outline-offset: -3px; }
.gl-item__btn img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--gl-ease), filter .4s;
}
.gl-item__btn:hover img, .gl-item__btn:focus-visible img { transform: scale(1.045); }
.gl-item__meta {
  position: absolute; inset: auto 0 0 0; padding: 2.5rem 1rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.1rem;
  background: linear-gradient(to top, rgba(15,14,12,.78), rgba(15,14,12,0));
  color: #fff; opacity: 0; transform: translateY(6px);
  transition: opacity .3s, transform .35s var(--gl-ease);
}
.gl-item__btn:hover .gl-item__meta, .gl-item__btn:focus-visible .gl-item__meta { opacity: 1; transform: none; }
.gl-item__cat { font-family: var(--gl-font-mono); font-size: 0.65rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; opacity: .8; }
.gl-item__title { font-family: var(--gl-font-display); font-size: 1.1rem; font-weight: 600; }
@media (hover: none) { .gl-item__meta { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.gl-footer {
  max-width: var(--gl-max); margin: 0 auto; padding: 1.5rem var(--gl-pad) 2.5rem;
  border-top: 1px solid var(--gl-line);
  display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; color: var(--gl-ink-soft);
}
.gl-footer p { margin: 0; }
.gl-footer a { color: inherit; }

/* ---------- Lightbox ---------- */
.gl-lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--gl-lb-bg); color: #f3efe8;
  overflow: hidden;
}
.gl-lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: gl-fade .25s ease both; }
.gl-lightbox::backdrop { background: transparent; }
@keyframes gl-fade { from { opacity: 0; } }

.gl-lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem clamp(0.75rem, 3vw, 1.5rem); }
.gl-lightbox__counter { font-size: 0.875rem; font-variant-numeric: tabular-nums; opacity: .75; }
.gl-lightbox__tools { display: flex; gap: 0.25rem; }

.gl-lb-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
  transition: background-color .2s;
}
.gl-lb-btn:hover { background: rgba(255,255,255,.18); }
.gl-lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gl-lb-btn[aria-pressed="true"] { background: var(--gl-accent); }

.gl-lightbox__stage {
  position: relative; min-height: 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem;
  padding: 0 clamp(0.5rem, 2vw, 1.5rem);
}
.gl-lightbox__figure { margin: 0; min-width: 0; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.75rem; }
.gl-lightbox__frame {
  position: relative; min-height: 0; overflow: hidden; border-radius: 4px;
  cursor: zoom-in; touch-action: pan-y;
}
.gl-lightbox__frame.is-zoomed { cursor: zoom-out; touch-action: none; }
.gl-lightbox__img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain;
  transform-origin: 50% 50%;
  transition: transform .35s var(--gl-ease), opacity .25s;
  user-select: none; -webkit-user-drag: none;
}
.gl-lightbox__img.is-loading { opacity: 0; }
.gl-lightbox__frame.is-zoomed .gl-lightbox__img { transition: transform .12s linear; }
.gl-lightbox__caption { text-align: center; font-family: var(--gl-font-display); font-size: 1.05rem; opacity: .85; padding-bottom: 0.25rem; }

.gl-lightbox__thumbs {
  display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.75rem clamp(0.75rem, 3vw, 1.5rem) 1rem;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
  justify-content: safe center;
}
.gl-thumb {
  flex: 0 0 auto; width: 76px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 4px;
  overflow: hidden; background: #000; cursor: pointer; opacity: .5; transition: opacity .2s, border-color .2s;
}
.gl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gl-thumb:hover { opacity: .85; }
.gl-thumb[aria-current="true"] { opacity: 1; border-color: var(--gl-accent); }

@media (max-width: 640px) {
  .gl-lightbox__stage { grid-template-columns: 1fr; padding: 0; }
  .gl-lb-btn--nav { position: absolute; top: 45%; z-index: 2; background: rgba(0,0,0,.45); }
  .gl-lb-btn--prev { left: 0.5rem; }
  .gl-lb-btn--next { right: 0.5rem; }
  .gl-lightbox__frame { border-radius: 0; }
  .gl-thumb { width: 60px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-body *, .gl-body *::before, .gl-body *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
