/* ============================================================
   NAVIGATION
   ------------------------------------------------------------
   Header, sidebar, drawer, action sheet, mobile bottom nav,
   site footer, plus the search field, nav list, dropdown,
   tabs, pagination, breadcrumb and page-header primitives.

   ============================================================
   CHROME TOKENS
   ============================================================
   The header, sidebar, drawer, and mobile bottom nav are
   chrome. They stay the same navy in both light and dark
   theme. That is the design — the fixed frame of the app
   does not react to the theme, only the content surface
   inside it does.

   Every chrome background, text colour, input surface and
   divider in this file reads from the `--chrome-*` family,
   which foundation.css declares and theme.css never
   reassigns. The result:
     · header stays navy in dark mode
     · sidebar stays navy in dark mode
     · drawer stays navy in dark mode
     · the post button on the mobile bottom nav stays navy
     · the sidebar nav link text is readable in both themes
       (the previous version used --border-strong, which
       flips to a dark navy in dark mode and made the link
       text disappear)

   The mobile bottom nav and the site footer are handled
   separately:
     · bottom nav reads --surface so it flips with the
       content. Its post button reads --chrome-bg so the
       navy circle stays constant on both themes.
     · footer reads --chrome-bg-deep because a footer is a
       fixed closing band, not content.

   ============================================================
   RTL
   ============================================================
   The physical side-swap for the header, sidebar, drawer and
   #main-content lives in theme.css, because it belongs with
   the rest of the shell orientation rules. This file owns
   only the RTL rules that are specific to a navigation
   component:
     · the active-state accent bar on a sidebar nav link
       (left in LTR, right in RTL)
     · the hamburger icon (mirrored so its "open left/right"
       cue matches the sidebar edge)
     · the sidebar context chevron
   ============================================================ */

:root {
  /* Idempotent. foundation.css owns this value; the override
     is a safety net for partial deploys. */
  --topbar-h: 54px;
}


/* ============================================================
   01 · SITE HEADER
   ============================================================ */

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topbar);

  min-height: var(--topbar-h);
  display: flex;
  align-items: center;

  background: var(--chrome-bg);
  color: var(--chrome-text);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: 0 4px 18px rgba(15, 39, 66, 0.18);

  overflow-x: clip;
  overflow-y: visible;
  isolation: isolate;

  transition: left var(--dur-slow) var(--ease),
              right var(--dur-slow) var(--ease);
}

/* Authenticated chrome offsets the header past the sidebar.
   In RTL theme.css switches the offset from left to right. */
#site-header[data-chrome="individual"],
#site-header[data-chrome="organization"],
#site-header[data-chrome="admin"] {
  left: var(--sidebar-w);
}

.header-inner {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  gap: var(--space-3);

  width: min(var(--container-max), calc(100% - 40px));
  min-height: var(--topbar-h);
  margin-inline: auto;
}

/* ---------- HAMBURGER ---------- */

.header-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  padding: 0;

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-input-line);
  border-radius: var(--radius-md);

  color: var(--chrome-text);
  cursor: pointer;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    transform        var(--dur-fast) var(--ease);
}

.header-hamburger:hover {
  background: var(--chrome-hover);
  border-color: var(--chrome-line-strong);
}

.header-hamburger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Mirror the hamburger glyph in RTL so the icon's visual
   weight leans toward the drawer it opens. */
html[dir="rtl"] .header-hamburger svg,
html[dir="rtl"] .header-hamburger iconify-icon {
  transform: scaleX(-1);
}

/* ---------- INLINE NAV ---------- */

.header-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
}

.nav-inline {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-inline li { margin: 0; padding: 0; }

.nav-inline .nav-link {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding-inline: var(--space-4);

  border-radius: var(--radius-pill);
  color: var(--chrome-text-soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.nav-inline .nav-link:hover {
  color: var(--chrome-text);
  background: var(--chrome-hover);
}

.nav-inline .nav-link[aria-current="page"] {
  color: var(--chrome-text);
  background: var(--chrome-active);
}

.nav-inline .nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-pill);
}

/* ---------- HEADER SEARCH ---------- */

.header-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 460px;
  margin-inline: var(--space-3);
}

/* ---------- ACTIONS CLUSTER ---------- */

.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

/* ---------- HEADER ACTION (icon button) ---------- */

.header-action {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-input-line);
  border-radius: var(--radius-md);

  color: var(--chrome-text);
  font-size: var(--fs-lg);
  cursor: pointer;
  text-decoration: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.header-action:hover {
  background: var(--chrome-hover);
  border-color: var(--chrome-line-strong);
  color: var(--chrome-text);
}

.header-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.header-action .count-bubble {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 3;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9px;
  border: 2px solid var(--chrome-bg);
  box-shadow: none;
}

/* The count bubble's own position flips in RTL — it sits on
   the visual top-right in LTR and top-left in RTL. */
html[dir="rtl"] .header-action .count-bubble {
  right: auto;
  left: -4px;
}

/* ---------- ORG CONTEXT ---------- */

.header-org-context {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  max-width: 220px;
  padding: 3px 12px 3px 3px;

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-input-line);
  border-radius: var(--radius-pill);

  color: var(--chrome-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-decoration: none;
  white-space: nowrap;

  transition: background-color var(--dur-fast) var(--ease);
}

html[dir="rtl"] .header-org-context {
  padding: 3px 3px 3px 12px;
}

.header-org-context:hover {
  background: var(--chrome-hover);
}

.header-org-context-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- IDENTITY PILL ---------- */

.header-identity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 3px 10px 3px 3px;

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-input-line);
  border-radius: var(--radius-pill);

  color: var(--chrome-text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;

  transition: background-color var(--dur-fast) var(--ease);
}

html[dir="rtl"] .header-identity {
  padding: 3px 3px 3px 10px;
}

.header-identity:hover {
  background: var(--chrome-hover);
}

.header-identity-name {
  color: var(--chrome-text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-identity-caret {
  color: var(--chrome-text-muted);
  font-size: 10px;
}

/* The avatar inside the identity pill must never exceed 34px.
   The border uses the chrome line so the avatar edge reads
   against the navy pill in both themes. */
.header-identity .avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--chrome-input-line);
}

