/* Bottom navigation (replaces fixed bottom ad strip on main map screen). Themes: default dark + html.hll-theme-light */
/* --hll-bottom-nav-h / --hll-main-chrome-bottom live in style.css :root */

/* Proportions ~ reference: icon slot ~2× label cap height; labels small / light sans. PNGs → monochrome (black on light bar, light on dark bar) via filter. */
:root {
  /* ~½ previous 9px; reference ~10–12px on smaller icons — icons are 2× so text stays fine */
  /* Smaller than before (~9px); Chrome may clamp sub-8px — use 8px floor */
  /* Fluid labels: fixed 7.5px looked tiny on tablets while icons scale with 19vw. Calibrate to ~412px CSS width (Pixel 8) ≈ 7.5px; scale up with vw, cap for desktop-sized webviews */
  --hll-bottom-nav-label-fs: clamp(7.5px, 1.821vw, 12px);
  /* One slot: maps vs about/theme relative size is baked into PNG canvases (see scripts/normalize-navbar-icons.py) */
  --hll-bottom-nav-icon-size: min(6.75rem, 19vw);
  --hll-bottom-nav-icon-inactive-opacity: 0.42;
  --hll-bottom-nav-pad-x: 0.06rem;
  /* Dark bar: inactive gray labels; active label = icon ink (see --hll-nav-active-label); slider matches */
  --hll-nav-ink: #8e8e93;
  --hll-nav-accent: #a594f9;
  --hll-nav-accent-muted: #9585e8;
  --hll-nav-bg: #000000;
  /* Match bar fill — was rgba(255,255,255,0.06) hairline above nav in dark mode */
  --hll-nav-border: #000000;
  --hll-nav-indicator: var(--hll-nav-accent);
  /* Active-tab label = same ink as PNG after --hll-nav-icon-filter (not purple accent) */
  --hll-nav-active-label: rgba(255, 255, 255, 0.95);
  /* Inactive text for tabs 1–4 (must differ from --hll-nav-active-label in each theme) */
  --hll-nav-label-idle: #8e8e93;
  /* PNG → single-color for theme bars (source art may be colored) */
  --hll-nav-icon-filter: brightness(0) saturate(100%) invert(1);
}

html.hll-theme-light {
  /* Light bar: active label slate; idle label muted slate (see --hll-nav-active-label / --hll-nav-label-idle) */
  --hll-nav-ink: #0f172a;
  --hll-nav-accent: #6200ee;
  --hll-nav-accent-muted: #7c4dff;
  --hll-nav-bg: #e6e3e0;
  --hll-nav-border: rgba(15, 23, 42, 0.1);
  --hll-nav-indicator: var(--hll-nav-accent);
  --hll-nav-active-label: #0f172a;
  --hll-nav-label-idle: #64748b;
  --hll-nav-icon-filter: brightness(0) saturate(100%);
  /* Warm gray chrome (not pure white); map shell + bottom bar use --hll-nav-bg */
  background: var(--hll-nav-bg);
}

/* Any primary overlay that lists before <nav> in DOM (sibling combinator from #screenMap) */
#screenMap:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenSide:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenArtyElevation:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenSpaArtySoviet:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenSpaArtyBritish:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenSpaArtyGerman:not(.screen-hidden) ~ nav.hll-bottom-nav,
#screenPoints:not(.screen-hidden) ~ nav.hll-bottom-nav {
  display: flex;
}

nav.hll-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  min-height: var(--hll-main-chrome-bottom);
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(var(--hll-bottom-nav-pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--hll-bottom-nav-pad-x), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  background: var(--hll-nav-bg);
  border-top: 1px solid var(--hll-nav-border);
  border-radius: 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

/* Single pill: fixed width, slides horizontally (position set in app.js) */
.hll-bottom-nav-slider {
  position: absolute;
  top: 0.2rem;
  left: 0;
  width: 4.5rem;
  height: 3px;
  border-radius: 2px;
  background: var(--hll-nav-active-label);
  transform: translateX(0);
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  z-index: 0;
}

/* Light bar: explicit chrome; no shadow (flat against #e6e3e0 content) */
html.hll-theme-light nav.hll-bottom-nav {
  background: #e6e3e0;
  border-top-color: #e6e3e0;
  box-shadow: none;
}

.hll-bottom-nav-item {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 0.4rem 0.04rem 0.28rem;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.28rem;
  color: var(--hll-nav-ink);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: 1.05;
  text-align: center;
  position: relative;
  z-index: 1;
  /* No color transition: avoids purple flash when .--active toggles (labels were inheriting interpolated accent) */
  transition: transform 0.22s ease;
}

.hll-bottom-nav-item:focus-visible {
  outline: 2px solid var(--hll-nav-accent);
  outline-offset: 2px;
}

.hll-bottom-nav-item .hll-bottom-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* Inactive ~30% smaller; active full size — same slot (transform does not reflow) */
  transform: scale(0.7);
  transform-origin: center bottom;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: min(var(--hll-bottom-nav-icon-size), 100%);
  height: min(var(--hll-bottom-nav-icon-size), 100%);
}

