/* Google Fonts được tải qua <link rel="preconnect"> + <link rel="stylesheet">
   trong <head> của từng trang (song song với CSS này), không dùng @import
   ở đây nữa — @import buộc trình duyệt phải tải xong file CSS này trước,
   rồi mới phát hiện ra và tải tiếp CSS của Google Fonts, rồi mới tải file
   font — 3 bước nối tiếp thay vì song song, làm chữ hiện chậm hơn. */

:root {
  --bg: #16110d;
  --cream: #f3ead9;
  --muted: rgba(243, 234, 217, 0.62);
  --gold: #cda45e;
  --gold-soft: rgba(205, 164, 94, 0.6);
  --rule: rgba(205, 164, 94, 0.28);
  --rule-soft: rgba(205, 164, 94, 0.14);

  /* Cinzel/Poppins don't ship Vietnamese diacritics (no "vietnamese"
     unicode-range subset), so accented Vietnamese letters silently
     fall back to a mismatched system font. Swap to Vietnamese-safe
     equivalents whenever the page language is "vi". */
  --heading-font: 'Cinzel', serif;
  --body-font: 'Poppins', sans-serif;
}

html[lang="vi"] {
  --heading-font: 'Playfair Display', serif;
  --body-font: 'Be Vietnam Pro', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 2.5rem 1.25rem 4rem;
  font-family: var(--body-font);
  color: var(--cream);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(205, 164, 94, 0.07), transparent 45%),
    radial-gradient(ellipse at 85% 100%, rgba(205, 164, 94, 0.05), transparent 45%);
  min-height: 100vh;
  line-height: 1.4;
}

.hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding-top: 1rem;
}

.gate-icon {
  width: 60px;
  height: 60px;
  color: var(--gold);
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--heading-font);
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: clamp(2.2rem, 7vw, 3rem);
  color: var(--gold);
  margin: 0.8rem 0 0;
}

.subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 520px;
  margin: 1.4rem auto 0;
}

.menu-nav {
  display: flex;
  justify-content: safe center;
  gap: 1.4rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
  margin-top: 1.6rem;
  padding-top: 1rem;
  padding-bottom: 0.6rem;
  border-top: 1px solid var(--rule-soft);
}

/* Chromium/WebKit ignore scrollbar-color and otherwise draw the native
   OS scrollbar (grey track + stepper arrow buttons) — style it to match
   the theme instead, same treatment already used for the horizontal-mode
   scroll area. */
.menu-nav::-webkit-scrollbar {
  height: 6px;
}

.menu-nav::-webkit-scrollbar-track {
  background: transparent;
}

.menu-nav::-webkit-scrollbar-thumb {
  background-color: var(--gold-soft);
  border-radius: 999px;
}

.menu-nav::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.menu-nav a {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--gold-soft);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.menu-nav a:hover,
.menu-nav a:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
}

main {
  max-width: 720px;
  margin: 3rem auto 0;
  scroll-margin-top: 1rem;
}

.price-section {
  scroll-margin-top: 1.5rem;
  margin-bottom: 3rem;
}

.price-section h2 {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--heading-font);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  margin: 0 0 1.2rem;
  color: var(--gold);
}

.price-section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.price-section h3 {
  font-family: var(--body-font);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--gold-soft);
  margin: 1.8rem 0 0.4rem;
}

.price-section h3 .unit {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.note {
  font-style: italic;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.price-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dish {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.dish:last-child { border-bottom: none; }

.dish-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  margin: 0;
}

.dish-name {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--cream);
}

.tags {
  font-size: 0.66rem;
  color: var(--gold-soft);
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-left: 0.4rem;
}

.dish-price {
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gold);
}

.dish-desc {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.variants {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}

.variant { white-space: nowrap; }

.variant-letter {
  color: var(--gold);
  font-weight: 700;
}

.variant-name {
  color: var(--cream);
  font-weight: 500;
  opacity: 0.85;
}

.variant-price {
  color: var(--gold);
  font-weight: 600;
}

.variant-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.7rem;
  color: var(--gold-soft);
}

.allergen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.allergen-grid .code {
  color: var(--gold);
  font-weight: 600;
  margin-right: 0.4rem;
}

