/* ====================================================================
   DI SẢN VĂN HÓA NHÃ NAM - STYLESHEET CHÍNH
   Bản sắc văn hóa truyền thống kết hợp thiết kế hiện đại
   Màu chủ đạo: Đỏ Đô Di Sản (#8B1E1E) & Vàng Kim Cổ Kính (#C59B27)
   Nền: Kem ngà ấm áp (#FDFBF7, #F5EFE6)
   Font chữ hỗ trợ 100% tiếng Việt: Merriweather & Be Vietnam Pro
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Merriweather:ital,wght@0,700;0,900;1,700&display=swap');

:root {
  --color-heritage-red: #8B1E1E;
  --color-heritage-red-dark: #6F1515;
  --color-heritage-red-light: #A82A2A;
  --color-heritage-gold: #C59B27;
  --color-heritage-gold-dark: #A67C18;
  --color-heritage-gold-light: #E0BA53;
  --color-bg-ivory: #FAF6EE;
  --color-surface: #FFFCF7;
  --color-bronze: #7A5C3E;
  --hairline: rgba(139, 30, 30, 0.12);
  --rule: rgba(44, 30, 24, 0.1);
  --color-bg-warm: #F5EFE6;
  --color-border-warm: #EADECF;
  --color-text-main: #2A2521;
  --color-text-muted: #5C5248;
  --color-text-light: #8C7D6F;
  
  --font-serif: 'Merriweather', Georgia, Cambria, 'Times New Roman', serif;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --shadow-warm-sm: 0 2px 4px rgba(139, 30, 30, 0.04);
  --shadow-warm-md: 0 2px 10px rgba(44, 30, 24, 0.05);
  --shadow-warm-lg: 0 8px 24px rgba(44, 30, 24, 0.08);
}

/* Cài đặt cơ bản */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--color-bg-ivory);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--color-bg-ivory);
}

/* Lớp phủ hoa văn giấy Dó truyền thống & vân lụa cổ (Vietnamese Dó Paper Grain) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Typography chuẩn Merriweather hỗ trợ dấu tiếng Việt */
.font-heritage-serif {
  font-family: var(--font-serif);
  font-weight: 700;
}

.font-heritage-sans {
  font-family: var(--font-sans);
}

/* Typography refinements & Editorial Scale (better-typography) */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 900;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.25rem);
  font-weight: 700;
}

h3 {
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  font-weight: 700;
}

h4 {
  font-size: 1rem;
  font-weight: 700;
}

p {
  text-wrap: pretty;
  line-height: 1.6;
}

/* Chống FOUC khi mạng di động tải chậm trước khi Tailwind CDN khởi chạy */
[hidden], .hidden {
  display: none;
}
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:inline { display: inline; }
  .sm\:inline-flex { display: inline-flex; }
  .sm\:flex { display: flex; }
}
@media (min-width: 768px) {
  .md\:inline { display: inline; }
}
@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
}

/* Bề mặt màu nền di sản ngữ nghĩa */
.bg-heritage-ivory { background-color: var(--color-bg-ivory); }
.bg-heritage-warm { background-color: var(--color-bg-warm); }
.bg-heritage-surface {
  background-color: var(--color-surface);
  padding: 1.25rem;
}
main > section {
  padding: 2.5rem 1rem;
}
[role="tablist"] {
  padding: 0.375rem;
}
#site-footer {
  background-color: #2A2521;
  color: #FFFFFF;
  padding: 3rem 1rem;
}

/* Tabular numbers for counters, timers and numerical displays */
.tabular-nums, [id^="count-"], #lightbox-counter, .audio-timestamp, .quiz-timer {
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

/* Accessibility: Skip-link for screen reader and keyboard users */
.skip-to-content-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background-color: var(--color-heritage-red);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-warm-lg);
  border: 2px solid var(--color-heritage-gold);
  transition: top 0.2s ease-in-out;
  text-decoration: none;
}

.skip-to-content-link:focus {
  top: 1rem;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Accessibility: High-contrast focus-visible outline for keyboard navigation (WCAG 2.2 AA/AAA) */
:focus-visible {
  outline: 2px solid var(--color-heritage-red);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, input:focus-visible, [role="button"]:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--color-heritage-red);
  outline-offset: 2px;
}

/* UI UX Pro Max: Cursor pointer & active feedback enforcement */
button, [role="button"], a, input[type="button"], input[type="submit"], select, .tab-btn, .category-tab-btn, .hero-entry-card, .route-relic-chip, .relic-stat-interactive-card {
  cursor: pointer;
}

