/* ==========================================================================
   R Media — gallery cards, filters, lightbox and the gallery page header
   ========================================================================== */

/* ---------- Page hero (gallery.html) ---------- */

.page-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(36px, 6vw, 72px) clamp(40px, 5vw, 64px);
  background: var(--c-surface);
  isolation: isolate;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40% 70% at 0% 0%, rgba(228, 0, 124, 0.12), transparent 70%),
    radial-gradient(40% 80% at 100% 100%, rgba(2, 85, 166, 0.12), transparent 70%);
}
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.92rem; color: var(--c-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: #b9b1cc; }
.breadcrumb a { font-weight: 600; color: var(--c-ink); }
.breadcrumb a:hover { color: var(--c-magenta-600); }
.page-hero .eyebrow { margin-top: 26px; }
.page-title {
  margin-top: 14px;
  font-size: clamp(2.3rem, 1.2rem + 4.4vw, 4.2rem);
  font-stretch: 118%;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.page-sub {
  margin-top: 18px;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  font-weight: 800;
  font-stretch: 112%;
}
.page-lead { max-width: 640px; margin-top: 10px; font-size: 1.08rem; color: var(--c-muted); }

/* ---------- Filters ---------- */

.gallery-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  border-bottom: 1px solid var(--c-line);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.gallery-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-block: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery-filters::-webkit-scrollbar { display: none; }

/* On narrow screens the filter row scrolls sideways; fade the edge to hint at more buttons. */
@media (max-width: 899.98px) {
  .gallery-filters {
    -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
    mask-image: linear-gradient(90deg, #000 82%, transparent);
    padding-right: 40px;
  }
}

.filter-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1.5px solid var(--c-line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.filter-btn:hover { border-color: var(--c-ink); }
.filter-btn[aria-pressed="true"] { border-color: var(--c-ink); background: var(--c-ink); color: #fff; }
.filter-count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 0.78rem;
  text-align: center;
}
.filter-btn[aria-pressed="true"] .filter-count { background: rgba(255, 255, 255, 0.18); color: #fff; }

@media (min-width: 900px) {
  .gallery-filters { flex-wrap: wrap; justify-content: center; overflow: visible; }
}

.gallery-section { padding-block: clamp(32px, 5vw, 64px) clamp(64px, 8vw, 104px); }

/* ---------- Grid & cards ---------- */

.gallery-grid { display: grid; gap: 20px; }

.gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }

.gallery-media { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--c-surface); }
.gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.gallery-card:hover .gallery-media img { transform: scale(1.05); }

.gallery-zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(21, 18, 45, 0.82);
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.gallery-zoom svg { width: 20px; height: 20px; }
.gallery-card:hover .gallery-zoom,
.gallery-card:focus-visible .gallery-zoom { opacity: 1; transform: none; }

.gallery-sample {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.gallery-body { display: block; padding: 16px 18px 18px; }
.gallery-cat {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-magenta-600);
}
.gallery-title {
  display: block;
  margin-top: 4px;
  font-size: 1.12rem;
  font-weight: 800;
  font-stretch: 110%;
  line-height: 1.3;
  color: var(--c-ink);
}
.gallery-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--c-muted);
}
.gallery-loc svg { width: 16px; height: 16px; }

.gallery-item.is-entering { animation: gallery-in 0.45s var(--ease) both; }
@keyframes gallery-in {
  from { opacity: 0; transform: translateY(12px); }
}

.gallery-empty {
  max-width: 560px;
  margin-inline: auto;
  padding: 40px 28px;
  border: 1.5px dashed #d6d0e3;
  border-radius: var(--radius);
  text-align: center;
  color: var(--c-muted);
}
.gallery-empty h2 { font-size: 1.35rem; font-stretch: 112%; }
.gallery-empty p { margin-top: 8px; }
.gallery-empty .btn { margin-top: 20px; }

@media (min-width: 600px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0918;
  color: #fff;
}
.lightbox::backdrop { background: rgba(11, 9, 24, 0.85); }
.lightbox[open] { animation: lightbox-in 0.25s var(--ease); }
@keyframes lightbox-in {
  from { opacity: 0; }
}
body.lightbox-open { overflow: hidden; }

.lightbox-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.lightbox-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.lightbox-count { padding-left: 8px; font-size: 0.95rem; font-weight: 600; color: rgba(255, 255, 255, 0.72); }

.lightbox-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: background-color 0.2s, border-color 0.2s;
}
.lightbox-btn svg { width: 22px; height: 22px; }
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); }
.lightbox-btn:focus-visible { outline-color: #fff; }

.lightbox-figure {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
}
.lightbox-stage { position: relative; min-height: 0; touch-action: pan-y; }
/* Absolutely filling the stage lets any photo (portrait, landscape or SVG) fit the space left above the caption. */
.lightbox-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s;
}
.lightbox-img.is-loading { opacity: 0.25; }

.lightbox-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 0 8px;
}
.lightbox-cat {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff9ad0;
}
.lightbox-title { margin-top: 4px; color: #fff; font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); font-stretch: 112%; }
.lightbox-loc { margin-top: 4px; color: rgba(255, 255, 255, 0.72); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  background: rgba(11, 9, 24, 0.55);
}
.lightbox-prev { left: 4px; }
.lightbox-next { right: 4px; }

@media (min-width: 900px) {
  .lightbox-inner { padding-inline: 88px; }
  .lightbox-nav { width: 56px; height: 56px; }
  .lightbox-prev { left: -72px; }
  .lightbox-next { right: -72px; }
}
