/* Shared navigation only. Loaded after the approved theme and page styles. */
/* Vietnamese-only release: hide unavailable language choices, including menus. */
html body .ttv-language-switch { display: none !important; }
/* Full navigation needs room for the approved long brand and all actions.
 * Browser zoom reduces the CSS viewport: switch before those columns collide. */
.site-header { height: auto; }
.site-header .brand-logo { flex-shrink: 0; }
.site-header .brand strong::after { content: none; }
@media (hover: hover) and (pointer: fine) {
  #map-shell #vietnam-map { cursor: grab; }
  #map-shell.is-mouse-panning, #map-shell.is-mouse-panning * { cursor: grabbing !important; user-select: none; }
}
@media (max-width: 1600px) {
  :root { --header-height: 72px; }
  /* Legacy hidden/auto overflow makes body a non-scrolling sticky ancestor. */
  .ttv-menu-ready body {
    overflow-x: clip !important;
    overflow-y: visible !important;
  }
  .ttv-menu-ready .site-header {
    display: grid;
    top: 0;
    height: auto;
    min-height: 72px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }

  .ttv-menu-ready .site-header .brand {
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    gap: 8px;
    color: var(--ttv-ink);
    font-family: var(--font-display, Georgia, serif);
    line-height: 1.3;
  }

  .ttv-menu-ready .site-header .brand > span { min-width: 0; }
  .ttv-menu-ready .site-header .brand-logo { width: 36px; height: 36px; }
  .ttv-menu-ready .site-header .brand strong {
    display: block;
    font-size: clamp(1rem, 4.3vw, 1.25rem);
    line-height: 1.3;
    letter-spacing: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .ttv-menu-ready .site-header .brand strong::after { content: none; }
  .ttv-menu-ready .site-header .brand small {
    display: block;
    margin-top: 3px;
    font-size: .6875rem;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .ttv-menu-ready .site-header .header-actions { gap: 8px; }
  .ttv-menu-ready .site-header .header-actions .icon-button,
  .ttv-menu-ready .site-header .report-header-btn,
  .ttv-menu-ready .site-header .ttv-menu-toggle {
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    touch-action: manipulation;
  }
  .ttv-menu-ready .site-header .ttv-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--ttv-border);
    border-radius: 8px;
    color: var(--ttv-ink);
    background: var(--ttv-surface);
    justify-self: end;
  }
  .ttv-menu-ready .desktop-nav,
  .ttv-menu-ready .mobile-nav { display: none; }
  .ttv-menu-ready .ttv-menu-toggle svg { display: block; flex-shrink: 0; }

  /* The brand and explicit Home menu link already provide the return route. */
  .ttv-menu-ready .site-header .minigame-header__back { display: none; }
  .ttv-menu-ready .site-header.minigame-header,
  .ttv-menu-ready .site-header:not(:has(.header-actions)) { grid-template-columns: minmax(0, 1fr) auto; }

  .ttv-mobile-menu {
    box-sizing: border-box;
    inset: auto 0 0;
    width: 100%;
    max-width: 34rem;
    height: auto;
    max-height: calc(100vh - max(16px, env(safe-area-inset-top)));
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)));
    margin: 0 auto;
    padding: 16px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border: 1px solid var(--ttv-border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: var(--ttv-surface);
    color: var(--ttv-ink);
    overscroll-behavior: contain;
    overflow-y: auto;
  }
  .ttv-mobile-menu:not([open]) { display: none; }
  .ttv-mobile-menu::backdrop { background: rgb(23 51 74 / 44%); }
  .ttv-mobile-menu__heading { align-items: flex-start; gap: 12px; }
  .ttv-mobile-menu__heading h2 {
    min-width: 0;
    margin: 6px 0;
    font-family: var(--font-display, Georgia, serif);
    font-size: 1.375rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .ttv-mobile-menu__heading button {
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    font-size: .875rem;
    line-height: 1.4;
    touch-action: manipulation;
  }
  .ttv-mobile-menu nav { margin-top: 16px; }
  .ttv-mobile-menu__links { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .ttv-mobile-menu__links li { min-width: 0; }
  .ttv-mobile-menu nav a {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 10px 12px;
    font-size: 1rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    touch-action: manipulation;
  }
  .ttv-mobile-menu nav a[aria-current="page"] {
    border-inline-start: 3px solid var(--ttv-brick);
    background: var(--ttv-paper);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .2em;
  }
  .ttv-mobile-menu > .ttv-language-switch { gap: 12px; margin-top: 20px; }
  .ttv-mobile-menu .ttv-language-switch a { min-width: 64px; min-height: 44px; justify-content: center; }
  .ttv-menu-ready .site-header .brand:focus-visible,
  .ttv-mobile-menu :focus-visible,
  .ttv-menu-ready .ttv-menu-toggle:focus-visible { outline: 3px solid var(--ttv-brick); outline-offset: 3px; }
}

@media (max-width: 560px) {
  .project-footer__inner,
  .project-footer__bottom {
    box-sizing: border-box;
    width: calc(100% - 40px);
    max-width: 100%;
  }
  .project-footer__inner { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 32px 28px; }
  .project-footer__inner > * { min-width: 0; }
  .project-footer__logo-link { max-width: 100%; gap: 12px; }
  .project-footer__logo-link > span { min-width: 0; }
  .project-footer__logo { width: 64px; height: 64px; }
  .project-footer__logo-link strong { font-size: 1.5rem; line-height: 1.25; }
  .project-footer__logo-link small { line-height: 1.5; }
  .project-footer__nav a,
  .project-footer__contact a {
    box-sizing: border-box;
    min-height: 44px;
    width: 100%;
    padding-block: 8px;
    font-size: .9375rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    touch-action: manipulation;
  }
  .project-footer__nav a + a { margin-top: 4px; }
  .project-footer__logo-link strong,
  .project-footer__logo-link small,
  .project-footer__fanpage-brand > span,
  .project-footer__bottom p { overflow-wrap: anywhere; }
  .project-footer__fanpage { box-sizing: border-box; max-width: 100%; }
  .project-footer__fanpage-brand > span { min-width: 0; }
  .project-footer__bottom { padding-bottom: max(24px, env(safe-area-inset-bottom)); font-size: .75rem; }
}

/* Preserve all geographic paths. Lower paint cost only during manipulation;
   the original constant-width borders are restored on release/cancellation. */
#map-shell.is-touch-transforming .province-shape {
  vector-effect: none !important;
  filter: none !important;
  transition: none !important;
}
#map-shell.is-touch-transforming .archipelago-group * { filter: none !important; }
#zoom-level-badge { font-variant-numeric: tabular-nums; min-width: 4ch; }