/* ---------- GUEST ACTIONS ---------- */

.header-guest-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.header-guest-actions .btn-ghost {
  color: var(--chrome-text-soft);
}

.header-guest-actions .btn-ghost:hover {
  color: var(--chrome-text);
  background: var(--chrome-hover);
  border-color: var(--chrome-input-line);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1024px) and (min-width: 851px) {
  .header-inner {
    width: min(100% - 30px, var(--container-max));
    gap: var(--space-3);
  }
  .nav-inline .nav-link { padding-inline: var(--space-3); font-size: var(--fs-xs); }
  .header-search { max-width: 280px; margin-inline: var(--space-2); }
}

@media (max-width: 850px) {
  /* Authenticated chrome collapses to full width. theme.css
     also handles this so a stale header rule cannot leak. */
  #site-header,
  #site-header[data-chrome="individual"],
  #site-header[data-chrome="organization"],
  #site-header[data-chrome="admin"] {
    left: 0;
  }

  .header-inner {
    width: calc(100% - 20px);
    gap: var(--space-2);
  }

  .header-hamburger { display: inline-flex; }
  .nav-inline        { display: none; }
  .header-search     { display: none; }

  /* Identity becomes a perfect circle. */
  .header-identity {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: var(--radius-circle);
    justify-content: center;
    gap: 0;
  }
  .header-identity-name { display: none; }
  .header-identity-caret { display: none; }
  .header-identity .avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }
}

@media (max-width: 480px) {
  .header-inner { width: calc(100% - 14px); gap: 4px; }
  .header-action { width: 38px; height: 38px; flex-basis: 38px; }
  .header-hamburger { width: 38px; height: 38px; flex-basis: 38px; }
  .header-org-context { max-width: 140px; padding: 3px 8px 3px 3px; }
  html[dir="rtl"] .header-org-context { padding: 3px 3px 3px 8px; }
}

@media (max-width: 380px) {
  .header-org-context-label { display: none; }
}

/* Safe-area padding for notched devices. */
@supports (padding: env(safe-area-inset-top)) {
  #site-header {
    padding-top: env(safe-area-inset-top);
  }
  .header-inner {
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  #site-header,
  .header-hamburger,
  .nav-inline .nav-link,
  .header-action,
  .header-org-context,
  .header-identity {
    transition: none !important;
  }
}

@media print {
  #site-header { display: none !important; }
}


/* ============================================================
   02 · SEARCH INPUT
   ------------------------------------------------------------
   Base search field renders on content surfaces (white in
   light mode, dark navy in dark mode). Uses --surface and
   --text so it flips automatically.

   The header search field is a chrome surface — it overrides
   the base with --chrome-input-* tokens.
   ============================================================ */

.search { width: 100%; }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-4) 0 40px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);

  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  outline: none;

  transition:
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

/* In RTL the leading icon flips to the visual right edge. */
html[dir="rtl"] .search-input {
  padding: 0 40px 0 var(--space-4);
}

.search-input::placeholder {
  color: var(--text-light);
  font-weight: var(--fw-regular);
}

.search-input:focus {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: var(--fs-md);
  pointer-events: none;
  transition: color var(--dur-fast) var(--ease);
}

html[dir="rtl"] .search-icon {
  left: auto;
  right: var(--space-4);
}

.search-input:focus ~ .search-icon,
.search-field:focus-within .search-icon {
  color: var(--blue-600);
}

.search-clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

html[dir="rtl"] .search-clear {
  right: auto;
  left: var(--space-2);
}

.search-clear:hover {
  background: var(--surface-muted);
  color: var(--text-soft);
}

/* ---------- HEADER SEARCH (chrome surface) ---------- */

.header-search .search-input {
  background: var(--chrome-input-bg);
  border-color: var(--chrome-input-line);
  color: var(--chrome-text);
}

.header-search .search-input::placeholder {
  color: var(--chrome-text-muted);
}

.header-search .search-input:focus {
  background: var(--chrome-active);
  border-color: var(--chrome-line-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.header-search .search-icon {
  color: var(--chrome-text-muted);
}

.header-search .search-input:focus ~ .search-icon,
.header-search .search-field:focus-within .search-icon {
  color: var(--chrome-text);
}

/* ---------- HERO VARIANT ---------- */

.search-hero .search-input {
  height: 48px;
  padding-left: 44px;
  font-size: var(--fs-base);
}

html[dir="rtl"] .search-hero .search-input {
  padding-left: var(--space-4);
  padding-right: 44px;
}

.search-hero .search-icon { font-size: var(--fs-lg); }

@media (max-width: 640px) {
  .search-input { height: 44px; }
  .search-hero .search-input { height: 46px; }
}


/* ============================================================
   03 · NAV LIST  (shared by sidebar + drawer)
   ------------------------------------------------------------
   Both the sidebar and the drawer render the same .nav-list
   markup on the same chrome background. Every rule here
   reads from the --chrome-* family.

   Why this matters: the previous version read --border-strong
   for the default link colour. --border-strong flips to a
   dark navy in dark mode, which made the link text invisible
   against the (still-navy) sidebar. Reading --chrome-text-soft
   instead keeps the text readable in both themes because the
   chrome background never changes.
   ============================================================ */

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-3);
}

.nav-group:first-child { margin-top: 0; }

.nav-group-label {
  display: block;
  margin: 0 var(--space-3) var(--space-1);
  color: var(--chrome-text-muted);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.9;
}

html[lang="ar"] .nav-group-label {
  letter-spacing: 0;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list > li { margin: 0; padding: 0; }

.nav-list .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);

  min-height: 44px;
  padding: var(--space-2) var(--space-3);

  color: var(--chrome-text-soft);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);

  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  text-align: start;
  width: 100%;

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

.nav-list .nav-link:hover {
  color: var(--chrome-text);
  background: var(--chrome-input-bg);
  border-color: var(--chrome-line);
}

