/*
  navbar.css
  Navbar-only styles: brand, links, CTA, scroll-shrink state, and the
  mobile slide-down menu. Scroll behavior toggling is handled by
  navbar-scroll.js, which only adds/removes the "navbar-scrolled" class.
*/

.comrade-navbar {
  position: sticky;
  top: 0;
  z-index: var(--comrade-z-navbar);
  width: 100%;
  background-color: var(--comrade-bg);
  border-bottom: 1px solid transparent;
  transition: background-color var(--comrade-transition-normal),
    box-shadow var(--comrade-transition-normal),
    border-color var(--comrade-transition-normal),
    backdrop-filter var(--comrade-transition-normal);
}

/* Floating warm glass, not a solid white bar: a translucent cream tint
   plus a soft blur so the page is faintly, deliberately visible through
   it. Kept fairly opaque (not sheer) so text stays effortlessly
   readable, per the "still feels solid" requirement. */
.comrade-navbar.navbar-scrolled {
  background-color: var(--comrade-glass-bg);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom-color: var(--comrade-glass-border);
  box-shadow: 0 8px 30px var(--comrade-shadow-soft);
}

/* Browsers without backdrop-filter support fall back to an opaque (but
   still warm, never white) surface rather than a half-transparent one
   that would hurt readability without the blur to back it up. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .comrade-navbar.navbar-scrolled {
    background-color: var(--comrade-glass-bg-fallback);
  }
}

.comrade-navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--comrade-space-md);
  height: var(--comrade-navbar-height);
  transition: height var(--comrade-transition-normal);
}

.navbar-scrolled .comrade-navbar__inner {
  height: var(--comrade-navbar-height-scrolled);
}

.comrade-navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
  transform-origin: left center;
  will-change: transform;
  transition: transform var(--comrade-transition-normal), opacity var(--comrade-transition-hover);
}

.comrade-navbar__brand:hover {
  opacity: 0.92;
}

.comrade-navbar__brand-mark {
  height: 50px;
  width: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

.comrade-navbar__brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.comrade-navbar__brand-title {
  font-family: var(--comrade-font-body);
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.16em;
  color: var(--comrade-text);
  text-transform: uppercase;
}

.comrade-navbar__brand-tagline {
  font-family: var(--comrade-font-body);
  font-size: 0.46rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.2em;
  color: var(--comrade-text);
  text-transform: uppercase;
  margin-top: 0.22rem;
  white-space: nowrap;
}

.comrade-navbar__brand-tagline-accent {
  color: var(--comrade-primary);
  font-weight: 800;
}

.navbar-scrolled .comrade-navbar__brand {
  transform: scale(0.92);
}

.comrade-navbar__links {
  display: flex;
  align-items: center;
  gap: var(--comrade-space-lg);
}

.comrade-navbar__link {
  position: relative;
  padding-block: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--comrade-text);
}

.comrade-navbar__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background-color: var(--comrade-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--comrade-transition-hover);
}

.comrade-navbar__link:hover {
  color: var(--comrade-primary);
}

.comrade-navbar__link:hover::after {
  transform: scaleX(1);
}

.comrade-navbar__link.active {
  color: var(--comrade-primary);
}

.comrade-navbar__link.active::after {
  transform: scaleX(1);
}

.comrade-navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--comrade-space-md);
  flex-shrink: 0;
}

/* A plain circular icon button rather than a bordered square: this and
   everything else under the "Mobile" heading below is only ever visible
   at the mobile/tablet breakpoint (see responsive.css), never on
   desktop, so it is safe to redesign directly here without a media
   query of its own. */
.comrade-navbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background-color: var(--comrade-surface-soft);
  color: var(--comrade-text);
  transition: background-color var(--comrade-transition-hover),
    color var(--comrade-transition-hover);
}

.comrade-navbar__toggle:hover,
.comrade-navbar__toggle[aria-expanded="true"] {
  background-color: var(--comrade-primary-light);
  color: var(--comrade-primary);
}

.comrade-navbar__toggle-icon {
  display: inline-flex;
  width: 17px;
  height: 17px;
}

.comrade-navbar__toggle-icon svg {
  width: 100%;
  height: 100%;
}

.comrade-navbar__toggle-icon--close {
  display: none;
}

.comrade-navbar__toggle[aria-expanded="true"] .comrade-navbar__toggle-icon--menu {
  display: none;
}

.comrade-navbar__toggle[aria-expanded="true"] .comrade-navbar__toggle-icon--close {
  display: inline-flex;
}

/* Mobile slide-down menu. This panel exists in the DOM at every
   breakpoint (only its trigger button is hidden above the mobile
   breakpoint, see responsive.css), collapsed to zero height rather than
   display:none so the open/close transition can animate. A border is
   only meaningful once it actually has visible content below it, so it
   is scoped to .is-open: an unconditional border here would render as
   a stray 1px line under the navbar at all times, most visible against
   the plain top-of-page state where nothing else masks it.

   The panel background matches the page (--comrade-bg) rather than a
   separate white surface: a stark white block stacked under the cream
   navbar read as two different components, not one continuous drawer.
*/
.comrade-navbar__mobile-menu {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  background-color: var(--comrade-bg);
  transition: grid-template-rows var(--comrade-transition-normal);
}

.comrade-navbar__mobile-menu.is-open {
  grid-template-rows: 1fr;
  border-bottom: 1px solid var(--comrade-border);
}

.comrade-navbar__mobile-menu-inner {
  min-height: 0;
}

/* No divider line under every link: on a five-item list that reads as
   a form or a settings screen, not an editorial nav. Compact spacing
   plus the same small burgundy accent mark the rest of the site uses
   for "current/active" is enough structure on its own. align-items is
   explicit (not the flex default of stretch) so links size to their
   own text; the CTA opts back into full width itself, below. */
.comrade-navbar__mobile-links {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  padding: 0 var(--comrade-space-xs) var(--comrade-space-sm);
}

.comrade-navbar__mobile-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1; /* Make them grow equally so they space out perfectly */
  padding: 0.5rem 0.25rem;
  gap: 0.35rem;
  color: var(--comrade-text);
  transition: color var(--comrade-transition-hover), transform var(--comrade-transition-hover);
  text-align: center;
}

.comrade-navbar__mobile-link svg {
  width: 1.75rem; /* Smaller size to fit on screen */
  height: 1.75rem;
  display: block;
}

.comrade-navbar__mobile-label {
  font-size: 0.65rem; /* Slightly smaller text to prevent wrapping */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.comrade-navbar__mobile-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 24px;
  height: 1px;
  border-radius: var(--comrade-radius-pill);
  background-color: var(--comrade-primary);
  transform: translateX(-50%) scaleX(0);
  transition: transform var(--comrade-transition-hover);
}

.comrade-navbar__mobile-link.active,
.comrade-navbar__mobile-link:hover {
  color: var(--comrade-primary);
}

.comrade-navbar__mobile-link.active::after,
.comrade-navbar__mobile-link:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.comrade-navbar__mobile-cta-wrapper {
  display: flex;
  justify-content: center;
  margin: var(--comrade-space-md) var(--comrade-space-md) var(--comrade-space-md);
}

.comrade-navbar__mobile-cta {
  width: 100%;
}

/* Reduced motion: the scroll/glass state change stays fully functional
   and the glass treatment itself is untouched, only the transition
   speeds up to a near-instant swap instead of an animated shrink. */
@media (prefers-reduced-motion: reduce) {
  .comrade-navbar,
  .comrade-navbar__inner,
  .comrade-navbar__brand {
    transition-duration: 1ms;
  }
}
