/* EdiX shared app-nav — sticky global top bar (see app-nav.js). Cyberpunk tokens from cyber.css,
   matches the homepage .nav aesthetic. RTL-safe (logical properties). Collapses to a hamburger ≤760px. */
.ax-nav {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 18px;
  padding: 10px clamp(14px, 4vw, 32px);
  background: rgba(10, 10, 15, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cyber-border);
}
/* .ax-logo is the brand mark — shape + size live in cyber.css's brand block. Nothing here may set
   `background`, `width` or `display`, or it would win on source order and break the mark. */

/* Brand + beta chip wrapper — keeps the chip tight to the logo despite the nav's flex gap. */
.ax-brand { display: inline-flex; align-items: center; gap: 8px; }
/* Small "beta" chip next to the brand (same recipe as dashboard .brand-beta / home .nav-beta). */
.ax-beta {
  align-self: center; padding: 1px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: .58rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; line-height: 1.5; color: var(--cyber-accent);
  background: var(--cyber-accent-dim); border: 1px solid var(--cyber-accent-line); flex-shrink: 0;
}
.ax-collapse { display: flex; align-items: center; gap: 22px; margin-inline-start: auto; }
.ax-links { display: flex; align-items: center; gap: 18px; }
.ax-link {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyber-muted-fg); text-decoration: none; white-space: nowrap;
  background: none; border: 0; cursor: pointer; padding: 6px 2px; position: relative;
  transition: color .15s var(--cyber-ease, ease);
}
.ax-link:hover { color: var(--cyber-accent); }
.ax-link.on { color: var(--cyber-accent); }
.ax-link.on::after { content: ''; position: absolute; inset-inline: 0; bottom: -2px; height: 2px; background: var(--cyber-accent); box-shadow: var(--neon-sm); }

.ax-right { display: flex; align-items: center; gap: 12px; }
.ax-lang {
  font-family: var(--font-mono); font-size: 12px; color: var(--cyber-accent-3);
  background: transparent; border: 1px solid var(--cyber-border); padding: 6px 10px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  clip-path: polygon(0 5px, 5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px));
}
.ax-lang option { background: #0c0c14; color: #e8e8f0; }
.ax-btn { font-size: .78rem; padding: 6px 12px; white-space: nowrap; }
.ax-btn-primary { background: var(--cyber-accent); color: var(--cyber-bg); border-color: var(--cyber-accent); }
.ax-btn-primary:hover { color: var(--cyber-bg); filter: brightness(1.1); }

.ax-chip { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--cyber-fg); max-width: 190px; }
.ax-chip:hover .ax-chip-name { color: var(--cyber-accent); }
.ax-chip.on .ax-chip-name { color: var(--cyber-accent); }
.ax-av { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--cyber-accent); color: var(--cyber-bg); font-family: var(--font-head); font-weight: 900; font-size: 13px; }
.ax-av img { width: 100%; height: 100%; object-fit: cover; }
.ax-chip-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyber-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Account menu — mirrors the dashboard topbar; all --cyber-* tokens so it skins cyber on studio + neo clay on body.nb. */
.axm-wrap { position: relative; flex-shrink: 0; }
.axm-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--cyber-surface, rgba(255,255,255,.04)); border: 1px solid var(--cyber-border, rgba(255,255,255,.14));
  color: var(--cyber-fg); cursor: pointer; font: inherit; }
