/* ============================================================
   Æther — Unified Top Bar (Concept 3: Conversion-First)
   Single source of truth for navbar layout, mobile menu, a11y.
   Loaded AFTER each page's inline <style>, so these rules win.
   Works with existing markup: nav.global > .nav-inner > .nav-links
   and header.app-nav (reading app).
   ============================================================ */

:root{
  --ae-nav-h: 60px;
  --ae-z-nav: 1000;
  --ae-z-panel: 1001;
  --ae-ink: #1A1525;
  --ae-ink-soft: #5A5070;
  --ae-line: #F0EDF5;
  --ae-line-strong: #E5E0EE;
  --ae-primary: #7C3AED;
  --ae-primary-mist: #FAF7FF;
  --ae-pill: 999px;
}

/* ---------- Sticky bar + scroll elevation ---------- */
nav.global,
header.app-nav{
  position: sticky; top: 0;
  z-index: var(--ae-z-nav);
  transition: box-shadow .25s ease, border-color .25s ease;
}
nav.global.ae-scrolled,
header.app-nav.ae-scrolled{
  box-shadow: 0 6px 24px -14px rgba(26,21,37,.22);
  border-bottom-color: var(--ae-line-strong);
}

/* ============================================================
   CONCEPT 3 — DESKTOP LAYOUT (marketing pages)
   logo | content links ........ globe · Sign in · CTA
   Achieved with the existing single .nav-links row:
   links stay left, utility cluster is pushed right.
   ============================================================ */
