nav {
  width: fit-content;
  height: calc(24px + 26px);
  position: fixed;
  bottom: 50px;
  left: 50%;
  translate: -50% 0;
  background-color: var(--color-surface);
  outline: 1px solid var(--color-navigation-outline);
  border-radius: var(--radius-navigation);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  gap: var(--gap-navigation);
  z-index: 10;
  view-transition-name: nav;
}

nav a, nav button, nav .off {
  display: flex;
  color: var(--color-text);
  text-decoration: none;
  transition: opacity .15s;
}

nav [hidden] { display: none !important; }

nav button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

nav a:hover, nav button:hover { opacity: .6; }
nav .off { opacity: .15; cursor: default; }
nav button.active { opacity: .4; }


nav .share-action { display: none; }
nav.share-mode .navigation-arrow { display: none; }
nav.share-mode .share-action { display: flex; }
nav.share-mode #slideshow-pause-button { display: none; }

nav.slideshow-mode .navigation-arrow { display: none; }
nav.slideshow-mode #jump-control { display: none; }

/* Filter badge — floating pill above the nav */
#filter-badge {
  position: fixed;
  bottom: calc(50px + 24px + 26px + 10px);
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  outline: 1px solid var(--color-navigation-outline);
  border-radius: var(--radius-navigation);
  padding: 5px 10px 5px 14px;
  z-index: 10;
  white-space: nowrap;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#filter-badge[hidden] { display: none !important; }

#filter-badge-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
#filter-badge-link:hover { opacity: 1; }
#filter-badge-link .icon { width: 14px; height: 14px; }

#filter-badge-clear {
  display: flex;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-text);
  opacity: 0.35;
  transition: opacity 0.15s;
}
#filter-badge-clear:hover { opacity: 0.8; }
#filter-badge-clear .icon { width: 14px; height: 14px; }

/* Sub-navigation — card opened above the nav pill via the ellipsis button */
#subnav {
  position: fixed;
  bottom: calc(50px + 24px + 26px + 10px);
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  background: var(--color-surface);
  outline: 1px solid var(--color-navigation-outline);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 10;
}
#subnav[hidden] { display: none !important; }

.subnav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-key);
  background: none;
  border: none;
  color: var(--color-text);
  text-decoration: none;
  font: inherit;
  font-size: .65rem;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s;
}
.subnav-item:hover { background-color: var(--surface-sunken); }
.subnav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Smartphone landscape — the horizontal pill eats too much of the (already
   short) viewport height, so it moves to a vertical pill on the right edge
   instead. max-height keeps this from matching tablets in landscape. Placed
   last so it wins the cascade over the base nav/#filter-badge/#subnav rules
   above (same specificity, later source order). */
@media (orientation: landscape) and (max-height: 500px) {
  nav {
    top: 50%;
    bottom: auto;
    left: auto;
    right: 50px;
    translate: 0 -50%;
    width: calc(24px + 26px);
    height: fit-content;
    flex-direction: column;
    padding: 16px 0;
  }

  #filter-badge {
    top: 24px;
    bottom: auto;
    left: 50%;
    translate: -50% 0;
  }

  #subnav {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(50px + 24px + 26px + 10px);
    translate: 0 -50%;
  }
}
