/* ---------------------------------------------------------------------------
 * sx-nav-actions.css
 * Top-bar enhancements for the Sigrix shell:
 *   - v2 (guest):  in-nav shopping cart button + popover
 *   - v3 (signed): credits chip, redesigned notifications popover,
 *                  Publish CTA, and user "pill" with stats dropdown.
 * Sourced from Sigrix Marketplace v2 / v3 design prototypes.
 * --------------------------------------------------------------------------- */

/* ---------- Base sx-nav chrome ----------
 * The structural top-bar styles (band, inner shell, logo, primary links)
 * live here rather than in css/sx-home.css so EVERY page that renders
 * components/sx_nav.html gets the styled top bar — including the
 * moderator/admin shells, which use a `shell-flush` body (no `.sx` scope)
 * and never opt into sx-home.css. The search, cart, publish, credits, and
 * mobile chrome already live in this file for the same reason.
 *
 * `.sx-nav-inner` folds in the layout-container box model (max-width /
 * centering / gutter) so the bar stays centred even where `.sx-container`
 * isn't defined, and `.sx-nav-link` / `.sx-logo` set `text-decoration: none`
 * directly instead of leaning on the `.sx a` reset that only ships with
 * sx-home.css. */
.sx-nav {
  position: sticky; top: 0; z-index: 5;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--sx-line);
}
.sx-nav-inner {
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 32px;
  height: 60px;
  display: flex; align-items: center; gap: 24px;
}
.sx-logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-family: var(--sx-font-display);
  font-size: 16px; letter-spacing: -0.02em;
  color: var(--sx-text); text-decoration: none;
}
.sx-logo-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, #3D4DFF 0%, #1A1F6B 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #FFFFFF; font-weight: 700; font-size: 12px;
}
/* align-items:center keeps every item on one line: the plain links carry a
 * fixed height:32px while the dropdown wrappers (.sx-nav-has-menu) size to
 * content, so without explicit centring the two kinds can ride at different
 * heights. Mirrors .sx-nav-inner / .sx-nav-actions, which both centre. */