footer {
  text-align: center;
  max-width: 720px;
  margin: 3rem auto 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.85rem;
  color: var(--muted);
}

footer .tagline {
  font-style: italic;
  color: var(--gold-soft);
  margin: 0 0 0.5rem;
}

footer p { margin: 0.3rem 0; }

@media (max-width: 480px) {
  body { padding: 2rem 1rem 3rem; }
  .gate-icon { width: 48px; height: 48px; }
  .dish-name { font-size: 0.88rem; }
  .dish-price { font-size: 0.85rem; }
}

/* ==== floating view controls (back-to-top) ==== */

.reset-btn {
  position: fixed;
  z-index: 30;
  border: 1px solid var(--rule);
  cursor: pointer;
  background: var(--bg);
  color: var(--gold);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
}

.reset-btn:hover {
  background: var(--gold);
  color: var(--bg);
}

.back-hub-btn {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 30;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.back-hub-btn:hover {
  background: var(--gold);
  color: var(--bg);
}

@media (max-width: 480px) {
  .back-hub-btn { width: 40px; height: 40px; font-size: 1.1rem; top: 1rem; left: 1rem; }
}

@media (max-width: 480px) {
  .reset-btn { width: 40px; height: 40px; font-size: 1.1rem; right: 1rem; bottom: 1rem; }
}

/* ==== top-right control row: 3-way view-mode switch + language
   dropdown, sitting side by side ==== */

.top-controls {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* segmented control chuyển 3 chế độ xem: Chữ / PDF / Ảnh */
.mode-switch {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.mode-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn + .mode-btn { border-left: 1px solid var(--rule-soft); }

.mode-btn:hover { color: var(--cream); }

.mode-btn.active {
  background: var(--gold);
  color: var(--bg);
}

.lang-dropdown { position: relative; }

.lang-dropdown-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.lang-dropdown-toggle:hover,
.lang-dropdown-toggle[aria-expanded="true"] {
  border-color: var(--gold);
  color: var(--cream);
}

.lang-dropdown-flag { display: inline-flex; line-height: 1; }
.lang-dropdown-flag img,
.lang-option .flag img {
  display: block;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  object-fit: cover;
}
.lang-dropdown .caret { font-size: 0.6rem; opacity: 0.7; }

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 150px;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-option .flag { display: inline-flex; }

.lang-option:hover {
  background: rgba(205, 164, 94, 0.12);
  color: var(--cream);
}

.lang-option[aria-selected="true"] {
  background: rgba(205, 164, 94, 0.18);
  color: var(--gold);
  font-weight: 600;
}

@media (max-width: 480px) {
  .top-controls { top: 0.9rem; right: 0.9rem; gap: 0.4rem; }
  .mode-btn { padding: 0.38rem 0.5rem; font-size: 0.66rem; }
  .lang-dropdown-toggle { padding: 0.32rem 0.55rem; font-size: 0.7rem; }
}

/* ==== mode Ảnh: thẻ món có ảnh (hoặc placeholder) bên trái ==== */

.dish-photo { display: none; }

.mode-img .dish {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  column-gap: 0.95rem;
}

.mode-img .dish > p { grid-column: 2; }

.mode-img .dish-photo {
  display: block;
  position: relative;
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--rule-soft);
  background: rgba(205, 164, 94, 0.06);
}

.mode-img .dish-photo svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 34px;
  height: 34px;
  color: var(--gold-soft);
  opacity: 0.7;
}

.mode-img .dish-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 480px) {
  .mode-img .dish { grid-template-columns: 62px minmax(0, 1fr); column-gap: 0.75rem; }
  .mode-img .dish-photo { width: 62px; height: 62px; }
}

/* ==== mode PDF: viewer toàn màn hình ==== */

/* khóa cuộn nền phía sau viewer để không có 2 thanh cuộn chồng nhau */
body.mode-pdf { overflow: hidden; }

#pdf-view {
  position: fixed;
  inset: 0;
  z-index: 20; /* dưới top-controls / back-hub / reset-btn (z-index 30) */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(205, 164, 94, 0.07), transparent 45%),
    radial-gradient(ellipse at 85% 100%, rgba(205, 164, 94, 0.05), transparent 45%);
}

