/* Category browse mega-menu. Uses the site design tokens (styles.css) so it
   inherits light/dark automatically; a fallback block covers pages that don't
   define them. */
.bm-wrap { position: relative; display: inline-flex; }
.bm-trigger {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.95rem; color: var(--ink, #15242a);
  background: transparent; border: 0; cursor: pointer;
  padding: 0.35rem 0.5rem; border-radius: var(--radius-sm, 8px);
}
.bm-trigger:hover, .bm-trigger.is-open { background: var(--surface-subtle, #eef3f1); color: var(--teal, #0d7a6f); }
.bm-grid { font-size: 0.85rem; }
.bm-caret { font-size: 0.7rem; opacity: 0.75; }
.bm-trigger:focus-visible { outline: 2px solid var(--teal, #0d7a6f); outline-offset: 2px; }

.bm-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 900;
  display: grid; grid-template-columns: 250px 300px;
  background: var(--paper, #fff); color: var(--ink, #15242a);
  border: 1px solid var(--line, #dce6e2); border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-lg, 0 18px 50px rgba(10,25,22,0.18));
  overflow: hidden; min-height: 320px;
}
/* `.bm-panel { display: grid }` would otherwise override the [hidden] attribute
   and keep the menu permanently open — this restores hide-when-closed. */
.bm-panel[hidden] { display: none !important; }
.bm-left { border-right: 1px solid var(--line, #dce6e2); padding: 0.6rem; }
.bm-right { padding: 0.9rem 1rem; background: var(--surface-subtle, #f6faf8); }
.bm-group { padding: 0.35rem 0.4rem 0.6rem; border-bottom: 1px solid var(--line, #dce6e2); margin-bottom: 0.4rem; }
.bm-group-title {
  margin: 0 0 0.3rem; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--muted, #586e69);
}
.bm-feat, .bm-cat {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.55rem; border-radius: var(--radius-sm, 8px);
  color: var(--ink, #15242a); text-decoration: none; font-size: 0.92rem;
}
.bm-feat:hover, .bm-cat:hover, .bm-cat.is-active {
  background: var(--surface-alt, #e6efeb); color: var(--teal, #0d7a6f);
}
.bm-cat-caret { color: var(--muted, #586e69); font-size: 0.9rem; }
.bm-cat.is-active .bm-cat-caret { color: var(--teal, #0d7a6f); }
.bm-cat:focus-visible, .bm-feat:focus-visible, .bm-fly-item:focus-visible, .bm-fly-all:focus-visible {
  outline: 2px solid var(--teal, #0d7a6f); outline-offset: -2px;
}

.bm-fly-title { margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 700; }
.bm-fly-item {
  display: block; padding: 0.5rem 0.4rem; border-radius: var(--radius-sm, 8px);
  color: var(--ink, #15242a); text-decoration: none; border-bottom: 1px solid var(--line, #dce6e2);
}
.bm-fly-item:last-of-type { border-bottom: 0; }
.bm-fly-item:hover { background: var(--paper, #fff); }
.bm-fly-name { display: block; font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-fly-meta { display: flex; gap: 0.7rem; font-size: 0.78rem; color: var(--muted, #586e69); margin-top: 0.15rem; }
.bm-fly-rate { color: var(--gold, #b7791f); font-weight: 600; }
.bm-fly-all { display: inline-block; margin-top: 0.7rem; font-size: 0.85rem; font-weight: 600; color: var(--teal, #0d7a6f); text-decoration: none; }
.bm-fly-all:hover { text-decoration: underline; }
.bm-fly-empty { color: var(--muted, #586e69); font-size: 0.88rem; }

/* Mobile: the desktop nav is hidden by the site's own responsive rules, so the
   trigger + panel become a full-width dropdown; tapping a category navigates. */
@media (max-width: 820px) {
  .bm-wrap { display: flex; width: 100%; }
  .bm-trigger { width: 100%; justify-content: flex-start; }
  .bm-panel { position: fixed; left: 0; right: 0; top: auto; width: 100%; grid-template-columns: 1fr; min-height: 0; max-height: 70vh; overflow-y: auto; border-radius: 0; }
  .bm-right { display: none; }
  .bm-left { border-right: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .bm-panel:not([hidden]) { animation: bm-in 0.14s ease-out; }
  @keyframes bm-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}