.sx-nav-links { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
/* Spacer between the primary links and the search/actions cluster. Grows to
 * fill the free space so the links stay grouped beside the logo while the
 * search + actions sit on the right (mirrors the Sigrix_new nav prototype,
 * which renders an equivalent flex:1 element in the same slot). */
.sx-nav-spacer { flex: 1 1 auto; }
.sx-nav-link {
  height: 32px; padding: 0 12px; border-radius: 8px;
  display: inline-flex; align-items: center;
  font-size: 14px; color: var(--sx-text-2); font-weight: 500;
  text-decoration: none;
}
.sx-nav-link:hover { background: var(--sx-surface); color: var(--sx-text); }
.sx-nav-link[aria-current], .sx-nav-link.is-active { color: var(--sx-text); background: var(--sx-surface); }
.sx-nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Glass nav + search hint over a dark backdrop. */
[data-theme="dark"] .sx-nav { background: rgba(11,13,18,0.72); }
[data-theme="dark"] .sx-kbd { background: var(--sx-bg); }

/* Narrow viewports tighten the gutter (mirrors the .sx-container rule the
 * home/marketplace pages apply at the same breakpoint). */
@media (max-width: 640px) {
  .sx-nav-inner { padding: 0 20px; }
}

/* ---------- v3 nav refinements (apply on top of base sx-nav) ---------- */
.sx-nav .sx-nav-inner { gap: 20px; }
/* position:relative anchors #login-dropdown's `position: absolute; right: 0`.
 * The dropdown is a sibling of .auth-wrapper (not a child) so the mobile
 * hide rule below can keep the wrapper hidden while letting the dropdown
 * surface as a sheet. */
.sx-nav .sx-nav-actions { gap: 6px; position: relative; }

/* ---------- Mobile hamburger (#nav-toggle) ----------
 * Hidden on desktop; surfaced on mobile to open #mobile-nav-panel via
 * the shared base_bootstrap.js handler that listens for
 * [data-action="header-toggle-nav"]. Lives in this globally-loaded
 * stylesheet so every page rendering sx_nav.html gets the burger — not
 * just the ones that opt into sx-home.css. */
.sx-nav-toggle {
  display: none;
  width: 40px; height: 40px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--sx-r-md);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.sx-nav-toggle:hover { box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.sx-nav-toggle:active { transform: scale(0.96); }
.sx-nav-toggle:focus-visible { outline: 2px solid var(--sx-brand); outline-offset: 2px; }
.sx-nav-toggle-icon { width: 18px; height: 18px; display: block; }

/* ---------- Global search bar (#global-search-form) ----------
 * Renders inside sx_nav.html on every page that pulls in base.html, so the
 * styling has to live in this globally-loaded stylesheet — not in sx-home.css
 * which only loads on a handful of marketing/home pages. Without these rules
 * the SVG icon renders at the SVG default size (~viewport-filling) and the
 * form items wrap to their own row, busting the topbar on moderator/admin
 * pages. Same logic as the hamburger toggle above. */
.sx-search {
  flex: 1; max-width: 360px;
  height: 36px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 12px;
  background: var(--sx-surface);
  border-radius: var(--sx-r-md);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text-3); font-size: 13px;
  position: relative;
}
.sx-search:hover { box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
/* Specificity (0,3,1) so this beats the inline base.html
 * `.global-search input[type="search"]` rule (0,2,1) that would
 * otherwise re-pill the input inside the new flat search shell. */
.sx-search input[type="search"].sx-search-input {
  flex: 1; min-width: 0;
  height: 100%;
  min-height: 0;
  width: auto;
  border: 0; background: transparent; outline: none;
  color: var(--sx-text); font-size: 13px;
  font-family: inherit;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.sx-search input[type="search"].sx-search-input::placeholder { color: var(--sx-text-3); }
.sx-search-icon { width: 14px; height: 14px; color: var(--sx-text-3); flex-shrink: 0; }
.sx-kbd {
  font-family: var(--sx-font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--sx-bg-2);
  color: var(--sx-text-3);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}

/* sign-in text link (v3 guest) */
.sx-nav-link--auth {
  height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center;
  font-size: 13.5px; color: var(--sx-text-2);
  border-radius: 8px;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color 140ms ease;
}
.sx-nav-link--auth:hover { color: var(--sx-text); background: transparent; }

/* ---------- Anchor for popovers ---------- */
.sx-nav-anchor { position: relative; display: inline-flex; }

/* ---------- Cart button + popover (v2) ---------- */
.mp-cart-btn {
  position: relative;
  width: 36px; height: 36px;
  min-height: 0;
  border-radius: var(--sx-r-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  border: 0;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: background 120ms ease, box-shadow 120ms ease, color 120ms ease;
}
.mp-cart-btn:hover { box-shadow: 0 0 0 1px var(--sx-line-2) inset; background: var(--sx-surface-2); }
.mp-cart-btn:focus-visible { outline: 2px solid var(--sx-brand); outline-offset: 2px; }
.mp-cart-btn[aria-expanded="true"] {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}
.mp-cart-btn-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--sx-brand);
  color: var(--sx-brand-ink, #fff);
  font-family: var(--sx-font-mono);
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--sx-bg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  transition: transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mp-cart-btn-badge--bump { transform: scale(1.35); }
.mp-cart-btn-badge.hidden { display: none !important; }

.mp-cart-anchor { position: relative; display: inline-flex; }

.mp-cart-pop {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  background: var(--sx-surface);
  border-radius: var(--sx-r-lg);
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(0,0,0,0.6),
    0 8px 16px -8px rgba(0,0,0,0.4);
  overflow: hidden;
  z-index: 50;
  transform-origin: top right;
  animation: mp-cart-pop-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.mp-cart-pop.hidden { display: none !important; }
[data-theme="light"] .mp-cart-pop {
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(14,19,32,0.18),
    0 8px 16px -8px rgba(14,19,32,0.10);
}
@keyframes mp-cart-pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.mp-cart-pop::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px; height: 12px;
  background: var(--sx-surface);
  transform: rotate(45deg);
  box-shadow: -1px -1px 0 0 var(--sx-line);
  z-index: 0;
}

.mp-cart-head {
  padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--sx-line);
  position: relative;
  z-index: 1;
}
.mp-cart-head h3 {
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  display: inline-flex; align-items: baseline; gap: 8px;
  color: var(--sx-text);
}
.mp-cart-head .count {
  font-family: var(--sx-font-mono);
  font-size: 11px; font-weight: 500;
  color: var(--sx-text-3);
  letter-spacing: 0.02em;
}
.mp-cart-head-close {
  width: 24px; height: 24px;
  min-height: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text-3);
  cursor: pointer;
  padding: 0;
  transition: color 120ms, background 120ms;
}
.mp-cart-head-close:hover { color: var(--sx-text); background: var(--sx-surface-2); }

.mp-cart-list {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sx-line) transparent;
}
.mp-cart-list::-webkit-scrollbar { width: 6px; }
.mp-cart-list::-webkit-scrollbar-thumb { background: var(--sx-line); border-radius: 3px; }

.mp-cart-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sx-line);
  align-items: center;
  transition: background 200ms ease;
}
.mp-cart-item:last-child { border-bottom: 0; }
.mp-cart-item--just-added {
  animation: mp-cart-flash 1400ms ease-out;
}
@keyframes mp-cart-flash {
  0%   { background: rgba(91,124,255,0.18); }
  100% { background: transparent; }
}

