:root {
  --ink: #fbf6f2;
  --ink-soft: rgba(251, 246, 242, 0.72);
  --ink-faint: rgba(251, 246, 242, 0.5);
  --accent: #e9b8a3;
  --accent-strong: #f3cbb9;
  --glass: rgba(22, 15, 18, 0.55);
  --glass-line: rgba(255, 255, 255, 0.14);
  --radius: 18px;
  --cw: 300px;
  --ch: 400px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* màu chữ — chọn trong trang quản trị */
  --name-color: #fbf6f2;
  --title-color: #ffffff;
  --sub-color: rgba(251, 246, 242, 0.78);
  --swash-color: #ec8fa8;
  --swash-soft: color-mix(in srgb, var(--swash-color) 55%, white);
  /* vị trí 2 bộ sưu tập (khoảng cách từ trên xuống, % chiều cao màn hình) */
  --shift-d: 10;
  --shift-m: 38;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* KHÔNG khoá chiều cao body = màn hình: nếu khoá, phần cuối trang bị thanh dưới che mất */
html, body { margin: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: #140f12;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent-strong); }

/* ---------- Nền cố định ---------- */
.bg {
  position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(120% 90% at 20% 10%, #4a2a35 0%, #1d1418 55%, #0e0a0c 100%);
  background-size: cover;
  background-position: center;
  /* trang đầu: ảnh nền là nhân vật chính → sáng, rõ */
  filter: brightness(1.06) saturate(1.06);
  transition: filter 1.3s cubic-bezier(0.37, 0, 0.63, 1), transform 1.3s cubic-bezier(0.37, 0, 0.63, 1);
}
/* đang xem bộ sưu tập: nền mờ và tối xuống để ảnh nổi bật */
body.viewing .bg { filter: blur(8px) brightness(0.68) saturate(0.9); transform: scale(1.05); }
.bg-shade {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10, 6, 8, 0.35), rgba(10, 6, 8, 0.6));
  pointer-events: none;
  opacity: 0.45;
  transition: opacity 1.3s ease;
}
body.viewing .bg-shade { opacity: 1; }

/* ---------- Thanh trên ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px clamp(16px, 4vw, 48px) 6px;
}
.brand h1 {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(26px, 3.4vw, 42px); letter-spacing: 0.01em; line-height: 1.1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.brand p {
  margin: 6px 0 0; color: var(--ink-soft);
  font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase;
}
.brand p:empty { display: none; }

/* ---------- Tên tiệm: cọ trang điểm vẽ ra ---------- */
.brand h1 { position: relative; display: inline-block; color: var(--name-color); }
.brand p { color: var(--sub-color) !important; }
.name-text { position: relative; z-index: 1; white-space: pre-wrap; }
.name-text .ch { display: inline-block; white-space: pre; }
.swash {
  position: absolute; z-index: 0; left: -0.15em; bottom: -0.12em;
  width: calc(100% + 0.3em); height: 0.62em;
  overflow: visible; pointer-events: none;
}
.swash path { fill: none; stroke-linecap: round; }
.brush {
  position: absolute; z-index: 2; left: 0; top: 0;
  width: 0.62em; height: 2em;
  transform-origin: 50% 100%;
  pointer-events: none; opacity: 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}
.brush svg { width: 100%; height: 100%; display: block; stroke: none; }
.dust {
  position: absolute; z-index: 1; width: 5px; height: 5px; border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff 0%, var(--swash-soft) 45%, var(--swash-color) 65%, transparent 100%);
}

