/* ============================================================
   Gallery wall + immersive photo viewer
   Loaded after base.css, so it reuses the site's colour tokens.
   ============================================================ */

/* ---------- Section tabs ---------- */
.wall-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.wall-tab {
  position: relative;
  flex: 1 1 190px;
  min-width: 0;
  text-align: left;
  padding: 0.75rem 2.4rem 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-ivory);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.25s ease, background 0.25s ease,
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}

/* Gilt sweep that fills from the left as the section becomes the active one. */
.wall-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-maroon-700), var(--color-maroon-900));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 0;
}

.wall-tab > span {
  position: relative;
  z-index: 1;
  display: block;
}

/* Poppins, not Noto: these tabs put Devanagari on the page in *every* language,
   so leaving them on the text face made an English visitor download the 118 KB
   Noto Devanagari for four short labels. Poppins covers Devanagari and is
   already here for .wall-tab-en beside it. */
.wall-tab-ne {
  /* No Noto in the stack on purpose: naming it as the fallback is enough to
     make the browser fetch all 118 KB of it even though Poppins covers every
     glyph here. The generic sans-serif is the real safety net. */
  font-family: "Poppins", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  line-height: 1.5;
  transition: color 0.25s ease;
}

.wall-tab-en {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-maroon-700);
  line-height: 1.3;
  transition: color 0.25s ease;
}

.wall-tab-n {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-maroon-700);
  background: var(--color-tint);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  transition: color 0.25s ease, background 0.25s ease;
}

.wall-tab:hover {
  border-color: var(--color-gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -14px rgba(58, 13, 13, 0.5);
}

.wall-tab:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

.wall-tab[aria-pressed="true"] {
  border-color: var(--color-maroon-900);
}

.wall-tab[aria-pressed="true"]::before {
  transform: scaleX(1);
}

.wall-tab[aria-pressed="true"] .wall-tab-en {
  color: #fff;
}

.wall-tab[aria-pressed="true"] .wall-tab-ne {
  color: var(--color-gold-light);
}

.wall-tab[aria-pressed="true"] .wall-tab-n {
  color: var(--color-maroon-900);
  background: var(--color-gold);
}

@media (max-width: 620px) {
  .wall-tabs {
    gap: 0.45rem;
  }
  .wall-tab {
    flex: 1 1 100%;
    padding: 0.6rem 2.4rem 0.6rem 0.85rem;
  }
}

/* ---------- Gallery page header ---------- */
.wall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--color-border);
}

.wall-count {
  font-family: "Poppins", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-maroon-700);
  margin: 0;
}

.wall-count span {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

.wall-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wall-chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 44px;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-ivory);
  color: var(--color-maroon-700);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.wall-chip:hover {
  background: var(--color-tint);
  border-color: var(--color-gold);
}

.wall-chip:active {
  transform: scale(0.96);
}

.wall-chip[aria-pressed="true"] {
  background: var(--color-maroon-700);
  border-color: var(--color-maroon-700);
  color: var(--color-gold-light);
}

.wall-chip:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

/* ---------- The wall: an editorial mosaic ---------- */
.wall {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 150px;
  gap: 16px;
}

.wall-tile {
  position: relative;
  grid-column: span 2;
  grid-row: span 2;
  margin: 0;
  border: 0;
  padding: 0;
  background: var(--color-tint);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
  /* Gilt hairline + a shadow that deepens on hover, matching the framed look
     used elsewhere on the site without the heavy moulding at this size. */
  box-shadow:
    0 0 0 1px rgba(217, 164, 65, 0.55),
    0 2px 6px -2px rgba(58, 13, 13, 0.35),
    0 12px 26px -16px rgba(58, 13, 13, 0.5);
  transition: box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wall-tile.is-hero {
  grid-column: span 4;
  grid-row: span 3;
}

.wall-tile.is-tall {
  grid-column: span 2;
  grid-row: span 3;
}

.wall-tile.is-wide {
  grid-column: span 4;
  grid-row: span 2;
}

.wall-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.5s ease;
}