.nav-list .nav-link[aria-current="page"] {
  color: var(--chrome-text);
  background: var(--chrome-active);
  border-color: var(--chrome-line);
  font-weight: var(--fw-bold);
}

/* Active-state accent bar. Sits on the leading edge of the
   sidebar in LTR and on the trailing edge in RTL. */
.nav-list .nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--blue-500);
  border-radius: 0 3px 3px 0;
}

html[dir="rtl"] .nav-list .nav-link[aria-current="page"]::before {
  left: auto;
  right: -1px;
  border-radius: 3px 0 0 3px;
}

.nav-link-icon {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: var(--chrome-text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.nav-link:hover .nav-link-icon {
  color: var(--blue-100);
}

.nav-link[aria-current="page"] .nav-link-icon {
  color: var(--blue-100);
  background: rgba(37, 99, 235, 0.16);
}

.nav-link-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link-trailing {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline-start: auto;
  flex: 0 0 auto;
}

.nav-link-trailing .count-bubble {
  position: static;
  top: auto;
  right: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(147, 197, 253, 0.14);
  color: var(--blue-100);
  box-shadow: none;
  font-size: 10px;
}

.nav-link-danger { color: var(--chrome-text-muted); }

.nav-link-danger:hover {
  color: var(--danger-100);
  background: rgba(180, 35, 24, 0.14);
  border-color: rgba(180, 35, 24, 0.20);
}

.nav-link-danger:hover .nav-link-icon {
  color: var(--danger-100);
}


/* ============================================================
   04 · SIDEBAR
   ============================================================ */

#site-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  width: var(--sidebar-w);

  background: var(--chrome-bg);
  color: var(--chrome-text);
  border-right: 1px solid var(--chrome-line);

  overflow: hidden;
  isolation: isolate;

  transition: transform var(--dur-slow) var(--ease);
}

#site-sidebar::before,
#site-sidebar::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.sidebar {
  position: relative;
  z-index: 1;

  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;

  padding: calc(var(--topbar-h) + var(--space-4)) 0 var(--space-4);
  overflow: hidden;
}

/* ---------- SIDEBAR CTA ----------
   The primary button in the sidebar is deliberately a light
   button on navy chrome. It stays white in both themes
   because the sidebar itself is navy in both themes. The
   hard-coded white is intentional and documented — reading
   --surface here would flip the button dark in dark mode and
   make it disappear against the sidebar. */

.sidebar-cta {
  padding: 0 var(--space-4) var(--space-3);
  flex-shrink: 0;
}

.sidebar-cta .btn {
  width: 100%;
  justify-content: center;
}

.sidebar-cta .btn-primary {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--chrome-bg);
  box-shadow: 0 4px 12px rgba(5, 25, 45, 0.20);
}

.sidebar-cta .btn-primary:hover {
  background: #f5f8fc;
  border-color: #f5f8fc;
  color: var(--chrome-bg);
}

.sidebar-cta .btn-primary::before,
.sidebar-cta .btn-primary::after {
  border-color: rgba(18, 59, 99, 0.10);
}

/* ---------- SIDEBAR CONTEXT BLOCK ---------- */

.sidebar-context {
  display: flex;
  align-items: center;
  gap: var(--space-3);

  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-3);

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-line);
  border-radius: var(--radius-lg);

  color: var(--chrome-text);
  text-decoration: none;

  transition: background-color var(--dur-fast) var(--ease);
}

.sidebar-context:hover {
  background: var(--chrome-hover);
}

.sidebar-context-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-context-label {
  color: var(--chrome-text-muted);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .sidebar-context-label {
  letter-spacing: 0;
}

.sidebar-context-name {
  color: var(--chrome-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-context > iconify-icon,
.sidebar-context > i {
  color: var(--chrome-text-muted);
  font-size: var(--fs-sm);
  flex: 0 0 auto;
}

/* The trailing chevron points right in LTR ("go forward")
   and left in RTL. */
html[dir="rtl"] .sidebar-context > iconify-icon,
html[dir="rtl"] .sidebar-context > i {
  transform: scaleX(-1);
}

/* ---------- SCROLL REGION ---------- */

.sidebar > .nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar > .nav::-webkit-scrollbar { width: 6px; }
.sidebar > .nav::-webkit-scrollbar-track { background: transparent; }
.sidebar > .nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
}

/* ---------- FOOTER ---------- */

.sidebar-footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-3) 0;
  border-top: 1px solid var(--chrome-line);
  margin-top: var(--space-3);
}

.sidebar-footer .nav-list .nav-link {
  min-height: 40px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 850px) {
  #site-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  #site-sidebar[data-open="true"] {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #site-sidebar,
  .sidebar-context { transition: none !important; }
}

@media print {
  #site-sidebar { display: none !important; }
}


/* ============================================================
   05 · MOBILE BOTTOM NAV
   ------------------------------------------------------------
   The bar itself reads --surface so it flips with the theme.
   The post button reads --chrome-bg so the navy circle stays
   navy in both themes — matching the fixed chrome of the app.

   Height 54px. Post button lifted above the bar.
   ============================================================ */

#mobile-bottom-nav {
  display: none;
  position: fixed;
  /* Floating pill: inset from the screen edges, above the safe area. */
  inset-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-topbar);
  overflow: visible;
  pointer-events: none;
  max-width: 520px;
  margin-inline: auto;
  transition: transform 220ms var(--ease), opacity 180ms var(--ease);
}

/* Hidden while scrolling down / when the keyboard is open.
   Driven by js/components/mobile-nav.js (data-hidden). */
#mobile-bottom-nav[data-hidden="true"] {
  transform: translateY(calc(100% + 24px + env(safe-area-inset-bottom, 0px)));
  opacity: 0;
  visibility: hidden;
  transition: transform 220ms var(--ease), opacity 180ms var(--ease), visibility 0s linear 220ms;
}
#mobile-bottom-nav[data-hidden="true"] .bottom-nav { pointer-events: none; }

#mobile-bottom-nav[data-visible="true"] {
  display: block;
}

