/* Thư viện ảnh (user 20/11/2026: "theo bạn có nên đưa thư viện ảnh vào trên web ko"): 12 ảnh tĩnh lấy từ phim 4K đã chốt
   (img/thu-vien/, tools ghi trong README). Dải ảnh lớn kéo ngang, bấm một ảnh mở toàn màn hình. js/gallery.js */
.ch-lib { padding-bottom: 0; }
.lib-head { display: flex; align-items: end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.lib-nav { display: flex; gap: 10px; }
.lib-nav button { width: 52px; height: 52px; font: inherit; font-size: 20px; line-height: 1; color: var(--ink); background: none; border: 1px solid var(--ink); cursor: pointer; transition: background .3s, color .3s, opacity .3s; }
.lib-nav button:hover { background: var(--ink); color: #fff; }
.lib-nav button:disabled { opacity: .3; pointer-events: none; }
.lib-strip { margin-top: clamp(40px, 5vw, 72px); display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
  padding-inline: max(28px, calc((100% - 1240px) / 2 + 28px)); scroll-padding-inline: max(28px, calc((100% - 1240px) / 2 + 28px)); cursor: grab; }
.lib-strip::-webkit-scrollbar { display: none; }
.lib-strip.drag { cursor: grabbing; scroll-snap-type: none; }
.lib-strip.free { scroll-snap-type: none; }   /* máy có chuột: khớp ảnh do js/gallery.js lướt êm, không để trình duyệt nhảy tức thì (user 21/11: "giật lại về ảnh cũ") */
.lib-item { flex: none; position: relative; height: clamp(260px, 60vh, 680px); aspect-ratio: 16 / 9; padding: 0; border: 0; overflow: hidden; background: #1a1c22; cursor: inherit; scroll-snap-align: start; }
.lib-item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease); -webkit-user-drag: none; user-select: none; }
.lib-item:hover img, .lib-item:focus-visible img { transform: scale(1.035); }
.lib-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 22px 18px; text-align: left; color: #fff; font: inherit; font-size: 15px; letter-spacing: .02em;
  background: linear-gradient(180deg, rgba(10,12,20,0), rgba(10,12,20,.62)); }
.lib-item span b { font-weight: 400; opacity: .7; margin-right: 12px; font-variant-numeric: tabular-nums; }

.lib-box { position: fixed; inset: 0; z-index: 90; background: rgba(8,9,11,.97); display: grid; place-items: center; opacity: 0; transition: opacity .4s ease; }
.lib-box.on { opacity: 1; }
.lib-box[hidden] { display: none; }
.lib-box img { max-width: 100vw; max-height: 100vh; width: auto; height: auto; display: block; transition: opacity .3s ease; }
.lib-box img.swap { opacity: 0; }
.lib-cap { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom, 0px)); margin: 0; text-align: center; color: #fff; font-size: 16px; text-shadow: 0 1px 12px rgba(0,0,0,.8); pointer-events: none; }
.lib-cap b { font-weight: 400; opacity: .7; margin-right: 14px; font-variant-numeric: tabular-nums; }
.lib-box button { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); background: rgba(8,9,11,.3); color: #fff; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; transition: background .3s; }
.lib-box button:hover, .lib-box button:focus-visible { background: rgba(255,255,255,.18); }
.lib-x { top: max(14px, env(safe-area-inset-top, 0px)); right: max(18px, env(safe-area-inset-right, 0px)); }
.lib-prev { left: max(18px, env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lib-next { right: max(18px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }

/* 04 · Tiện ích: ba clip nhỏ dưới clip chính */
.gallery.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; }
.gallery.three figure { aspect-ratio: 4 / 3; }

@media (max-width: 960px) { .gallery.three { grid-template-columns: minmax(0, 1fr); } .gallery.three figure { aspect-ratio: 16 / 9; } }
@media (max-width: 640px) {
  .lib-nav { display: none; }
  .lib-strip { padding-inline: 16px; scroll-padding-inline: 16px; }
  .lib-item { height: auto; width: 86vw; }
  .lib-box button { width: 44px; height: 44px; }
  .lib-prev, .lib-next { top: auto; bottom: max(64px, env(safe-area-inset-bottom, 0px)); transform: none; }
}
@media (prefers-reduced-motion: reduce) { .lib-box, .lib-box img, .lib-item img { transition: none; } }
