html:has(.a-bottom-nav) {
  --bottom-nav-height: calc(53px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(var(--bottom-nav-height) + 12px);
}

body:has(.a-bottom-nav) {
  padding-bottom: var(--bottom-nav-height);
}

.a-bottom-nav {
  position: fixed;
  z-index: 50;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: center;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  border-top: 1px solid #393a38;
  background: #171817;
  color: #f2eee8;
}

@media (min-width: 800px) {
  .a-bottom-nav { grid-template-columns: repeat(4, minmax(0, 160px)); }
}

body:has(#a-opening, dialog[open]) .a-bottom-nav { visibility: hidden; }

.a-bottom-nav a {
  position: relative;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 0;
  height: 52px;
  padding: 0 5px;
  color: inherit;
  text-align: center;
  text-decoration: none;
  font: 500 14px/1.2 -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  letter-spacing: .035em;
}

.a-bottom-nav a + a { border-inline-start: 1px solid #ffffff19; }
.a-bottom-nav svg { display: block; width: 22px; height: 22px; }
.a-bottom-nav a::after {
  content: "";
  position: absolute;
  inset: auto calc(50% - 10px) 6px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 200ms ease-out;
}

.a-bottom-nav a:active,
.a-bottom-nav a:focus-visible,
.a-bottom-nav a[aria-current="page"],
body:has(#collection:target) .a-bottom-nav a[href="#collection"] { background: #ffffff0e; }

.a-bottom-nav a:is(:active, :focus-visible, [aria-current="page"])::after,
body:has(#collection:target) .a-bottom-nav a[href="#collection"]::after { transform: scaleX(1); }

@media (hover: hover) {
  .a-bottom-nav a:hover { background: #ffffff0e; }
  .a-bottom-nav a:hover::after { transform: scaleX(1); }
}

.a-bottom-nav a:focus-visible { outline: 1px solid currentColor; outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  .a-bottom-nav a::after { transition: none; }
}