.mp-cart-thumb {
  width: 44px; height: 44px;
  border-radius: var(--sx-r-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #1B2230 0%, #131722 100%);
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
[data-theme="light"] .mp-cart-thumb {
  background: linear-gradient(135deg, #EEF1F8 0%, #F7F8FB 100%);
}
.mp-cart-thumb-letter {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sx-font-display);
  font-weight: 600;
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  z-index: 1;
}
[data-theme="light"] .mp-cart-thumb-letter { color: rgba(14,19,32,0.7); }
.mp-cart-thumb::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 8px 8px;
}
[data-theme="light"] .mp-cart-thumb::after {
  background-image:
    linear-gradient(to right, rgba(14,19,32,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14,19,32,0.04) 1px, transparent 1px);
}
.mp-cart-thumb-tag {
  position: absolute; top: 4px; left: 4px;
  width: 6px; height: 6px; border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.4);
}
.mp-cart-thumb-tag--prompt    { background: #5B7CFF; }
.mp-cart-thumb-tag--persona   { background: #F5B454; }
.mp-cart-thumb-tag--agent     { background: #7CE3D4; }
.mp-cart-thumb-tag--assistant { background: #B48CFF; }
.mp-cart-thumb-tag--product   { background: #F47B7B; }

.mp-cart-info { min-width: 0; }
.mp-cart-info-title {
  font-size: 13px; font-weight: 500;
  color: var(--sx-text);
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.mp-cart-info-meta {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--sx-text-3);
}
.mp-cart-info-meta .type { text-transform: capitalize; font-weight: 500; }
.mp-cart-info-meta .sep { opacity: 0.5; }

.mp-cart-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.mp-cart-price {
  font-family: var(--sx-font-mono);
  font-size: 12px; font-weight: 500;
  color: var(--sx-text);
  letter-spacing: -0.01em;
}
.mp-cart-price--free { color: var(--sx-ok); }
.mp-cart-remove {
  width: 20px; height: 20px;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text-3);
  cursor: pointer;
  padding: 0;
  transition: color 120ms, background 120ms;
}
.mp-cart-remove:hover { color: var(--sx-danger); background: var(--sx-surface-2); }

.mp-cart-summary {
  padding: 12px 16px;
  border-top: 1px solid var(--sx-line);
  background: var(--sx-surface-2);
  display: grid; gap: 6px;
}
.mp-cart-summary-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  color: var(--sx-text-2);
}
.mp-cart-summary-row .num {
  font-family: var(--sx-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.mp-cart-summary-row--total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--sx-line);
  font-size: 14px;
  color: var(--sx-text);
  font-weight: 600;
}
.mp-cart-summary-row--total .num { font-size: 15px; font-weight: 600; }

.mp-cart-actions {
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
}
.mp-cart-actions .sx-btn { height: 38px; }
.mp-cart-actions .sx-btn--primary { justify-content: center; }

.mp-cart-empty {
  padding: 36px 20px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mp-cart-empty-icon {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  margin: 0 0 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sx-surface-2);
  color: var(--sx-text-3);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.mp-cart-empty h4 { font-size: 14px; font-weight: 600; margin: 0 0 4px; color: var(--sx-text); text-align: center; }
.mp-cart-empty p  { font-size: 12px; color: var(--sx-text-3); line-height: 1.5; max-width: 28ch; margin: 0 auto; text-align: center; }

.mp-cart-tip {
  padding: 9px 16px;
  font-size: 11px;
  color: var(--sx-text-3);
  letter-spacing: 0.01em;
  background: var(--sx-bg);
  border-top: 1px solid var(--sx-line);
  display: flex; align-items: center; gap: 8px;
}
.mp-cart-tip svg { color: var(--sx-accent); flex-shrink: 0; }

/* Toast when cart is closed and an item was added */
.mp-cart-toast {
  position: fixed;
  top: 74px;
  right: 32px;
  background: var(--sx-surface);
  border-radius: var(--sx-r-md);
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 12px 28px -10px rgba(0,0,0,0.5);
  padding: 10px 12px;
  display: inline-flex; align-items: center; gap: 10px;
  z-index: 60;
  font-size: 13px;
  animation: mp-toast-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 340px;
}
[data-theme="light"] .mp-cart-toast {
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 12px 28px -10px rgba(14,19,32,0.18);
}
.mp-cart-toast.hidden { display: none !important; }
@keyframes mp-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mp-cart-toast-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(110,231,161,0.16);
  color: var(--sx-ok);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(110,231,161,0.30) inset;
}
.mp-cart-toast-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-cart-toast-text strong {
  font-size: 12px; font-weight: 600; color: var(--sx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.mp-cart-toast-text span { font-size: 11px; color: var(--sx-text-3); }
.mp-cart-toast-view {
  font-size: 12px; font-weight: 500; color: var(--sx-brand);
  margin-left: 4px;
  white-space: nowrap;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}
.mp-cart-toast-view:hover { background: var(--sx-surface-2); }


/* ---------- Credits chip (Refined) — star + number in a surface chip ---------- */
.sx-nav-credits {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px 0 10px;
  border-radius: 10px;
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: box-shadow 140ms ease, background 140ms ease;
}
.sx-nav-credits svg { color: #F5B454; flex-shrink: 0; }
.sx-nav-credits .num {
  font-family: var(--sx-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 500;
}
.sx-nav-credits:hover {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}

/* Inactive state — credits feature not live yet. */
.sx-nav-credits--disabled,
.sx-nav-credits--disabled:hover {
  cursor: not-allowed;
  pointer-events: auto;
  opacity: 0.55;
  filter: grayscale(0.85);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text-3);
}
.sx-nav-credits--disabled svg { color: var(--sx-text-3); }

/* ---------- Notifications icon (v3) ---------- */
.sx-nav-icon {
  position: relative;
  width: 36px; height: 36px;
  min-height: 0;
  border: 0;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text-2);
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.sx-nav-icon:hover { background: var(--sx-surface-2); color: var(--sx-text); box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.sx-nav-icon[aria-expanded="true"],
.sx-nav-icon.is-open {
  background: var(--sx-surface);
  color: var(--sx-text);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.sx-nav-icon-dot {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--sx-danger);
  color: #fff;
  font-family: var(--sx-font-mono);
  font-size: 9.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--sx-bg);
  font-variant-numeric: tabular-nums;
}
.sx-nav-icon-dot.hidden { display: none !important; }

/* ---------- Publish CTA (Refined) — secondary outlined surface button ---------- */
.sx-nav-publish {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
  font-size: 13px; font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none; flex-shrink: 0;
  transition: background 120ms ease, box-shadow 120ms ease, color 120ms ease;
}
.sx-nav-publish:hover {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}
.sx-nav-publish svg { color: var(--sx-text-3); transition: color 120ms ease; }
.sx-nav-publish:hover svg { color: var(--sx-text); }
.sx-nav-publish.is-active {
  color: var(--sx-brand);
  box-shadow: 0 0 0 1px var(--sx-brand) inset;
}
.sx-nav-publish.is-active svg { color: var(--sx-brand); }

/* ---------- User pill (v3) ---------- */
.sx-nav-user {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
  cursor: pointer;
  margin-left: 4px;
  border: 0;
  font: inherit;
  transition: background 140ms ease, box-shadow 140ms ease;
}
.sx-nav-user:hover {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}
.sx-nav-user[aria-expanded="true"],
.sx-nav-user.is-open {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}
.sx-nav-user-avatar.avatar {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sx-brand) 0%, #6B82FF 100%);
  color: #fff;
  font-size: 12px; font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  overflow: hidden;
}
.sx-nav-user-avatar.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.sx-nav-user-avatar.lg.avatar {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  font-size: 16px;
}
.sx-nav-user-name {
  display: flex; flex-direction: column; align-items: flex-start;
  line-height: 1.1;
}
.sx-nav-user-name .n { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.sx-nav-user-name .r { font-size: 10.5px; color: var(--sx-text-3); margin-top: 2px; letter-spacing: 0.04em; }
.sx-nav-user-chevron { transition: transform 160ms; }
.sx-nav-user[aria-expanded="true"] .sx-nav-user-chevron,
.sx-nav-user.is-open .sx-nav-user-chevron { transform: rotate(180deg); }

/* ---------- Popover panels (notifications + user menu) ---------- */
.sx-nav-pop {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: var(--sx-surface);
  border-radius: var(--sx-r-lg);
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(0,0,0,0.6),
    0 8px 16px -8px rgba(0,0,0,0.4);
  overflow: hidden;
  z-index: 60;
  transform-origin: top right;
  animation: sx-nav-pop-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="light"] .sx-nav-pop {
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(14,19,32,0.18),
    0 8px 16px -8px rgba(14,19,32,0.10);
}
.sx-nav-pop.hidden { display: none !important; }
.sx-nav-pop--user { width: 300px; }
@keyframes sx-nav-pop-in {
  from { opacity: 0; transform: scale(0.97) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.sx-nav-pop-head {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--sx-line);
  font-size: 12px; font-weight: 600; color: var(--sx-text);
  letter-spacing: -0.005em;
}
.sx-nav-pop-link {
  font-size: 11px; color: var(--sx-text-3); font-weight: 500;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.sx-nav-pop-link:hover { color: var(--sx-text-2); }
.sx-nav-pop-body { padding: 6px; }
.sx-notif {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px;
  border-radius: var(--sx-r-md);
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease;
}
.sx-notif:hover { background: var(--sx-surface-2); }
.sx-notif-dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
  background: var(--sx-brand);
}
.sx-notif-title {
  font-size: 13px; color: var(--sx-text); line-height: 1.4;
}
.sx-notif-meta {
  font-size: 11px; color: var(--sx-text-3);
  margin-top: 2px; font-family: var(--sx-font-mono);
}
.sx-notif-empty {
  padding: 28px 18px;
  text-align: center;
  font-size: 12px; color: var(--sx-text-3);
}
.sx-nav-pop-foot {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--sx-line);
  font-size: 12px; font-weight: 500;
  color: var(--sx-text-2);
  text-align: center;
  text-decoration: none;
}
.sx-nav-pop-foot:hover { color: var(--sx-text); background: var(--sx-surface-2); }

/* User menu card / stats / sections */
.sx-nav-user-card {
  padding: 16px;
  display: flex; gap: 12px; align-items: center;
  border-bottom: 1px solid var(--sx-line);
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease;
}
.sx-nav-user-card:hover { background: var(--sx-surface-2); }
.sx-nav-user-fullname {
  font-size: 14px; font-weight: 600; color: var(--sx-text);
  letter-spacing: -0.01em;
}
.sx-nav-user-handle {
  font-size: 12px; color: var(--sx-text-3);
  margin-top: 2px; font-family: var(--sx-font-mono);
}
.sx-nav-user-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 12px 8px;
  border-bottom: 1px solid var(--sx-line);
  text-align: center;
}
.sx-nav-user-stats > div + div { box-shadow: -1px 0 0 var(--sx-line); }
.sx-nav-user-stats .v {
  font-family: var(--sx-font-mono);
  font-size: 14px; color: var(--sx-text);
  font-weight: 500;
}
.sx-nav-user-stats .l {
  font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sx-text-3);
  margin-top: 4px;
}
.sx-nav-pop-section {
  padding: 6px;
  border-bottom: 1px solid var(--sx-line);
}
.sx-nav-pop-section:last-child { border-bottom: 0; }
.sx-nav-pop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--sx-r-md);
  font-size: 13px; color: var(--sx-text);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
  background: transparent;
  border: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
}
.sx-nav-pop-item:hover { background: var(--sx-surface-2); }
.sx-nav-pop-item svg { color: var(--sx-text-3); flex-shrink: 0; }
.sx-nav-pop-item .kbd {
  margin-left: auto;
  font-family: var(--sx-font-mono);
  font-size: 11px;
  color: var(--sx-text-3);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--sx-bg);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.sx-nav-pop-item--muted { color: var(--sx-text-2); }
.sx-nav-pop-item--muted:hover { color: var(--sx-text); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sx-nav-user-name   { display: none; }
}

/* Mobile chrome (≤900px) matches the Sigrix_new prototype: nav links,
 * search, and most actions collapse into the hamburger drawer. The notification
 * bell and cart stay visible in the top bar alongside the hamburger (the bell
 * is hidden for guests by its own .hidden modifier in notification_bell.html).
 *
 * The burger lives inside .sx-nav-actions (it's #nav-toggle), so we keep
 * the actions container visible and only hide the actions that aren't the
 * toggle, cart, or bell. Keep the breakpoint in lockstep with the
 * .mobile-nav-panel desktop-hide rule in style.css. */
@media (max-width: 900px) {
  /* Specificity (0,2,0) — must beat the unconditional `.sx-nav-links
   * { display: flex }` rule in css/sx-home.css, which page templates
   * load AFTER css/sx-nav-actions.css via their {% block extra_head %}.
   * Without the `.sx-nav` prefix the two declarations tie on specificity
   * and the later-loaded sx-home.css wins, leaving the desktop links
   * visible on mobile alongside the hamburger. */
  .sx-nav .sx-nav-links { display: none; }
  .sx-search,
  .sx-nav .sx-search { display: none; }
  /* #login-dropdown is exempt so the mobile drawer's "Sign in" tile can
   * surface it as a centered sheet — see body.is-login-dropdown-open below.
   * Its .hidden class keeps it invisible until JS opens it. */
  .sx-nav-actions > *:not(.sx-nav-toggle):not(#nav-cart-anchor):not(#notification-bell-container):not(#login-dropdown) { display: none !important; }
  .sx-nav-toggle { display: inline-flex; }

  /* Full-height sheet on phones (per design doc). Size with viewport units
   * because `.site-header` has `backdrop-filter`, which makes it the
   * containing block for `position: fixed` descendants — `inset: 0` would
   * size the sheet to the ~60px header box, not the viewport, leaving a
   * top stripe over a translucent backdrop. */
  body.is-login-dropdown-open #login-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 56px 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: center;
    z-index: 60;
  }
  body.is-login-dropdown-open #login-dropdown .login-eyebrow {
    display: block;
    position: absolute;
    top: 18px;
    left: 0;
    right: 0;
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }
  body.is-login-dropdown-open #login-dropdown .login-close {
    top: 12px;
    left: 12px;
    right: auto;
  }
  body.is-login-dropdown-open #login-dropdown .login-brand { margin-top: 8px; }
  body.is-login-dropdown-open #login-dropdown .login-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 26px;
  }
  body.is-login-dropdown-open #login-dropdown .login-title {
    font-size: 1.5rem;
  }
  body.is-login-dropdown-open #login-dropdown .login-oauth-btn { height: 48px; }
  /* No backdrop on mobile: the full-bleed sheet already covers the viewport.
   * Painting a backdrop here is also broken — `.site-header` (which contains
   * the sheet) has `backdrop-filter` and `z-index: 30`, so it forms a
   * stacking context. The sheet's `z-index: 60` is scoped inside that
   * context, while a `body::before` backdrop sits in the root stacking
   * context — so a z-index above 30 would paint over the sheet. */
}

