/* =======================================================================
   TALA & TIA — Media Gallery (gallery.php)
   Sits on top of style.css tokens. All selectors are prefixed g- / glb-
   so nothing here can collide with the rest of the site.
   ======================================================================= */

:root { --g-hdr: 88px; }

/* -----------------------------------------------------------------------
   Hero
   ----------------------------------------------------------------------- */
.g-hero { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); }
.g-hero__bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: .34; transform-origin: 60% 40%;
  animation: g-kenburns 22s ease-in-out infinite alternate;
}
@keyframes g-kenburns { from { transform: scale(1); } to { transform: scale(1.12) translate(-1.5%, -1%); } }

.g-hero__shade { position: absolute; inset: 0; background:
  linear-gradient(180deg, rgba(19,18,16,.55) 0%, rgba(19,18,16,.2) 40%, var(--ink) 100%),
  linear-gradient(90deg, rgba(19,18,16,.85) 0%, rgba(19,18,16,0) 70%); }

/* pyramid motif — echoes the logo */
.g-hero__tri {
  position: absolute; right: -4%; bottom: -1px; width: min(46vw, 560px); aspect-ratio: 1.15;
  background: linear-gradient(160deg, rgba(215,181,101,.22), rgba(169,129,42,.04));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  animation: g-float 9s ease-in-out infinite alternate;
}
.g-hero__tri::after {
  content: ""; position: absolute; inset: 0; transform: scale(.62) translateY(22%);
  background: rgba(215,181,101,.12); clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
@keyframes g-float { from { transform: translateY(0); } to { transform: translateY(-14px); } }

.g-hero__in > * { opacity: 0; transform: translateY(22px); animation: g-rise .8s cubic-bezier(.2,.7,.2,1) forwards; }
.g-hero__in > *:nth-child(1) { animation-delay: .05s; }
.g-hero__in > *:nth-child(2) { animation-delay: .15s; }
.g-hero__in > *:nth-child(3) { animation-delay: .27s; }
.g-hero__in > *:nth-child(4) { animation-delay: .39s; }
.g-hero__in > *:nth-child(5) { animation-delay: .5s; }
@keyframes g-rise { to { opacity: 1; transform: none; } }

.g-stat { border-left: 2px solid var(--gold); padding-left: 1rem; }
.g-stat b { display: block; font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 2rem; line-height: 1; color: var(--paper); font-variant-numeric: tabular-nums; }
.g-stat span { font-size: .8rem; color: rgba(250,249,246,.6); letter-spacing: .02em; }

/* -----------------------------------------------------------------------
   Sticky filter bar
   ----------------------------------------------------------------------- */
.g-bar {
  position: sticky; top: var(--g-hdr); z-index: 40;
  background: rgba(250,249,246,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.g-bar__scroll { display: flex; gap: .6rem; overflow-x: auto; padding: .85rem 0; scrollbar-width: none; }
.g-bar__scroll::-webkit-scrollbar { display: none; }

.g-chip {
  flex: none; display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem 1.05rem; font-size: .88rem; font-weight: 600; color: var(--slate);
  border: 1px solid var(--line); background: var(--paper);
  transition: background-color .25s, color .25s, border-color .25s, transform .25s;
}
.g-chip:hover { border-color: var(--gold); color: var(--ink); transform: translateY(-1px); }
.g-chip i { font-style: normal; font-size: .72rem; font-weight: 700; padding: .08rem .45rem; background: var(--limestone); color: var(--slate); transition: inherit; }
.g-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.g-chip[aria-pressed="true"] i { background: var(--gold); color: var(--ink); }

/* -----------------------------------------------------------------------
   Category sections
   ----------------------------------------------------------------------- */
.g-section { padding: 4.5rem 0 5rem; scroll-margin-top: calc(var(--g-hdr) + 70px); }
.g-section[hidden] { display: none; }
.g-section:nth-of-type(even) { background: var(--limestone); }
.g-section.g-enter .g-head { animation: g-rise .7s cubic-bezier(.2,.7,.2,1) both; }

.g-head { display: flex; align-items: flex-end; gap: 1.5rem; margin-bottom: 2.5rem; position: relative; }
.g-num {
  font-family: 'Archivo', sans-serif; font-weight: 900; line-height: .8;
  font-size: clamp(4.5rem, 10vw, 8rem);
  color: transparent; -webkit-text-stroke: 1.5px rgba(169,129,42,.55);
  user-select: none;
}
.g-head__txt { padding-bottom: .35rem; max-width: 40rem; }
.g-ico { width: 1.6rem; height: 1.6rem; stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.g-count { margin-left: auto; align-self: flex-end; padding-bottom: .5rem; font-size: .82rem; font-weight: 600; color: var(--gold-dim); white-space: nowrap; }

/* -----------------------------------------------------------------------
   Masonry grid
   ----------------------------------------------------------------------- */
.g-grid { column-count: 2; column-gap: .85rem; }
@media (min-width: 640px)  { .g-grid { column-count: 3; column-gap: 1rem; } }
@media (min-width: 1024px) { .g-grid { column-count: 4; column-gap: 1.1rem; } .g-grid.g-few { column-count: 3; } }

.g-tile {
  position: relative; display: block; width: 100%; margin: 0 0 .85rem; padding: 0; border: 0;
  break-inside: avoid; overflow: hidden; cursor: zoom-in; background: var(--ink2);
  opacity: 0; transform: translateY(26px) scale(.98);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease;
}
@media (min-width: 640px) { .g-tile { margin-bottom: 1rem; } }
@media (min-width: 1024px) { .g-tile { margin-bottom: 1.1rem; } }
.g-tile.is-in { opacity: 1; transform: none; }
.g-tile:hover { box-shadow: 0 18px 40px -12px rgba(19,18,16,.45); }

.g-tile img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .5s; }
.g-tile:hover img { transform: scale(1.07); filter: brightness(.82); }

/* shimmer placeholder while the photo loads */
.g-tile::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.08) 50%, transparent 70%);
  background-size: 200% 100%; animation: g-shimmer 1.4s linear infinite;
}
@keyframes g-shimmer { to { background-position: -200% 0; } }