.bottom-nav {
  position: relative;
  isolation: isolate;

  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;

  min-height: 58px;
  padding: 6px 8px;
  border-radius: 999px;

  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(11, 31, 58, 0.16);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  overflow: visible;
  pointer-events: auto;
}

/* The shadow is a light-mode value — the dark theme needs a
   darker version so the bar reads as lifted on a dark page. */
html[data-theme="dark"] .bottom-nav {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.bottom-nav > * { position: relative; z-index: 1; }

/* ---------- ITEM ---------- */

.bottom-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  min-width: 0;
  padding: 2px;

  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);

  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0.01em;

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.bottom-nav-item > iconify-icon,
.bottom-nav-item > i {
  font-size: 20px;
  color: currentColor;
}

.bottom-nav-item > span:not(.count-bubble) {
  color: currentColor;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav-item[aria-current="page"] {
  color: var(--blue-600);
}

.bottom-nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: var(--blue-600);
  border-radius: 0 0 4px 4px;
}

.bottom-nav-item .count-bubble {
  position: absolute;
  top: 0;
  right: 50%;
  transform: translateX(20px);
  z-index: 3;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: var(--text-invert);
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: var(--fw-extrabold);
  line-height: 1;
  box-shadow: none;
}

html[dir="rtl"] .bottom-nav-item .count-bubble {
  right: auto;
  left: 50%;
  transform: translateX(-20px);
}

/* ---------- CENTRE POST BUTTON (lifted) ----------
   The post button stays navy in both themes. It is a
   persistent chrome affordance — the app's primary action —
   and its colour matches the header and the sidebar. The
   border reads --surface so the button appears to lift off
   the bar in both themes. */

.bottom-nav-post {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;

  min-width: 0;
  padding: 0 0 2px;
  background: transparent;
  border: none;

  color: var(--heading);
  font-family: inherit;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  cursor: pointer;

  overflow: visible;
}

.bottom-nav-post-inner {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);

  width: 46px;
  height: 46px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--chrome-bg);
  color: #ffffff;
  border: 3px solid var(--surface);
  border-radius: var(--radius-circle);

  font-size: 20px;

  box-shadow:
    0 8px 20px rgba(15, 39, 66, 0.25),
    0 0 0 1px rgba(15, 39, 66, 0.04);

  transition:
    transform        var(--dur-base) var(--ease),
    background-color var(--dur-base) var(--ease),
    box-shadow       var(--dur-base) var(--ease);
}

.bottom-nav-post-inner iconify-icon,
.bottom-nav-post-inner i {
  color: #ffffff !important;
}

.bottom-nav-post:hover .bottom-nav-post-inner {
  background: var(--chrome-bg-deep);
  transform: translateX(-50%) translateY(-4px);
  box-shadow:
    0 12px 26px rgba(15, 39, 66, 0.30),
    0 0 0 1px rgba(15, 39, 66, 0.04);
}

html[data-theme="dark"] .bottom-nav-post-inner {
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .bottom-nav-post:hover .bottom-nav-post-inner {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.10);
}

.bottom-nav-post-label {
  color: var(--heading);
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  margin-top: 22px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 480px) {
  .bottom-nav { min-height: 56px; padding-inline: 6px; }
  .bottom-nav-item { font-size: 10px; gap: 2px; }
  .bottom-nav-item > iconify-icon,
  .bottom-nav-item > i { font-size: 18px; }
  .bottom-nav-item > span:not(.count-bubble) { font-size: 10px; }
  .bottom-nav-post-inner { width: 42px; height: 42px; font-size: 18px; bottom: 18px; }
  .bottom-nav-post-label { margin-top: 20px; }
}

@media (max-width: 360px) {
  .bottom-nav { min-height: 56px; }
  .bottom-nav-item > span:not(.count-bubble) { font-size: 10px; letter-spacing: 0; }
}

@media (min-width: 851px) {
  #mobile-bottom-nav { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  #mobile-bottom-nav,
  #mobile-bottom-nav[data-hidden="true"] { transition: none !important; }
  .bottom-nav-item,
  .bottom-nav-post-inner { transition: none !important; }
  .bottom-nav-post:hover .bottom-nav-post-inner {
    transform: translateX(-50%);
  }
}

@media print {
  #mobile-bottom-nav { display: none !important; }
}


/* ============================================================
   06 · DRAWER
   ------------------------------------------------------------
   A narrow side sheet. The panel reads --chrome-bg so it
   stays navy in both themes. The slide direction and the
   panel radii flip under [dir="rtl"] via theme.css.
   ============================================================ */

.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);

  display: flex;
  justify-content: flex-start;

  background: rgba(7, 25, 43, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity    var(--dur-base) var(--ease),
    visibility var(--dur-base) var(--ease);
}

.drawer[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body[data-drawer-open="true"] {
  overflow: hidden;
}

.drawer-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}

.drawer-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  width: min(80vw, 300px);
  height: 100%;
  max-height: 100dvh;

  display: flex;
  flex-direction: column;

  background: var(--chrome-bg);
  color: var(--chrome-text);

  border-top-right-radius: var(--radius-2xl);
  border-bottom-right-radius: var(--radius-2xl);
  border-right: 1px solid var(--chrome-line);

  box-shadow: 0 28px 70px rgba(7, 25, 43, 0.30);

  transform: translateX(-100%);
  transition: transform var(--dur-slow) var(--ease-spring);
}

.drawer[data-open="true"] .drawer-panel {
  transform: translateX(0);
}

.drawer-panel::before,
.drawer-panel::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.drawer-panel > * { position: relative; z-index: 1; }

.drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--chrome-line);
  min-height: var(--topbar-h);
}

.drawer-header .brand { color: var(--chrome-text); }

.drawer-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;

  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-input-line);
  border-radius: var(--radius-sm);

  color: var(--chrome-text-soft);
  font-size: var(--fs-md);
  cursor: pointer;

  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.drawer-close:hover {
  background: var(--chrome-hover);
  color: var(--chrome-text);
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--space-3);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
}