@media (max-width: 720px) {
  .sx-nav-publish span { display: none; }
  .sx-nav-publish { padding: 0 10px; }
}

/* Mobile popovers (≤900px) — anchor cart + notifications to the viewport
 * instead of their trigger buttons.
 *
 * On narrow screens the desktop bell / cart buttons can be small or off-axis,
 * so an `position: absolute; right: 0` popover ends up off-screen or visually
 * disconnected from the tile the user tapped. We use `position: fixed` so the
 * popover doesn't follow its anchor button's small bounding box.
 *
 * Caveat: `.site-header` and `.sx-nav` apply `backdrop-filter`, which creates
 * a containing block for fixed descendants. So `top: 72px` is measured from
 * the header's box, not the actual viewport — but because the header is
 * `position: sticky; top: 0` it stays glued to viewport y=0, which makes the
 * two coordinate systems coincide in practice. Anchoring via `top` (just
 * below the 60px header bar) gives a stable position regardless of scroll;
 * `bottom: 16px` would have measured 16px from the *header's* bottom edge,
 * placing the popover at the top of the page.
 *
 * The triggers' existing outside-click handlers (see sx_nav_cart.js and
 * notifications_bell.js) still close the popover, so no JS coordination is
 * needed — the change is presentation-only. */
@media (max-width: 900px) {
  .mp-cart-pop,
  .sx-nav-pop {
    position: fixed;
    top: 72px;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(380px, calc(100vw - 24px));
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    transform: translateX(-50%);
    animation: sx-nav-pop-mobile-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  /* The pointer arrow points at the desktop trigger button, which is hidden
   * (or visually disconnected) on mobile — hide it to avoid a stray triangle
   * floating at the top of the centered sheet. */
  .mp-cart-pop::before,
  .sx-nav-pop::before { display: none; }
  @keyframes sx-nav-pop-mobile-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}

/* Narrow desktop (901-1200px): the inline nav + search + full action cluster
 * still all fit, but tighten gaps and shrink the search so nothing overflows.
 * Above this range the canonical Refined spacing kicks back in. */
@media (min-width: 901px) and (max-width: 1200px) {
  .sx-nav .sx-nav-inner { gap: 14px; }
  .sx-nav .sx-nav-actions { gap: 4px; }
  .sx-nav .sx-search { max-width: 220px; }
  .sx-nav-publish span { display: none; }
  .sx-nav-publish { padding: 0 10px; }
}

/* ---------- Mobile drawer interior (Refined design) -----------------------
 * The drawer shell + slide animation lives in style.css (.mobile-nav-panel).
 * Rules below cover the new richer content: drawer head (logo + close),
 * search, primary CTA, navigation list with trailing indicator, theme row,
 * and the variant block (account card + credits + inbox/cart grid for
 * signed-in, or sign-in link + get-started CTA for guests).
 * ------------------------------------------------------------------------- */
.mobile-nav-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  /* Span the panel edge-to-edge by reversing the panel's 14px side padding. */
  margin: 0 -14px 6px;
  padding: 0 14px;
  border-bottom: 1px solid var(--sx-line);
}
.mobile-nav-head-logo { text-decoration: none; }
.mobile-nav-close {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sx-surface);
  color: var(--sx-text-2);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  border: 0; padding: 0; cursor: pointer;
  transition: color 140ms ease, box-shadow 140ms ease;
}
.mobile-nav-close:hover { color: var(--sx-text); box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.mobile-nav-close svg { display: block; }

.mobile-nav-search {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px;
  background: var(--sx-surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.mobile-nav-search-icon { width: 14px; height: 14px; color: var(--sx-text-3); flex-shrink: 0; }
.mobile-nav-search-input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--sx-text); font-size: 14px; font-family: inherit;
}
.mobile-nav-search-input::placeholder { color: var(--sx-text-3); }
.mobile-nav-search-input:focus { outline: 0; }
.mobile-nav-search:focus-within { box-shadow: 0 0 0 1px var(--sx-brand) inset; }

.mobile-nav-publish {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 16px;
  border-radius: 12px;
  background: var(--sx-brand, #3D4DFF);
  color: #FFFFFF;
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 0 0 1px rgba(91,124,255,0.6);
  transition: filter 140ms ease;
}
.mobile-nav-publish:hover { filter: brightness(1.05); }
.mobile-nav-publish-label { display: inline-flex; align-items: center; gap: 8px; }
.mobile-nav-publish svg { display: block; }

.mobile-nav-eyebrow {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sx-text-3); font-weight: 600;
  padding: 0 4px;
}

.mobile-nav-theme-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px;
}
.mobile-nav-theme-label { font-size: 13px; color: var(--sx-text-2); font-weight: 500; }