/* trước khi cọ chạy qua, chữ còn ẩn; cọ qua tới đâu chữ biến hình hiện ra tới đó */
.brand h1.drawing .ch {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(0.28em) scale(1.1) skewX(-8deg);
  color: var(--swash-soft);
}
.brand h1.drawing .ch.on {
  opacity: 1; filter: blur(0); transform: none; color: var(--name-color);
  /* hiện ra mềm mại, không bật nảy */
  transition: opacity 0.9s ease, filter 1s ease,
    transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), color 1.8s ease 0.3s;
}
.brand h1 { transition: text-shadow 1.4s ease; }
/* các lần cọ chạy sau: chữ vẫn hiện rõ, chỉ nhấp nhô nhẹ như gợn sóng và ửng hồng khi cọ đi qua */
.name-text .ch.pulse { animation: chWave 1.8s cubic-bezier(0.37, 0, 0.63, 1); }
@keyframes chWave {
  0% { transform: translateY(0); color: var(--name-color); }
  40% { transform: translateY(-0.09em) scale(1.04); color: color-mix(in srgb, var(--name-color) 45%, var(--swash-soft)); text-shadow: 0 0 16px color-mix(in srgb, var(--swash-color) 70%, transparent), 0 2px 18px rgba(0, 0, 0, 0.45); }
  75% { transform: translateY(0.02em); }
  100% { transform: translateY(0); color: var(--name-color); }
}
.brand h1.glow { text-shadow: 0 0 22px color-mix(in srgb, var(--swash-color) 75%, transparent), 0 2px 18px rgba(0, 0, 0, 0.45); }
.brand p { transition: opacity 0.8s ease, transform 0.8s ease; }
.brand.intro p { opacity: 0; transform: translateY(6px); }

.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}
.pill-btn:hover { background: rgba(40, 28, 33, 0.75); }
.pill-btn:active { transform: scale(0.97); }
.pill-btn.solid { background: var(--accent); color: #2a171d; border-color: transparent; }
.pill-btn.solid:hover { background: var(--accent-strong); }
.pill-btn.wide { width: 100%; margin-top: 10px; }

/* ---------- Bố cục ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.5vw, 36px);
  padding: 8px clamp(16px, 4vw, 48px) 32px;
  min-height: calc(100vh - 100px);
  min-height: calc(100dvh - 100px);
}

/* ---------- Trang đầu & khung xem: chồng lên cùng một chỗ ---------- */
.scene { display: grid; min-width: 0; }
.home, .viewer { grid-area: 1 / 1; min-width: 0; }

.home {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  /* độ cao của 2 bộ sưu tập — chỉnh bằng thanh kéo trong trang quản trị */
  padding: calc(var(--shift-d) * 1vh) clamp(0px, 3vw, 72px) 0;
  transition: opacity 0.9s ease 0.25s, visibility 0s;
}
body.viewing .home {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.55s ease, visibility 0s linear 0.55s;
}

.viewer { visibility: hidden; display: flex; flex-direction: column; }
body.viewing .viewer { visibility: visible; }
.fade-chrome { opacity: 0; transition: opacity 0.3s ease; }
body.viewing .fade-chrome { opacity: 1; transition: opacity 0.45s ease 0.35s; }

/* làm nền tối thêm một chút khi đang xem ảnh */
.bg-focus {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: rgba(10, 6, 8, 0.38);
  opacity: 0; transition: opacity 0.6s ease;
}
body.viewing .bg-focus { opacity: 1; }

/* ---------- Bộ sưu tập (chồng ảnh) ---------- */
.album {
  --sw: var(--sw-fit, clamp(150px, min(19vw, 27vh), 270px));
  display: flex; flex-direction: column; align-items: center;
  max-width: 42%;
  padding: 0; border: 0; background: none; color: inherit; text-align: center;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.9;
  transition: opacity 0.4s ease;
}
/* hai chồng ảnh dịu xuống một chút để ảnh nền làm chủ; rê chuột / chạm vào thì sáng lên */
.album .album-stack { filter: brightness(0.8) saturate(0.88) blur(0.6px); transition: filter 0.4s ease; }
.album:hover, .album:focus-visible { opacity: 1; }
.album:hover .album-stack, .album:focus-visible .album-stack { filter: none; }
.album-title {
  display: block;
  font-family: var(--title-font, var(--serif));
  font-style: var(--title-style, italic);
  font-weight: 500;
  font-size: calc(clamp(30px, 3.3vw, 52px) * var(--title-scale, 1));
  line-height: 1.12;
  letter-spacing: 0.005em;
  color: var(--title-color);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 4px 28px rgba(0, 0, 0, 0.55);
  overflow-wrap: anywhere;
}
.album-sub {
  display: block; margin-top: 6px;
  font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sub-color);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
.album-title:empty, .album-sub:empty { display: none; }
/* tiêu đề dài ngắn khác nhau vẫn giữ 2 chồng ảnh thẳng hàng */
.home { align-items: stretch; align-self: start; }
.album-title, .album-sub { margin-bottom: 22px; }
.album-title:has(+ .album-sub:not(:empty)) { margin-bottom: 0; }

.album-stack {
  position: relative; display: block; flex: none;
  width: var(--sw); aspect-ratio: var(--ratio, 3 / 4);
  margin-top: auto;
}
.album-stack img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 14px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.75);
  transition: transform 0.8s cubic-bezier(0.37, 0, 0.63, 1);
  background: #2a1f23;
}
/* chồng ảnh bồng bềnh lên xuống nhẹ nhàng như sóng, hai bên lệch nhịp */
.album-stack { animation: floaty 7s cubic-bezier(0.37, 0, 0.63, 1) infinite; }
.album.right .album-stack { animation-delay: -3.5s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(0.5deg); }
  50% { transform: translateY(-9px) rotate(0deg); }
  75% { transform: translateY(-4px) rotate(-0.5deg); }
}
body.viewing .album-stack { animation-play-state: paused; }
.album-stack img:nth-child(1) { z-index: 3; }
.album-stack img:nth-child(2) { z-index: 2; transform: translateX(-10px) rotate(-6deg); }
.album-stack img:nth-child(3) { z-index: 1; transform: translateX(12px) rotate(7deg); }
.album:hover .album-stack img:nth-child(1),
.album:focus-visible .album-stack img:nth-child(1) { transform: translateY(-8px); }
.album:hover .album-stack img:nth-child(2),
.album:focus-visible .album-stack img:nth-child(2) { transform: translateX(-34px) rotate(-12deg); }
.album:hover .album-stack img:nth-child(3),
.album:focus-visible .album-stack img:nth-child(3) { transform: translateX(36px) rotate(13deg); }
.album:focus-visible { outline: none; }

