/* ==========================================================================
   BOTTOM BAR (email / GitHub list)
   Turns the email and GitHub list into a horizontal bar that looks exactly
   like the top bar (bladerunner-topbar.css), but fixed to the bottom of
   the page. Load it after bladerunner-lists.css, bladerunner-topbar.css and
   bladerunner-mobile.css.

   It finds the list by itself: any <ul> that contains a mailto: link or a
   github.com link. If your email and GitHub are plain text (no links), give
   the list class="contact" instead.

   To place it at the end of the page instead of keeping it on screen, change
   "position: fixed" to "position: static" in the bar rule, and delete the
   two "padding-bottom" / "scroll-padding-bottom" rules just below it.
   ========================================================================== */

/* ---------- The bar (same as the top bar, but at the bottom) ---------- */
ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;

  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0 2rem;

  height: var(--topbar-height, 3.5rem);
  margin: 0;
  padding: 0 max(1.25rem, calc((100% - 1080px) / 2));   /* same gutter as the top bar */

  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;

  background: var(--ink, var(--void, #0f1112));
  background: color-mix(in srgb, var(--ink, var(--void, #0f1112)) 88%, transparent);
  border-top: 1px solid var(--line, var(--steel-line, #34393a));   /* the divider is on top, facing the page */
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}

ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar)::-webkit-scrollbar { display: none; }

/* The end of the page stays visible above the bar.
   (CSS does not allow :has() inside :has(), so the list is described directly here.) */
body:has(
  ul.contact,
  ul:not(.topbar) > li a[href^="mailto:"],
  ul:not(.topbar) > li a[href*="github.com"]
) {
  padding-bottom: calc(var(--topbar-height, 3.5rem) + 1rem);
}

html:has(
  ul.contact,
  ul:not(.topbar) > li a[href^="mailto:"],
  ul:not(.topbar) > li a[href*="github.com"]
) {
  scroll-padding-bottom: calc(var(--topbar-height, 3.5rem) + 1rem);
}

/* ---------- The items: no markers, no list spacing ---------- */
ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) > li {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
}

ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) > li::before { content: none; }

/* ---------- The links ---------- */
ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) a {
  display: block;
  padding: 0.35rem 0;
  font-family: var(--font-ui, var(--font-display, "Arial Narrow", sans-serif));
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--dim, #8b867b);
}

ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) a:hover,
ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) a:focus-visible,
ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) a[aria-current="page"] {
  color: var(--text, var(--ice, #fff));
}

/* ---------- Small screens: compact, like the top bar in bladerunner-mobile.css ---------- */
@media (max-width: 640px) {
  ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) {
    justify-content: space-between;
    gap: 0 0.5rem;
    padding-inline: 0.75rem;
    overflow: hidden;
  }

  ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) > li {
    flex: 0 1 auto;
    min-width: 0;
  }

  ul:is(.contact, :has(a[href^="mailto:"], a[href*="github.com"])):not(.topbar) a {
    padding: 0.4rem 0;
    font-size: clamp(0.62rem, 3.2vw, 0.85rem);
    letter-spacing: 0.06em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