/* Pill-style theme toggle — track + thumb (mirrors the desktop sx-theme-toggle
 * visual). The track shows both sun + moon glyphs at low opacity; the thumb
 * slides between them and shows the icon for the *current* theme. */
.mobile-nav-theme-pill {
  position: relative;
  width: 56px; height: 30px;
  border-radius: 999px;
  background: var(--sx-surface-2, #F4F5F8);
  box-shadow: 0 0 0 1px var(--sx-line, #E6E8EE) inset;
  cursor: pointer; padding: 0; border: 0;
  display: inline-flex; align-items: center; flex-shrink: 0;
  transition: box-shadow 140ms ease, background 140ms ease;
}
.mobile-nav-theme-pill:hover { box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.mobile-nav-theme-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--sx-brand) inset, 0 0 0 3px rgba(91, 124, 255, 0.25);
}
.mobile-nav-theme-pill-track-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text-3);
  pointer-events: none;
}
.mobile-nav-theme-pill-track-icon--moon { left: 7px; }
.mobile-nav-theme-pill-track-icon--sun { right: 7px; }
.mobile-nav-theme-pill-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset, 0 1px 2px rgba(0, 0, 0, 0.18);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-text);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
/* Drive visual state from the document-root [data-theme] attribute so the
 * pill matches the inline bootstrap script (set before paint), avoiding a
 * flash between markup default and the JS-applied state. */
