/* ============================================================
   Language switching — 繁體中文 (zh-Hant) for HK · Macau · Taiwan
   Two pieces:
     1. .lg-gate    — conspicuous first-visit entry selector.
                      SEO-SAFE: it is an overlay on TOP of the fully
                      rendered English page (no redirect, no cloaking,
                      content crawlable with JS off). Real <a href> to
                      /zh-hant/ does the routing; hreflang in <head>
                      tells crawlers about the pair.
     2. .lg-toggle  — persistent EN / 繁 segmented control in the
                      top utility bar, for switching at any time.
   Traditional glyphs use Noto Serif/Sans TC (imported in <head>).
   ============================================================ */

:root {
  --font-serif-tc: "Noto Serif TC", "Noto Serif SC", Georgia, serif;
  --font-sans-tc:  "Noto Sans TC", "Noto Sans SC", system-ui, sans-serif;
}

/* ---------- 1. Entry gate ---------------------------------- */
.lg-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: var(--parchment);
  opacity: 0;
  animation: lg-gate-in 420ms cubic-bezier(0.22,1,0.36,1) forwards;
}
.lg-gate[hidden] { display: none; }
@keyframes lg-gate-in { to { opacity: 1; } }

/* faint meridian texture so the gate feels like part of the brand world */
.lg-gate__bg {
  position: absolute; inset: 0;
  background-image: url('/assets/pattern-meridians.svg');
  background-size: 260px 260px;
  opacity: 0.05;
  pointer-events: none;
}

