/* ==========================================================================
   HOÀNG ANH QUÂN — Hiệu ứng cinematic (đi kèm assets/js/effects.js)
   Màu hiệu ứng thống nhất: cyan #7fe9ff · xanh biển #7cc4ff · trắng trong suốt
   ========================================================================== */

/* ---------- A. Giọt nước ---------- */
.fx-layer {
  position: fixed; inset: 0; z-index: 60;
  overflow: hidden; pointer-events: none;
  contain: strict;
}
.drop { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.drop > * { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; will-change: transform, opacity; }

.drop__flash {                    /* điểm sáng lúc giọt nước chạm mặt */
  width: 18px; height: 18px; margin: -9px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, rgba(214, 248, 255, .85) 40%, rgba(127, 233, 255, 0) 70%);
}
.drop__dimple {                   /* vùng lõm khúc xạ ở tâm */
  width: 58px; height: 58px; margin: -29px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(4, 30, 60, .16) 0 30%, rgba(255, 255, 255, .24) 62%, rgba(255, 255, 255, 0) 72%);
  -webkit-backdrop-filter: blur(1.5px) saturate(1.25);
  backdrop-filter: blur(1.5px) saturate(1.25);
}
.drop__ring {                     /* vòng gợn — méo nhẹ bằng border-radius bất đối xứng */
  width: var(--size); height: var(--size);
  margin: calc(var(--size) / -2);
  border-radius: 49% 51% 48% 52% / 52% 48% 51% 49%;
}
.drop__ring--white {
  border: 1.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 6px rgba(255, 255, 255, .35), inset 0 0 6px rgba(255, 255, 255, .25);
}
.drop__ring--cyan {
  border: 2px solid rgba(127, 233, 255, .72);
  box-shadow: 0 0 12px rgba(63, 211, 245, .32), inset 0 0 10px rgba(127, 233, 255, .18);
}
.drop__ring--sea { border: 1px solid rgba(124, 196, 255, .6); }
.drop__glint {                    /* cung sáng phản chiếu trên gợn */
  width: calc(var(--size) * .8); height: calc(var(--size) * .8);
  margin: calc(var(--size) * -.4);
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(255, 255, 255, .95);
  border-left-color: rgba(255, 255, 255, .3);
}
.drop__bead {                     /* giọt nước li ti bắn lên */
  width: 4px; height: 4px; margin: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, rgba(160, 240, 255, .7) 60%, rgba(160, 240, 255, 0) 75%);
}

/* ---------- E. Ripple trong nút ---------- */
.btn-ripple {
  position: absolute; z-index: -1;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .6) 0, rgba(214, 248, 255, .35) 40%, rgba(127, 233, 255, 0) 70%);
}
.btn--ghost .btn-ripple,
.lb__btn .btn-ripple {
  background: radial-gradient(circle, rgba(127, 233, 255, .5) 0, rgba(127, 233, 255, .18) 45%, rgba(127, 233, 255, 0) 70%);
}

/* ---------- B. Chuyển cảnh section ---------- */
.scene-veil {
  position: fixed; inset: 0; z-index: 48;
  overflow: hidden; pointer-events: none;
  contain: strict;
}
.scene-veil[hidden] { display: none; }
.veil__tint {
  position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(180deg, rgba(7, 42, 82, 0) 0%, rgba(7, 42, 82, .3) 45%, rgba(63, 211, 245, .1) 100%);
}
.veil__sweep {
  position: absolute; top: -25%; bottom: -25%; left: 0;
  width: 42vw; opacity: 0;
  background: linear-gradient(90deg, rgba(127, 233, 255, 0), rgba(127, 233, 255, .16) 40%, rgba(225, 252, 255, .32) 50%, rgba(127, 233, 255, .16) 60%, rgba(127, 233, 255, 0));
  mix-blend-mode: screen;
}
.veil__cloud {
  position: absolute; left: 0;
  width: 62vw; aspect-ratio: 2.6 / 1;
  opacity: 0;
  filter: blur(18px);
}
.veil__cloud:nth-of-type(1) { top: 14%; }
.veil__cloud:nth-of-type(2) { top: 56%; width: 48vw; }
.veil__wave {
  position: absolute; left: 0; right: 0; top: 100%;
  height: 46vh; opacity: 0;
}
.veil__wave svg { display: block; width: 100%; height: 100%; }

