/* ============================================================
   gallery.css — work gallery grid + click-to-zoom lightbox
   ============================================================ */
.gallery-wrap {
  grid-column: 1 / -1;
  margin-top: clamp(2rem, 4.5vw, 3.6rem);
}
.gallery-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  margin: 0 0 1rem;
  color: var(--paper);
}
.gallery-title span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
/* sophisticated horizontal slider: scroll-snap track + drag/swipe + arrows */
.gallery__viewport { position: relative; }
.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(220px, 26vw, 300px);
  gap: clamp(0.6rem, 1.4vw, 1rem);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
  cursor: grab;
  padding: 6px 4px 16px;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery.is-grabbing { cursor: grabbing; scroll-behavior: auto; scroll-snap-type: none; }
.gallery.is-grabbing .gallery__item { cursor: grabbing; }
.gallery__item {
  scroll-snap-align: start;
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 11, 16, 0.6);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s;
}
.gallery__item:hover,
.gallery__item:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  outline: none;
  z-index: 3;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery__item:hover img { transform: scale(1.06); }

/* "N angles" badge on multi-photo projects */
.gallery__count {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 6px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  color: #0b0a07;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.gallery__count svg { display: block; }

/* caption: a tidy mixed-case title is always shown; the full English
   explanation slides up on hover (and the lightbox shows both on click) */
.gallery__cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.55rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5) 35%, rgba(0, 0, 0, 0.9));
  pointer-events: none;
  transition: background 0.3s ease;
}
.gallery__item:hover .gallery__cap,
.gallery__item:focus-within .gallery__cap {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62) 16%, rgba(0, 0, 0, 0.93) 44%);
}
.gallery__t {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gallery__d {
  display: block;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  font-style: normal;
  font-size: 0.55rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.82);
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
}
.gallery__item:hover .gallery__d,
.gallery__item:focus-within .gallery__d {
  max-height: 9rem;
  opacity: 1;
  margin-top: 0.35rem;
}

/* slider arrows (fade in on hover) + progress thumb */
.gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 38px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent);
  background: rgba(8, 10, 16, 0.6);
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease, background 0.2s, transform 0.2s;
}
.gallery__viewport:hover .gallery__arrow { opacity: 1; }
.gallery__arrow:hover { background: color-mix(in oklab, var(--accent) 22%, #04130f); transform: translateY(-50%) scale(1.06); }
.gallery__arrow--prev { left: 6px; }
.gallery__arrow--next { right: 6px; }
.gallery__arrow.is-disabled { opacity: 0 !important; pointer-events: none; }
.gallery__viewport.is-static .gallery__arrow { display: none; }
@media (hover: none) {
  .gallery__arrow { opacity: 0.82; width: 34px; height: 48px; font-size: 22px; }
}
.gallery__progress {
  position: relative;
  height: 3px;
  width: min(220px, 60%);
  margin: 0.9rem auto 0;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.gallery__progress i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  border-radius: 100px;
  background: var(--accent);
  transition: left 0.12s linear, width 0.12s linear;
}
.gallery__viewport.is-static + .gallery__progress { display: none; }

/* placeholder shown until the real photo is saved into the folder */
.gallery__missing {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  text-align: center;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-faint);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 10px, transparent 10px 20px);
}
.gallery__missing b { display: block; margin-top: 0.4rem; color: var(--accent); font-size: 0.72rem; }
.gallery__item.is-missing { cursor: default; }
.gallery__item.is-missing img,
.gallery__item.is-missing .gallery__cap { display: none; }
.gallery__item.is-missing .gallery__missing { display: grid; }

.gallery-note {
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--paper-dim);
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 2vw, 1.4rem);
  padding: clamp(0.8rem, 3vw, 2.4rem);
  background: rgba(3, 4, 8, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 92vw;
}
.lightbox__img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  background: #111;
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.lightbox.is-open .lightbox__img { transform: scale(1); }
.lightbox__cap {
  margin-top: 1rem;
  max-width: 60ch;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--paper-dim);
}
.lightbox__cap .lb-t {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0;
  color: var(--paper);
  margin-bottom: 0.4rem;
}
.lightbox__cap .lb-d { display: block; }
.lightbox__close {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.4rem);
  right: clamp(0.6rem, 2vw, 1.4rem);
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.lightbox__close:hover { background: var(--accent); color: #0b0a07; }
.lightbox__nav {
  flex: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.lightbox__nav:hover { background: var(--accent); color: #0b0a07; }
@media (max-width: 600px) {
  .lightbox__nav { position: absolute; bottom: 1rem; }
  .lightbox__prev { left: 1rem; }
  .lightbox__next { right: 1rem; }
}

/* ---- Video carousel (reuses the .gallery slider engine) ---- */
.video-rail { grid-auto-columns: clamp(260px, 34vw, 380px); }
.video-card { aspect-ratio: 16 / 9; }
.video-card img { filter: brightness(0.82); }
.video-card:hover img { filter: brightness(0.96); }
.video-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(8, 10, 16, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: none;
  transition: background 0.25s, transform 0.25s, border-color 0.25s, color 0.25s;
}
.video-card__play svg { width: 24px; height: 24px; margin-left: 3px; }
.video-card:hover .video-card__play,
.video-card:focus-visible .video-card__play {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0a07;
  transform: translate(-50%, -50%) scale(1.08);
}

/* video lightbox (YouTube embed) */
.vlightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.8rem, 4vw, 3rem);
  background: rgba(3, 4, 8, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.vlightbox.is-open { opacity: 1; visibility: visible; }
.vlightbox__frame {
  position: relative;
  width: min(1100px, 92vw);
  aspect-ratio: 16 / 9;
  max-height: 84vh;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.97);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.vlightbox.is-open .vlightbox__frame { transform: scale(1); }
.vlightbox__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.vlightbox__close {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.4rem);
  right: clamp(0.6rem, 2vw, 1.4rem);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.vlightbox__close:hover { background: var(--accent); color: #0b0a07; }
