/* =========================================================
   סהר · Gallery page
   ========================================================= */

/* ---------- Page header ---------- */
.ghero {
  position: relative; min-height: 74vh; min-height: 74svh;
  display: flex; align-items: flex-end; color: var(--paper);
  overflow: hidden; isolation: isolate; background: var(--night);
}
.ghero__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  transform: scale(1.08); animation: heroZoom 12s var(--ease) forwards;
}
.ghero__shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(20, 19, 15, .55) 0%, rgba(20, 19, 15, 0) 30%),
    linear-gradient(0deg, rgba(20, 19, 15, .92) 0%, rgba(20, 19, 15, .3) 50%, rgba(20, 19, 15, 0) 75%);
}
.ghero__inner { padding-top: 150px; padding-bottom: clamp(40px, 6vw, 70px); }
.crumbs { display: flex; gap: 10px; font-size: 14px; opacity: .75; margin-bottom: 18px; }
.crumbs a { border-bottom: 1px solid transparent; transition: border-color .3s; }
.crumbs a:hover { border-color: currentColor; }
.ghero__title {
  font-family: var(--display); font-weight: 300;
  font-size: clamp(52px, 9vw, 130px); line-height: .95; letter-spacing: -.02em; margin-bottom: 24px;
}
.ghero__title em { font-style: normal; color: var(--ochre); font-weight: 400; }
.ghero__lede { font-size: clamp(17px, 1.5vw, 20px); max-width: 560px; opacity: .88; }
.ghero__meta { font-size: 14px; letter-spacing: .06em; color: var(--ochre); margin: 0; }

/* ---------- Filter bar ---------- */
.gfilters {
  position: sticky; top: var(--navh, 64px); z-index: 50;
  background: rgba(250, 246, 239, .9);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  transition: top .4s var(--ease);
}
.gfilters__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 14px; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin-inline: -4px; padding: 4px; min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; font-size: 15px; font-weight: 400; white-space: nowrap;
  transition: background .3s, color .3s, border-color .3s;
}
.chip span { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; transition: color .3s; }
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--night); color: var(--paper); border-color: var(--night); }
.chip.is-active span { color: var(--ochre); }
.gfilters__status { margin: 0; font-size: 14px; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Justified grid ----------
   Each item grows in proportion to its aspect ratio (--ar), so all items in a row
   share one height. The ::after spacer keeps the last row from stretching. */
.gallery.section { padding-top: clamp(36px, 5vw, 60px); }
.jgrid { --h: 300px; display: flex; flex-wrap: wrap; gap: 14px; }
.jgrid::after { content: ""; flex-grow: 1000000; }
.g-item {
  position: relative; margin: 0;
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--h));
  aspect-ratio: var(--ar);
  border-radius: 16px; overflow: hidden; background: var(--sand-2);
}
.g-item[hidden] { display: none; }
.g-item.is-entering { animation: gIn .6s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes gIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }

.g-open {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none;
  cursor: zoom-in; position: relative; border-radius: inherit;
}
.g-open img, .g-open video {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s var(--ease), filter .6s;
}
.g-item:hover .g-open img, .g-item:hover .g-open video { transform: scale(1.05); }
.g-open:focus-visible { outline: 3px solid var(--clay); outline-offset: -3px; }

