/*!
 * wowTracker
 * Self-contained styles — no external CSS variable dependencies.
 * All color tokens are hardcoded so this file is portable across projects.
 */

/* ── Container ─────────────────────────────────────────────── */

.wt-nav {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.75rem);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.wt-nav.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ── Desktop track ─────────────────────────────────────────── */

.wt-track {
  display: grid;
  grid-template-columns: repeat(var(--wt-count), minmax(0, 1fr));
  align-items: flex-end;
  list-style: none;
  margin: 0;
  padding: 1.25rem 2.5rem 0.875rem;
  width: min(calc(100vw - 3rem), 46rem);
  box-sizing: border-box;
  background: #1b3169;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 3rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.30), 0 1px 3px rgba(0, 0, 0, 0.26);
  position: relative;
  overflow: visible;
}

/* Connecting line — left/right set by JS after mount */
.wt-track::before {
  content: '';
  position: absolute;
  left: var(--wt-line-left, 2.5rem);
  right: var(--wt-line-right, 2.5rem);
  bottom: calc(0.875rem + 4px); /* track padding + half of 8px dot */
  height: 1px;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.wt-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  min-width: 0;
  height: 1.75rem;
  justify-content: flex-end;
}

.wt-label {
  font-family: poppins, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #1b3169;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.85rem);
  transform: translate(-50%, 0.25rem) scale(0.96);
  transform-origin: center bottom;
  height: auto;
  min-height: 1.6rem;
  padding: 0.42rem 0.9rem 0.36rem;
  border-radius: 0.4rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  z-index: 3;
}

.wt-label::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -0.38rem;
  width: 0.75rem;
  height: 0.75rem;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 0.125rem 0;
  z-index: -1;
}

.wt-item:hover .wt-label,
.wt-item:focus-within .wt-label {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.wt-item--active .wt-label {
  bottom: 0.95rem;
  max-width: min(16rem, calc(100vw - 4rem));
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  opacity: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  animation: wt-active-label-in 0.24s ease both;
}

.wt-item--active .wt-label::after {
  display: none;
}

.wt-item--active:hover .wt-label,
.wt-item--active:focus-within .wt-label {
  transform: translateX(-50%);
}

.wt-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(27, 49, 105, 0.22);
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: background 0.25s ease, transform 0.25s ease;
}

/* Expanded tap target */
.wt-dot::after {
  content: '';
  position: absolute;
  inset: -10px;
}

.wt-dot:focus-visible {
  outline: 2px solid #e8792a;
  outline-offset: 4px;
  border-radius: 50%;
}

.wt-item--active .wt-dot {
  background: #e8792a;
  transform: scale(1.625);
}

.wt-track.wt-track--forward .wt-item--active .wt-label {
  --wt-label-shift: 0.5rem;
}

.wt-track.wt-track--backward .wt-item--active .wt-label {
  --wt-label-shift: -0.5rem;
}

@keyframes wt-active-label-in {
  from {
    opacity: 0;
    transform: translateX(calc(-50% + var(--wt-label-shift, 0rem)));
  }
  to {
    opacity: 1;
    transform: translateX(-50%);
  }
}

/* ── Mobile chip ───────────────────────────────────────────── */

.wt-mobile {
  display: none;
  position: relative;
}

.wt-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem 0.625rem 1.375rem;
  background: #1b3169;
  color: #fff;
  border: none;
  border-radius: 3rem;
  cursor: pointer;
  font-family: poppins, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  transition: background 0.15s ease;
}

.wt-chip:hover {
  background: #243f87;
}

.wt-chip-count {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.6;
}

.wt-chip-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.wt-chip[aria-expanded="true"] .wt-chip-arrow {
  transform: rotate(180deg);
}

/* ── Mobile sheet ──────────────────────────────────────────── */

.wt-sheet {
  position: absolute;
  bottom: calc(100% + 0.625rem);
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  margin: 0;
  padding: 0.375rem;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
}

.wt-sheet[hidden] {
  display: none;
}

.wt-sheet-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  font-family: poppins, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #555555;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.wt-sheet-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(27, 49, 105, 0.15);
  transition: background 0.15s ease;
}

.wt-sheet-item--active {
  color: #1b3169;
  font-weight: 600;
}

.wt-sheet-item--active::before {
  background: #e8792a;
}

.wt-sheet-item:hover {
  background: rgba(27, 49, 105, 0.06);
  color: #1b3169;
}

/* ── Breakpoint ────────────────────────────────────────────── */

@media (max-width: 767.98px) {
  .wt-track {
    display: none;
  }
  .wt-mobile {
    display: block;
  }
}

/* ── Reduced motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .wt-nav {
    transform: translateX(-50%) !important;
  }
  .wt-nav,
  .wt-label,
  .wt-dot,
  .wt-chip,
  .wt-chip-arrow,
  .wt-sheet-item,
  .wt-sheet-item::before {
    transition: none !important;
  }
  .wt-item--active .wt-label {
    animation: none !important;
  }
}