.album-more {
  display: inline-block; margin-top: 18px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s;
}
.album:hover .album-more { background: rgba(233, 184, 163, 0.9); color: #2a171d; }

/* ---------- Khung xem ---------- */
.viewer-head {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; margin-bottom: 6px;
}
.back-btn { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.back-btn:active { transform: translateY(-50%) scale(0.97); }
.viewer-title {
  margin: 0; padding: 0 120px;
  font-family: var(--title-font, var(--serif));
  font-style: var(--title-style, italic);
  font-weight: 500;
  font-size: calc(clamp(24px, 2.4vw, 36px) * var(--title-scale, 1));
  line-height: 1.15; text-align: center;
  color: var(--title-color);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
}
.nav .ic-done { display: none; }
.nav.finish .ic-next { display: none; }
.nav.finish .ic-done { display: block; }
.nav.finish { background: rgba(233, 184, 163, 0.85); color: #2a171d; border-color: transparent; }

/* ---------- Bộ ảnh trượt ---------- */
.gallery { display: flex; flex-direction: column; min-width: 0; }
.stage {
  position: relative;
  height: clamp(340px, 64vh, 780px);
  height: clamp(340px, 64dvh, 780px);
  overflow: hidden;
  isolation: isolate; /* thứ tự lớp của ảnh không đè lên hộp chia sẻ / xem ảnh */
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
  outline: none;
  cursor: grab;
  /* mép trái/phải mờ dần */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
}
.stage.dragging { cursor: grabbing; }
/* lúc ảnh bay ra / bay về chồng ảnh: không cắt mép */
.stage.flying { overflow: visible; -webkit-mask-image: none; mask-image: none; }

.card {
  position: absolute; top: 0; left: 0;
  width: var(--cw); height: var(--ch);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 50%;
  visibility: hidden;
}
.card img {
  pointer-events: none;
  opacity: 0; transition: opacity 0.35s ease;
}
/* Khung ảnh đã chỉnh trong trang quản trị: --x, --y = điểm giữa (%), --z = độ phóng to.
   Đổi kích thước thật (không dùng transform) để ảnh vẫn sắc nét. */
.card img, .framed {
  position: absolute;
  left: calc((1 - var(--z, 1)) * var(--x, 50) * 1%);
  top: calc((1 - var(--z, 1)) * var(--y, 50) * 1%);
  width: calc(var(--z, 1) * 100%);
  height: calc(var(--z, 1) * 100%);
  max-width: none;
  object-fit: cover;
  object-position: calc(var(--x, 50) * 1%) calc(var(--y, 50) * 1%);
  display: block;
}
.card img.loaded { opacity: 1; }
.card.is-center {
  cursor: zoom-in;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.empty {
  display: grid; place-items: center; text-align: center;
  width: min(100%, 460px); margin: 8vh auto 0; padding: 40px 24px;
  border: 1px dashed var(--glass-line); border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  align-content: center;
}
.empty p { margin: 4px 0; color: var(--ink-soft); }
.empty .empty-title { font-family: var(--serif); font-size: 24px; color: var(--ink); }

.controls {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-top: 18px;
}
.nav {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background 0.2s, transform 0.15s;
}
.nav:hover { background: rgba(40, 28, 33, 0.8); }
.nav:active { transform: scale(0.94); }
.meta { flex: 0 1 260px; min-width: 0; text-align: center; } /* rộng cố định → nút ‹ › không bị xê dịch */
.caption {
  margin: 0; font-family: var(--serif); font-style: italic; font-size: 18px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.caption:empty { display: none; }
.counter { margin: 2px 0 0; font-size: 13px; color: var(--ink-faint); letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.hint { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--ink-faint); }

/* ---------- Thông tin liên hệ ---------- */
.contact {
  justify-self: start;
  width: min(100%, 420px);
  padding: 26px 24px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 20px 60px -24px rgba(0, 0, 0, 0.7);
}
.contact h2 {
  margin: 0 0 6px;
  font-family: var(--serif); font-weight: 500; font-size: 24px;
}
.about { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; white-space: pre-line; }
.about:empty { display: none; }
.cta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.cta:empty { display: none; }
.cta a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; border-radius: 12px;
  text-decoration: none; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #2a171d;
  transition: background 0.2s, transform 0.15s;
}
.cta a:only-child { grid-column: span 2; }
.cta a.ghost { background: rgba(255, 255, 255, 0.08); color: var(--ink); border: 1px solid var(--glass-line); }
.cta a:hover { background: var(--accent-strong); }
.cta a.ghost:hover { background: rgba(255, 255, 255, 0.14); }
.cta a:active { transform: scale(0.97); }

.info { list-style: none; margin: 0; padding: 0; }
.info li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.info li:first-child { border-top: 0; }
.info .ic {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(233, 184, 163, 0.14); color: var(--accent-strong);
}
.info .ic svg { width: 18px; height: 18px; }
.info .txt { min-width: 0; padding-top: 1px; }
.info .lbl { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.info .val { display: block; font-size: 15px; line-height: 1.45; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; white-space: pre-line; }
.info a.val:hover { color: var(--accent-strong); }
.contact-empty { color: var(--ink-faint); font-size: 14px; margin: 0; }

/* ---------- Xem ảnh lớn ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 5, 7, 0.96);
  animation: fade 0.2s ease;
}
.lightbox[hidden], .modal[hidden] { display: none; }
.lb-view { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-in; }
.lb-view.zoomed { cursor: grab; }
.lb-view.panning { cursor: grabbing; }
.lb-view img {
  position: absolute; left: 0; top: 0;
  max-width: none; max-height: none;
  user-select: none; -webkit-user-select: none;
  image-rendering: auto;
  /* bo tròn 4 góc giống khung ảnh */
  border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.lb-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}
.lb-bar > * { pointer-events: auto; }
.lb-count { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  min-width: 42px; height: 42px; padding: 0 12px; border-radius: 999px;
  display: grid; place-items: center;
  border: 1px solid var(--glass-line); background: rgba(30, 22, 26, 0.7);
  font-size: 13px; font-weight: 600;
}
.lb-btn.active { background: var(--accent); color: #2a171d; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--glass-line); background: rgba(30, 22, 26, 0.6);
}
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.lb-hint {
  position: absolute; bottom: 14px; left: 0; right: 0; margin: 0;
  text-align: center; font-size: 12px; color: var(--ink-faint); pointer-events: none;
}

/* ---------- Hộp chia sẻ ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 5, 7, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}
.modal-card {
  position: relative; width: min(400px, 100%);
  padding: 28px 24px 24px; border-radius: 22px;
  background: #1e1519; border: 1px solid var(--glass-line);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  text-align: center;
}
.modal-card h3 { margin: 0 0 16px; font-family: var(--serif); font-weight: 500; font-size: 22px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; }
.modal-x:hover { background: rgba(255, 255, 255, 0.08); }
.qr { display: grid; place-items: center; margin: 0 auto 16px; }
.qr:empty { display: none; }
.qr svg, .qr img { width: 200px; height: 200px; border-radius: 12px; background: #fff; padding: 10px; }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.06);
  color: var(--ink); font: inherit; font-size: 13px;
}
.warn { margin: 14px 0 0; font-size: 13px; line-height: 1.5; color: #f3c98b; text-align: left; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 70;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 18px; border-radius: 999px;
  background: #fbf6f2; color: #2a171d; font-size: 14px; font-weight: 500;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }

/* ---------- Màn hình rộng: liên hệ nằm cố định ở góc trái dưới ---------- */
@media (min-width: 1200px) and (min-height: 640px) {
  .contact {
    position: fixed; z-index: 20;
    left: clamp(16px, 2.5vw, 40px);
    bottom: clamp(16px, 3vh, 32px);
    width: 250px;
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    padding: 14px 14px 8px;
    border-radius: 16px;
    scrollbar-width: thin;
  }
  .contact h2 { font-size: 17px; margin-bottom: 4px; }
  .about {
    margin-bottom: 10px; font-size: 12px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .cta { gap: 6px; margin-bottom: 6px; }
  .cta a { padding: 8px 6px; font-size: 12.5px; border-radius: 10px; }
  .cta a svg { width: 16px; height: 16px; }
  .info li { gap: 9px; padding: 6px 0; }
  .info .ic { width: 26px; height: 26px; border-radius: 8px; }
  .info .ic svg { width: 15px; height: 15px; }
  .info .lbl { font-size: 9.5px; }
  .info .val { font-size: 12.5px; line-height: 1.35; }
}

/* ---------- Điện thoại / máy tính bảng ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .contact { position: static; padding: 18px 16px 10px; }
  .contact h2 { font-size: 20px; }
  .cta a { padding: 10px 8px; font-size: 13px; }
  .info li { padding: 8px 0; }
  .info .ic { width: 30px; height: 30px; }
  .info .val { font-size: 14px; }
  .stage { height: clamp(340px, 62vh, 700px); height: clamp(340px, 62dvh, 700px); }
  .stage { -webkit-mask-image: none; mask-image: none; }
}
/* Thanh Gọi / Zalo / Liên hệ — chỉ hiện trên điện thoại */
.quickbar { display: none; }
.sheet-close, .sheet-backdrop { display: none; }
.sheet-top { display: block; }

/* =================== ĐIỆN THOẠI (bố cục riêng) =================== */
@media (max-width: 640px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar { padding: 14px 16px 4px; }
  .brand h1 { font-size: clamp(24px, 7.2vw, 32px); }
  .brand p { font-size: 11px; letter-spacing: 0.12em; margin-top: 4px; }
  .pill-btn span { display: none; }
  .pill-btn { padding: 10px 12px; }
  .pill-btn.solid span, .pill-btn.wide span { display: inline; }
  .layout { padding: 4px 12px 20px; gap: 18px; }
  .lb-nav { display: none; }
  .hint { display: none; }

  /* Trang đầu: ảnh nền chiếm màn hình đầu tiên, 2 bộ sưu tập nằm thấp để lộ ảnh nền */
  .home {
    min-height: calc(100dvh - 160px);
    padding: calc(var(--shift-m) * 1vh) 0 8px;
    gap: 10px;
  }
  .album { --sw: 32vw; max-width: 48%; opacity: 1; }
  .album .album-stack { filter: brightness(0.92) saturate(0.95); }
  .album-title { font-size: calc(clamp(20px, 6.2vw, 28px) * var(--title-scale, 1)); }
  .album-sub { font-size: 10px; letter-spacing: 0.1em; }
  .album-title, .album-sub { margin-bottom: 12px; }
  .album-title:has(+ .album-sub:not(:empty)) { margin-bottom: 0; }
  .album-more { margin-top: 12px; font-size: 12px; padding: 7px 12px; }

  /* Khung xem ảnh: tận dụng hết chiều cao màn hình */
  .viewer-head { min-height: 44px; margin-bottom: 4px; }
  .viewer-title { padding: 0 52px; font-size: calc(21px * var(--title-scale, 1)); }
  .stage { height: max(320px, calc(100dvh - 300px)); }
  .controls { margin-top: 12px; gap: 14px; }
  .nav { width: 50px; height: 50px; }
  .meta { flex-basis: 170px; }
  .caption { font-size: 16px; }

  /* Liên hệ: khung trượt lên từ đáy màn hình (bấm "Liên hệ" để mở, kéo xuống để đóng) */
  .contact {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 46;
    justify-self: stretch; width: auto; max-height: 86dvh;
    overflow-y: auto; overscroll-behavior: contain;
    padding: 0 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    border: 0; border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(26, 18, 22, 0.94);
    backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
    box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, 0.6);
    transform: translateY(105%);
    transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
    visibility: hidden;
  }
  body.sheet-open .contact { transform: translateY(0); visibility: visible; }
  body.sheet-open { overflow: hidden; }
  .contact.dragging { transition: none; }
  .sheet-top {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 -18px 4px; padding: 10px 18px 8px;
    background: inherit; border-radius: 24px 24px 0 0;
    touch-action: none; cursor: grab;
  }
  .sheet-top::before {
    content: ""; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
    width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.32);
  }
  .sheet-top h2 { margin: 18px 0 0; font-size: 22px; }
  .sheet-close {
    display: grid !important; place-items: center; margin-top: 14px;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.06);
  }
  .about { font-size: 14px; margin: 4px 0 16px; }
  .cta { gap: 10px; margin-bottom: 16px; }
  .cta a { padding: 14px 8px; font-size: 15px; border-radius: 14px; }
  .info { display: grid; gap: 8px; }
  .info li {
    border: 0; padding: 12px 14px; border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
  }
  .info li:first-child { border-top: 0; }
  .info .ic { width: 36px; height: 36px; border-radius: 11px; }
  .info .val { font-size: 15px; }
  .sheet-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 45;
    background: rgba(8, 5, 7, 0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.45s ease;
  }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

  /* Thanh bấm nhanh cố định ở đáy */
  .quickbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; gap: 8px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(20, 14, 17, 0.72);
    border-top: 1px solid var(--glass-line);
    backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  }
  .quickbar[hidden] { display: none; }
  .quickbar a {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 46px; border-radius: 12px;
    text-decoration: none; font-size: 14px; font-weight: 600;
    color: var(--ink); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-line);
  }
  .quickbar a.main { background: var(--accent); color: #2a171d; border-color: transparent; }
  .quickbar svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
