/* Thư viện ảnh (dùng chung biến màu, phông từ style.css) */

.gbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  background: var(--night); color: var(--ivory);
  border-bottom: 1px solid var(--gold-faint);
}
.gbar__back {
  justify-self: start;
  font: var(--caps-w) var(--caps-size)/1 var(--f-caps), serif; letter-spacing: .14em;
  color: var(--gold); text-decoration: none;
}
.gbar__back span { display: inline-block; transition: transform .25s; }
.gbar__back:hover span { transform: translateX(-4px); }
.gbar__mark { font: italic 400 22px/1 var(--f-head), serif; color: var(--gold); text-decoration: none; }
.gbar__count { justify-self: end; font-style: italic; color: var(--muted-n); font-size: 16px; }

.ghero { position: relative; overflow: hidden; text-align: center; padding: 76px 20px 56px; }
.ghero > * { position: relative; }
.ghero .nave__cross { margin-bottom: 14px; }
.ghero h1 { font: var(--head-w) clamp(44px, 6vw, 76px)/1.05 var(--f-head), serif; margin: 12px 0 16px; }
.ghero__sub { margin-top: 12px; font-style: italic; color: var(--muted-n); }
.ghero__fl { position: absolute !important; height: auto; aspect-ratio: 252 / 240; width: 320px; opacity: .26; pointer-events: none; }
.ghero__fl--l { left: -60px; bottom: -70px; }
.ghero__fl--r { right: -60px; top: -60px; transform: rotate(180deg); }

/* Thanh chọn nhóm */
.gnav {
  position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 30;
  background: rgba(245, 240, 230, .96);
  border-bottom: 1px solid var(--gold-faint);
}
.gnav__inner {
  display: flex; gap: 10px; justify-content: center;
  max-width: 1240px; margin: 0 auto; padding: 12px 20px;
  overflow-x: auto; scrollbar-width: none;
}
.gnav__inner::-webkit-scrollbar { display: none; }
.gchip {
  flex: none;
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--gold-soft); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  font-size: 16px; line-height: 1.2;
  transition: background-color .25s, color .25s, border-color .25s;
}
.gchip small { font: 500 11px/1 system-ui, sans-serif; color: var(--muted); }
.gchip:hover { border-color: var(--gold); }
.gchip.is-active { background: var(--night); border-color: var(--night); color: var(--ivory); }
.gchip.is-active small { color: var(--gold); }

/* Nhóm ảnh */
.groups { max-width: 1240px; margin: 0 auto; padding: 64px 20px 90px; }
.groups .group { margin-bottom: 96px; scroll-margin-top: 130px; }
.group:last-child { margin-bottom: 0; }
.group__head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 20px;
  padding-bottom: 16px; margin-bottom: 28px;
  border-bottom: 1px solid var(--gold-soft);
}
.group__no { font: 600 16px/1 'Cormorant SC', serif; letter-spacing: .08em; color: var(--gold); }
.group__head h2 { font: var(--head-w) clamp(32px, 4vw, 48px)/1.1 var(--f-head), serif; color: var(--night); }
.group__meta { margin-left: auto; font-style: italic; color: var(--muted); }

.masonry { display: flex; align-items: flex-start; gap: 14px; }
.masonry__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.gph { background: var(--ivory-2); }
.masonry__col:first-child .gph.is-portrait:first-child { border-radius: 999px 999px 0 0; }
.gph.is-loaded img { transition: opacity .8s ease, transform 1.4s cubic-bezier(.2, .7, .2, 1); }
.gph.is-loaded:hover img { transform: scale(1.03); }

.gempty { max-width: 560px; margin: 0 auto; padding: 90px 20px 110px; text-align: center; }
.gempty h2 { font: var(--head-w) 34px/1.2 var(--f-head), serif; margin: 26px 0 14px; color: var(--night); }
.gempty p { color: var(--muted); }
.gempty code { font-size: .8em; background: var(--ivory-2); padding: 1px 6px; border-radius: 3px; }

.gpage .foot a { color: var(--gold); text-decoration: none; }
.gpage .foot { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }

@media (max-width: 760px) {
  .gbar { padding-left: 14px; padding-right: 14px; }
  .gbar__back { font-size: 12px; }
  .ghero { padding: 56px 16px 44px; }
  .ghero__fl { width: 200px; }
  .gnav__inner { justify-content: flex-start; padding: 10px 16px; }
  .groups { padding: 44px 10px 70px; }
  .groups .group { margin-bottom: 70px; scroll-margin-top: 120px; }
  .group__head { padding: 0 6px 14px; margin-bottom: 18px; }
  .group__meta { margin-left: 0; width: 100%; font-size: .9em; }
  .masonry, .masonry__col { gap: 8px; }
}