button:active:not(:disabled), [role="button"]:active {
  transform: scale(0.98);
  transition: transform 0.08s ease;
}

/* Accessibility: Respect prefers-reduced-motion (UI UX Pro Max & better-accessibility) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-drum-bg img, .hero-drum-bg svg {
    animation: none !important;
  }
}

/* Ngăn vỡ dòng thanh điều hướng */
.nowrap-text {
  white-space: nowrap !important;
}

/* Trống đồng chìm, căn tâm sau khối tiêu đề Hero; mask làm mờ viền nên không lan xuống 2 thẻ bên dưới */
.hero-drum-bg {
  position: absolute;
  top: 50%;
  left: 38%;
  transform: translate(-50%, -50%);
  width: min(420px, 90vw);
  aspect-ratio: 1;
  z-index: 0;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
}

.hero-drum-bg img, .hero-drum-bg svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Sóng âm thanh thuyết minh di tích (Audio Guide Wave) */
@keyframes soundWave {
  0%, 100% { height: 6px; }
  50% { height: 22px; }
}

.audio-wave-bar {
  width: 3px;
  height: 8px;
  background-color: currentColor;
  border-radius: 2px;
  display: inline-block;
  transition: height 0.2s ease;
}

.is-speaking .audio-wave-bar-1 { animation: soundWave 0.75s ease-in-out infinite; }
.is-speaking .audio-wave-bar-2 { animation: soundWave 0.55s ease-in-out 0.15s infinite; }
.is-speaking .audio-wave-bar-3 { animation: soundWave 0.85s ease-in-out 0.3s infinite; }
.is-speaking .audio-wave-bar-4 { animation: soundWave 0.65s ease-in-out 0.45s infinite; }

/* Tương tác bản ghi câu thuyết minh (Interactive Audio Guide Transcript) */
.transcript-sentence-item {
  padding: 6px 10px;
  border-radius: 8px;
  transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  cursor: pointer;
  color: #4A4036;
}

.transcript-sentence-item:hover {
  background-color: rgba(197, 155, 39, 0.12);
  color: #8B1E1E;
}

.transcript-sentence-item.active-sentence {
  background-color: #FEF3C7;
  color: #8B1E1E;
  font-weight: 600;
  border: 1px solid rgba(139, 30, 30, 0.25);
  box-shadow: 0 1px 4px rgba(44, 30, 24, 0.1);
  transform: translateX(2px);
}

.speed-selector-btn {
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.speed-selector-btn.is-active {
  background-color: #8B1E1E !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 4px rgba(44, 30, 24, 0.16);
}

/* Họa tiết hoa văn truyền thống */
.border-heritage-accent {
  border-color: var(--color-border-warm);
}

.heritage-crimson {
  color: var(--color-heritage-red);
}

.heritage-gold {
  color: var(--color-heritage-gold);
}

.bg-heritage-crimson {
  background-color: var(--color-heritage-red);
}

.bg-heritage-gold {
  background-color: var(--color-heritage-gold);
}

/* Thẻ di sản: giấy kem, viền chỉ, đổ bóng đa tầng ấm áp & nâng mượt mà */
.heritage-card {
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 6px -1px rgba(44, 30, 24, 0.05), 0 1px 3px rgba(44, 30, 24, 0.03);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.28s ease;
  will-change: transform;
}

.heritage-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 30, 30, 0.35);
  box-shadow: 0 14px 28px -6px rgba(44, 30, 24, 0.09), 0 6px 12px -4px rgba(44, 30, 24, 0.05);
}

.heritage-card .card-thumb-img {
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.heritage-card:hover .card-thumb-img {
  transform: scale(1.035);
}

.card-media .ic { width: 16px; height: 16px; }

/* Hero Cards lớn - Lớp phủ ấm áp văn hóa & nâng khối nổi bật */
.hero-entry-card {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  padding: 1.5rem;
  box-shadow: 0 4px 14px rgba(44, 30, 24, 0.12);
}

.hero-entry-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 10, 8, 0.08) 0%, rgba(20, 10, 8, 0.42) 42%, rgba(25, 10, 8, 0.92) 100%);
  transition: background 0.3s ease;
}

.hero-entry-card:hover::before {
  background: linear-gradient(180deg, rgba(20, 10, 8, 0.04) 0%, rgba(20, 10, 8, 0.36) 38%, rgba(25, 10, 8, 0.94) 100%);
}

.hero-entry-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(44, 30, 24, 0.22);
}

