/* ===== TRINH CHIEU ALBUM – Thu vien anh KTXD (single-ktxd_album.php + album-player.js) ===== */
:root { --or: #F5A23C; --or2: #E8731A; --ink: #F4EDE3; --dim: rgba(244,237,227,.62); --cw: min(70vmin, 780px); } /* co anh chinh (khop voi CW trong album-player.js) */
body.admin-bar .alb { height: calc(100dvh - 32px); }
@media (max-width: 782px) { body.admin-bar .alb { height: calc(100dvh - 46px); } }
.alb-back { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-size: .85rem; font-weight: 600;
  padding: 7px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(10,12,24,.45); backdrop-filter: blur(6px); white-space: nowrap; transition: border-color .2s, background .2s; }
.alb-back:hover, .alb-back:focus-visible { border-color: var(--or); background: rgba(232,115,26,.25); outline: none; }
.alb-head .alb-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alb-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); z-index: 4; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #04050b; color: var(--ink); font-family: "Be Vietnam Pro", system-ui, sans-serif; overflow: hidden; }
.alb { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: radial-gradient(ellipse at 50% 120%, #0d1020 0%, #04050b 60%); }
.alb-neb { position: absolute; inset: -30%; pointer-events: none; opacity: .55; filter: blur(40px);
  background:
    radial-gradient(closest-side at var(--n1x) var(--n1y), hsla(var(--h1), 85%, 52%, .55), transparent),
    radial-gradient(closest-side at var(--n2x) var(--n2y), hsla(var(--h2), 80%, 45%, .45), transparent),
    radial-gradient(closest-side at var(--n3x) var(--n3y), hsla(var(--h1), 70%, 35%, .35), transparent);
  animation: neb 120s linear infinite; }
@keyframes neb { to { transform: rotate(360deg); } }
.alb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.alb-stage { position: absolute; inset: 0; perspective: 1100px; perspective-origin: 50% 46%; }
.alb-world { position: absolute; inset: 0; transform-style: preserve-3d; transition: opacity .9s ease; }
.alb-world.out { opacity: 0; }
/* The theo dung ty le anh (--r = rong/cao), nam gon trong khung --cw x 0.8*--cw: anh ngang hay doc deu hien du, khong cat */
.ph { --r: 1.3333; --pw: min(var(--cw), calc(var(--cw) * .88 * var(--r)));
  position: absolute; left: 50%; top: 46%; width: var(--pw); height: calc(var(--pw) / var(--r));
  margin: calc(var(--pw) / var(--r) * -.5) 0 0 calc(var(--pw) * -.5);
  /* lam tron ve diem anh nguyen (tranh nhoe do le 0.5 px); trinh duyet cu bo qua 2 dong nay */
  top: round(46%, 1px); margin: round(calc(var(--pw) / var(--r) * -.5), 1px) 0 0 round(calc(var(--pw) * -.5), 1px);
  border-radius: 18px; overflow: hidden; background: #111; cursor: zoom-in; backface-visibility: hidden; /* khong dung will-change: Chrome se dong bang do net o co nho luc anh moi bay vao -> mo */
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 18px 50px rgba(0,0,0,.55), 0 0 40px rgba(245,162,60,.10); }
.ph img { width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity .8s ease; }
.ph.hero { box-shadow: 0 0 0 1px rgba(255,200,140,.5), 0 25px 70px rgba(0,0,0,.6), 0 0 80px rgba(245,162,60,.35); }
/* Re chuot vao anh: vien cam sang, anh troi cham lai (album.js) */
.ph:hover { box-shadow: 0 0 0 2px rgba(245,162,60,.9), 0 25px 70px rgba(0,0,0,.6), 0 0 90px rgba(245,162,60,.45); }
.alb canvas, .alb-stage { pointer-events: none; }
.ph { pointer-events: auto; }
.ph.crisp img { filter: url(#alb-net); }
/* Toan canh: anh hien du (contain) chua le, nen la ban mo cua chinh anh do */
.kb { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; will-change: transform, opacity; }
.kb::before { content: ""; position: absolute; inset: -6%; background: var(--bg) center / cover no-repeat; filter: blur(34px) brightness(.4) saturate(1.2); }
.kb::after { content: ""; position: absolute; inset: 9vh 4vw 13vh; background: var(--bg) center / contain no-repeat; filter: drop-shadow(0 20px 50px rgba(0,0,0,.6)); }
.kb.on { opacity: 1; }
.kb-vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.65)); }
.alb-head { position: absolute; left: 0; right: 0; top: 0; padding: 18px 24px; display: flex; align-items: center; gap: 14px; z-index: 5; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.55), transparent); }
.alb-head b { font-size: clamp(1rem, 2.2vw, 1.35rem); font-weight: 800; letter-spacing: .02em; text-wrap: balance; }
.alb-head span { color: var(--dim); font-size: .85rem; }
.alb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--or); box-shadow: 0 0 14px var(--or); flex: none; }
.alb-cap { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 5; max-width: min(90vw, 760px); text-align: center;
  font-size: clamp(.9rem, 1.8vw, 1.05rem); font-weight: 600; color: var(--ink); text-shadow: 0 2px 12px #000; opacity: 0; transition: opacity .6s; text-wrap: balance; pointer-events: none; }
.alb-cap.on { opacity: 1; }
.alb-cap { padding: 6px 14px; border-radius: 14px; background: rgba(6,8,18,.45); backdrop-filter: blur(4px); width: max-content; }
.alb-ctl { position: absolute; right: 18px; bottom: 18px; z-index: 6; display: flex; gap: 8px; }
.alb-ctl button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); background: rgba(10,12,24,.55); color: var(--ink);
  font: 600 1rem/1 inherit; cursor: pointer; backdrop-filter: blur(6px); display: grid; place-items: center; transition: border-color .2s, background .2s; }
.alb-ctl button:hover, .alb-ctl button:focus-visible { border-color: var(--or); background: rgba(232,115,26,.25); outline: none; }
.alb-ctl svg { width: 18px; height: 18px; fill: currentColor; }
.alb-mode { position: absolute; left: 24px; bottom: 26px; z-index: 6; color: var(--dim); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.alb-count { color: var(--or); }
.alb-lb { position: fixed; inset: 0; z-index: 50; background: rgba(2,3,8,.94); display: grid; place-items: center; }
.alb-lb[hidden] { display: none; }
.alb-lb img { max-width: 94vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 30px 90px #000; filter: url(#alb-net); }
.alb-lb p { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; margin: 0; color: var(--dim); font-size: .9rem; }
.alb-lb button { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; font-size: 1.3rem; cursor: pointer; }
.alb-lb .x { top: 18px; right: 18px; } .alb-lb .pv { left: 18px; top: 50%; } .alb-lb .nx { right: 18px; top: 50%; }
/* Toan canh: chua dai duoi cho chu thich, anh khong cham chu */
.kb::after { bottom: max(13vh, 132px); }
@media (max-width: 700px) { :root { --cw: min(88vmin, 440px); } .alb-head { padding: 14px 16px; } .alb-head span { display: none; }
  /* nhan ten mau nam cung hang voi nut (ben trai), nhuong cho chu thich */
  .alb-mode { left: 16px; bottom: 32px; font-size: .66rem; letter-spacing: .08em; max-width: calc(100% - 200px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .alb-cap { bottom: 74px; }
  .kb::after { inset: 9vh 3vw 0; bottom: 165px; } }
@media (prefers-reduced-motion: reduce) { .alb-neb { animation: none; } }