/* Mặt nước dâng lên để lộ ảnh: mask cao 300%, 1/3 trên trong suốt, mép sóng ở giữa */
.fx-wave-reveal {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 300' preserveAspectRatio='none'%3E%3Cpath d='M0 142 Q6.25 136 12.5 142 T25 142 T37.5 142 T50 142 T62.5 142 T75 142 T87.5 142 T100 142 V300 H0Z' fill-opacity='.35'/%3E%3Cpath d='M0 150 Q6.25 143 12.5 150 T25 150 T37.5 150 T50 150 T62.5 150 T75 150 T87.5 150 T100 150 V300 H0Z'/%3E%3C/svg%3E") 0 0 / 100% 300% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 300' preserveAspectRatio='none'%3E%3Cpath d='M0 142 Q6.25 136 12.5 142 T25 142 T37.5 142 T50 142 T62.5 142 T75 142 T87.5 142 T100 142 V300 H0Z' fill-opacity='.35'/%3E%3Cpath d='M0 150 Q6.25 143 12.5 150 T25 150 T37.5 150 T50 150 T62.5 150 T75 150 T87.5 150 T100 150 V300 H0Z'/%3E%3C/svg%3E") 0 0 / 100% 300% no-repeat;
  animation: fx-wave-reveal .9s cubic-bezier(.33, 1, .68, 1) both;
}
@keyframes fx-wave-reveal {
  from { -webkit-mask-position: 0 0; mask-position: 0 0; }
  to   { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
}

/* Hero chờ trình tự xuất hiện (class do script inline trong <head> đặt, tự gỡ sau 3s) */
.fx-intro .hero [data-seq] { opacity: 0; }

.scene-sweep { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.scene-sweep > span {
  position: absolute; top: -10%; bottom: -10%; left: 0; width: 40%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(127, 233, 255, .07) 30%, rgba(214, 248, 255, .16) 50%, rgba(127, 233, 255, .07) 70%, transparent);
  mix-blend-mode: screen;
}

/* ---------- C. Lightbox ---------- */
html.lb-open { overflow: hidden; }
html.lb-open body { padding-right: var(--sbw, 0px); }

.lb {
  position: fixed; inset: 0; z-index: 100;
  color: var(--ink, #eaf6ff);
}
.lb[hidden] { display: none; }
.lb__backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(10, 46, 92, .78), rgba(3, 12, 30, .94));
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  opacity: 0;
  transition: opacity .45s cubic-bezier(.22, 1, .36, 1);
}
.lb.is-open .lb__backdrop { opacity: 1; }

.lb__figure {
  position: absolute; inset: 0; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 72px 84px 26px;
}
.lb__stage { position: relative; flex: 1; width: 100%; min-height: 0; touch-action: pan-y; }
.lb__frame {
  position: absolute; left: 50%; top: 50%;
  border-radius: 14px; overflow: hidden;
  background: #061a33;
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0), 0 0 0 1px rgba(160, 235, 255, 0);
  transition: box-shadow .5s cubic-bezier(.22, 1, .36, 1);
  will-change: transform, opacity;
}
.lb__frame.is-settled {        /* bóng chỉ hiện khi ảnh đã đứng yên — tránh bị clip-path cắt lúc phóng */
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .75), 0 0 0 1px rgba(160, 235, 255, .16);
}
.lb__frame.is-leaving { pointer-events: none; }
.lb__halo {                    /* gợn nước lan ra từ mép khung */
  position: absolute; left: 50%; top: 50%;
  border-radius: 18px; pointer-events: none; opacity: 0;
  border: 1.5px solid rgba(170, 242, 255, .6);
  box-shadow: 0 0 26px rgba(63, 211, 245, .25), inset 0 0 18px rgba(127, 233, 255, .12);
  will-change: transform, opacity;
}
.lb__img {
  display: block; width: 100%; height: 100%;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}
.lb__shine {
  position: absolute; top: 0; bottom: 0; left: -50%; width: 200%;
  pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(170, 240, 255, 0) 42%, rgba(200, 248, 255, .32) 50%, rgba(170, 240, 255, 0) 58%, transparent 62%);
  mix-blend-mode: screen;
}
.lb__edge {                      /* gợn nước ở mép khung */
  position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 0 1.5px rgba(170, 242, 255, .7), inset 0 0 26px rgba(127, 233, 255, .3);
}

