/* =====================================================================
   my-design-kit · Tubelight nav
   A frosted pill of links. The active link gets a soft fill and a small
   glowing "tube light" that slides across to it with a spring.
   Needs: tokens.css, tubelight-nav.js
   ===================================================================== */

.kit-tubelight {
  /* Fixed and centred, like the original: bottom of the screen on phones,
     top of the screen from 640px up. */
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 50;
  margin-bottom: 24px;
  font-family: var(--kit-font-sans);
}

@media (min-width: 640px) {
  .kit-tubelight {
    bottom: auto;
    top: 0;
    margin-bottom: 0;
    padding-top: 24px;
  }
}

/* Inline version: sits in the normal page flow (e.g. inside a header) */
.kit-tubelight--inline {
  position: relative;
  left: auto;
  top: auto;
  bottom: auto;
  transform: none;
  margin: 0;
  padding: 0;
}

.kit-tubelight__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  border: 1px solid var(--kit-border);
  border-radius: var(--kit-radius-pill);
  background: color-mix(in srgb, var(--kit-background) 72%, transparent); /* original is 5%: too see-through over dark bands */
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--kit-shadow-lg);
  isolation: isolate;
}

.kit-tubelight__item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  border-radius: var(--kit-radius-pill);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: color-mix(in srgb, var(--kit-foreground) 80%, transparent);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms var(--kit-ease-standard),
              background-color 150ms var(--kit-ease-standard);
  -webkit-tap-highlight-color: transparent;
}

.kit-tubelight__item:hover {
  color: var(--kit-primary-ink, var(--kit-primary)); /* the text-safe shade of the main colour */
}

.kit-tubelight__item.is-active {
  background: var(--kit-muted);
  color: var(--kit-primary-ink, var(--kit-primary)); /* the text-safe shade of the main colour */
}

.kit-tubelight__item:focus-visible {
  outline: 2px solid var(--kit-primary);
  outline-offset: 2px;
}

/* Text from 768px up, icon below */
.kit-tubelight__icon {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 767.98px) {
  .kit-tubelight__item:has(.kit-tubelight__icon) .kit-tubelight__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .kit-tubelight__icon {
    display: block;
  }
}

/* ---- the lamp: one element that slides between items ------------------ */
.kit-tubelight__lamp {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  z-index: 0;
  border-radius: var(--kit-radius-pill);
  background: color-mix(in srgb, var(--kit-primary) 5%, transparent);
  pointer-events: none;
  will-change: transform, width;
}

.kit-tubelight__tube {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 32px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 9999px 9999px 0 0;
  background: var(--kit-primary);
}

.kit-tubelight__tube i {
  position: absolute;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--kit-primary) 20%, transparent);
}

.kit-tubelight__tube i:nth-child(1) { width: 48px; height: 24px; top: -8px; left: -8px; filter: blur(12px); }
.kit-tubelight__tube i:nth-child(2) { width: 32px; height: 24px; top: -4px; left: 0;    filter: blur(12px); }
.kit-tubelight__tube i:nth-child(3) { width: 16px; height: 16px; top: 0;    left: 8px;  filter: blur(8px); }

/* When the nav is at the bottom of a phone screen, leave room for it */
@media (max-width: 639.98px) {
  body:has(.kit-tubelight:not(.kit-tubelight--inline)) {
    padding-bottom: 96px;
  }
}