.g-item figcaption {
  position: absolute; inset-inline: 0; bottom: 0; pointer-events: none;
  padding: 40px 18px 16px; color: var(--paper);
  background: linear-gradient(0deg, rgba(20, 19, 15, .78), rgba(20, 19, 15, 0));
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transform: translateY(8px); transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.g-item figcaption strong { font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.2; }
.g-item figcaption span { font-size: 12.5px; letter-spacing: .06em; color: var(--ochre); }
.g-item:hover figcaption, .g-item:focus-within figcaption { opacity: 1; transform: none; }
@media (hover: none) {
  .g-item figcaption { opacity: 1; transform: none; padding: 30px 14px 12px; }
  .g-item figcaption strong { font-size: 17px; }
}

.g-play {
  position: absolute; top: 14px; inset-inline-start: 14px;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(20, 19, 15, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(250, 246, 239, .35); color: var(--paper);
  transition: transform .4s var(--ease), background .3s;
}
.g-play svg { width: 16px; height: 16px; fill: currentColor; margin-left: 3px; }
.g-item:hover .g-play { transform: scale(1.1); background: var(--clay); border-color: var(--clay); }

.gempty { text-align: center; color: var(--ink-soft); padding: 60px 0; }

/* ---------- CTA ---------- */
.gcta { position: relative; isolation: isolate; overflow: hidden; padding-block: clamp(100px, 13vw, 170px); color: var(--paper); text-align: center; background: var(--night); }
.gcta img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.gcta__shade { position: absolute; inset: 0; z-index: -1; background: rgba(10, 11, 18, .62); }
.gcta__inner { display: grid; justify-items: center; }
.gcta .h2 { margin-bottom: 34px; }

.footer--compact { padding-top: 10px; }

/* ---------- Lightbox ---------- */
.lb {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; inset: 0;
  background: rgba(12, 11, 9, .97); color: var(--paper);
  overflow: hidden;
}
.lb[open] { display: grid; grid-template-rows: auto 1fr auto auto; animation: lbIn .4s var(--ease); }
.lb::backdrop { background: rgba(12, 11, 9, .7); }
@keyframes lbIn { from { opacity: 0; } }

.lb__top { display: flex; align-items: center; justify-content: space-between; padding: 16px clamp(16px, 3vw, 28px); }
.lb__count { margin: 0; font-size: 14px; letter-spacing: .08em; opacity: .7; font-variant-numeric: tabular-nums; }

.lb__btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(250, 246, 239, .08); border: 1px solid rgba(250, 246, 239, .16); color: var(--paper);
  transition: background .3s, border-color .3s, transform .3s var(--ease), opacity .3s;
}
.lb__btn:hover { background: rgba(250, 246, 239, .18); border-color: rgba(250, 246, 239, .5); }
.lb__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb__btn:disabled { opacity: .2; pointer-events: none; }

.lb__stage {
  position: relative; min-height: 0; display: grid; place-items: center;
  grid-template-rows: 100%; grid-template-columns: 100%; /* gives the media a definite box to fit into */
  padding: 0 clamp(16px, 7vw, 100px); touch-action: pan-y; user-select: none;
}
.lb__img, .lb__video {
  grid-area: 1 / 1; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.lb__img { cursor: grab; }
.lb__img[hidden], .lb__video[hidden] { display: none; }
.lb.is-loading .lb__img { opacity: 0; transform: translateX(calc(var(--dir, 0) * 24px)) scale(.98); }
.lb__spinner {
  grid-area: 1 / 1; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(250, 246, 239, .2); border-top-color: var(--ochre);
  animation: spin .9s linear infinite; opacity: 0; transition: opacity .3s;
}
.lb.is-loading .lb__spinner { opacity: 1; }

.lb__nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 56px; height: 56px; }
.lb__prev { inset-inline-start: clamp(10px, 2vw, 28px); }
.lb__next { inset-inline-end: clamp(10px, 2vw, 28px); }
.lb__prev:hover { transform: translateX(3px); }
.lb__next:hover { transform: translateX(-3px); }

.lb__caption { text-align: center; padding: 18px 20px 6px; }
.lb__caption h2 { font-family: var(--display); font-size: clamp(22px, 2.4vw, 30px); font-weight: 400; margin-bottom: 2px; }
.lb__caption p { margin: 0; font-size: 13px; letter-spacing: .08em; color: var(--ochre); }

.lb__thumbs {
  display: flex; gap: 8px; justify-content: safe center; overflow-x: auto; scrollbar-width: none;
  padding: 14px clamp(16px, 3vw, 28px) 20px;
}
.lb__thumbs::-webkit-scrollbar { display: none; }
.lb__thumbs button {
  flex-shrink: 0; width: 64px; height: 46px; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  opacity: .4; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .3s, outline-color .3s; background: #222;
}
.lb__thumbs button:hover { opacity: .8; }
.lb__thumbs button[aria-current="true"] { opacity: 1; outline-color: var(--ochre); }
.lb__thumbs img, .lb__thumbs video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

@media (max-width: 900px) {
  .jgrid { --h: 220px; gap: 10px; }
  .gfilters__status { display: none; }
}
@media (max-width: 640px) {
  .jgrid { --h: 110px; gap: 6px; }
  .g-item { border-radius: 10px; }
  .g-item figcaption { display: none; }
  .g-play { width: 36px; height: 36px; top: 10px; inset-inline-start: 10px; }
  .chip { padding: 9px 15px; font-size: 14px; }
  .lb[open] { grid-template-rows: auto 1fr auto auto; }
  .lb__stage { padding: 0 8px; }
  .lb__nav { width: 42px; height: 42px; background: rgba(12, 11, 9, .55); }
  .lb__thumbs button { width: 52px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .ghero__img { animation: none; transform: none; }
  .g-item.is-entering { animation: none; }
  .lb[open] { animation: none; }
  .lb__img, .lb__video { transition: none; }
}