/* Tab nút bấm */
.tab-btn {
  transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  position: relative;
}

.tab-btn.active {
  background-color: var(--color-heritage-red);
  color: #ffffff;
}

/* Nút bấm vàng son */
.btn-gold {
  background: #A67C18;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, background-color 0.25s ease;
}

.btn-gold:hover {
  background: #8B6914;
  box-shadow: 0 4px 12px rgba(44, 30, 24, 0.16);
  transform: translateY(-1px);
}

/* Nút bấm đỏ đô di sản */
.btn-crimson {
  background: #8B1E1E;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, background-color 0.25s ease;
}

.btn-crimson:hover {
  background: #6F1515;
  box-shadow: 0 4px 12px rgba(44, 30, 24, 0.18);
  transform: translateY(-1px);
}

/* Thẻ Tag tìm kiếm nhanh dạng Chip tương tác */
.quick-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #4A4036;
  background-color: var(--color-bg-ivory);
  border: 1px solid var(--color-border-warm);
  border-radius: 9999px;
  padding: 0.35rem 0.8rem;
  min-height: 32px;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.quick-tag:hover {
  color: var(--color-heritage-red);
  border-color: rgba(139, 30, 30, 0.45);
  background-color: #FFFDF9;
  transform: translateY(-1px);
}

.quick-tag.is-active {
  background-color: var(--color-heritage-red);
  color: #FFFFFF;
  border-color: var(--color-heritage-red);
}

/* Nút Zalo nổi góc phải */
.zalo-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0068FF;
  color: #ffffff;
  padding: 10px 18px 10px 14px;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(20, 16, 14, 0.22);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.zalo-floating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 16, 14, 0.28);
  background: #0056d6;
}

/* Điện thoại: nút Zalo thu gọn thành hình tròn, không che nội dung */
@media (max-width: 639px) {
  .zalo-floating-btn {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 16px;
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
  }
  .zalo-floating-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .back-to-top-btn {
    bottom: 80px;
    right: 20px;
  }
}

/* Nút cuộn lên đầu trang */
.back-to-top-btn {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 34;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--color-border-warm);
  color: var(--color-heritage-red);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top-btn:hover {
  background-color: var(--color-heritage-red);
  color: #ffffff;
  transform: translateY(-2px);
}

/* Trình phát nhạc nền Lưu Thủy Kim Tiền */
.sound-player-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 9999px;
  background-color: rgba(197, 155, 39, 0.12);
  border: 1px solid rgba(197, 155, 39, 0.35);
  color: var(--color-heritage-gold-dark);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  user-select: none;
}

.sound-player-btn:hover {
  background-color: rgba(197, 155, 39, 0.22);
  border-color: var(--color-heritage-gold);
  transform: translateY(-1px);
}

.sound-player-btn.playing {
  background: #8B1E1E;
  color: #ffffff;
  border-color: #8B1E1E;
  box-shadow: 0 4px 12px rgba(44, 30, 24, 0.18);
}

/* Biểu tượng Equalizer động */
.equalizer-icon {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 14px;
  height: 13px;
  overflow: hidden;
}

.eq-bar {
  width: 2.5px;
  height: 100%;
  background-color: currentColor;
  border-radius: 1px;
  transform-origin: bottom;
  transform: scaleY(0.3);
  transition: transform 0.2s ease;
}

.sound-player-btn.playing .eq-bar-1,
.music-player-pill.playing .eq-bar-1 {
  animation: eqWave 0.75s cubic-bezier(0.22, 1, 0.36, 1) infinite alternate;
}
.sound-player-btn.playing .eq-bar-2,
.music-player-pill.playing .eq-bar-2 {
  animation: eqWave 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.2s infinite alternate;
}
.sound-player-btn.playing .eq-bar-3,
.music-player-pill.playing .eq-bar-3 {
  animation: eqWave 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.35s infinite alternate;
}