.drawer-context {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--chrome-input-bg);
  border: 1px solid var(--chrome-line);
  border-radius: var(--radius-lg);
}

.drawer-context-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-context-name {
  color: var(--chrome-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-context-meta {
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-guest-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--chrome-line);
}

.drawer-guest-actions .btn { width: 100%; }

.drawer-guest-actions .btn-ghost { color: var(--chrome-text-soft); }

.drawer-guest-actions .btn-ghost:hover {
  color: var(--chrome-text);
  background: var(--chrome-hover);
  border-color: var(--chrome-input-line);
}

@media (max-width: 380px) {
  .drawer-panel { width: min(88vw, 290px); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer,
  .drawer-panel,
  .drawer-close { transition: none !important; }
  .drawer-panel { transform: none !important; }
  .drawer[data-open="false"] .drawer-panel { display: none; }
}

@media print {
  .drawer { display: none !important; }
}


/* ============================================================
   07 · ACTION SHEET
   ------------------------------------------------------------
   Bottom sheet. Uses --surface so it flips with the theme.
   The scrim stays dark in both themes.
   ============================================================ */

.action-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);

  display: flex;
  align-items: flex-end;
  justify-content: center;

  background: rgba(7, 25, 43, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity    var(--dur-base) var(--ease),
    visibility var(--dur-base) var(--ease);
}

.action-sheet[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.action-sheet-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}

.action-sheet-panel {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;

  width: 100%;
  max-width: 520px;
  padding: var(--space-2) var(--space-4) var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));

  background: var(--surface);
  color: var(--text);
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  box-shadow: 0 -20px 50px rgba(7, 25, 43, 0.22);

  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-spring);
}

html[data-theme="dark"] .action-sheet-panel {
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.55);
}

.action-sheet[data-open="true"] .action-sheet-panel {
  transform: translateY(0);
}

.action-sheet-panel > * { position: relative; z-index: 1; }

.action-sheet-handle {
  width: 40px;
  height: 4px;
  margin: 4px auto var(--space-3);
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.action-sheet-title {
  text-align: center;
  margin: 0 0 var(--space-4);
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

html[lang="ar"] .action-sheet-title {
  letter-spacing: 0;
}

.action-sheet-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.action-sheet-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);

  padding: var(--space-3) var(--space-4);

  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

.action-sheet-item:hover {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .action-sheet-item:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.action-sheet-item-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--surface);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  color: var(--blue-600);
  font-size: var(--fs-base);
}

html[data-theme="dark"] .action-sheet-item-icon {
  background: var(--surface-soft);
  border-color: rgba(96, 165, 250, 0.22);
}

.action-sheet-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-sheet-item-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}

.action-sheet-item-desc {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-sheet-cancel {
  width: 100%;
  justify-content: center;
}

@media (min-width: 640px) {
  .action-sheet { align-items: center; }

  .action-sheet-panel {
    max-width: 420px;
    border-radius: var(--radius-xl);
    transform: translateY(24px) scale(0.98);
  }

  .action-sheet[data-open="true"] .action-sheet-panel {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-sheet,
  .action-sheet-panel { transition: none !important; }
  .action-sheet-panel { transform: none !important; }
}

@media print {
  .action-sheet { display: none !important; }
}


/* ============================================================
   08 · NOTIFICATIONS PANEL
   ------------------------------------------------------------
   Desktop: anchored dropdown.
   Mobile:  fixed full-width sheet pinned below the header.
   ============================================================ */

.notifications-panel {
  width: min(360px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - var(--topbar-h) - var(--space-10)));
  padding: 0;
  overflow: hidden;
}

.notifications-panel .dropdown-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  margin-bottom: 0;
}

.notifications-panel .dropdown-header-name {
  color: var(--heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.01em;
}

.notifications-panel-body {
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.notifications-panel-body::-webkit-scrollbar { width: 6px; }
.notifications-panel-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.notifications-panel-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-3);

  padding: var(--space-3) var(--space-4);

  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft);

  transition: background-color var(--dur-fast) var(--ease);
}

.notifications-panel-row:last-child { border-bottom: none; }
.notifications-panel-row:hover { background: var(--surface-soft); }

.notifications-panel-row[data-unread="true"] {
  background: var(--blue-50);
}

html[data-theme="dark"] .notifications-panel-row[data-unread="true"] {
  background: rgba(96, 165, 250, 0.08);
}

.notifications-panel-row[data-unread="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: var(--space-3);
  bottom: var(--space-3);
  width: 2px;
  background: var(--blue-600);
  border-radius: 0 2px 2px 0;
}

html[dir="rtl"] .notifications-panel-row[data-unread="true"]::before {
  left: auto;
  right: 0;
  border-radius: 2px 0 0 2px;
}

.notifications-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  color: var(--blue-600);
  font-size: var(--fs-sm);
}

html[data-theme="dark"] .notifications-panel-icon {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.notifications-panel-row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notifications-panel-row-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notifications-panel-row-text {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notifications-panel-row-meta {
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  margin-top: 2px;
}

/* ---------- MOBILE: detach from the trigger and pin to the viewport ---------- */

@media (max-width: 640px) {
  .dropdown-end .notifications-panel {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + var(--space-2));
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
    max-width: none;
    max-height: min(65vh, 520px);
    z-index: var(--z-overlay);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(7, 25, 43, 0.22);
  }

  html[data-theme="dark"] .dropdown-end .notifications-panel {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  }
}


/* ============================================================
   09 · SITE FOOTER
   ------------------------------------------------------------
   A fixed closing band. Reads --chrome-bg-deep so it stays
   the same navy in both themes. Every text and hover colour
   uses the --chrome-text-* family — the previous version
   read --text-light and --text-muted, which had ~3.5:1
   contrast against the navy (below AA).
   ============================================================ */

.site-footer,
[data-mount="footer"] {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  background: var(--chrome-bg-deep);
  color: var(--chrome-text-soft);
  border-top: 1px solid var(--chrome-line);
}

.site-footer::before,
[data-mount="footer"]::before,
.site-footer::after,
[data-mount="footer"]::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

/* In RTL the two decorative rings mirror to the opposite
   physical corners so the composition stays balanced. */
html[dir="rtl"] .site-footer::before,
html[dir="rtl"] [data-mount="footer"]::before {
  right: auto;
  left: -260px;
}

html[dir="rtl"] .site-footer::after,
html[dir="rtl"] [data-mount="footer"]::after {
  left: auto;
  right: -200px;
}

/* ---------- INNER ---------- */

.site-footer-inner,
[data-mount="footer"] > .site-footer-inner {
  position: relative;
  z-index: 1;

  width: min(var(--container-max), calc(100% - 40px));
  margin-inline: auto;
  padding-top: var(--space-12);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 1fr));
  gap: var(--space-10);
  padding-bottom: var(--space-10);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.footer-brand .brand { color: var(--chrome-text); }