html[data-theme="light"] .mobile-nav-theme-pill-thumb { transform: translateX(26px); }
.mobile-nav-theme-pill-thumb-icon { display: none; }
html[data-theme="dark"] .mobile-nav-theme-pill .mobile-nav-theme-pill-thumb-icon--moon { display: block; }
html[data-theme="light"] .mobile-nav-theme-pill .mobile-nav-theme-pill-thumb-icon--sun { display: block; }
html[data-theme="dark"] .mobile-nav-theme-pill-track-icon--moon { opacity: 0; }
html[data-theme="light"] .mobile-nav-theme-pill-track-icon--sun { opacity: 0; }

.mobile-nav-account-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--sx-surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 140ms ease, background 140ms ease;
}
.mobile-nav-account-card:hover { background: var(--sx-surface-2); box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.mobile-nav-account-card-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sx-brand) 0%, #1A1F6B 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}
.mobile-nav-account-card-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.mobile-nav-account-card-name {
  font-size: 14px; font-weight: 500; color: var(--sx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mobile-nav-account-card-role {
  font-size: 10px; color: var(--sx-text-3);
  font-family: var(--sx-font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
}

.mobile-nav-credits-row {
  /* Inherits .sx-nav-credits + --disabled styling. Stretch full-width. */
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 14px;
  width: 100%;
  box-sizing: border-box;
}
.mobile-nav-credits-row .num { padding-left: 4px; }

.mobile-nav-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.mobile-nav-tile {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 14px;
  border-radius: 12px;
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
  color: var(--sx-text);
  border: 0;
  font: inherit;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}
.mobile-nav-tile:hover { background: var(--sx-surface-2); box-shadow: 0 0 0 1px var(--sx-line-2) inset; }
.mobile-nav-tile svg { color: var(--sx-text-3); }
.mobile-nav-tile-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--sx-brand);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.mobile-nav-tile-badge.hidden { display: none !important; }
.mobile-nav-tile--ghost {
  background: transparent;
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.mobile-nav-tile--primary {
  background: var(--sx-brand);
  color: var(--sx-brand-ink, #fff);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 0 0 1px rgba(91,124,255,0.6);
  font-weight: 600;
}
.mobile-nav-tile--primary:hover { filter: brightness(1.05); background: var(--sx-brand); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 0 0 1px rgba(91,124,255,0.6); }

/* Guest variant: full-width Cart tile rendered above the auth row so guests
 * can reach the cart from the mobile drawer (matches the Building Blocks
 * canonical top-bar spec where cart is always present, even for guests). */
.mobile-nav-tile--guest-cart { width: 100%; }

/* Guest CTA grid — 2-up Sign in (ghost) + Get started (primary), matching
 * the Sigrix_new prototype's .sx-mb-cta layout. Both buttons share the same
 * height and stretch to fill their column. */
.mobile-nav-auth-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding: 4px 0 0;
}
.mobile-nav-signin-link,
.mobile-nav-signup-cta {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 16px;
  border-radius: 12px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  transition: background 140ms ease, box-shadow 140ms ease, filter 140ms ease, color 140ms ease;
}
.mobile-nav-signin-link {
  background: var(--sx-surface);
  color: var(--sx-text);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.mobile-nav-signin-link:hover {
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line-2) inset;
}
.mobile-nav-signup-cta {
  background: var(--sx-brand);
  color: var(--sx-brand-ink, #fff);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 0 0 1px rgba(91,124,255,0.6);
}
.mobile-nav-signup-cta:hover { filter: brightness(1.05); }

/* ── Marketplace "browse by type" dropdown (desktop nav) ─────────────────────
   CSS-only flyout: the trigger is a real link to /marketplace; the panel opens
   on hover and on keyboard focus (:focus-within). Greyed types carry a "Soon"
   pill and are non-interactive spans. The whole thing is hidden ≤900px where
   the mobile drawer's nested sub-links take over. */
.sx-nav-has-menu { position: relative; display: inline-flex; align-items: center; }
.sx-nav-link-chevron {
  margin-left: 5px;
  /* Negative right margin tucks the caret toward the trigger's edge, matching
   * the Sigrix_new prototype caret (.sx-nav-trigger .caret). */
  margin-right: -2px;
  opacity: 0.75;
  transition: transform 160ms ease, opacity 160ms ease;
}
.sx-nav-has-menu:hover .sx-nav-link-chevron,
.sx-nav-has-menu:focus-within .sx-nav-link-chevron {
  opacity: 1;
  transform: rotate(180deg);
}
.sx-nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 300px;
  padding: 6px;
  /* Deeper than the surrounding chrome (matches the Sigrix_new flyout): the
   * panel sits on --sx-bg-2 so the surface-level icon tiles + hover rows read
   * as raised cards against it. */
  background: var(--sx-bg-2);
  border-radius: var(--sx-r-lg);
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(0,0,0,0.6),
    0 8px 16px -8px rgba(0,0,0,0.4);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.97) translateY(-6px);
  transform-origin: top left;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
}
[data-theme="light"] .sx-nav-menu {
  box-shadow:
    0 0 0 1px var(--sx-line) inset,
    0 24px 48px -16px rgba(14,19,32,0.18),
    0 8px 16px -8px rgba(14,19,32,0.10);
}
/* Hover bridge so the cursor can cross the gap to the panel without it closing. */
.sx-nav-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.sx-nav-has-menu:hover .sx-nav-menu,
.sx-nav-has-menu:focus-within .sx-nav-menu {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  transition: opacity 160ms ease, transform 160ms ease;
}
.sx-nav-menu-link {
  display: block;
  padding: 9px 11px;
  border-radius: var(--sx-r-md);
  text-decoration: none;
  color: var(--sx-text);
  transition: background 120ms ease;
}
a.sx-nav-menu-link:hover,
a.sx-nav-menu-link:focus-visible { background: var(--sx-surface); }
.sx-nav-menu-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.sx-nav-menu-blurb {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--sx-text-3);
}
.sx-nav-menu-link--soon { cursor: default; }
.sx-nav-menu-link--soon .sx-nav-menu-label { color: var(--sx-text-2); }
.sx-nav-menu-link--soon .sx-nav-menu-blurb { color: var(--sx-text-3); opacity: 0.7; }

/* Shared "Soon" pill — used in the desktop menu and the mobile sub-nav. */
.sx-nav-soon {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sx-text-3);
  background: var(--sx-surface-2);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}