/* PNG icons: uniform box; intrinsic files vary (e.g. light.png 520×480, garrison 451×554) */
.hll-bottom-nav-item .hll-bottom-nav-icon--img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hll-bottom-nav-item .hll-bottom-nav-icon--img:not(.hll-bottom-nav-icon--theme) img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  filter: var(--hll-nav-icon-filter);
  transition: opacity 0.2s ease, transform 0.22s ease, filter 0.2s ease;
}

/* Garrison −20%, Station −10% vs SPA (same nav slot) */
.hll-bottom-nav-item[data-hll-nav-page="1"] .hll-bottom-nav-icon--img img {
  width: 80%;
  height: 80%;
}

.hll-bottom-nav-item[data-hll-nav-page="2"] .hll-bottom-nav-icon--img img {
  width: 90%;
  height: 90%;
}

.hll-bottom-nav-item:not(.hll-bottom-nav-item--active):not(.hll-bottom-nav-item--theme) .hll-bottom-nav-icon--img img {
  opacity: var(--hll-bottom-nav-icon-inactive-opacity);
}

/* Theme toggle: same ink weight as other inactive tab icons (was full-opacity) */
.hll-bottom-nav-item--theme .hll-bottom-nav-icon--theme {
  opacity: var(--hll-bottom-nav-icon-inactive-opacity);
}

.hll-bottom-nav-item--active .hll-bottom-nav-icon {
  transform: scale(1) translateY(1px);
}

.hll-bottom-nav-item--active:not(.hll-bottom-nav-item--theme) .hll-bottom-nav-icon--img img {
  opacity: 1;
}

.hll-bottom-nav-item--theme {
  color: var(--hll-nav-label-idle);
}

/* Two-line tabs: natural height. About: one word, nudged down partway toward neighbors’ 2nd line (not a full blank line). */
.hll-bottom-nav-label {
  display: grid;
  min-height: calc(var(--hll-bottom-nav-label-fs) * 1.1 * 2);
  place-content: center;
  text-align: center;
  max-width: 100%;
  word-break: break-word;
  hyphens: auto;
  font-family: "Core Sans AR 35 Light", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--hll-bottom-nav-label-fs);
  font-weight: 300;
  letter-spacing: 0.03em;
  line-height: 1.1;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Page tabs 1–4: idle vs active must contrast in light + dark (see --hll-nav-label-idle) */
.hll-bottom-nav-item:not(.hll-bottom-nav-item--theme) .hll-bottom-nav-label {
  color: var(--hll-nav-label-idle);
}

.hll-bottom-nav-item--active:not(.hll-bottom-nav-item--theme) .hll-bottom-nav-label {
  color: var(--hll-nav-active-label);
}

.hll-bottom-nav-item--theme .hll-bottom-nav-label {
  color: var(--hll-nav-label-idle);
}

/* ~0.5 ≈ vertically centered vs neighbors; ~1.0 ≈ full blank first line (too low) — tune 0.64 */
.hll-bottom-nav-label--about {
  display: block;
  text-align: center;
  box-sizing: border-box;
  place-content: unset;
  height: calc(var(--hll-bottom-nav-label-fs) * 1.1 * 2);
  min-height: calc(var(--hll-bottom-nav-label-fs) * 1.1 * 2);
  padding-top: calc(var(--hll-bottom-nav-label-fs) * 1.1 * 0.64);
  line-height: 1.1;
}

/* Theme toggle: light.png (switch to light) vs dark.png — crossfade in same slot */
.hll-bottom-nav-icon--theme .hll-bottom-nav-theme-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  filter: var(--hll-nav-icon-filter);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center center;
}

