/* =========================================================
   YUSY 科学+ — 往届赛事掠影 Gallery
   Loads AFTER style.css. Adds gallery grid + lightbox only.
   ========================================================= */

/* Intro band under page-head */
.gallery-intro { max-width: 820px; margin: 0 auto 8px; text-align: center; color: var(--c-ink-2); font-size: 16px; line-height: 1.8; }
.gallery-meta {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 22px 0 6px;
}
.gallery-meta .gm {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--c-bg-sky); border: 1px solid var(--c-line);
}
.gallery-meta .gm .n { font-size: 20px; font-weight: 800; color: var(--c-brand); }
.gallery-meta .gm .l { font-size: 13px; color: var(--c-mute); font-weight: 600; }

.gallery-note {
  max-width: 880px; margin: 26px auto 0; padding: 14px 18px;
  background: #fbfaf3; border: 1px solid #ece5cc; border-left: 4px solid var(--c-sun);
  border-radius: 12px; font-size: 13.5px; color: var(--c-ink-2); line-height: 1.7;
}

/* Filter tabs */
.gallery-filter {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 0 0 30px;
}
.gallery-filter button {
  border: 1px solid var(--c-line-2); background: #fff;
  border-radius: 999px; padding: 9px 20px; cursor: pointer;
  font-size: 14.5px; font-weight: 700; color: var(--c-ink-2);
  font-family: inherit; transition: all .15s ease;
}
.gallery-filter button:hover { border-color: var(--c-brand-2); color: var(--c-brand); }
.gallery-filter button.active { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(30,111,217,.28); }
.gallery-filter button .c { opacity: .7; font-weight: 600; font-size: 12.5px; margin-left: 4px; }

/* Masonry via CSS columns */
.masonry { column-count: 4; column-gap: 16px; }
@media (max-width: 1100px) { .masonry { column-count: 3; } }
@media (max-width: 760px)  { .masonry { column-count: 2; column-gap: 12px; } }
@media (max-width: 460px)  { .masonry { column-count: 1; } }

.g-item {
  position: relative; break-inside: avoid; margin-bottom: 16px;
  border-radius: 14px; overflow: hidden; cursor: pointer;
  background: var(--c-bg-soft); box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-line);
  transition: transform .2s ease, box-shadow .25s ease;
}
.g-item.hide { display: none; }
.g-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.g-item img { width: 100%; height: auto; display: block; transition: transform .4s ease; }
.g-item:hover img { transform: scale(1.04); }
.g-item .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 14px 12px;
  background: linear-gradient(180deg, transparent, rgba(7,18,40,.82));
  color: #fff; font-size: 13.5px; font-weight: 600;
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease;
}
.g-item:hover .cap { opacity: 1; transform: none; }
.g-item .badge-theme {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; color: #fff;
  background: rgba(11,30,63,.6); backdrop-filter: blur(4px);
}

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 200; display: none; }
.lb.open { display: block; }
.lb-bg { position: absolute; inset: 0; background: rgba(5,10,24,.92); }
.lb-stage {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 40px 64px; flex-direction: column; gap: 14px;
}
.lb-stage img {
  max-width: 100%; max-height: 82vh; border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5); background: #111;
}
.lb-cap { color: #e8eefc; font-size: 15px; font-weight: 600; text-align: center; }
.lb-cap small { display: block; color: #93a5c5; font-weight: 400; margin-top: 4px; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 24px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-close {
  position: absolute; top: 16px; right: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 26px; cursor: pointer; line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.24); }
.lb-count { position: absolute; top: 22px; left: 22px; color: #b6c5e3; font-size: 13px; font-weight: 600; letter-spacing: .04em; }
@media (max-width: 640px) {
  .lb-stage { padding: 56px 12px; }
  .lb-btn { width: 42px; height: 42px; font-size: 20px; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
}

/* ===== Homepage hero background video ===== */
.hero-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-media .tint { position: absolute; inset: 0; background: var(--grad-hero); opacity: .82; }
.hero.has-video { background: #07142b; }      /* fallback under video */
.hero.has-video::before { z-index: 1; }        /* keep starfield above video */
.hero.has-video > .container { position: relative; z-index: 2; }

/* ===== Gallery featured video ===== */
.gallery-video {
  position: relative; max-width: 960px; margin: 0 auto 32px;
  border-radius: 18px; overflow: hidden; background: #000;
  box-shadow: var(--shadow-md); border: 1px solid var(--c-line);
}
.gallery-video video { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.gallery-video .gv-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 16px 12px; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(7,18,40,.78));
  color: #fff; font-size: 13.5px; font-weight: 600;
}
.gallery-video .gv-cap small { display: block; color: #b6c5e3; font-weight: 400; margin-top: 2px; }

/* Homepage teaser strip */
.gallery-teaser { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.gallery-teaser a { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4/3; box-shadow: var(--shadow-sm); }
.gallery-teaser img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.gallery-teaser a:hover img { transform: scale(1.06); }
@media (max-width: 760px) { .gallery-teaser { grid-template-columns: repeat(2, 1fr); } }