/* Scrim only appears on hover/focus so the photograph is unobstructed at rest. */
.wall-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(42, 10, 10, 0.82) 0%,
    rgba(42, 10, 10, 0.35) 38%,
    rgba(42, 10, 10, 0) 68%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.wall-tile:hover,
.wall-tile:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px var(--color-gold),
    0 6px 14px -4px rgba(58, 13, 13, 0.4),
    0 26px 48px -22px rgba(58, 13, 13, 0.65);
}

.wall-tile:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
}

.wall-tile:hover img,
.wall-tile:focus-visible img {
  transform: scale(1.08);
}

.wall-tile:hover::after,
.wall-tile:focus-visible::after {
  opacity: 1;
}

.wall-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 0.9rem 1rem;
  text-align: left;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.wall-tile:hover .wall-cap,
.wall-tile:focus-visible .wall-cap {
  opacity: 1;
  transform: translateY(0);
}

.wall-cap strong {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.wall-cap em {
  display: block;
  margin-top: 0.2rem;
  font-style: normal;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-gold-light);
}

.wall-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  background: var(--color-gold);
  color: var(--color-maroon-900);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* Entrance: tiles rise into place, staggered by JS via --d. Scoped to html.js so
   the wall is fully visible if scripting is unavailable. */
html.js .wall-tile[data-reveal] {
  opacity: 0;
  transform: translateY(26px) scale(0.97);
}

html.js .wall-tile[data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease var(--d, 0ms),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms),
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wall-tile[hidden] {
  display: none;
}

.wall-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem 1rem;
}

@media (max-width: 980px) {
  .wall {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 130px;
    gap: 12px;
  }
  .wall-tile.is-hero,
  .wall-tile.is-wide {
    grid-column: span 4;
  }
}

@media (max-width: 620px) {
  .wall {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 108px;
    gap: 10px;
  }
  .wall-tile,
  .wall-tile.is-hero,
  .wall-tile.is-tall,
  .wall-tile.is-wide {
    grid-column: span 2;
    grid-row: span 2;
  }
  .wall-tile.is-hero {
    grid-row: span 3;
  }
  /* Touch devices have no hover, so the caption stays put. */
  .wall-cap {
    opacity: 1;
    transform: none;
  }
  .wall-tile::after {
    opacity: 1;
  }
}

/* ============================================================
   Immersive viewer
   ============================================================ */
.pv {
  position: fixed;
  inset: 0;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  overscroll-behavior: contain;
}

.pv.is-open {
  opacity: 1;
  visibility: visible;
}

/* Two ambient layers crossfade, so the room takes on the colour of the photo. */
.pv__ambient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #140606;
}

.pv__glow {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  filter: blur(70px) saturate(1.5) brightness(0.62);
  transform: scale(1.25);
  opacity: 0;
  transition: opacity 0.9s ease;
}

.pv__glow.is-on {
  opacity: 0.85;
}

.pv__scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(12, 4, 4, 0.35) 0%, rgba(12, 4, 4, 0.86) 78%),
    linear-gradient(to bottom, rgba(12, 4, 4, 0.75), rgba(12, 4, 4, 0.4) 30%, rgba(12, 4, 4, 0.85));
}

.pv__shell {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ---------- Top bar ---------- */
.pv__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  color: #fff;
}

.pv__meta {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
}

.pv__count {
  font-family: "Poppins", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--color-gold);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.pv__count i {
  font-style: normal;
  opacity: 0.45;
  margin: 0 0.25rem;
}

.pv__count small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95em;
}

.pv__titles {
  min-width: 0;
}

.pv__title {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv__date {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold-light);
  opacity: 0.8;
}

.pv__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pv__btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.pv__btn:hover {
  background: rgba(217, 164, 65, 0.28);
  border-color: var(--color-gold);
}

.pv__btn:active {
  transform: scale(0.93);
}

.pv__btn:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
}

.pv__btn svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.pv__btn .pv-icon-pause {
  display: none;
}

.pv__btn.is-playing .pv-icon-play {
  display: none;
}