.footer-tagline {
  margin: 0;
  color: var(--chrome-text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.55;
}

.footer-brand-note {
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.03em;
}

html[lang="ar"] .footer-brand-note {
  letter-spacing: 0;
}

.footer-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col-title {
  margin: 0;
  color: var(--chrome-text);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1.3;
}

html[lang="ar"] .footer-col-title {
  letter-spacing: 0;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links a {
  display: inline-block;
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-decoration: none;
  line-height: 1.5;
  transition:
    color        var(--dur-fast) var(--ease),
    padding-inline-start var(--dur-fast) var(--ease);
}

.footer-links a:hover {
  color: var(--chrome-text);
  padding-inline-start: 3px;
}

.footer-note {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--chrome-line);
}

.footer-note p {
  margin: 0;
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  line-height: 1.65;
  max-width: 720px;
}

.footer-note strong {
  color: var(--chrome-text-soft);
  font-weight: var(--fw-extrabold);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--chrome-line);
  min-height: 64px;
}

.footer-copyright {
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.footer-legal-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.footer-legal-links a {
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.footer-legal-links a:hover { color: var(--chrome-text); }

.footer-inner-compact {
  width: min(var(--container-max), calc(100% - 40px));
  margin-inline: auto;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;

  padding: var(--space-5) 0;
  color: var(--chrome-text-muted);
  font-size: var(--fs-xs);
}

.footer-inner-compact .footer-legal-links a {
  color: var(--chrome-text-muted);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1024px) {
  .footer-top {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, 1fr);
    gap: var(--space-8);
  }
}

@media (max-width: 850px) {
  .footer-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-8);
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: 520px;
  }
}

@media (max-width: 640px) {
  .site-footer-inner,
  [data-mount="footer"] > .site-footer-inner {
    width: calc(100% - 28px);
    padding-top: var(--space-8);
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding-bottom: var(--space-6);
  }

  .footer-brand { grid-column: auto; }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .footer-legal-links { gap: var(--space-3); }

  .footer-inner-compact {
    width: calc(100% - 28px);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-links a,
  .footer-legal-links a { transition: none !important; }
}

@media print {
  .site-footer,
  [data-mount="footer"],
  .footer-inner-compact {
    display: none !important;
  }
}


/* ============================================================
   10 · DROPDOWN
   ============================================================
   Content surface. Reads --surface, --text, --border so it
   flips with the theme.
   ============================================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-end .dropdown-panel {
  right: 0;
  left: auto;
}

html[dir="rtl"] .dropdown-end .dropdown-panel {
  right: auto;
  left: 0;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: var(--z-overlay);

  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));

  padding: var(--space-2);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);

  transition:
    opacity     var(--dur-base) var(--ease),
    visibility  var(--dur-base) var(--ease),
    transform   var(--dur-base) var(--ease);

  isolation: isolate;
  overflow: hidden;
}

html[dir="rtl"] .dropdown-panel {
  right: auto;
  left: 0;
}

.dropdown-panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-panel > * { position: relative; z-index: 1; }

.dropdown-panel-lg {
  min-width: 320px;
  max-width: min(400px, calc(100vw - 24px));
}

.dropdown-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) var(--space-2);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-sunken);
}

.dropdown-header > .avatar { grid-row: 1 / span 2; }

.dropdown-header-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-header-name {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-header-meta {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-label {
  display: block;
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .dropdown-label {
  letter-spacing: 0;
}

.dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);

  width: 100%;
  padding: var(--space-2) var(--space-3);
  margin: 0;

  background: transparent;
  border: none;
  border-radius: var(--radius-sm);

  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  text-align: start;
  text-decoration: none;
  cursor: pointer;

  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.dropdown-item:hover {
  color: var(--heading);
  background: var(--surface-soft);
}

.dropdown-item:focus-visible {
  outline: var(--focus-outline);
  outline-offset: -2px;
}

.dropdown-item[aria-current="true"],
.dropdown-item.is-active {
  color: var(--blue-700);
  background: var(--blue-50);
  font-weight: var(--fw-bold);
}

html[data-theme="dark"] .dropdown-item[aria-current="true"],
html[data-theme="dark"] .dropdown-item.is-active {
  color: var(--blue-400);
  background: rgba(96, 165, 250, 0.10);
}

.dropdown-item > iconify-icon,
.dropdown-item > svg,
.dropdown-item > i {
  flex: 0 0 18px;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease);
}

.dropdown-item:hover > iconify-icon,
.dropdown-item:hover > svg,
.dropdown-item:hover > i {
  color: var(--blue-600);
}

.dropdown-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item-title {
  color: inherit;
  font-weight: var(--fw-bold);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item-desc,
.dropdown-item-meta {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item-danger { color: var(--danger); }

.dropdown-item-danger > iconify-icon,
.dropdown-item-danger > i { color: var(--danger); }

.dropdown-item-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-soft);
  margin: var(--space-2) 0;
}

.dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  margin: var(--space-2) calc(var(--space-2) * -1) calc(var(--space-2) * -1);
  border-top: 1px solid var(--border-soft);
  background: var(--surface-sunken);
}

.dropdown-footer .dropdown-item {
  padding: 0;
  min-height: auto;
  color: var(--blue-600);
  font-weight: var(--fw-bold);
}

.dropdown-footer .dropdown-item:hover {
  background: transparent;
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 480px) {
  .dropdown-panel {
    min-width: 200px;
    max-width: calc(100vw - 24px);
  }

  .dropdown-panel-lg { min-width: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  .dropdown-panel { transition: none !important; transform: none !important; }
}

@media print {
  .dropdown-panel { display: none !important; }
}


/* ============================================================
   11 · TABS
   ============================================================
   Content surface. Reads --surface, --border, --text so it
   flips with the theme.
   ============================================================ */

.tabs { width: 100%; }

.tabs-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);

  width: 100%;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-list::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);

  padding: var(--space-3) var(--space-4);
  margin: 0;

  background: transparent;
  border: none;

  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;

  transition: color var(--dur-fast) var(--ease);
}

