/* ==========================================================================
   HALL VIII · IIT KANPUR  -  gallery.css  (gallery.html only)

   Table of contents
   01. Page heading & breadcrumbs
   02. Album cards
   03. Album toolbar (grid / slideshow switch)
   04. Grid view
   05. Slideshow view (stage, caption, arrows, progress, controls, thumbnails)
   06. Fullscreen & responsive

   Colours and fonts come from the tokens in styles.css (var(--acc) etc.),
   so light/dark themes work automatically. All class names start with g-.
   ========================================================================== */

/* 01. PAGE HEADING & BREADCRUMBS ------------------------------------------ */
.g-hero {
  padding: 56px 0 8px;
}
.g-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  font: 400 13px var(--m);
  color: var(--mute);
}
.g-crumbs a {
  color: var(--acc);
}
.g-crumbs a:hover {
  text-decoration: underline;
}
.g-hero h1 {
  margin: 0 0 10px;
  font: 700 clamp(32px, 5vw, 52px) / 1.1 var(--d);
  letter-spacing: -0.03em;
}
.g-hero p {
  max-width: 62ch;
  margin: 0;
  color: var(--mute);
}
[hidden] {
  display: none !important; /* beats display:grid/flex set on the components below */
}

/* 02. ALBUM CARDS --------------------------------------------------------- */
.g-albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 28px 0 72px;
  padding: 0;
  list-style: none;
}
.g-album {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--sh);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.25s,
    border-color 0.25s;
}
.g-album:hover {
  transform: translateY(-4px);
  border-color: var(--acc);
}
/* Striped placeholder shows when the cover image file is missing (JS removes the broken <img>) */
.g-cover,
.g-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: repeating-linear-gradient(
    45deg,
    var(--grid) 0 10px,
    transparent 10px 20px
  );
}
.g-cover img,
.g-tile img,
.g-cover video,
.g-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.g-album:hover .g-cover img,
.g-album:hover .g-cover video {
  transform: scale(1.05);
}
.g-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(7, 26, 51, 0.78);
  color: #fff;
  font: 500 12px var(--m);
}
.g-meta {
  padding: 14px 16px 18px;
}
.g-meta h3 {
  margin: 0 0 4px;
  font: 700 18px var(--d);
  letter-spacing: -0.01em;
}
.g-meta p {
  margin: 0;
  color: var(--mute);
  font-size: 14px;
}

/* 03. ALBUM TOOLBAR ------------------------------------------------------- */
.g-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 18px;
}
.g-countl {
  font: 400 13px var(--m);
  color: var(--mute);
}
.g-seg {
  display: inline-flex;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.g-seg button {
  padding: 9px 18px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 13px var(--m);
  cursor: pointer;
}
.g-seg button[aria-pressed="true"] {
  background: var(--acc);
  color: var(--on);
}

/* 04. GRID VIEW ----------------------------------------------------------- */
.g-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 72px;
}
a.g-tile {
  display: block;
}
.g-tile {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: zoom-in;
}
.g-tile:hover img,
.g-tile:hover video {
  transform: scale(1.06);
}
/* Caption slides up on hover/focus; always visible when the image is missing */
.g-tile::after {
  content: attr(data-c);
  position: absolute;
  inset: auto 0 0;
  padding: 26px 10px 8px;
  text-align: left;
  color: #fff;
  font: 500 13px var(--b);
  background: linear-gradient(transparent, rgba(7, 26, 51, 0.88));
  opacity: 0;
  transition: opacity 0.25s;
}
.g-tile:hover::after,
.g-tile:focus-visible::after,
.g-tile:not(:has(img))::after {
  opacity: 1;
}

/* Year heading between groups of photos (albums with year folders) */
.g-year {
  grid-column: 1 / -1;
  margin: 14px 0 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font: 700 18px var(--d);
}
.g-year:first-child {
  margin-top: 0;
}

/* 05. SLIDESHOW VIEW ------------------------------------------------------ */
.g-show {
  margin-bottom: 72px;
}
.g-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 72vh;
  overflow: hidden;
  background: #071a33;
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: pan-y; /* keep vertical scrolling, JS handles horizontal swipes */
}
.g-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.4s;
}
.g-cap {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 36px 18px 14px;
  color: #fff;
  background: linear-gradient(transparent, rgba(4, 16, 31, 0.9));
  pointer-events: none;
}
.g-cap b {
  font: 500 12px var(--m);
  color: #9fd8ff;
}
.g-cap span {
  font: 500 16px var(--b);
}
.g-ar {
  position: absolute;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-top: -23px;
  border: 0;
  border-radius: 50%;
  background: rgba(4, 16, 31, 0.6);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  transition: background 0.2s;
}
.g-ar:hover {
  background: var(--acc);
}
.g-pv {
  left: 12px;
}
.g-nx {
  right: 12px;
}
/* Progress bar = autoplay timer. When it finishes (animationend) JS shows the next photo.
   It only animates while the slideshow is playing, so a paused show shows an empty bar. */
.g-pb {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}
.g-pb i {
  display: block;
  height: 100%;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: left;
}
.g-show.playing .g-pb i {
  animation: g-pb 5s linear forwards;
}
@keyframes g-pb {
  to {
    transform: scaleX(1);
  }
}
.g-ctrl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.g-hint {
  margin-left: auto;
  font: 400 12px var(--m);
  color: var(--mute);
}
.g-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 4px 2px 8px;
  overflow-x: auto;
}
.g-thumbs button {
  flex: none;
  width: 96px;
  padding: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    var(--grid) 0 8px,
    transparent 8px 16px
  );
  opacity: 0.55;
  cursor: pointer;
  transition:
    opacity 0.2s,
    border-color 0.2s;
}
.g-thumbs button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.g-thumbs button:hover {
  opacity: 0.9;
}
.g-thumbs button.on {
  opacity: 1;
  border-color: var(--acc);
}

/* 06. FULLSCREEN & RESPONSIVE --------------------------------------------- */
.g-show:fullscreen {
  display: flex;
  flex-direction: column;
  padding: 16px;
  margin: 0;
  background: #04101f;
}
.g-show:fullscreen .g-stage {
  flex: 1;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
}
.g-show:fullscreen .g-hint {
  color: #9fb4d0;
}
@media (max-width: 700px) {
  .g-hero {
    padding-top: 36px;
  }
  .g-hint {
    display: none;
  }
  .g-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .g-ar {
    width: 40px;
    height: 40px;
  }
}
@media print {
  .g-ctrl,
  .g-thumbs,
  .g-ar {
    display: none;
  }
}

/* Videos in albums: still-frame previews with a play mark; the stage plays them with native controls */
.g-play {
  position: absolute;
  right: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(7, 26, 51, 0.78);
  color: #fff;
  font-size: 11px;
  padding-left: 2px;
  pointer-events: none;
}
.g-tile:has(video)::before {
  content: "▶";
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(7, 26, 51, 0.78);
  color: #fff;
  font-size: 11px;
  padding-left: 2px;
}
.g-thumbs button {
  position: relative;
}
.g-thumbs button video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.g-thumbs .g-play {
  right: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  font-size: 8px;
}
.g-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* the caption moves to the top so it does not cover the video's controls */
.g-show.is-video .g-cap {
  inset: 3px 0 auto;
  padding: 12px 18px 30px;
  background: linear-gradient(rgba(4, 16, 31, 0.85), transparent);
}