.lb__caption {
  position: relative; z-index: 2;
  display: flex; align-items: baseline; justify-content: center; gap: 14px;
  min-height: 1.8em; margin: 0; max-width: 70ch;
  text-align: center;
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s .15s, transform .6s .15s cubic-bezier(.22, 1, .36, 1);
}
.lb.is-open .lb__caption { opacity: 1; transform: none; }
.lb__count { font-size: .72rem; letter-spacing: .2em; color: var(--cyan-300, #7fe9ff); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb__text { font-family: var(--font-display, serif); font-size: 1.35rem; font-style: italic; color: rgba(234, 246, 255, .92); }

.lb__btn {
  position: absolute; z-index: 3;
  display: grid; place-items: center;
  width: 52px; height: 52px; padding: 0;
  border: 1px solid rgba(190, 240, 255, .35); border-radius: 50%;
  background: rgba(8, 34, 72, .5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  cursor: pointer; overflow: hidden; isolation: isolate;
  opacity: 0;
  transition: opacity .4s, background-color .3s, border-color .3s, box-shadow .3s;
  -webkit-tap-highlight-color: transparent;
}
.lb.is-open .lb__btn { opacity: 1; }
.lb__btn:hover { background: rgba(20, 70, 130, .65); border-color: rgba(190, 240, 255, .75); box-shadow: 0 0 22px -4px rgba(63, 211, 245, .5); }
.lb__btn:focus-visible { outline: 2px solid var(--cyan-300, #7fe9ff); outline-offset: 3px; }
.lb__btn:active { background: rgba(30, 90, 160, .75); }
.lb__btn:disabled { opacity: .35; cursor: not-allowed; }
.lb__btn svg { width: 22px; height: 22px; }
.lb__close { top: 16px; right: 16px; }
.lb__prev { left: 18px; top: calc(50% - 26px); }
.lb__next { right: 18px; top: calc(50% - 26px); }

@media (max-width: 640px) {
  .lb__figure { padding: 70px 12px 96px; }
  .lb__prev, .lb__next { top: auto; bottom: 22px; }
  .lb__prev { left: calc(50% - 64px); }
  .lb__next { right: auto; left: calc(50% + 12px); }
  .lb__text { font-size: 1.1rem; }
}

/* ---------- D. Cursor glow ---------- */
.cursor-glow {
  position: fixed; left: 0; top: 0; z-index: 45;
  width: 440px; height: 440px; margin: -220px 0 0 -220px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(127, 233, 255, .13), rgba(63, 211, 245, .05) 50%, rgba(63, 211, 245, 0));
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity .6s;
  will-change: transform;
}
.cursor-glow.is-active { opacity: 1; }
html.lb-open .cursor-glow { opacity: 0; }

/* Ánh phản chiếu khi chạm trên thiết bị cảm ứng */
.photo.is-glare .photo__sheen { opacity: 1; }

/* Thumbnail "nhấc" khỏi gallery khi lightbox mở — để lại ô trống như ảnh vừa bay lên */
.photo.is-lifted > *, .photo.is-lifted::after { opacity: 0 !important; transition: none !important; }

/* ---------- F. Reveal khi cuộn (chỉ bật khi JS chạy) ---------- */
.fx-reveal [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 32px, 0) scale(.985);
  transition: opacity .9s cubic-bezier(.22, 1, .36, 1), transform 1s cubic-bezier(.22, 1, .36, 1);
  transition-delay: calc(min(var(--i, 0), 7) * 70ms);
}
.fx-reveal [data-reveal].is-visible { opacity: 1; transform: none; }
.header-sentinel { position: absolute; left: 0; top: 0; width: 1px; height: 60px; pointer-events: none; visibility: hidden; }

/* ---------- Giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-layer, .scene-veil, .cursor-glow, .scene-sweep { display: none !important; }
  .fx-reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
  .fx-intro .hero [data-seq] { opacity: 1; }
  .fx-wave-reveal { -webkit-mask: none; mask: none; animation: none; }
  .lb__halo, .lb__shine, .lb__edge { display: none; }
  .lb__backdrop, .lb__caption, .lb__btn { transition-duration: .01ms; }
}