.pv__btn.is-playing .pv-icon-pause {
  display: block;
}

/* Slideshow progress ring drawn around the play button. */
.pv__ring {
  position: absolute;
  inset: -1px;
  width: 46px;
  height: 46px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.pv__ring circle {
  fill: none;
  stroke: var(--color-gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 138.2;
  stroke-dashoffset: 138.2;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.pv__btn.is-playing .pv__ring circle {
  opacity: 1;
}

/* ---------- Stage ---------- */
.pv__stage {
  position: relative;
  min-height: 0;
  margin: 0 clamp(0.5rem, 5vw, 4.5rem);
  display: grid;
  place-items: center;
  touch-action: pinch-zoom;
  cursor: zoom-in;
}

.pv__img {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(217, 164, 65, 0.45),
    0 40px 90px -30px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translate3d(calc(var(--dir, 1) * 7%), 0, 0) scale(0.95);
  transition: opacity 0.4s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
  user-select: none;
  -webkit-user-drag: none;
}

.pv__img.is-in {
  opacity: 1;
  transform: none;
}

.pv__img.is-out {
  opacity: 0;
  transform: translate3d(calc(var(--dir, 1) * -5%), 0, 0) scale(1.03);
}

.pv__img.is-dragging {
  transition: none;
}

/* Slow drift while the slideshow runs — the photo is never quite still. */
.pv__img.is-drifting {
  animation: pv-drift 9s ease-in-out infinite alternate;
}

@keyframes pv-drift {
  from {
    transform: scale(1) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.06) translate3d(-1.2%, -0.8%, 0);
  }
}

.pv__spinner {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-gold);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  animation: pv-spin 0.8s linear infinite;
}

.pv__spinner.is-on {
  opacity: 1;
}

@keyframes pv-spin {
  to {
    transform: rotate(360deg);
  }
}

/* The FLIP clone that morphs the clicked thumbnail into the full photo. */
.pv-flip {
  position: fixed;
  z-index: 2100;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  will-change: top, left, width, height;
}

.pv-flip.is-moving {
  transition: top 0.52s cubic-bezier(0.3, 0.9, 0.25, 1),
    left 0.52s cubic-bezier(0.3, 0.9, 0.25, 1),
    width 0.52s cubic-bezier(0.3, 0.9, 0.25, 1),
    height 0.52s cubic-bezier(0.3, 0.9, 0.25, 1),
    opacity 0.3s ease 0.22s;
}

/* ---------- Side navigation ---------- */
.pv__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 8, 8, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.25s ease;
}

.pv__nav:hover {
  background: rgba(217, 164, 65, 0.35);
  border-color: var(--color-gold);
}

.pv__nav:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
}

.pv__nav svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.pv__nav--prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
}

.pv__nav--next {
  right: clamp(0.5rem, 2vw, 1.5rem);
}

.pv__nav--prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.pv__nav--next:hover {
  transform: translateY(-50%) translateX(3px);
}

/* ---------- Foot ---------- */
.pv__foot {
  padding: 0.75rem clamp(0.5rem, 3vw, 2rem) 1rem;
}

.pv__hint {
  margin: 0.25rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.pv__hint kbd {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  padding: 0 0.28rem;
}

@media (max-width: 640px) {
  .pv__nav {
    display: none;
  }
  .pv__title {
    font-size: 0.9rem;
  }
  .pv__hint {
    font-size: 0.66rem;
  }
}

@media (max-width: 420px) {
  .pv__date {
    display: none;
  }
}

/* ---------- Motion-sensitive users get the content, not the choreography ---- */
@media (prefers-reduced-motion: reduce) {
  .wall-tab,
  .wall-tab::before,
  .wall-tile,
  .wall-tile img,
  .wall-cap,
  .pv__img,
  .pv-flip {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  html.js .wall-tile[data-reveal] {
    transform: none;
  }
  .wall-tile:hover {
    transform: none;
  }
  .pv__img.is-drifting {
    animation: none !important;
  }
}