.axm-btn:hover { border-color: var(--cyber-accent); }
.axm-btn:focus-visible { outline: 2px solid var(--cyber-accent); outline-offset: 2px; }
.axm-btn::after { content: ''; flex-shrink: 0; margin-inline-start: 2px; border-inline: 4px solid transparent; border-top: 5px solid var(--cyber-muted-fg); }
.axm-av { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--cyber-accent); color: var(--cyber-bg); font-family: var(--font-head); font-weight: 900; font-size: 13px; }
.axm-av img { width: 100%; height: 100%; object-fit: cover; }
.axm-av-lg { width: 36px; height: 36px; font-size: 15px; }
.axm-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyber-fg); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axm-menu { position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; z-index: 200; padding: 6px;
  background: var(--cyber-surface, #12121a); border: 1px solid var(--cyber-border, rgba(255,255,255,.14)); border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.32); }
.axm-menu[hidden] { display: none; }
.axm-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--cyber-border, rgba(255,255,255,.1)); }
.axm-idy { min-width: 0; }
.axm-name-lg { font-family: var(--font-head); font-weight: 800; font-size: .9rem; color: var(--cyber-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axm-plan { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; color: var(--cyber-accent); margin-top: 2px; }
.axm-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-family: var(--font-mono); font-size: .8rem;
  color: var(--cyber-fg); text-decoration: none; background: none; border: 0; width: 100%; text-align: start; cursor: pointer; }
.axm-item:hover { background: var(--cyber-accent-dim, rgba(255,255,255,.06)); }
.axm-item .ms { font-size: 18px; color: var(--cyber-muted-fg); flex-shrink: 0; }
.axm-logout { color: var(--cyber-danger); }
.axm-lang { gap: 8px; }
.axm-lang .ax-lang { margin-inline-start: auto; padding: 3px 8px; font-size: 12px; }
@media (max-width: 1279px) {
  .axm-wrap { width: 100%; }
  .axm-btn { width: 100%; border-radius: 0; border: 0; border-bottom: 1px solid var(--cyber-border); padding: 14px clamp(14px, 4vw, 32px); }
  .axm-menu { position: static; inset: auto; min-width: 0; border: 0; box-shadow: none; padding: 0 0 6px; }
}

.ax-burger { display: none; margin-inline-start: auto; background: none; border: 0; color: var(--cyber-fg); cursor: pointer; padding: 6px; line-height: 0; }

/* Collapse to the hamburger below 1280px. The logged-in bar has grown to ~1200px intrinsic
   width (8 primary links + search + identity, wider in some languages), so the 1025-1279
   band overflowed horizontally on every signed-in page; at ≥1280 the community pages hide
   their links behind the side rail and the bar fits everywhere. */
@media (max-width: 1279px) {
  .ax-burger { display: inline-flex; }
  .ax-collapse {
    position: absolute; top: 100%; inset-inline: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(10, 10, 15, .97);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cyber-border);
    max-height: 0; overflow: hidden; transition: max-height .2s var(--cyber-ease, ease);
  }
  .ax-nav.open .ax-collapse { max-height: 80vh; overflow: auto; }
  .ax-links { flex-direction: column; align-items: stretch; gap: 0; }
  .ax-link { padding: 14px clamp(14px, 4vw, 32px); border-bottom: 1px solid var(--cyber-border); }
  .ax-link.on::after { display: none; }
  .ax-link.on { background: var(--cyber-accent-dim); }
  .ax-right { flex-direction: column; align-items: stretch; gap: 0; }
  .ax-lang, .ax-btn, .ax-chip { width: 100%; padding: 14px clamp(14px, 4vw, 32px); border: 0; border-bottom: 1px solid var(--cyber-border); border-radius: 0; clip-path: none; justify-content: flex-start; }
  .ax-btn-primary { background: transparent; color: var(--cyber-accent); }
  .ax-chip { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ax-collapse { transition: none; }
}

/* ── Global people search (signed-in only; results element-built, XSS-safe) ── */
.ax-search { position: relative; }
.ax-search-in {
  width: 170px; padding: 6px 10px; font-family: var(--font-mono); font-size: 12.5px;
  color: var(--cyber-fg); background: var(--cyber-input, rgba(255,255,255,.04));
  border: 1px solid var(--cyber-border); border-radius: 6px; outline: none;
}
.ax-search-in:focus { border-color: var(--cyber-accent); }
.ax-search-res {
  display: none; position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
  min-width: 230px; max-height: 320px; overflow-y: auto; z-index: 60;
  background: rgba(10, 10, 15, .97); border: 1px solid var(--cyber-border); border-radius: 8px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ax-search-res.open { display: block; }
.ax-search-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  color: var(--cyber-fg); text-decoration: none; border-bottom: 1px solid var(--cyber-border);
}
.ax-search-row:last-child { border-bottom: 0; }
.ax-search-row:hover { background: var(--cyber-accent-dim); }
.ax-search-name { font-family: var(--font-mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-search-empty { padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; opacity: .65; }
@media (max-width: 1279px) {   /* must match the collapse threshold above */
  .ax-search { width: 100%; padding: 10px clamp(14px, 4vw, 32px); border-bottom: 1px solid var(--cyber-border); }
  .ax-search-in { width: 100%; }
  .ax-search-res { position: static; margin-top: 8px; min-width: 0; }
}

/* ── Community side rail (injected by app-nav.js on the 7 community pages only) ──
   ≥1280px: a fixed left column replaces the community links in the top bar; body gets
   padding so the centered .pf-page/.lb-page columns shift into the remaining width.
   Below 1280px the rail is gone and everything behaves exactly as before.
   Logical properties throughout → RTL (he/ar) flips for free. */
.ax-rail { display: none; }
/* .ax-badge-ev = the events (going-soon) counter. Distinct class ON PURPOSE:
   app-nav.js paintUnread blanket-paints every .ax-badge with the MESSAGES count. */
.ax-badge, .ax-badge-ev {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  margin-inline-start: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--cyber-accent, #0f8); color: #0a0a0f;
}
/* The JS hides via the `hidden` attribute; without this rule the author-origin
   display:inline-flex above would beat the UA's [hidden]{display:none} forever. */
.ax-badge[hidden], .ax-badge-ev[hidden] { display: none; }
.ax-link .ax-badge, .ax-link .ax-badge-ev { margin-inline-start: 6px; }
/* .ax-badge-new = a small "new feature" dot (Realms) — presence cue, no count. Distinct class,
   never touched by paintUnread/paintEvents; cleared once the user visits /realms (rl_seen flag). */
.ax-badge-new { display: inline-block; width: 8px; height: 8px; padding: 0; border-radius: 50%; align-self: center;
  margin-inline-start: auto; background: var(--cyber-accent, #0f8); box-shadow: 0 0 6px var(--cyber-accent, #0f8); }
.ax-badge-new[hidden] { display: none; }
.ax-link .ax-badge-new { margin-inline-start: 6px; }
@media (min-width: 1280px) {
  body.ax-rail-on { padding-inline-start: 240px; }
  /* The body padding pushes the sticky bar right too, leaving a bare hole above
     the rail (invisible on the old dark skin — bar and page backgrounds nearly
     matched — but a visible discontinuity on a light surface). Pull the bar back
     across the full width; the logo then sits above the rail like an app header. */
  body.ax-rail-on .ax-nav { margin-inline-start: -240px; }
  .ax-rail {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: var(--ax-nav-h, 60px); bottom: var(--ax-foot-h, 46px); inset-inline-start: 0;
    width: 240px; padding: 18px 12px; z-index: 80; overflow-y: auto;
    background: rgba(10, 10, 15, .6);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-inline-end: 1px solid var(--cyber-border, rgba(255,255,255,.1));
  }
  .ax-nav.ax-with-rail .ax-link-comm { display: none; }
}
.ax-rail-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  font-family: var(--font-mono); font-size: 13px; color: var(--cyber-fg, #eee);
  text-decoration: none; border-radius: 8px;
  border-inline-start: 2px solid transparent;
}
.ax-rail-link .ms { font-size: 18px; color: var(--cyber-dim, #9a9aaa); }
.ax-rail-link:hover { background: rgba(255, 255, 255, .05); }
.ax-rail-link.on {
  background: var(--cyber-accent-dim, rgba(0,255,136,.1));
  border-inline-start-color: var(--cyber-accent, #0f8);
  color: var(--cyber-accent, #0f8);
}
.ax-rail-link.on .ms { color: var(--cyber-accent, #0f8); }

/* Sponsored slot at the foot of the rail. Tokens only, so the community skin (and its dark
   mode / high-contrast variants) restyle it for free. It only exists inside .ax-rail, which
   itself only renders at >=1280px — so there is no mobile ad slot by construction. */
.ax-ad { margin-top: auto; padding-top: 14px; }
.ax-ad-label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyber-dim, #9a9aaa);
}
.ax-ad-link { display: block; border-radius: 10px; overflow: hidden; line-height: 0; }
.ax-ad-link img { width: 100%; height: auto; display: block; }
.ax-ad-link:hover { opacity: .9; }
@media (prefers-reduced-motion: reduce) { .ax-ad-link:hover { opacity: 1; } }

/* ═══ Bottom dock (app-nav.js buildDock) — adaptive: mobile tab-bar / desktop slim footer.
   All --cyber-* tokens so neo.css reskins it; logical properties throughout → RTL flips for free. ═══ */
:root { --ax-dock-h: 56px; --ax-foot-h: 46px; }
.ax-dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 90;
  background: rgba(10, 10, 15, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--cyber-border);
}

/* ── Mobile (≤1279px): a persistent bottom tab-bar (the top bar is a hamburger here) ── */
@media (max-width: 1279px) {
  .ax-dock-status, .ax-dock-actions { display: none; }
  .ax-dock { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .ax-dock-tabs { display: flex; align-items: stretch; height: var(--ax-dock-h); }
  .ax-tab {
    flex: 1 1 0; min-width: 0; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 6px 2px; font-family: var(--font-mono);
    color: var(--cyber-muted-fg); text-decoration: none;
    background: none; border: 0; cursor: pointer;
    transition: color .15s var(--cyber-ease, ease);
  }
  .ax-tab:hover { color: var(--cyber-accent); }
  .ax-tab.on { color: var(--cyber-accent); }
  .ax-tab .ms { font-size: 22px; line-height: 1; }
  .ax-tab-lbl { font-size: 10px; letter-spacing: .02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Center compose FAB — raised above the bar */
  .ax-tab-fab {
    flex: 0 0 auto; width: 52px; height: 52px; margin: -18px 6px 0; border-radius: 50%;
    background: var(--cyber-accent); color: var(--cyber-bg);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--neon-sm, 0 0 10px rgba(0, 255, 136, .5));
  }
  .ax-tab-fab:hover { color: var(--cyber-bg); filter: brightness(1.08); }
  .ax-tab-fab .ms { font-size: 26px; }
  /* Messages unread badge → top-centre of its tab (override the .ax-badge margin-auto) */
  .ax-tab .ax-badge { position: absolute; top: 5px; inset-inline-end: calc(50% - 22px); margin-inline-start: 0; }
  /* Slide the dock out while the mobile hamburger menu is open, so they never collide */
  .ax-nav.open ~ .ax-dock { transform: translateY(100%); }
}
@media (max-width: 1279px) and (prefers-reduced-motion: no-preference) {
  .ax-dock { transition: transform .2s var(--cyber-ease, ease); }
}

/* ── Desktop (≥1280px): a slim status + quick-action footer (dashboard .dash-footer analog) ── */
@media (min-width: 1280px) {
  .ax-dock-tabs { display: none; }
  .ax-dock { height: var(--ax-foot-h); display: flex; align-items: center; gap: 14px; padding: 0 clamp(14px, 4vw, 32px); }
  .ax-dock-status { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .ax-foot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyber-muted-fg); flex-shrink: 0; }
  .ax-foot-dot.is-online { background: var(--cyber-accent); box-shadow: 0 0 7px var(--cyber-accent); }
  .ax-foot-text { font-family: var(--font-mono); font-size: .74rem; color: var(--cyber-muted-fg); white-space: nowrap; }
  .ax-dock-actions {
    margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
    padding-inline-end: 64px;   /* clear the floating notification bell (fixed 20px inset) */
  }
  .ax-foot-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    background: var(--cyber-surface, rgba(255, 255, 255, .04)); border: 1px solid var(--cyber-border);
    color: var(--cyber-fg); font-family: var(--font-mono); font-size: .74rem; font-weight: 600;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: color .15s var(--cyber-ease, ease), border-color .15s var(--cyber-ease, ease);
  }
  .ax-foot-btn:hover { color: var(--cyber-accent); border-color: var(--cyber-accent); }
  .ax-foot-btn .ms { font-size: 16px; }
}

/* Reserve page space + lift the always-on floaters so nothing hides under the dock (scoped to when it mounts) */
@media (max-width: 1279px) {
  body.ax-dock-on { padding-bottom: calc(var(--ax-dock-h) + env(safe-area-inset-bottom, 0px)); }
  body.ax-dock-on .nt-root,
  body.ax-dock-on .sb-root,
  body.ax-dock-on .pf-toast { bottom: calc(20px + var(--ax-dock-h) + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 1280px) {
  body.ax-dock-on { padding-bottom: var(--ax-foot-h); }
}

/* Realms runs a full-screen immersive mode that hides the rest of the shell (realms.css, not editable). */
body.rl-immersive .ax-dock { display: none !important; }