.music-player-pill {
  padding: 0.35rem 0.75rem;
  transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.music-player-pill.playing {
  background: #FFFBEB;
  border-color: #C59B27;
  box-shadow: 0 2px 8px rgba(44, 30, 24, 0.12);
}

@keyframes eqWave {
  0% { transform: scaleY(0.2); }
  100% { transform: scaleY(1); }
}

/* Modal Dialog: Lớp phủ mờ sâu & hiệu ứng xuất hiện tinh tế */
.modal-overlay {
  background-color: rgba(20, 16, 14, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1rem;
  transition: opacity 0.25s ease;
}

.modal-content-box {
  background-color: #FFFFFF;
  color: var(--color-text-main);
  padding: 1.5rem;
  animation: modalScaleUp 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

#heritage-detail-modal .modal-content-box {
  padding: 0;
}

@keyframes modalScaleUp {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Lightbox Gallery */
.lightbox-overlay {
  background-color: rgba(10, 8, 7, 0.95);
  backdrop-filter: blur(8px);
  padding: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #F5EFE6;
}

::-webkit-scrollbar-thumb {
  background: #C59B27;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #8B1E1E;
}

/* Style In ấn học tập (Print) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  header, footer, .zalo-floating-btn, .back-to-top-btn, #search-section, #quiz-section, .no-print {
    display: none !important;
  }
  .modal-content-box {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  iframe {
    display: none !important;
  }
}


/* ====================================================================
   HOA VĂN PHÂN CÁCH TRUYỀN THỐNG (TRADITIONAL VIETNAMESE MOTIF DIVIDER)
   ==================================================================== */
.heritage-motif-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto;
  padding: 24px 0;
  width: 100%;
  max-width: 650px;
  opacity: 0.75;
}

.heritage-motif-divider::before,
.heritage-motif-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(139, 30, 30, 0.15);
}

.heritage-motif-symbol {
  color: var(--color-bronze);
  opacity: 0.7;
  flex-shrink: 0;
}


/* Thẻ thống kê 4 nhóm di tích tương tác */
.relic-stat-interactive-card {
  padding: 1.125rem;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, background-color 0.25s ease;
  background-color: var(--color-surface);
  color: var(--color-text-main);
}

.relic-stat-interactive-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -6px rgba(44, 30, 24, 0.1);
  border-color: rgba(139, 30, 30, 0.4);
}

.relic-stat-interactive-card:active {
  transform: translateY(0);
}

.stat-number-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 3.5rem;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  border-radius: 0.75rem;
  flex-shrink: 0;
}

/* ====================================================================
   BẢN ĐỒ TUYẾN HÀNH TRÌNH TƯƠNG TÁC (INTERACTIVE HERITAGE ROUTES)
   ==================================================================== */
.heritage-route-card {
  padding: 1.125rem;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, background-color 0.25s ease;
  cursor: pointer;
  position: relative;
  background-color: #FFFFFF;
  color: var(--color-text-main);
}

.heritage-route-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 30, 30, 0.35);
  box-shadow: 0 6px 16px -4px rgba(44, 30, 24, 0.08);
}

.heritage-route-card.active {
  background-color: #FBF4EC !important;
  border-color: #8B1E1E !important;
  box-shadow: 0 6px 18px -4px rgba(44, 30, 24, 0.1) !important;
}

.heritage-route-card.active .route-status-pill {
  display: inline-flex !important;
}

.route-status-pill {
  display: none;
}

.route-relic-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #2A2521;
  background-color: #F5EFE6;
  border: 1px solid #EADECF;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.route-relic-chip:hover {
  background-color: #8B1E1E !important;
  color: #FFFFFF !important;
  border-color: #8B1E1E !important;
}