nav.global .nav-inner{
  justify-content: flex-start;
  gap: 14px;
}
nav.global .nav-links{
  flex: 1 1 auto;
  gap: 4px;
}
/* push the language switcher + everything after it to the right edge */
nav.global .nav-links .lgs-mount{
  margin-left: auto;
}
/* tighten link padding for a cleaner left group */
nav.global .nav-links > a:not(.cta){
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
nav.global .nav-links > a:not(.cta):hover{
  background: var(--ae-primary-mist);
}
/* active page (set by nav.js) */
nav.global .nav-links > a[aria-current="page"]{
  color: var(--ae-primary);
  font-weight: 600;
}

/* injected Sign in link (quiet text) */
.ae-signin{
  font-size: 14px; font-weight: 600;
  color: var(--ae-ink-soft); text-decoration: none;
  padding: 8px 12px; border-radius: 8px;
  white-space: nowrap;
}
.ae-signin:hover{ color: var(--ae-ink); background: var(--ae-primary-mist); }

/* hairline divider before the auth cluster */
.ae-div{
  width: 1px; height: 22px;
  background: var(--ae-line-strong);
  flex: none;
}

/* CTA stays the single dominant filled button (existing .cta styles kept) */
nav.global .nav-links a.cta{ white-space: nowrap; }

/* ============================================================
   HAMBURGER BUTTON (injected by nav.js) — mobile only
   ============================================================ */
.ae-burger{
  display: none;
  width: 44px; height: 44px;
  border: 0; background: none; cursor: pointer;
  align-items: center; justify-content: center;
  border-radius: 10px; flex: none;
  -webkit-tap-highlight-color: transparent;
}
.ae-burger:hover{ background: var(--ae-primary-mist); }
.ae-burger .bar{ position: relative; width: 20px; height: 2px; background: var(--ae-ink); border-radius: 2px; display:block; transition: background .15s ease; }
.ae-burger .bar::before,
.ae-burger .bar::after{ content:""; position:absolute; left:0; width:20px; height:2px; background: var(--ae-ink); border-radius:2px; transition: transform .2s ease, top .2s ease; }
.ae-burger .bar::before{ top:-6px; } .ae-burger .bar::after{ top:6px; }
.ae-burger[aria-expanded="true"] .bar{ background: transparent; }
.ae-burger[aria-expanded="true"] .bar::before{ top:0; transform: rotate(45deg); }
.ae-burger[aria-expanded="true"] .bar::after{ top:0; transform: rotate(-45deg); }

/* ============================================================
   MOBILE PANEL + BACKDROP (built by nav.js)
   ============================================================ */
.ae-backdrop{
  position: fixed; inset: 0;
  background: rgba(26,21,37,.42);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  z-index: var(--ae-z-panel);
}
.ae-backdrop.open{ opacity: 1; visibility: visible; }

.ae-panel{
  position: fixed; top: 0; right: 0;
  width: min(86vw, 360px); height: 100%;
  max-height: 100dvh;
  background: #fff;
  box-shadow: -18px 0 50px -20px rgba(26,21,37,.4);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  z-index: calc(var(--ae-z-panel) + 1);
  display: flex; flex-direction: column;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 22px calc(28px + env(safe-area-inset-bottom));
}
.ae-panel.open{ transform: translateX(0); }

.ae-panel-head{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.ae-panel-head .ae-panel-logo{
  font-family: var(--serif, "Fraunces", Georgia, serif);
  font-size: 24px; font-weight: 500; letter-spacing: -.02em;
  color: var(--ae-ink); text-decoration: none;
}
.ae-panel-close{
  width: 44px; height: 44px; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 10px;
  color: var(--ae-ink);
}
.ae-panel-close:hover{ background: var(--ae-primary-mist); }
.ae-panel-close svg{ width: 22px; height: 22px; }

.ae-panel a.ae-m-link{
  display: block;
  font-size: 17px; font-weight: 500; color: var(--ae-ink);
  text-decoration: none; padding: 14px 4px;
  border-bottom: 1px solid var(--ae-line);
}
.ae-panel a.ae-m-link[aria-current="page"]{ color: var(--ae-primary); font-weight: 600; }

.ae-panel .ae-m-label{
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #9890ab; margin: 20px 0 8px;
}
.ae-panel .ae-m-langrow{ display: flex; flex-wrap: wrap; gap: 8px; }
.ae-panel .ae-m-langrow a{
  font-size: 13px; font-weight: 600; color: var(--ae-ink-soft);
  background: #F5F0FF; border-radius: var(--ae-pill);
  padding: 9px 14px; text-decoration: none;
}
.ae-panel .ae-m-langrow a[aria-current="true"]{ background: var(--ae-primary); color: #fff; }

.ae-panel .ae-m-cta{
  display: flex; align-items: center; justify-content: center;
  height: 52px; margin-top: 22px; border-radius: var(--ae-pill);
  background: var(--ae-ink); color: #fff; font-weight: 600; font-size: 15.5px;
  text-decoration: none;
}
.ae-panel .ae-m-cta:hover{ background: var(--ae-primary); }
.ae-panel .ae-m-signin{
  display: block; text-align: center; margin-top: 14px;
  font-size: 15px; font-weight: 600; color: var(--ae-ink-soft); text-decoration: none;
  padding: 6px;
}

/* lock body scroll while panel open */
body.ae-menu-open{ overflow: hidden; }

/* ============================================================
   RESPONSIVE SWITCH
   ============================================================ */
@media (max-width: 760px){
  /* hide the desktop link row; show hamburger */
  nav.global .nav-links,
  header.app-nav .nav-links{ display: none !important; }
  .ae-burger{ display: flex; }
  /* marketing: link row is hidden on mobile, so push the burger to the right edge
     (the reading app already right-aligns it via .applang margin-left:auto) */
  nav.global .ae-burger{ margin-left: auto; }
}
@media (min-width: 761px){
  .ae-burger, .ae-panel, .ae-backdrop{ display: none !important; }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.ae-skip{
  position: absolute; left: 12px; top: -60px;
  z-index: calc(var(--ae-z-panel) + 2);
  background: var(--ae-ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-size: 14px;
  transition: top .15s ease;
}
.ae-skip:focus{ top: 12px; }

nav.global a:focus-visible,
nav.global button:focus-visible,
header.app-nav a:focus-visible,
header.app-nav button:focus-visible,
.ae-panel a:focus-visible,
.ae-panel button:focus-visible,
.ae-burger:focus-visible{
  outline: 2px solid var(--ae-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce){
  .ae-panel, .ae-backdrop, .ae-burger .bar,
  .ae-burger .bar::before, .ae-burger .bar::after{
    transition: none !important;
  }
}
