/**
 * Shrichakra Theme - Primary Navigation
 * Six top-level items; everything else lives in a dropdown (desktop) or an
 * accordion section (mobile drawer).
 */

/* ==========================================================================
   Desktop dropdown navigation
   ========================================================================== */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.desktop-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-main);
  white-space: nowrap;
  padding: var(--space-2) 0;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}
.desktop-nav .nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--color-secondary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-fast);
}
.desktop-nav .nav-link:hover,
.desktop-nav .nav-link:focus-visible,
.nav-item.open > .nav-link {
  color: var(--color-primary);
}
.desktop-nav .nav-link:hover::after,
.nav-item:hover > .nav-link::after,
.nav-item.open > .nav-link::after,
.desktop-nav .nav-link.active::after {
  transform: scaleX(1);
}
.desktop-nav .nav-link.active {
  color: var(--color-primary);
  font-weight: 700;
}

.nav-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.65;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.nav-item:hover .nav-caret,
.nav-item.open .nav-caret {
  opacity: 1;
  transform: rotate(180deg);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  min-width: 232px;
  padding: var(--space-2);
  margin-top: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-header) + 5);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  transition: opacity var(--transition-fast), transform var(--transition-fast),
    visibility var(--transition-fast);
}
/* Bridges the gap between trigger and panel so the pointer can travel down */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -13px;
  left: 0;
  right: 0;
  height: 13px;
}
.nav-item:hover > .nav-dropdown,
.nav-item:focus-within > .nav-dropdown,
.nav-item.open > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.nav-dropdown a {
  display: block;
  padding: 9px var(--space-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast),
    padding-left var(--transition-fast);
}
.nav-dropdown a:hover,
.nav-dropdown a:focus-visible {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  padding-left: calc(var(--space-3) + 4px);
}
.nav-dropdown a.active {
  color: var(--color-primary);
  font-weight: 700;
  background: var(--color-bg-alt);
}

/* Header contact link sitting beside the CTA buttons */
.nav-contact-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-main);
  white-space: nowrap;
  padding: var(--space-2) 0;
  transition: color var(--transition-fast);
}
.nav-contact-link:hover,
.nav-contact-link.active {
  color: var(--color-primary);
}

/* ==========================================================================
   Mobile drawer accordion
   ========================================================================== */
.m-group {
  border-bottom: 1px solid var(--color-border);
}
.m-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 11px 2px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-main);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
.m-group-toggle:hover,
.m-group.open > .m-group-toggle {
  color: var(--color-primary);
}
.m-group-toggle .nav-caret {
  flex-shrink: 0;
}
.m-group.open .nav-caret {
  transform: rotate(180deg);
}

/* Collapsed only once navigation.js has confirmed it can expand them again;
   without JS every section stays open rather than becoming unreachable.
   max-height rather than grid-template-rows: the 0fr -> 1fr grid transition is
   not reliably interpolated and leaves the panel stuck at its start value. */
.m-group-panel {
  overflow: hidden;
}
.nav-js .m-group-panel {
  max-height: 0;
  transition: max-height var(--transition-normal);
}
.nav-js .m-group.open > .m-group-panel {
  /* --panel-h is set from scrollHeight by navigation.js; the fallback covers
     the first frame and any group it has not measured yet. */
  max-height: var(--panel-h, 600px);
}
.m-group-panel a {
  display: block;
  padding: 9px 2px 9px var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-left: 2px solid var(--color-border);
  margin-left: 4px;
}
.m-group-panel a:hover,
.m-group-panel a.active {
  color: var(--color-primary);
  border-left-color: var(--color-secondary);
}
.m-group-panel a.active {
  font-weight: 700;
}



/* Keep the right-most panel inside the viewport on narrower desktops */
.desktop-nav > .nav-item:last-child > .nav-dropdown {
  left: auto;
  right: 0;
  transform: translate(0, -6px);
}
.desktop-nav > .nav-item:last-child:hover > .nav-dropdown,
.desktop-nav > .nav-item:last-child:focus-within > .nav-dropdown,
.desktop-nav > .nav-item:last-child.open > .nav-dropdown {
  transform: translate(0, 0);
}

/* Contact already appears at the bottom of the drawer on small screens, so the
   header copy just steals width from the logo there. */
@media (max-width: 900px) {
  .nav-contact-link {
    display: none;
  }
}

/* ==========================================================================
   Header brand
   One markup block on every page, so the header does not visibly change when
   a visitor moves between the home page and an inner page.
   ========================================================================== */
.site-logo img {
  border: 1.5px solid var(--color-border-gold);
}
.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: clamp(0.86rem, 1.35vw, 1.15rem);
  color: var(--color-primary-dark);
  line-height: 1.2;
}
.brand-tagline {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-secondary-dark);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 0.78rem;
  }
  .brand-tagline {
    font-size: 9px;
  }
}

/* ==========================================================================
   Header shell
   Identical on every page: utility bar (scrolls away) + sticky nav bar.
   ========================================================================== */
.site-header {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}
.main-nav-wrap {
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Header CTA */
.btn-join {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  border-radius: var(--radius-full);
  font-size: 12px;
  padding: 6px 14px;
}
.btn-join:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

@media (max-width: 900px) {
  /* The utility bar's identity line duplicates the logo right below it */
  .utility-brand {
    display: none;
  }
  .utility-flex {
    justify-content: center;
  }
}