.route-relic-chip svg {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.route-relic-chip:hover svg {
  opacity: 1;
}

#heritage-route-map-frame {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Khung chờ ảnh thật: viền kép đỏ - vàng */
.photo-pending-frame {
  border: 1px solid rgba(197, 155, 39, 0.55);
  outline: 4px double rgba(139, 30, 30, 0.18);
  outline-offset: -10px;
  background-color: #FBF6EE;
}

/* Bề mặt trình duyệt theo bảng màu di sản */
html { -webkit-tap-highlight-color: rgba(139, 30, 30, 0.12); }
a, button, [role="button"], input, label { touch-action: manipulation; }
::selection { background: rgba(197, 155, 39, 0.35); color: #2A2521; }
[role="button"]:not(button):focus-visible { outline: 2px solid var(--color-heritage-gold); outline-offset: 3px; }
#heritage-detail-modal, #relics-inventory-modal, .doc-fulltext, #audioguide-transcript-container { overscroll-behavior: contain; }
.doc-fulltext { scrollbar-color: rgba(139, 30, 30, 0.35) transparent; }

/* Bộ biểu tượng nét (sprite #i-* trong index.html), thay cho emoji */
.ic {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* Khung video tư liệu responsive 16:9 */
.aspect-video {
  aspect-ratio: 16 / 9;
}

.video-container iframe {
  width: 100%;
  height: 100%;
}

/* An toàn modal: không để nút Zalo và Back-to-top che khuất Modal/Lightbox */
body.modal-open .zalo-floating-btn,
body.modal-open .back-to-top-btn {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

@media (max-width: 640px) {
  .zalo-floating-btn {
    bottom: 16px;
    right: 16px;
    padding: 8px 14px 8px 10px;
    font-size: 0.85rem;
  }
  .back-to-top-btn {
    bottom: 70px;
    right: 16px;
    width: 38px;
    height: 38px;
  }
}

/* Zero text orphan / awkward wrapping rules */
.route-relic-chip,
.badge,
.tab-btn,
.category-tab-btn,
.rank-filter-btn,
.nav-link,
.nowrap-badge,
.route-status-pill {
  white-space: nowrap;
}

/* Typographic balance & anti-orphan rules */
h1, h2 {
  text-wrap: balance;
}

/* Tiêu đề dài nhiều dòng (câu hỏi, tuyến): ngắt tự nhiên, chỉ chống chữ mồ côi */
h3, h4, h5, h6 {
  text-wrap: pretty;
}

p, blockquote, figcaption {
  text-wrap: pretty;
}

/* Ensure interactive cards wrap text naturally and balance titles */
.hero-entry-card,
.relic-stat-interactive-card,
.heritage-route-card,
.heritage-card {
  white-space: normal;
}

.hero-entry-card p,
.relic-stat-interactive-card p,
.heritage-route-card p,
.heritage-card p {
  white-space: normal;
  text-wrap: pretty;
}

.hero-entry-card h2,
.heritage-card h3 {
  text-wrap: balance;
}


/* ====================================================================
   KIỂU CHỮ BIÊN TẬP (EDITORIAL) — nhãn, bảng thông mục, modal
   ==================================================================== */
.eyebrow {
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-heritage-red);
}

.eyebrow-muted { color: var(--color-bronze); }

.tab-count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.7;
}

/* Bảng thông mục kiểu nhãn hiện vật bảo tàng */
.spec-table {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.spec-table > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) 1fr;
  gap: 0.25rem 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.spec-table dt {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-bronze);
  padding-top: 0.15rem;
}

.spec-table dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-text-main);
}

.spec-action {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-heritage-red);
  text-underline-offset: 3px;
  white-space: nowrap;
}

.spec-action:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .spec-table > div { grid-template-columns: 1fr; }
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  color: var(--color-bronze);
  transition: color 0.2s ease;
}

.modal-link:hover { color: var(--color-heritage-red); }

.modal-lede {
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.75;
  color: #3A2F27;
  max-width: 68ch;
}

.modal-section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-heritage-red);
  margin-bottom: 0.75rem;
}

.modal-subhead {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-bronze);
  margin-bottom: 0.5rem;
}

.modal-list {
  list-style: disc;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #4A4036;
  max-width: 72ch;
}

.modal-list > li + li { margin-top: 0.4rem; }
.modal-list > li::marker { color: rgba(139, 30, 30, 0.45); }

.modal-aside {
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(197, 155, 39, 0.6);
  font-size: 0.875rem;
  line-height: 1.7;
  color: #5C4A42;
  max-width: 68ch;
}

@media (prefers-reduced-motion: reduce) {
  .heritage-card, .hero-entry-card, .relic-stat-interactive-card, .heritage-route-card, .modal-content-box, .btn-crimson, .btn-gold {
    transition: none !important;
    animation: none !important;
  }
  .heritage-card:hover, .hero-entry-card:hover, .relic-stat-interactive-card:hover, .heritage-route-card:hover, .btn-crimson:hover, .btn-gold:hover {
    transform: none !important;
  }
  .heritage-card .card-thumb-img, .heritage-card:hover .card-thumb-img {
    transform: none !important;
  }
}

.hero-card-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 0.875rem;
  max-width: 46ch;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Đoạn mở đầu hero: canh đều hai bên, nhấn mạnh mốc và tên riêng */
.hero-lede {
  text-wrap: pretty;
  hyphens: none;
}

@media (min-width: 640px) {
  .hero-lede {
    text-align: justify;
    text-justify: inter-word;
  }
}

.hero-em {
  font-weight: 600;
  color: var(--color-heritage-red);
  white-space: nowrap;
}

/* Thẻ tuyến: thẻ đang chọn hiện "Đang xem trên bản đồ", thẻ khác hiện gợi ý bấm */
.heritage-route-card.active .route-hint-pill { display: none; }
@media (max-width: 639px) { .route-hint-pill { display: none; } }

