/* ======================================
       DESKTOP NAV
    ====================================== */
#nav_section {
  padding-block: calc(var(--space-xs) / 2);
}

#menu_wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-branding {
  width: max-content;
  height: max-content;
}

.site-branding .custom-logo-link {
  padding: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.3rem;
}

.site-branding .custom-logo {
  width: 36px;
  max-width: 100%;
}

.site-branding span {
  font-size: var(--text-s);
  font-weight: 500;
  color: var(--accent);
}

nav.pan-menu {
  position: relative;
  z-index: 100;
}

/* Top-level: horizontal flex row */
nav.pan-menu > ul {
  list-style: none;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  position: relative;
}

nav.pan-menu > ul > li {
  position: relative;
}

nav.pan-menu a {
  display: block;
  padding: 0 14px;
  color: var(--accent);
  font-size: 1rem;
  line-height: 60px;
  white-space: nowrap;
}

nav.pan-menu a:hover {
  color: #b9ac8a;
}

/* "+" indicator on links that have children — desktop nav only */
nav.pan-menu > ul li > a:after {
  content: " +";
}
nav.pan-menu > ul li > a:only-child:after {
  content: "";
}

/* Make sure the sidebar never picks up the desktop :after rule */
.sidebar-nav li > a:after {
  content: "" !important;
}

/* Desktop dropdowns — hidden, revealed on hover */
nav.pan-menu ul ul {
  display: none;
  position: absolute;
  top: 60px;
  left: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 170px;
  background: #e64a19;
  z-index: 200;
}

nav.pan-menu ul li:hover > ul {
  display: block;
}

nav.pan-menu ul ul li {
  display: block;
  position: relative;
}

/* Flyout to the right for deeper levels */
nav.pan-menu ul ul ul {
  top: 0;
  left: 170px;
}

/* =============================================
       BURGER BUTTON  (mobile only)
    ============================================= */
.burger {
  display: none; /* shown via media query */
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 0 16px;
  height: 60px;
  transition: background 0.2s;
}
.burger:hover {
  background: rgba(0, 0, 0, 0.25);
}
.burger svg {
  display: block;
  pointer-events: none;
}

/* =============================================
       OVERLAY
    ============================================= */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.overlay.active {
  display: block;
}
.overlay.visible {
  opacity: 1;
}

/* =============================================
       SIDEBAR  (mobile slide-in from left)
    ============================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #202020;
  z-index: 400;
  visibility: hidden;
  transform: translateX(-100%);
  transition:
    transform 0.33s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.33s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.5);
}
.sidebar.open {
  visibility: visible;
  transform: translateX(0);
}

/* Sidebar header row */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 60px;
  padding: 0 20px;
  background-color: #896d4a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.sidebar-title {
  font-family: inherit;
  font-size: 1.1rem;
  color: #fff;
}
.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 6px;
  border-radius: 4px;
  line-height: 0;
  transition: background 0.2s;
}
.close-btn:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* =============================================
       SIDEBAR NAV — tap/click accordion
       No hover required!
    ============================================= */
.sidebar-nav {
  list-style: none;
  padding: 6px 0;
  flex: 1;
}

/* Every top-level item has a subtle divider */
.sidebar-nav > li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-nav > li:last-child {
  border-bottom: none;
}

/* Base link style */
.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 16px;
  line-height: 50px;
  color: #fff;
  text-decoration: none;
  /* Large tap target — comfortable for thumbs */
  min-height: 50px;
  transition: background 0.15s;
}
.sidebar-nav a:active {
  background: rgba(0, 0, 0, 0.3);
}

/*
      The arrow badge next to items that have children.
      It's a styled <span> inside the <a>, NOT a CSS :after pseudo-element,
      so we can animate it independently and it doesn't interfere with
      the desktop nav's :after rule.
    */
.sidebar-nav .arrow {
  display: inline-flex;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  transition:
    transform 0.25s ease,
    background 0.2s;
  /* Override the desktop nav's li > a:after rule */
  content: none;
}

/* Rotate arrow when expanded */
.has-children.expanded > a .arrow {
  transform: rotate(45deg);
  background: rgba(0, 0, 0, 0.2);
}

/* Nested lists: collapsed by default, animate open with max-height */
.sidebar-nav ul {
  list-style: none;
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.15);
}
.has-children.expanded > ul {
  max-height: 800px;
}

/* Indent each nesting level */
.sidebar-nav ul a {
  padding-left: 36px;
  font-size: 15px;
  line-height: 46px;
  min-height: 46px;
}
.sidebar-nav ul ul a {
  padding-left: 52px;
}
.sidebar-nav ul ul ul a {
  padding-left: 68px;
}

/* Nested arrow badges slightly smaller */
.sidebar-nav ul .arrow {
  width: 24px;
  height: 24px;
  font-size: 17px;
}

/* Subtle separators inside nested groups */
.sidebar-nav ul li {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* =============================================
       RESPONSIVE BREAKPOINT
    ============================================= */
@media (max-width: 768px) {
  /* Hide the CSS-hover desktop nav */
  nav.pan-menu > ul {
    display: none;
  }
  /* Show the burger button */
  .burger {
    display: flex;
  }
}

/* ===== Dynamic Header Styles ===== */
.site-header {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 100;
  transition:
    transform 0.3s ease-in-out,
    background-color 0.3s ease-in-out;
  background-color: transparent;
}
.site-header.header--fixed {
  position: fixed;
  background-color: rgba(20, 20, 20, 0.9);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
}
.site-header.header--hidden {
  transform: translateY(-100%);
}