html:not(.hll-theme-light) .hll-bottom-nav-theme-img--light {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html:not(.hll-theme-light) .hll-bottom-nav-theme-img--dark {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

html.hll-theme-light .hll-bottom-nav-theme-img--light {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

html.hll-theme-light .hll-bottom-nav-theme-img--dark {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* MAPS main scroll: kill UA button hover tint in both themes (side logos use divs — see .arty-grid-item:hover in style.css). */
#screenMap #mainContent button:not(.about-apple-cta) {
  background: var(--hll-nav-bg);
}
#screenMap #mainContent button:not(.about-apple-cta):hover {
  background: var(--hll-nav-bg);
}

/* —— Light theme: main map + side picker — warm gray chrome (#e6e3e0 = --hll-nav-bg). Map tile cells stay #000 (style.css). Points / elevation / SPA calc use same token in style.css. —— */
html.hll-theme-light body {
  background: var(--hll-nav-bg);
  color: #0f172a;
}

html.hll-theme-light #screenMap {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .layout,
html.hll-theme-light #screenMap .content {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .title-belt {
  background: var(--hll-nav-bg);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  /* Base .title-belt uses box-shadow 0 -3px #000 — remove black hairline in light mode */
  box-shadow: 0 -3px 0 0 var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .title {
  color: #0f172a;
}

html.hll-theme-light #screenMap .page-section {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .page-divider {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .hll-maps-end-io-anchor {
  background: var(--hll-nav-bg);
}

/* Floating MAPS ↓/↑: same white as dark theme (see style.css — no light-theme recolor). */

/* Match bottom bar white: main scroll chrome (not map thumbnails / dividers) */
html.hll-theme-light #screenMap #mainContent.content.page-1 {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .hll-map-ad-top-wrap,
html.hll-theme-light #screenMap .hll-map-ad-top-wrap .ad-slot.ad-top {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenMap .page-section.page-section-2.arty-section,
html.hll-theme-light #screenMap .page-section.page-section-3.spa-arty-section,
html.hll-theme-light #screenMap .page-section.page-section-4.about-section {
  background: var(--hll-nav-bg);
}

/* Native ABOUT paywall — dark text on warm-gray shell */
html.hll-theme-light #screenMap .about-section .about-apple-paywall {
  color: #0f172a;
}
html.hll-theme-light #screenMap .about-section .about-apple-link-btn {
  color: #0f172a;
}
html.hll-theme-light #screenMap .about-section .about-apple-link-btn:active {
  opacity: 0.65;
}
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-legal-link {
  color: #1d4ed8;
}
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-legal-link:active {
  color: #1e40af;
}
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-browser-version-link,
html.hll-theme-light #screenMap .about-section .about-android-paywall .about-browser-version-link,
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-rate-secondary-link,
html.hll-theme-light #screenMap .about-section .about-android-paywall .about-rate-secondary-link {
  color: #0a5ed6;
}
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-rate-secondary-link,
html.hll-theme-light #screenMap .about-section .about-android-paywall .about-rate-secondary-link {
  color: rgba(10, 94, 214, 0.82);
}
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-browser-version-link:active,
html.hll-theme-light #screenMap .about-section .about-android-paywall .about-browser-version-link:active,
html.hll-theme-light #screenMap .about-section .about-apple-paywall .about-rate-secondary-link:active,
html.hll-theme-light #screenMap .about-section .about-android-paywall .about-rate-secondary-link:active {
  opacity: 0.85;
}
html.hll-theme-light #screenMap .about-section .about-browser-paywall .about-legal-link {
  color: #0a5ed6;
}
html.hll-theme-light #screenMap .about-section .about-browser-paywall .about-legal-link:active {
  opacity: 0.85;
}
/* Choose-a-side flow (same light shell as main map) */
html.hll-theme-light #screenSide .title-bar.title-bar-side,
html.hll-theme-light #screenSide .side-banner,
html.hll-theme-light #screenSide .side-list,
html.hll-theme-light #screenSide .side-item {
  background: var(--hll-nav-bg);
}

html.hll-theme-light #screenSide .title-side,
html.hll-theme-light #screenSide .back-arrow {
  color: #0f172a;
}

html.hll-theme-light #screenSide .back-arrow:hover {
  color: #000000;
}

html.hll-theme-light #screenSide .side-item {
  color: #0f172a;
}
