/* Xưa preview v4 — force Nat Geo palette even if older :root wins on specificity */
html[data-product="xua"] {
  --bg: #0B0B0B;
  --bg-soft: #141414;
  --surface: #161616;
  --ink: #F4F1EA;
  --ink-soft: #C9C2B6;
  --muted: #C9C2B6;
  --faint: #C9C2B6;
  --line: rgba(244, 241, 234, 0.14);
  --accent: #C4A35A;
  --accent-hover: #D4B56A;
  --accent-soft: #2A2416;
  --accent-ink: #14110B;
  --theme-color: #0B0B0B;
  --gold: #C4A35A;
  overflow-x: hidden;
}
html[data-product="xua"] body { background: var(--bg); color: var(--ink); overflow-x: hidden; }
html[data-product="xua"] .cmp,
html[data-product="xua"] .cmp-hero,
html[data-product="xua"] .place .cmp,
html[data-product="xua"] .place:first-child .cmp {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  box-sizing: border-box;
}
html[data-product="xua"] .place { max-width: 100%; }
html[data-product="xua"] .place img { max-width: 100%; height: auto; }
html[data-product="xua"] .city-panel {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
html[data-product="xua"] .today-sec { order: 20; margin-top: var(--space-m); }
html[data-product="xua"] .cmp-hero,
html[data-product="xua"] .place:first-of-type { order: -1; }

/* Xưa preview v4 — National Geographic × Arts & Culture. Image-led, dark. */
html { scroll-padding-top: var(--header-h); background: var(--bg); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.5;
}
.site-header {
  min-height: var(--header-h);
  padding: 0.25rem 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .brand { font-weight: 600; font-size: var(--step--1); letter-spacing: 0.08em; color: var(--ink); }
.site-header .product { font-weight: 400; font-size: var(--step--2); letter-spacing: 0.1em; color: var(--muted); }

.license-banner {
  margin: var(--space-2xs) 0 var(--space-s);
  padding: 0.5rem 0.75rem;
  border-radius: 0;
  border: 0;
  border-left: 2px solid var(--accent);
  background: transparent;
  font-size: var(--step--1);
}
.license-banner p { font-size: var(--step--1); color: var(--muted); }

/* Kill the large top hero space; keep a short caption */
.hero { padding: 0 0 var(--space-s) !important; margin: 0 !important; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-3) !important;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 var(--space-2xs) !important;
  color: var(--ink);
  max-width: 16em;
}
.hero h1 em { color: var(--accent); font-style: italic; font-weight: 600; }
.hero .lede {
  font-size: var(--step--1) !important;
  color: var(--muted);
  margin: 0 !important;
  max-width: 42em;
}

/* Nav must not cover content */
.quicknav {
  position: static !important;
  top: auto !important;
  box-shadow: none !important;
  border-radius: var(--radius-m) !important;
  padding: 0.35rem !important;
  margin: 0 0 var(--space-s) !important;
  background: var(--surface) !important;
}
.timebar {
  position: static !important;
  top: auto !important;
  margin-top: var(--space-s) !important;
  padding: 0.5rem 0 !important;
  background: transparent;
}
.timebar label, .timebar .year-readout { font-weight: 600; font-size: var(--step-0); }
.year-readout { font-family: var(--font-num); font-weight: 600 !important; }

/* Year markers: one scrolling row, never wrap or clip */
.year-ticks {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 0.35rem;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.year-ticks button {
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 400;
  font-size: var(--step--1);
  min-height: 2.25rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-m);
}
.year-ticks button[aria-pressed="true"], .year-ticks button.is-active {
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
}

/* Fewer giant pills */
.city-switch {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.35rem;
  margin-bottom: var(--space-s);
  -webkit-overflow-scrolling: touch;
}
.city-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  border-radius: var(--radius-m) !important;
  min-height: var(--touch);
  padding: 0.4rem 0.8rem !important;
  font-weight: 400;
}
.city-tab .cmeta { display: none; } /* drop secondary pill text on all sizes; keep name */
.city-tab .cname { font-family: var(--font-sans); font-weight: 600; font-size: var(--step--1); }
.city-tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

button, .btn, .year-reset, .qn-share, .quiz-next {
  min-height: var(--touch);
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-m);
}

