/* ============================================================
   МОТО ТОП — galeria.css
   Masonry gallery grid, lite-YouTube, native <dialog> lightbox.
   Extends base.css tokens.
   ============================================================ */

/* ---------- featured video (lite-youtube) ---------- */
.g-video {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 16 / 9;
}
.lite-yt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #000;
}
.lite-yt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 0.25s, transform 0.4s;
}
.lite-yt:hover img {
  opacity: 0.85;
  transform: scale(1.03);
}
.yt-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, background 0.2s;
}
.lite-yt:hover .yt-play {
  transform: scale(1.08);
  background: var(--accent-2);
}
.yt-play svg {
  width: 30px;
  height: 30px;
  margin-left: 4px;
}
.g-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.g-video__label {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text);
  background: rgba(20, 19, 17, 0.65);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  pointer-events: none;
}

/* ---------- masonry grid ---------- */
.g-grid {
  columns: 4 260px;
  column-gap: 14px;
}
@media (max-width: 900px) {
  .g-grid {
    column-gap: 12px;
  }
}
.g-item {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  break-inside: avoid;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.g-item:hover {
  border-color: rgba(246, 143, 71, 0.5);
  box-shadow: var(--shadow-1);
}
.g-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}
.g-item:hover img {
  transform: scale(1.05);
}
.g-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.4rem 0.8rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text);
  background: linear-gradient(transparent, rgba(20, 19, 17, 0.85));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}
.g-item:hover figcaption,
.g-item:focus-visible figcaption {
  opacity: 1;
  transform: none;
}

/* ---------- lightbox <dialog> ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(94vw, 1100px);
  max-height: 94vh;
  color: var(--text);
  overflow: visible;
}
.lightbox::backdrop {
  background: rgba(10, 9, 8, 0.9);
  backdrop-filter: blur(4px);
}
.lb-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.lb-cap {
  margin-top: 0.9rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  max-width: 60ch;
}
.lb-count {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-right: 0.5rem;
}
.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 19, 17, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lb-btn:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.lb-btn svg {
  width: 26px;
  height: 26px;
}
.lb-prev {
  left: -68px;
}
.lb-next {
  right: -68px;
}
.lb-close {
  position: absolute;
  top: -56px;
  right: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 19, 17, 0.8);
  color: var(--text);
  cursor: pointer;
}
.lb-close:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.lb-close svg {
  width: 22px;
  height: 22px;
}
@media (max-width: 820px) {
  .lb-prev {
    left: 6px;
  }
  .lb-next {
    right: 6px;
  }
  .lb-close {
    top: 6px;
    right: 6px;
    background: rgba(10, 9, 8, 0.7);
  }
}