.tab:hover { color: var(--heading); }

.tab[aria-selected="true"] {
  color: var(--heading);
  font-weight: var(--fw-bold);
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: -1px;
  height: 2px;
  background: var(--blue-600);
  border-radius: 2px 2px 0 0;
}

.tab:focus-visible {
  outline: var(--focus-outline);
  outline-offset: -3px;
  border-radius: var(--radius-sm);
}

.tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.tab > i,
.tab > iconify-icon { font-size: 13px; }

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-2);
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  line-height: 1;
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.tab[aria-selected="true"] .tab-count {
  background: var(--blue-100);
  color: var(--blue-700);
}

html[data-theme="dark"] .tab[aria-selected="true"] .tab-count {
  background: rgba(96, 165, 250, 0.20);
  color: var(--blue-400);
}

.tabs-panels {
  padding-top: var(--space-5);
}

.tab-panel {
  display: none;
}

.tab-panel:not([hidden]) {
  display: block;
}

.tab-panel:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .tab { padding: var(--space-3); font-size: var(--fs-xs); }
  .tab > i, .tab > iconify-icon { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .tab, .tab-count { transition: none !important; }
}

@media print {
  .tabs-list { border-bottom: 1px solid #ccc !important; }
  .tab { color: #000 !important; background: transparent !important; }
  .tab[aria-selected="true"] { font-weight: 700; }
  .tab[aria-selected="true"]::after { background: #000 !important; }
  .tab-panel { display: block !important; }
}


/* ============================================================
   12 · PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding: var(--space-1) 0;
}

.pagination-summary {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.pagination-summary strong {
  color: var(--heading);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}

.pagination-prev,
.pagination-next {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);

  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1;
  cursor: pointer;

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

.pagination-prev:hover:not(:disabled),
.pagination-next:hover:not(:disabled) {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .pagination-prev:hover:not(:disabled),
html[data-theme="dark"] .pagination-next:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.pagination-prev:disabled,
.pagination-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-prev > span,
.pagination-next > span:first-child:not(:only-child) {
  display: none;
}

@media (min-width: 640px) {
  .pagination-prev > span,
  .pagination-next > span:first-child:not(:only-child) {
    display: inline;
  }
}

.pagination-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination-link,
.pagination-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);

  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1;
  text-decoration: none;
  font-variant-numeric: tabular-nums;

  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

.pagination-link { cursor: pointer; }

.pagination-link:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .pagination-link:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.pagination-link:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.pagination-current {
  color: var(--text-invert);
  background: var(--blue-600);
  border-color: var(--blue-600);
  font-weight: var(--fw-extrabold);
  cursor: default;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 36px;
  color: var(--text-light);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 1px;
  user-select: none;
}

.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) 0;
}

.load-more .btn {
  min-width: 180px;
  justify-content: center;
}

@media (max-width: 640px) {
  .pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .pagination-list {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination-link,
  .pagination-current {
    min-width: 34px;
    height: 34px;
    font-size: 11px;
  }

  .pagination-list .pagination-link:not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pagination-link,
  .pagination-current,
  .pagination-prev,
  .pagination-next { transition: none !important; }
}

@media print {
  .pagination,
  .load-more { display: none !important; }
}


/* ============================================================
   13 · BREADCRUMB
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--text-light);
  font-size: 11px;
  opacity: 0.6;
}

/* In RTL the separator flips to a mirrored slash so the
   breadcrumb reads along the new text direction. */
html[dir="rtl"] .breadcrumb li + li::before {
  content: "\\";
}

.breadcrumb a {
  color: var(--blue-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.breadcrumb a:hover {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumb [aria-current="page"] {
  color: var(--heading);
  font-weight: var(--fw-bold);
}

@media (max-width: 640px) {
  .breadcrumb {
    margin-bottom: var(--space-4);
    font-size: 11px;
    gap: var(--space-1);
  }
}


/* ============================================================
   14 · PAGE HEADER
   ============================================================ */

.page-head,
.discovery-head,
.my-tasks-head,
.portfolio-head,
.reviews-head,
.notifications-head,
.saved-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;

  margin-bottom: 0;
  padding-bottom: 0;
}

/* In RTL the ring mirrors to the opposite top corner. */
html[dir="rtl"] .page-head::before,
html[dir="rtl"] .discovery-head::before,
html[dir="rtl"] .my-tasks-head::before {
  right: auto;
  left: -110px;
}

.page-head > *,
.discovery-head > *,
.my-tasks-head > * {
  position: relative;
  z-index: 1;
}

.page-head-main,
.discovery-head-main {
  min-width: 0;
  flex: 1 1 320px;
}

.page-head-actions,
.discovery-head-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.page-title,
.discovery-title,
.my-tasks-title,
.portfolio-title,
.reviews-title,
.notifications-title,
.saved-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

html[lang="ar"] .page-title,
html[lang="ar"] .discovery-title,
html[lang="ar"] .my-tasks-title,
html[lang="ar"] .portfolio-title,
html[lang="ar"] .reviews-title,
html[lang="ar"] .notifications-title,
html[lang="ar"] .saved-title {
  letter-spacing: 0;
}

.page-subtitle,
.discovery-subtitle,
.my-tasks-subtitle,
.portfolio-subtitle,
.reviews-subtitle,
.notifications-subtitle,
.saved-subtitle {
  margin: var(--space-2) 0 0;
  max-width: 620px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.65;
}

@media (max-width: 640px) {
  .page-head,
  .discovery-head,
  .my-tasks-head,
  .portfolio-head,
  .reviews-head,
  .notifications-head,
  .saved-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .page-head-actions,
  .discovery-head-actions { width: 100%; }

  .page-head-actions .btn,
  .discovery-head-actions .btn { flex: 1 1 auto; }
}

@media print {
  .page-head::before,
  .discovery-head::before,
  .my-tasks-head::before { display: none !important; }
}


/* ============================================================
   END OF NAVIGATION
   ------------------------------------------------------------
   Verification:

     ✅ Zero raw hex outside the token block, except for the
        deliberate #ffffff on the sidebar CTA and the post
        button, both of which are documented inline as light
        buttons on dark chrome that must stay light in both
        themes.

     ✅ CHROME TOKENS
        Every chrome surface, control, text and divider now
        reads from the --chrome-* family:
          #site-header                → --chrome-bg
          #site-header[data-chrome]   → chrome tokens
          .header-hamburger           → --chrome-input-bg
          .nav-inline .nav-link       → --chrome-text-soft
          .header-action              → --chrome-input-bg
          .header-org-context         → --chrome-input-bg
          .header-identity            → --chrome-input-bg
          .header-guest-actions       → --chrome-text-soft
          .header-search .search-input→ --chrome-input-bg
          .search-icon (chrome variant)→ --chrome-text-muted
          .nav-list .nav-link         → --chrome-text-soft
          .nav-link-icon              → --chrome-text-muted
          #site-sidebar               → --chrome-bg
          .sidebar-context            → --chrome-input-bg
          .drawer-panel               → --chrome-bg
          .drawer-close               → --chrome-input-bg
          .drawer-context             → --chrome-input-bg
          .footer                     → --chrome-bg-deep
          .footer-links a             → --chrome-text-muted

        The chrome stays navy in both themes. That is the fix
        for the header/sidebar going white in dark mode.

     ✅ MOBILE BOTTOM NAV
        The bar itself now reads --surface so it flips with
        the theme. The post button reads --chrome-bg and
        stays navy in both. Its border reads --surface so
        the button appears to lift off the bar in both themes.
        The dark-theme shadow override makes the bar read as
        raised on a dark page.

     ✅ CHROME HOVER / ACTIVE STATES
        Consolidated onto four tokens:
          --chrome-input-bg    resting control background
          --chrome-hover       hovered control background
          --chrome-active      pressed / selected background
          --chrome-line        resting border
          --chrome-line-strong hovered border

     ✅ FIXED — sidebar nav link text was invisible in dark
        mode because it read --border-strong, which flips to
        a dark navy in dark mode. Now reads --chrome-text-soft,
        which is fixed at 78% white and stays readable on the
        navy sidebar in both themes.

     ✅ FIXED — mobile bottom nav was hard-coded
        rgba(255, 255, 255, 0.98) and stayed white in dark
        mode. Now reads --surface, which flips.

     ✅ FIXED — site footer text had ~3.5:1 contrast on the
        navy background because it read --text-light and
        --text-muted. Now reads --chrome-text-soft and
        --chrome-text-muted, which are tuned for navy.

     ✅ FIXED — sidebar CTA button became dark text on dark
        background in dark mode because it read --surface for
        its background and --navy-800 for its text. Now uses
        explicit #ffffff with a documented rationale.

     ✅ FIXED — sidebar context chevron, hamburger, and
        sidebar-context icon mirror in RTL.

     ✅ RTL RULES
        Owned by theme.css:  header offset, sidebar side,
                             drawer slide direction, drawer
                             radii, #main-content margin.
        Owned by this file:  active-state accent bar,
                             hamburger icon, sidebar context
                             chevron, search field padding,
                             search icon position, header
                             count-bubble position, footer
                             decorative rings, breadcrumb
                             separator, page-head ring.
        The split is documented at the top of the file.

     ✅ ARABIC TYPOGRAPHY
        Letter-spacing zeroed on every uppercase-Latin class
        (nav-group-label, sidebar-context-label, footer-col-
        title, footer-brand-note, action-sheet-title,
        dropdown-label, page-title and friends) under
        html[lang="ar"].

     ✅ Preserved: every element, every state, every
        responsive breakpoint, every print rule from the
        previous version. Only the colour tokens changed.

     ✅ NEXT PASS: overlays.css
        #app-splash switches to --chrome-bg-deep.
        The modal busy overlay gets a dark-mode variant.
        The toast region gets a dark-mode-aware surface.
   ============================================================ */


/* ------------------------------------------------------------
   MOBILE BLANK-SPACE FIX
   The head blocks switch to a column flex layout on small
   screens. `flex: 1 1 320px` then meant "320px TALL", which
   rendered as a big empty gap under the title. In a column the
   block must size to its content.
   ------------------------------------------------------------ */
@media (max-width: 850px) {
  .page-head-main,
  .discovery-head-main {
    flex: 0 0 auto;
    width: 100%;
  }
}


/* ------------------------------------------------------------
   HEADER — signed-in chrome: search replaces the logo
   The logo is no longer rendered for signed-in users, and the
   search bar stays visible on small screens, filling the space
   between the menu button and the action icons.
   ------------------------------------------------------------ */
@media (max-width: 850px) {
  #site-header[data-chrome="individual"] .header-search,
  #site-header[data-chrome="organization"] .header-search,
  #site-header[data-chrome="admin"] .header-search {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin-inline: 0;
  }
}

/* Very narrow phones: Messages lives in the bottom nav ("Inbox"),
   so drop the duplicate header icon to give the search bar room. */
@media (max-width: 520px) {
  #site-header[data-chrome="individual"] .header-actions a[href="/messages.html"],
  #site-header[data-chrome="organization"] .header-actions a[href="/messages.html"],
  #site-header[data-chrome="admin"] .header-actions a[href="/messages.html"] {
    display: none;
  }
}
