/* Global Top Nav */
.ts-topnav {
  background: var(--bg-topnav);
  box-shadow: var(--shadow-1);
}

/* Containers */
.ts-topnav__inner,
.ts-subnav__inner {
  max-width: 1200px;
  padding: 0.5rem 1rem; /* 8px 16px */
  display: flex;
  align-items: center;
}

.ts-topnav__inner { 
  justify-content: flex-end; 
  margin: 0 0.8rem 0 auto; 
}

.ts-subnav__inner {
  justify-content: center;
  margin: 0 auto;
}

/* Lists */
.ts-topnav__list,
.ts-subnav__list {
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ts-subnav__list {
  justify-content: center !important;
}

/* Links (top nav) */
.ts-topnav__link {
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.ts-topnav__link:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.is-active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Top Sub Nav (in‑page toolbar) */
.ts-subnav {
  background: var(--bg-elev-1);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: background 0.3s ease;
}

.ts-subnav__inner {
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ts-subnav.scrolled {
  background: linear-gradient(
    135deg,
    rgba(240, 249, 255, 0.9) 0%,
    rgba(219, 234, 254, 0.9) 40%,
    rgba(254, 243, 199, 0.9) 75%,
    rgba(147, 197, 253, 0.9) 100%
  );
  background-size: 200% 200%;   /* make room to move */
  animation: gradientShift 12s ease infinite;
  backdrop-filter: blur(6px);
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.ts-subnav {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 20;
}

/* Floating state when user scrolls */
.ts-subnav.scrolled {
  /* Existing gradient + animation */
  background: linear-gradient(135deg,
      rgba(240, 249, 255, 0.9) 0%,
      rgba(219, 234, 254, 0.9) 40%,
      rgba(254, 243, 199, 0.9) 75%,
      rgba(147, 197, 253, 0.9) 100%);
  background-size: 200% 200%;
  animation: gradientShift 12s ease infinite;
  backdrop-filter: blur(6px);

  /* force float */
  position: fixed;
  top: 0.75rem;
  z-index: 50;
}

/* Mobile toggle: hidden on desktop */
.ts-mobile-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line-soft);
  background: var(--bg-elev-1);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: 0.375rem;
}
@media (min-width: 768px) { .ts-mobile-toggle { display: none; } }

/* Mobile panel (only below md) */
.ts-mobile-panel {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-elev-1);
  padding: 0.5rem 1rem 1rem;
}
@media (min-width: 768px) { .ts-mobile-panel { display: none !important; } }

.ts-mobile-list { list-style: none; margin: 0; padding: 0; }
.ts-mobile-item { margin: 0.25rem 0; }
.ts-mobile-link {
  display: block;
  padding: 0.5rem 0.25rem;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 0.375rem;
}
.ts-mobile-link:hover { background: var(--accent-soft); }

/* Mobile accordion */
.ts-mobile-accordion {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.25rem;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.375rem;
}
.ts-mobile-accordion:hover { background: var(--accent-soft); }

.ts-mobile-sublist {
  list-style: none;
  margin: 0.25rem 0 0.5rem 0.75rem;
  padding: 0;
}
.ts-caret { font-size: 0.8rem; opacity: 0.7; }

/* attribute-based hidden support */
[hidden] { display: none !important; }