/* gold corner brackets */
.g-tile::after {
  content: ""; position: absolute; z-index: 4; inset: 10px; pointer-events: none;
  border: 1.5px solid var(--gold-light); opacity: 0;
  clip-path: polygon(0 0, 22px 0, 22px 1.5px, 1.5px 1.5px, 1.5px 22px, 0 22px,
                     0 100%, 22px 100%, 22px calc(100% - 1.5px), 1.5px calc(100% - 1.5px), 1.5px calc(100% - 22px), 0 calc(100% - 22px),
                     100% 100%, calc(100% - 22px) 100%, calc(100% - 22px) calc(100% - 1.5px), calc(100% - 1.5px) calc(100% - 1.5px), calc(100% - 1.5px) calc(100% - 22px), 100% calc(100% - 22px),
                     100% 0, calc(100% - 22px) 0, calc(100% - 22px) 1.5px, calc(100% - 1.5px) 1.5px, calc(100% - 1.5px) 22px, 100% 22px);
  transform: scale(1.08); transition: opacity .35s, transform .45s cubic-bezier(.2,.7,.2,1);
}
.g-tile:hover::after, .g-tile:focus-visible::after { opacity: 1; transform: none; }

.g-tile__meta {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 1.4rem .9rem .8rem;
  display: flex; align-items: center; justify-content: space-between; color: var(--paper);
  background: linear-gradient(180deg, transparent, rgba(19,18,16,.85));
  opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .35s;
}
.g-tile:hover .g-tile__meta, .g-tile:focus-visible .g-tile__meta { opacity: 1; transform: none; }
.g-tile__meta b { font-family: 'Archivo', sans-serif; font-size: .8rem; letter-spacing: .08em; color: var(--gold-light); }
.g-tile__meta svg { width: 1.15rem; height: 1.15rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* video tile */
.g-play {
  position: absolute; z-index: 2; top: 50%; left: 50%; width: 3.6rem; height: 3.6rem; margin: -1.8rem 0 0 -1.8rem;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(169,129,42,.92); color: var(--ink);
  box-shadow: 0 0 0 0 rgba(215,181,101,.6); animation: g-pulse 2.2s infinite;
  transition: transform .3s;
}
.g-tile:hover .g-play { transform: scale(1.12); }
.g-play svg { width: 1.3rem; height: 1.3rem; margin-left: 3px; fill: currentColor; }
@keyframes g-pulse { 70% { box-shadow: 0 0 0 16px rgba(215,181,101,0); } 100% { box-shadow: 0 0 0 0 rgba(215,181,101,0); } }
.g-badge { position: absolute; z-index: 2; top: .7rem; left: .7rem; padding: .22rem .6rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; background: var(--ink); color: var(--gold-light); }

/* -----------------------------------------------------------------------
   Lightbox
   ----------------------------------------------------------------------- */
.glb { position: fixed; inset: 0; z-index: 120; display: none; background: rgba(10,9,8,.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--paper); }
.glb.is-open { display: flex; flex-direction: column; animation: glb-in .3s ease; }
@keyframes glb-in { from { opacity: 0; } }
.glb__top, .glb__bot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; }
.glb__cat { font-family: 'Archivo', sans-serif; font-weight: 700; letter-spacing: .04em; color: var(--gold-light); font-size: .95rem; }
.glb__count { font-variant-numeric: tabular-nums; font-size: .85rem; color: rgba(250,249,246,.65); }
.glb__stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 3.5rem; touch-action: pan-y; }
.glb__stage img, .glb__stage video { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.glb__stage > img, .glb__stage > video { animation: glb-next .45s cubic-bezier(.2,.7,.2,1); }
.glb__stage.is-prev > img, .glb__stage.is-prev > video { animation-name: glb-prev; }
@keyframes glb-next { from { opacity: 0; transform: translateX(36px) scale(.98); } }
@keyframes glb-prev { from { opacity: 0; transform: translateX(-36px) scale(.98); } }

.glb__btn {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border: 1px solid rgba(250,249,246,.25);
  background: rgba(19,18,16,.6); color: var(--paper); transition: background-color .2s, border-color .2s, color .2s;
}
.glb__btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.glb__btn svg { width: 1.2rem; height: 1.2rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.glb__nav { position: absolute; top: 50%; margin-top: -1.45rem; z-index: 2; }
.glb__nav--prev { left: .6rem; } .glb__nav--next { right: .6rem; }
.glb__bar { height: 2px; background: rgba(250,249,246,.12); }
.glb__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold-light)); transition: width .45s cubic-bezier(.2,.7,.2,1); }
@media (max-width: 640px) { .glb__stage { padding: 0 .5rem; } .glb__nav { top: auto; bottom: .9rem; margin: 0; } .glb__bot { padding-bottom: 4.2rem; } }

/* videos have a low native size — let them fill the stage */
.glb__stage video { width: min(100%, 1100px); height: 100%; background: #000; }

/* -----------------------------------------------------------------------
   Reduced motion: show everything, no movement
   ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .g-hero__bg, .g-hero__tri, .g-play, .g-tile::before { animation: none !important; }
  .g-hero__in > * { opacity: 1; transform: none; animation: none; }
  .g-tile { opacity: 1; transform: none; }
}