.lg-gate__card {
  position: relative;
  width: 100%; max-width: 720px;
  background: var(--paper, #fff);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--brand-red);
  box-shadow: 0 40px 100px rgba(2,29,66,0.28);
  padding: 48px 52px 40px;
  text-align: center;
  transform: translateY(10px);
  animation: lg-card-in 520ms 80ms cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes lg-card-in { to { transform: translateY(0); } }

.lg-gate__brand {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 26px;
}
.lg-gate__logo { height: 40px; width: 40px; object-fit: contain; }
.lg-gate__zh {
  font-family: var(--font-serif-tc);
  font-weight: 700; font-size: 24px; line-height: 1;
  color: var(--brand-red); letter-spacing: 0.02em;
}
.lg-gate__wm {
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px; line-height: 1;
  color: var(--brand-navy); letter-spacing: -0.01em;
}

.lg-gate__eyebrow {
  font-family: var(--font-sans);
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.lg-gate__eyebrow b { color: var(--brand-red); font-weight: 700; }
.lg-gate__title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 30px; line-height: 1.15;
  color: var(--brand-navy);
  margin: 0 0 28px;
}
.lg-gate__title .lg-tc { font-family: var(--font-serif-tc); }

.lg-gate__choices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  text-align: left;
}
.lg-choice {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  text-align: center; /* explicit — <button> (EN) centers by UA default, <a> (繁) doesn't */
  padding: 24px 24px 22px;
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none; cursor: pointer;
  transition: transform 160ms cubic-bezier(0.22,1,0.36,1),
              box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
.lg-choice:hover {
  transform: translateY(-3px);
  border-color: var(--brand-navy);
  box-shadow: 0 18px 40px rgba(2,29,66,0.16);
  background: #fff;
}
.lg-choice__flag {
  font-family: var(--font-sans);
  font-weight: 700; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--brand-red);
  margin-bottom: 6px;
  line-height: 13px;
}
.lg-choice__name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 30px; line-height: 1.05;
  color: var(--brand-navy);
  min-height: 32px;
}
.lg-choice--tc .lg-choice__name { font-family: var(--font-serif-tc);   font-size: 27px; line-height: 32px;
}
.lg-choice__region {
  font-family: var(--font-sans);
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.4;
}
.lg-choice--tc .lg-choice__region { font-family: var(--font-sans-tc); }
.lg-choice__arrow {
  position: absolute; top: 22px; right: 22px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1.5px solid var(--rule);
  color: var(--brand-navy); font-size: 15px; line-height: 1;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.lg-choice:hover .lg-choice__arrow {
  background: var(--brand-red); border-color: var(--brand-red);
  color: #fff; transform: translateX(3px);
}

.lg-gate__foot {
  margin-top: 26px;
  font-family: var(--font-sans);
  font-size: 12px; color: var(--ink-mute); line-height: 1.5;
}
.lg-gate__foot .lg-tc { font-family: var(--font-sans-tc); }

@media (max-width: 560px) {
  .lg-gate__card { padding: 36px 24px 30px; }
  .lg-gate__choices { grid-template-columns: 1fr; }
  .lg-gate__title { font-size: 24px; }
  /* Explicit centering on phones — belt-and-braces so no UA default or
     override can leave the choice-card text left-aligned. */
  .lg-choice { align-items: center; text-align: center; }
  .lg-choice__flag, .lg-choice__name, .lg-choice__region { text-align: center; }
}

/* ---------- 2. Utility-bar EN / 繁 toggle ------------------ */
/* Globe segment: lives INSIDE the toggle pill as a third option —
   same colors/dividers as EN/繁, but no gold underline (it opens
   the welcome gate rather than indicating a locale). */
.lg-toggle__opt--globe { padding: 2px 9px 4px; color: rgba(247,242,233,0.5); }
.lg-toggle__opt--globe svg { width: 14px; height: 14px; display: block; }

.lg-toggle {
  display: inline-flex; align-items: center;
  background: rgba(247,242,233,0.07);
  border-radius: 100px;
  padding: 2px 4px;
  flex: none;
}
.lg-toggle__opt {
  position: relative;
  display: inline-flex; align-items: center;
  appearance: none; border: none; background: transparent;
  font-family: var(--font-sans);
  font-weight: 700; font-size: 12px; letter-spacing: 0.1em;
  color: rgba(247,242,233,0.5);
  padding: 2px 10px 4px; cursor: pointer; text-decoration: none;
  line-height: 1;
  transition: color 160ms ease;
}
.lg-toggle__opt + .lg-toggle__opt { border-left: 1px solid rgba(247,242,233,0.14); }
.lg-toggle__opt--tc { font-family: var(--font-sans-tc); font-size: 13px; letter-spacing: 0.04em; }
.lg-toggle__opt:hover { color: #fff; }
.lg-toggle__opt.is-active { color: #fff; }
.lg-toggle__opt--globe:hover { color: var(--brand-gold); }

/* Gold underline = the active indicator (a real element so it renders
   everywhere, not a pseudo). It's always lit under the current locale, and
   slides out from the centre to PREVIEW the other one on hover — so the
   toggle quietly shows you where you'll land before you commit. */
.lg-toggle__bar {
  position: absolute; bottom: 1px; left: 50%; right: 50%;
  height: 2px; background: var(--brand-gold); border-radius: 2px;
  opacity: 0; pointer-events: none;
  transition: left 220ms cubic-bezier(0.22,1,0.36,1),
              right 220ms cubic-bezier(0.22,1,0.36,1),
              opacity 160ms ease;
}
.lg-toggle__opt.is-active .lg-toggle__bar { left: 7px; right: 7px; opacity: 1; }
.lg-toggle__opt:not(.is-active):hover .lg-toggle__bar,
.lg-toggle__opt:not(.is-active):focus-visible .lg-toggle__bar { left: 7px; right: 7px; opacity: 0.55; }

/* ---------- 2b. Bilingual label (static, non-interactive) -----------------
   For pages whose content is shown in BOTH English and 繁體中文 on the same
   page (e.g. guide articles), the EN/繁 control is not a switcher — it is a
   quiet label that says "this page is bilingual." A rounded pill + languages
   icon makes the intent unmistakable, so it never reads as a broken toggle.
   Non-interactive by construction: spans only, no pointer, not focusable. */
.lg-bi {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 4px 11px 5px;
  border: 1px solid rgba(247,242,233,0.22);
  border-radius: 999px;
  background: rgba(247,242,233,0.04);
  color: rgba(247,242,233,0.82);
  cursor: default; line-height: 1;
}
.lg-bi__icon { display: inline-flex; }
.lg-bi__icon svg { width: 14px; height: 14px; stroke: var(--brand-gold); opacity: 0.92; }
.lg-bi__en {
  font-family: var(--font-sans);
  font-weight: 700; font-size: 11.5px; letter-spacing: 0.07em;
}
.lg-bi__plus { color: var(--brand-gold); font-weight: 700; font-size: 12px; margin: 0 -1px; }
.lg-bi__tc { font-family: var(--font-sans-tc); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; }

/* ---------- 3. Locale-switch transition (reuses the loading splash) -------
   Tapping EN/繁 raises the same parchment loader the site shows on boot, then
   navigates. The destination locale shows its own loader until ready, so the
   two blend into one continuous "loading" beat. SEO-neutral: purely a
   click-time visual over a real <a href>. */
.lg-veil {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: var(--parchment);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.lg-veil.is-on { opacity: 1; pointer-events: auto; }
.lg-veil__mark {
  font-family: var(--font-serif-cn, "Noto Serif SC", Georgia, serif);
  font-weight: 700; font-size: 40px; letter-spacing: 0.12em;
  color: var(--brand-navy);
}
.lg-veil__bar {
  width: 160px; height: 3px; border-radius: 3px;
  background: rgba(26,62,110,0.14); overflow: hidden;
}
.lg-veil__bar span {
  display: block; height: 100%; width: 40%;
  background: var(--brand-red);
  animation: hh-boot-slide 1100ms cubic-bezier(0.5,0,0.2,1) infinite;
}
.lg-veil__cap {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-mute);
}
@keyframes hh-boot-slide {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(310%); }
}
@media (prefers-reduced-motion: reduce) {
  .lg-veil { display: none; }
}


/* ---------- 4. Bilingual top-nav labels ---------------------------------
   On a BILINGUAL single page (guide article / itinerary), the page shows
   English + 繁體中文 throughout, so the primary nav reads bilingually too:
   each top-level item stacks its English label over a quiet 繁體 gloss.
   Activated only when TopNav adds .hh-nav--bi (i.e. HELocale.isBilingual());
   twin pages keep the plain English nav. The href targets are handled
   separately by localizeChrome() — this is purely the visible label. */
.hh-nav--bi .hh-nav__links a { padding-top: 3px; padding-bottom: 3px; }
.hh-nav__bi { display: inline-flex; flex-direction: column; justify-content: center; gap: 1px; line-height: 1.06; }
.hh-nav__bi-en { font-family: var(--font-sans); font-weight: 600; font-size: 14px; color: inherit; }
.hh-nav__bi-cn {
  font-family: var(--font-sans-tc);
  font-weight: 500; font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-mute);
  transition: color var(--dur-fast, 160ms) var(--ease-out, ease);
}
.hh-nav--bi .hh-nav__links a:hover .hh-nav__bi-cn,
.hh-nav--bi .hh-nav__links a.is-active .hh-nav__bi-cn { color: var(--brand-red); }

/* Twin pages have a single, definite locale, so their nav is single-language:
   hide the secondary gloss line (繁體 on EN twins, English on 繁 twins) and show
   only the primary label. Keyed on the page-type marker so it works whether the
   baked nav carries .hh-nav--bi or not. Bilingual single pages
   (data-he-page="bilingual") are excluded and keep both lines. */
html:not([data-he-page="bilingual"]) .hh-nav__bi-cn { display: none; }

/* CTA button — stack the gloss under the label, centred, on brand navy */
.hh-nav__bi--cta { align-items: center; gap: 0; }
.hh-nav__bi--cta .hh-nav__bi-en { color: inherit; }
.hh-nav__bi--cta .hh-nav__bi-cn { color: rgba(247,242,233,0.72); letter-spacing: 0.12em; font-size: 10.5px; }
.hh-nav--bi .hh-nav > .hh-btn--primary,
.hh-btn--primary .hh-nav__bi--cta { line-height: 1.05; }

/* Mobile drawer — top-level group gloss, inline after the English label */
.hh-mobnav__link-cn {
  font-family: var(--font-sans-tc);
  font-weight: 500; font-size: 12.5px; letter-spacing: 0.04em;
  color: var(--ink-mute); margin-left: 9px;
}

/* Reduced motion: the gate must still APPEAR (base state is opacity:0,
   revealed by animation) — show it instantly instead of never. */
@media (prefers-reduced-motion: reduce) {
  .lg-gate { animation: none; opacity: 1; }
  .lg-gate__card { animation: none; transform: none; }
}