#pdf-view[hidden] { display: none; }

.pdf-controls {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--rule-soft);
}

/* hàng chính chừa 2 bên cho nút back-hub (trái) và mode/lang (phải) */
.pdf-controls-main {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.9rem;
  padding: 1.35rem 5.5rem 0.5rem;
}

.pdf-dir-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.pdf-dir-btn:hover {
  border-color: var(--gold);
  color: var(--cream);
}

#pdf-dir-icon { color: var(--gold); font-size: 0.9rem; }

/* số trang dạng chìm */
.pdf-page-indicator {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.55;
  white-space: nowrap;
}

/* hàng nav category — cùng kiểu .menu-nav của mode chữ */
.pdf-nav {
  display: flex;
  justify-content: safe center;
  gap: 1.4rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
  padding: 0.35rem 1rem 0.65rem;
}

.pdf-nav::-webkit-scrollbar { height: 6px; }
.pdf-nav::-webkit-scrollbar-track { background: transparent; }
.pdf-nav::-webkit-scrollbar-thumb { background-color: var(--gold-soft); border-radius: 999px; }
.pdf-nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

.pdf-nav button {
  appearance: none;
  border: none;
  background: transparent;
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--gold-soft);
  font-family: var(--body-font);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0 0 2px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.pdf-nav button:hover,
.pdf-nav button:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
}

.pdf-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.2rem 1rem 0;
  margin: 0;
}

.pdf-status[hidden] { display: none; }

/* vùng trang: mặc định kéo dọc, trang xếp chồng */
.pdf-pages {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
}

.pdf-pages::-webkit-scrollbar { width: 8px; height: 8px; }
.pdf-pages::-webkit-scrollbar-track { background: transparent; }
.pdf-pages::-webkit-scrollbar-thumb { background-color: var(--gold-soft); border-radius: 999px; }

.pdf-page {
  flex: 0 0 auto;
  width: min(100%, 900px);
  background: rgba(205, 164, 94, 0.04);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  overflow: hidden;
}

.pdf-page img {
  display: block;
  width: 100%;
  height: auto;
}

/* nút tải file PDF gốc, cùng kiểu pill với nút đổi hướng */
.pdf-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.pdf-download:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* hướng vuốt ngang: mỗi trang chiếm trọn khung, snap từng trang */
.pdf-pages.pdf-h {
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  gap: 0;
  padding: 0;
}

.pdf-pages.pdf-h .pdf-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  /* mỗi cú vuốt dừng đúng 1 trang — không cho đà vuốt (momentum) văng
     xuyên qua nhiều trang một lúc */
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: auto !important;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.75rem;
}

.pdf-pages.pdf-h .pdf-page img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
}

/* gợi ý rìa trái/phải có thể bấm để lật trang — chỉ hiện khi rê chuột qua,
   không ảnh hưởng thao tác chạm trên di động */
.pdf-pages.pdf-h::before,
.pdf-pages.pdf-h::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.pdf-pages.pdf-h::before { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, 0.22), transparent); }
.pdf-pages.pdf-h::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, 0.22), transparent); }

.pdf-pages.pdf-h:hover::before,
.pdf-pages.pdf-h:hover::after { opacity: 1; }

@media (max-width: 640px) {
  /* màn hẹp: cụm nút nổi hai góc trên chiếm gần hết bề ngang — đẩy hàng
     điều khiển xuống hẳn bên dưới thay vì chừa lề hai bên */
  .pdf-controls-main { padding: 3.4rem 1rem 0.4rem; flex-wrap: wrap; }
}

/* ==== print: dùng để in/tạo file menu.pdf từ mode chữ ==== */

@media print {
  html, body {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  body { padding: 10mm 11mm; background-image: none; }
  .top-controls,
  .back-hub-btn,
  .reset-btn,
  .menu-nav,
  #pdf-view,
  .dish-photo { display: none !important; }
  .dish { break-inside: avoid; }
  .price-section h2 { break-after: avoid; }
}

@page { size: A4; margin: 0; }