/* ── Resources dropdown (Learn + Blog grouped menu, IA "Option A") ────────────
   Reuses the .sx-nav-has-menu / .sx-nav-menu flyout above. The trigger is a
   disclosure <button> (there is no /resources landing page), so it needs the
   usual button reset to read as a plain nav link. Each menu item is the "rich"
   variant: a colour-tinted icon tile alongside the label + blurb. */
.sx-nav-trigger {
  background: none;
  border: 0;
  cursor: pointer;
  /* Only the family needs inheriting to escape the UA's default button font.
   * The full `font` shorthand also resets font-size/weight/line-height to the
   * inherited body values (16px / 400 / 1.6), which clobbers `.sx-nav-link`'s
   * 14px / 500 — so the Resources <button> rendered larger and off-baseline
   * from the sibling links (Home / Marketplace / Hub / About). Inheriting just
   * the family keeps it the same size as the rest of the row. Matches the
   * Sigrix_new prototype (.sx-nav-trigger { … font-family: inherit }). */
  font-family: inherit;
}
.sx-nav-menu-link--rich {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.sx-nav-menu-ic {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Surface-level tile raised against the deeper --sx-bg-2 panel. */
  background: var(--sx-surface);
  box-shadow: 0 0 0 1px var(--sx-line) inset;
}
.sx-nav-menu-ic svg { width: 16px; height: 16px; }
.sx-nav-menu-link--rich .sx-nav-menu-text { min-width: 0; }
.sx-nav-menu-link[aria-current="page"] .sx-nav-menu-label { color: var(--sx-brand-3); }
/* Not-yet-launched ("Soon") types: mute the icon tile like the blurb. */
.sx-nav-menu-link--soon .sx-nav-menu-ic { opacity: 0.72; }

/* Mobile drawer: per-type hubs nested under Marketplace. */
.mobile-nav-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px;
  padding-left: 12px;
  border-left: 1px solid var(--sx-line);
}
.mobile-nav-sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--sx-r-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--sx-text-2);
  text-decoration: none;
}
a.mobile-nav-sublink:hover,
a.mobile-nav-sublink:focus-visible { background: var(--sx-surface-2); color: var(--sx-text); }
.mobile-nav-sublink svg { opacity: 0.6; }
.mobile-nav-sublink--soon { color: var(--sx-text-3); cursor: default; }