/* Lời giải thích trắc nghiệm: kẻ lề trái, không hộp màu */
.quiz-explain {
  margin-top: 0.75rem;
  margin-left: 2.5rem;
  padding: 0.25rem 0 0.25rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #4A4036;
  border-left: 2px solid;
}
.quiz-explain-ok { border-color: #4D7C4F; }
.quiz-explain-ok strong { color: #3F6B41; }
.quiz-explain-wrong { border-color: #8B1E1E; }
.quiz-explain-wrong strong { color: #8B1E1E; }

#quiz-section input[type="radio"] { accent-color: #8B1E1E; }

/* Bản đồ trong hồ sơ: chuyển Bản đồ / Ảnh vệ tinh */
.map-view-toggle {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.8125rem;
}
.map-view-toggle button {
  padding: 0.4rem 0.75rem;
  min-height: 36px;
  color: #5C5248;
  background: var(--color-surface);
}
.map-view-toggle button + button { border-left: 1px solid var(--hairline); }
.map-view-toggle button.is-active { background: var(--color-heritage-red); color: #fff; }

/* Câu hỏi nhanh cuối hồ sơ */
.mini-quiz-q { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
.mini-quiz-q legend { font-weight: 600; color: #2A2521; margin-bottom: 0.6rem; line-height: 1.5; }
.mini-quiz-options { display: grid; gap: 0.5rem; }
@media (min-width: 640px) { .mini-quiz-options { grid-template-columns: 1fr 1fr; } }
.mini-quiz-options button {
  text-align: left;
  padding: 0.65rem 0.85rem;
  min-height: 44px;
  border: 1px solid #EADECF;
  border-radius: 6px;
  background: var(--color-surface);
  font-size: 0.9375rem;
  color: #4A4036;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.mini-quiz-options button:hover:not(:disabled) { border-color: rgba(139, 30, 30, 0.4); }
.mini-quiz-options button:disabled { cursor: default; }
.mini-quiz-options button.is-correct { border-color: #4D7C4F; background: #F1F6EF; color: #2F5232; }
.mini-quiz-options button.is-wrong { border-color: #8B1E1E; background: #FBF1EE; color: #8B1E1E; }
.quiz-explain.mini-quiz-feedback { margin-left: 0; }
@media (min-width: 640px) { .mini-quiz-options.quiz-bank-options { grid-template-columns: 1fr; } }
.quiz-explain.quiz-bank-explain { margin-left: 0; }

/* Chống tràn ngang trên điện thoại */
#modal-dynamic-content, #modal-dynamic-content * { min-width: 0; }
#modal-dynamic-content { overflow-wrap: anywhere; }
@media (max-width: 639px) {
  .category-tab-btn, .route-relic-chip, .route-status-pill, .eyebrow,
  .spec-action, .whitespace-nowrap {
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
  }
  .spec-table dd { overflow-wrap: anywhere; }
}

/* ====================================================================
   NÂNG CẤP TRẢI NGHIỆM TƯƠNG TÁC (RIBBON KHÁM PHÁ, MEDIA BADGES, QUIZ)
   ==================================================================== */
#mobile-menu,
#empty-search-state,
#route-single-relic-toolbar {
  padding: 1rem;
}

.discovery-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
}

.discovery-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  border: 1px solid rgba(139, 30, 30, 0.22);
  box-shadow: 0 2px 6px rgba(44, 30, 24, 0.04);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.discovery-stat-pill:hover {
  transform: translateY(-1px);
  background-color: #FBF4EC;
  border-color: var(--color-heritage-red);
  color: var(--color-heritage-red);
  box-shadow: 0 4px 12px rgba(44, 30, 24, 0.08);
}

.discovery-stat-pill .pill-num {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-heritage-red);
  font-variant-numeric: tabular-nums;
}

.card-media-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background-color: #F5EFE6;
  color: #4A3F35;
  border: 1px solid #E5D7C3;
}

.card-media-pill--audio {
  background-color: rgba(139, 30, 30, 0.08);
  color: var(--color-heritage-red);
  border-color: rgba(139, 30, 30, 0.22);
}

.card-media-pill--video {
  background-color: rgba(197, 155, 39, 0.14);
  color: #6B5322;
  border-color: rgba(197, 155, 39, 0.35);
}

.quiz-option-label {
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz-option-label.is-selected {
  background-color: #FBF4EC !important;
  border-color: var(--color-heritage-red) !important;
}

.quiz-option-label.is-selected span {
  font-weight: 600;
  color: var(--color-heritage-red);
}

