/*
  WP Scroll Snap Menu – Modern Redesign
  Colors: Primary #FE0000, Secondary #000000 (black), Accent #FFFFFF (white)
*/
:root {
  --color-primary: #fe0000;
  --color-secondary: #000000;
  --color-text: #ffffff;
  --color-muted: rgba(255, 255, 255, 0.6);
  --rail-width: 260px;
}

/* Base container (desktop fixed rail, mobile sticky top chips) */
.navbar-menu {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  z-index: 1000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  max-height: 80vh; /* Limit height to enable scrolling */
  overflow-y: auto; /* Enable vertical scrolling */
}
.navbar-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item layout */
.navbar-menu li {
  width: var(--rail-width);
  position: relative;
  text-align: right;
}
.navbar-menu a.dot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--color-text);
  padding: 8px 0;
  position: relative;
  text-decoration: none;
}

/* Circle marker with active ring */
.navbar-menu a.dot::before {
  content: "";
  height: 8px;
  width: 8px;
  border: 2px solid var(--color-muted);
  border-radius: 50%;
  display: block;
  transition: 0.2s ease-out;
}
.navbar-menu a.dot.active::before,
.navbar-menu li:hover > a.dot::before {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

/* Label pill */
.navbar-menu a.dot span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 210px;
  justify-content: center;
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(254, 0, 0, 0.95),
    rgba(254, 0, 0, 0.82)
  );
  padding: 6px 10px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(254, 0, 0, 0.25);
  opacity: 0.85;
  transform: translateX(24px);
  transition: opacity 0.22s ease, transform 0.22s ease,
    background-color 0.22s ease, box-shadow 0.22s ease;
}
.navbar-menu a.dot.active span,
.navbar-menu li:hover > a.dot span {
  opacity: 1;
  transform: translateX(0);
}

/* Thumbnails – always visible */
.navbar-menu .ssm-thumb {
  display: inline-block !important;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  object-fit: cover;
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 0;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

/* Items with children */
.ssm-item {
  position: relative;
}
.ssm-item.has-children > a.dot {
  padding-right: 6px;
}
.ssm-toggle {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
}
.ssm-item:hover .ssm-toggle {
  opacity: 1;
}
.ssm-caret {
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}
.ssm-toggle[aria-expanded="true"] .ssm-caret {
  transform: rotate(180deg);
}

/* Submenu base: hidden by default, can be opened by .open (JS) or hover (desktop) */
.ssm-submenu {
  display: none;
}
.ssm-item.open > .ssm-submenu {
  display: block;
}

/* Subcategory list (simple, no thumbnails) */
.ssm-subcats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ssm-subcats li {
  margin: 0;
}
.navbar-menu a.dot.sub {
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 0;
}
.navbar-menu a.dot.sub .ssm-thumb {
  display: none !important;
}
.navbar-menu a.dot.sub span {
  /* Make subitems visually close to parent color while staying distinct */
  background: linear-gradient(
    180deg,
    rgba(254, 0, 0, 0.18),
    rgba(254, 0, 0, 0.12)
  );
  color: #fff;
  border: 1px solid rgba(254, 0, 0, 0.25);
  box-shadow: 0 1px 6px rgba(254, 0, 0, 0.18);
  font-weight: 600;
}

/* Active state emphasis */
.navbar-menu a.dot.active span {
  box-shadow: 0 4px 16px rgba(254, 0, 0, 0.32);
}

/* ===== Desktop: submenu flows inline (no overlap) ===== */
@media (min-width: 992px) {
  .ssm-submenu {
    /* flow under parent so siblings are pushed down */
    position: static;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: saturate(120%) blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px;
    width: 100%;
    max-width: 100%;
    max-height: 70vh;
    overflow: auto;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

    /* smooth reveal */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  /* show on hover without JS changing hidden attr, and when .open set by JS */
  .ssm-item:hover > .ssm-submenu[hidden],
  .ssm-item.open > .ssm-submenu {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
  }

  /* better list spacing on desktop */
  .ssm-subcats {
    display: block;
  }
  .ssm-subcats li {
    margin: 6px 0;
  }
}

/* Emphasis for active subitems (reduce motion to avoid jitter) */
.navbar-menu a.dot.sub.active span {
  background: linear-gradient(
    180deg,
    rgba(254, 0, 0, 0.36),
    rgba(254, 0, 0, 0.28)
  );
  border-color: rgba(254, 0, 0, 0.45);
  box-shadow: 0 2px 10px rgba(254, 0, 0, 0.25);
  transform: translateX(0); /* remove scale to prevent jump */
}

/* Mobile navbar hide/show with class, avoids inline styles */
@media (max-width: 991.98px) {
  .navbar-menu {
    transition: top 0.3s ease-in-out;
    will-change: top;
  }
  .navbar-menu.is-hidden {
    top: -110px; /* move out of view while staying fixed */
  }
}

/* Subcategory list small styling override for sub items on desktop */
.navbar-menu a.dot.sub span {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Mobile – horizontal chips bar (kept exactly like your old file) */
@media (max-width: 991.98px) {
  .navbar-menu {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    transform: none;
    padding: 10px 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 9999;
  }
  .navbar-menu ul {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .navbar-menu li {
    width: auto;
    text-align: left;
  }
  .navbar-menu a.dot {
    gap: 8px;
    color: #111;
  }
  .navbar-menu a.dot::before {
    display: none;
  }
  .navbar-menu .ssm-thumb {
    outline-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }
  .navbar-menu a.dot span {
    background: #000;
    color: #fff;
    border: 1px solid #000;
    opacity: 1;
    transform: none;
    padding: 8px 12px;
  }
  .navbar-menu a.dot.active span {
    background: var(--color-primary);
    border-color: var(--color-primary);
  }
  /* Submenu collapses under parent item */
  .ssm-submenu {
    position: static;
    transform: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 6px 0 0 0;
    box-shadow: none;
  }
  .ssm-subcats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

/* Accessibility focus */
.navbar-menu a.dot:focus-visible,
.ssm-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Active section visual emphasis */
.ssm-section-active {
  position: relative;
  z-index: 1;
  transform: scale(1.03); /* safer default to avoid layout shift */
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  border-radius: 12px;
  will-change: transform, box-shadow;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

/* Ensure 3D context for smoother scaling if parent uses transform */
.ssm-section-active,
.ssm-section-active * {
  transform-origin: center center;
}

/* Minor helpers for theme conflicts */
.navbar-menu {
  pointer-events: auto;
}
.navbar-menu a,
.navbar-menu button {
  cursor: pointer;
}
