/* Home: gallery "One university, many moments" (partials/home_gallery.html, #huGallery). Lato.
   A compact viewer: the large picture on the left with arrows and a counter, a scrollable grid of small
   pictures on the right at the same height, tabs with counts above, and a full-screen view. */
.hg {
  --hg-green: #0b3a26;
  --hg-green-2: #0f6843;
  --hg-bright: #34c47c;
  --hg-blue: #2b86bf;
  --hg-ink: #13241b;
  --hg-soft: #56665e;
  --hg-line: #dbe3de;
  --hg-h: clamp(320px, 38vw, 500px);   /* height of the viewer and the grid beside it */
  background: #f6f8f7;
  padding: clamp(64px, 7vw, 104px) 0;
  font-family: "Lato", "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--hg-ink);
}
:where(.hg) * { font-family: inherit; }   /* the site-wide stylesheet sets `* { Poppins }` */
.hg p, .hg h2, .hg ul { margin: 0; }
.hg button { font: inherit; cursor: pointer; }
.hg-shell { width: min(1200px, calc(100% - 56px)); margin-inline: auto; }

/* heading and tabs */
.hg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 32px;
  margin-bottom: clamp(20px, 2.4vw, 28px);
}
.hg-head h2 {
  font-size: clamp(26px, 1.1rem + 1.5vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--hg-green);
}
.hg-head h2 span { color: var(--hg-blue); }
.hg-head p { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--hg-soft); }
/* small, nearly square tabs (2px corners), like the tags and buttons on NVIDIA's site */
.hg-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hg-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  border-radius: 2px;
  background: #e4e9e6;
  color: var(--hg-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.hg-tabs button span { font-size: 11px; font-weight: 700; color: var(--hg-soft); }
.hg-tabs button:hover { background: #d5ddd8; }
.hg-tabs button[aria-selected="true"] { background: var(--hg-green-2); color: #ffffff; }
.hg-tabs button[aria-selected="true"] span { color: #c9f0dc; }
.hg-tabs button:focus-visible { outline: 2px solid var(--hg-blue); outline-offset: 2px; }

/* viewer + grid */
.hg-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
}
.hg-viewer {
  position: relative;
  height: var(--hg-h);
  overflow: hidden;
  border-radius: 8px;
  background: #0d1a14;
}
.hg-viewer:focus-visible { outline: 2px solid var(--hg-blue); outline-offset: 3px; }
.hg-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.hg-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s ease;
}
.hg-open img.is-changing { opacity: 0.35; }
.hg-open { position: relative; z-index: 1; }
/* portrait pictures: shown whole, centred, over a blurred and darkened copy of themselves */
.hg-backdrop {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(28px) brightness(0.55) saturate(1.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.hg-viewer.is-portrait .hg-backdrop { opacity: 1; }
.hg-viewer.is-portrait .hg-open img { object-fit: contain; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35)); }
.hg-arrow, .hg-count { z-index: 2; }

.hg-arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--hg-green);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.hg-arrow svg { width: 20px; height: 20px; }
.hg-arrow--prev { left: 14px; }
.hg-arrow--next { right: 14px; }
.hg-viewer:hover .hg-arrow, .hg-viewer:focus-within .hg-arrow { opacity: 1; }
.hg-arrow:hover { transform: scale(1.06); }
.hg-arrow:focus-visible { opacity: 1; outline: 2px solid var(--hg-blue); outline-offset: 2px; }

.hg-count {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(8, 22, 15, 0.72);
  color: #ffffff;
  font-size: 13px;
  pointer-events: none;
}
.hg-count b { font-weight: 700; color: #9fe3c0; }

.hg-thumbs {
  list-style: none;
  padding: 0 4px 0 0;
  height: var(--hg-h);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #b9c7bf transparent;
}
.hg-thumbs li[hidden] { display: none; }
.hg-thumbs button {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #e2e8e4;
  outline: 3px solid transparent;
  outline-offset: -3px;
  transition: outline-color 0.2s ease;
}
.hg-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 0.2s ease, transform 0.4s ease;
}
.hg-thumbs button:hover img { opacity: 1; transform: scale(1.05); }
.hg-thumbs button[aria-current="true"] { outline-color: var(--hg-bright); }
.hg-thumbs button[aria-current="true"] img { opacity: 1; }
.hg-thumbs button:focus-visible { outline-color: var(--hg-blue); }

/* full screen */
.hg-lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(6, 14, 10, 0.94);
}
.hg-lightbox::backdrop { background: rgba(6, 14, 10, 0.94); }
.hg-lightbox[open] { display: grid; place-items: center; }
.hg-lightbox img { max-width: calc(100vw - 140px); max-height: calc(100vh - 80px); object-fit: contain; }
.hg-lightbox .hg-arrow { position: fixed; opacity: 1; }
.hg-box-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--hg-green);
}
.hg-box-close svg { width: 20px; height: 20px; }

/* tablets and phones: viewer on top, small pictures in one sideways strip */
@media (max-width: 860px) {
  .hg { --hg-h: auto; }
  .hg-body { grid-template-columns: minmax(0, 1fr); }
  .hg-viewer { height: auto; aspect-ratio: 4 / 3; }
  .hg-arrow { opacity: 1; width: 38px; height: 38px; margin-top: -19px; }
  .hg-thumbs {
    height: auto;
    padding: 0 0 6px;
    overflow-x: auto;
    overflow-y: hidden;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 84px;
  }
  .hg-lightbox img { max-width: 100vw; }
}
@media (max-width: 600px) {
  .hg-shell { width: calc(100% - 40px); }
  .hg-tabs button { padding: 6px 10px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .hg-open img, .hg-thumbs img, .hg-arrow, .hg-tabs button { transition: none; }
}

/* dark theme (the site's own toggle) */
html[data-theme="dark"] .hg { background: #0f1713; --hg-ink: #e8f0ec; --hg-soft: #a9bab1; --hg-line: #24352c; }
html[data-theme="dark"] .hg-head h2 { color: #e8f0ec; }
html[data-theme="dark"] .hg-head h2 span { color: #8fd0f2; }
html[data-theme="dark"] .hg-tabs button { background: #1d2b24; }
html[data-theme="dark"] .hg-tabs button[aria-selected="true"] { background: #86d5b2; color: #0b1a12; }
html[data-theme="dark"] .hg-tabs button[aria-selected="true"] span { color: #0b3a26; }