/* Image is the dominant element */
.cmp, .cmp-hero, .place .cmp, .place:first-child .cmp {
  aspect-ratio: 16 / 9;
  min-height: min(56vh, 28rem);
  border-radius: 0;
  box-shadow: none;
  width: 100%;
}
.cmp-hero {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  min-height: min(62vh, 34rem);
  aspect-ratio: 16 / 9;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 6rem !important; }
@media (max-width: 480px) {
  .wrap { padding: 0 0 6rem !important; }
  .site-header, .license-banner, .hero, .quicknav, .city-switch, .timebar, .birth-sec, .quiz-sec, footer, .places, .eras-sec {
    padding-left: 16px;
    padding-right: 16px;
  }
  .cmp-hero, .place:first-child .cmp, #city-danang .cmp, #city-dalat .cmp, #city-quangngai .cmp, #city-saigon .cmp-hero {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
  }
  .hero .lede { display: none; } /* caption lives with the image; lede was eating the fold */
  .birth-sec, .quiz-sec { margin-top: var(--space-m); padding: var(--space-s) !important; }
}

/* Hidden unverified places (JS also removes them) */
.place.is-unverified, .cmp img[src*="placeholder-license"] { display: none !important; }

.bottomnav { background: var(--bg); border-top: 1px solid var(--line); }
.hidden-places-note { font-size: var(--step--1); color: var(--muted); margin: var(--space-s) 16px; }

/* Overflow guard */
.timebar .row { flex-wrap: wrap; }
.timebar input[type="range"] { min-width: 0; width: 100%; }
img, svg, canvas { max-width: 100%; }
html[data-product="xua"] .fact,
html[data-product="xua"] .fact.kept,
html[data-product="xua"] .fact.changed,
html[data-product="xua"] .facts .kept,
html[data-product="xua"] .facts .changed {
  background: var(--surface) !important;
  color: var(--ink) !important;
}
html[data-product="xua"] .fact p,
html[data-product="xua"] .fact p strong {
  color: var(--ink) !important;
  background: transparent !important;
}
html[data-product="xua"] .fact.kept b {
  background: #2A2416 !important;
  color: #E8D7A0 !important;
}
html[data-product="xua"] .fact.changed b {
  background: var(--ink) !important;
  color: var(--bg) !important;
}
html[data-product="xua"] .cmp,
html[data-product="xua"] .cmp-hero,
html[data-product="xua"] .place .cmp {
  height: unset !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
  width: 100% !important;
  max-width: 100% !important;
}
html[data-product="xua"] .wrap {
  display: flex;
  flex-direction: column;
  max-width: 1120px;
}
html[data-product="xua"] .site-header { order: 0; }
html[data-product="xua"] .license-banner { order: 1; }
html[data-product="xua"] .hero { order: 2; }
html[data-product="xua"] .quicknav { order: 3; }
html[data-product="xua"] .city-switch { order: 4; }
html[data-product="xua"] .city-panel { order: 5; }
html[data-product="xua"] .birth-sec { order: 8; }
html[data-product="xua"] .quiz-sec { order: 9; }
html[data-product="xua"] .places { order: 6; }
html[data-product="xua"] .hidden-places-note { order: 12; }
html[data-product="xua"] footer, html[data-product="xua"] #hiddenPlacesNote { order: 13; }
html[data-product="xua"] .bottomnav { order: 14; }
html[data-product="xua"] #main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
html[data-product="xua"] .city-panel[hidden] { display: none !important; }
html[data-product="xua"] .birth-sec { order: 8 !important; }
html[data-product="xua"] .quiz-sec { order: 9 !important; }
html[data-product="xua"] .today-sec { order: 10 !important; }
html[data-product="xua"] .city-panel { order: 5 !important; }
html[data-product="xua"] .hero { order: 2 !important; }
html[data-product="xua"] .quicknav { order: 3 !important; }
html[data-product="xua"] .city-switch { order: 4 !important; }
html[data-product="xua"] .howto { order: 11 !important; }
html[data-product="xua"] #main { padding-bottom: 5.5rem; }
@media (max-width: 767px) {
  /* Mid-page quicknav duplicates the bottom tab bar and adds too many pills. */
  html[data-product="xua"] .quicknav { display: none !important; }
}
