/* ==========================================================================
   Musaed (مساعد) — shared stylesheet
   Loaded by every page. legal.css loads AFTER this one on privacy.html and
   terms.html and depends on the tokens + the shared components
   (.btn, .icon, .sprite, .skip-link, .subpage) defined here.
   Static site: no build step, no dependencies, fonts vendored locally.
   ========================================================================== */

/* ------------------------------------------------------------------ fonts
   Arabic and Latin are separate files under one family name. The Arabic
   faces carry a unicode-range so Latin text never pulls the Arabic file.
*/

@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-arabic-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-arabic-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-latin-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("../fonts/plex-latin-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ----------------------------------------------------------------- tokens
   Design locks: dark only, ONE accent hue, exactly two radii. Every grey
   used for text below clears 4.5:1 on --bg — measured, not guessed:
   --text-dim 7.4:1, --text-mute 6.1:1, --text-faint 5.3:1.
*/

:root { color-scheme: dark; }

:root {
  --bg:          #0b0d0c;
  --bg-1:        #111413;
  --bg-2:        #141918;
  --line:        rgb(255 255 255 / 0.07);
  --line-strong: rgb(15 227 125 / 0.26);

  --text:        #f3f5f3;
  --text-dim:    #9aa29b;
  --text-mute:   #8a928c;
  --text-faint:  #7e8781;

  --accent:      #0fe37d;
  --accent-soft: rgb(15 227 125 / 0.09);
  --accent-line: rgb(15 227 125 / 0.20);
  --on-accent:   #07130c;

  /* Deliberately deeper than Discord's own #5865f2 — white label measured
     at 4.99:1 here, 4.60:1 on the brand colour. Scoped to .btn--primary
     only: blurple means "this link goes to Discord", nothing else. */
  --discord:       #5a63d8;
  --discord-hover: #4e56c6;
  --on-discord:    #ffffff;

  --sans: "Plex Arabic", system-ui, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", "Consolas", monospace;

  /* Two radii. No third one, anywhere. */
  --r-sm: 8px;
  --r-md: 14px;

  --side-w: 256px;
  --bar-h:  58px;
  --gutter: clamp(20px, 4vw, 46px);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

/* Deliberately NOT `scroll-behavior: smooth`. A global smooth scroll turns
   the browser's fragment jump on a cold /#commands load into an animation
   that starts after the router has already reset the scroll position, and it
   wins the race — the panel lands with its heading under the sticky bar.
   main.js asks for smooth explicitly where it wants it (nested anchors). */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain overlay: breaks up the flat solid black, invisible at a glance.
   Fixed and non-interactive, so it costs nothing functionally - pure texture. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* Arabic is a connected script — negative tracking breaks the joins. Latin
   and mono get tracking where it helps; Arabic headings never do. */
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.35; }
p  { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
dl, dd, dt { margin: 0; }

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

button { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: absolute;
  inset-inline-start: 50%;
  top: -100px;
  transform: translateX(50%);
  z-index: 100;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-sm);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.icon { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }

/* Visually hidden but still in the accessibility tree. Never swap this for
   display:none on anything that is a control's accessible name. */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .22s var(--ease),
              border-color .22s var(--ease),
              color .22s var(--ease),
              box-shadow .22s var(--ease),
              transform .12s var(--ease);
}

.btn--primary {
  background: var(--discord);
  color: var(--on-discord);
  box-shadow: 0 4px 16px rgb(90 99 216 / 0.22);
}
.btn--primary:hover {
  background: var(--discord-hover);
  box-shadow: 0 6px 22px rgb(90 99 216 / 0.30);
}

.btn--ghost {
  background: rgb(255 255 255 / 0.04);
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--line-strong); color: var(--accent); }

.btn:hover { transform: translateY(-1px); }

/* Solid accent fill. --primary (blurple) stays scoped to Discord destinations;
   this is the green answer for a non-Discord CTA that still has to carry a
   panel — currently just the Pro upgrade link on #pricing. */
.btn--accent {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 4px 16px rgb(15 227 125 / 0.22);
}
.btn--accent:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 22px rgb(15 227 125 / 0.30);
}

.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 40px; padding: 9px 16px; font-size: 0.875rem; }
.btn--sm .btn__logo { width: 16px; height: 16px; }

.btn:active { transform: translateY(1px); }

.btn__logo {
  width: 18px;
  height: 18px;
  flex: none;
  filter: brightness(0) invert(1);
}

/* ------------------------------------------------------------------ modal
   Native <dialog>, opened with .showModal() from main.js. Centered by the
   UA stylesheet; only the box and the backdrop need styling here. Closes
   on Escape for free (native <dialog> behaviour) — main.js adds the
   backdrop-click and the explicit button.
*/
dialog.modal {
  max-width: 400px;
  width: calc(100% - 40px);
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  color: var(--text);

  /* Fades + rises in on .showModal(), reverses on .close() - allow-discrete
     keeps the dialog (and its ::backdrop below) painted in the top layer
     for the exit transition instead of vanishing the instant [open] drops. */
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity .2s var(--ease), transform .2s var(--ease),
              overlay .2s var(--ease) allow-discrete,
              display .2s var(--ease) allow-discrete;
}
dialog.modal[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* The state a browser that supports @starting-style transitions FROM on the
   frame [open] is added - without this the open transition has no "before"
   to animate from and the dialog just appears at its end state. Browsers
   that don't support @starting-style ignore this block and get the same
   instant appearance either way, so this degrades safely. */
@starting-style {
  dialog.modal[open] {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

dialog.modal::backdrop {
  background: rgb(0 0 0 / 0);
  transition: background-color .2s var(--ease),
              overlay .2s var(--ease) allow-discrete,
              display .2s var(--ease) allow-discrete;
}
dialog.modal[open]::backdrop {
  background: rgb(0 0 0 / 0.6);
}
@starting-style {
  dialog.modal[open]::backdrop {
    background-color: rgb(0 0 0 / 0);
  }
}
.modal__kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.modal__title { margin: 0 0 10px; font-size: 1.25rem; }
.modal__body {
  margin: 0 0 22px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* No-JS visitor never sees a button that can't open the dialog; a JS one
   never sees the plain static line sitting under it. Same .no-js/.js split
   as .no-js .filters above. */
.no-js [data-open-modal] { display: none; }
.js .pro-cta-fallback { display: none; }

/* ============================================================== app shell
   Two columns at >=900px: a sticky sidebar and the scrolling main column.
   Below that the sidebar collapses into a sticky header whose nav is a
   horizontally scrollable tab strip — see the phone block near the bottom.
*/

.app {
  display: grid;
  /* minmax(0,1fr), not 1fr: an auto minimum would size the column to the
     tab strip's min-content width and push the whole page sideways. */
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
}

/* ------------------------------------------------------------- sidebar */

.side {
  position: sticky;
  top: 0;
  z-index: 30;
  min-width: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.side__mark { width: 30px; height: 30px; border-radius: var(--r-sm); flex: none; }

.side__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* The terminal caret is the one piece of the old hero wordmark kept — it is
   the mark people recognise the project by. */
.side__caret {
  width: 2px;
  height: 1em;
  background: var(--accent);
  border-radius: 1px;
  animation: caret-blink 1.15s steps(1, end) infinite;
}

@keyframes caret-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

/* ------------------------------------------------------------------ tabs
   Anchors, not buttons: without JS they are plain in-page links to sections
   that are all rendered, so the page still works and still deep-links.
*/

.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.tab:hover { background: rgb(255 255 255 / 0.04); color: var(--text); }

.tab[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* A flat bar, not a third radius - the design lock allows exactly two. */
.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset-inline-start: 3px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--accent);
}

/* ------------------------------------------------------- the phone toggle
   A plain disclosure, not a modal: no focus trap, no scroll lock, no overlay.
   The button owns aria-expanded and the panel is the next element in the DOM.
*/

.side__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.side__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.side__toggle:hover { border-color: var(--line-strong); background: rgb(255 255 255 / 0.04); }

/* Hidden when it cannot work. A control that does nothing is worse than none;
   the footer carries every destination for this case. */
.no-js .side__toggle { display: none; }

/* Three bars from one element: the middle is the box, the outer two are its
   pseudo-elements, so the X state is two transforms and one opacity. */
.side__burger,
.side__burger::before,
.side__burger::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform .22s var(--ease), opacity .16s var(--ease);
}
.side__burger { position: relative; }
.side__burger::before,
.side__burger::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
}
.side__burger::before { top: -6px; }
.side__burger::after  { top: 6px; }

.side.is-open .side__burger { background: transparent; }
.side.is-open .side__burger::before { transform: translateY(6px) rotate(45deg); }
.side.is-open .side__burger::after  { transform: translateY(-6px) rotate(-45deg); }

/* Clipped, not display:none — this is the button's accessible name and it has
   to stay in the accessibility tree. See docs/claude/design-and-invariants.md */
.side__toggle-text {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* --------------------------------------------------------- sidebar footer */

.side__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}
.side__legal a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text-faint);
  transition: color .18s var(--ease);
}
.side__legal a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ main */

.main {
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- topbar
   Desktop only. On phones the sticky tab strip is the navigation and this
   bar's contents move up into the header, so it would just be noise.
*/

.topbar { display: none; }

.topbar__crumb { font-size: 0.875rem; color: var(--text-dim); }

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: status-pulse 2.6s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgb(15 227 125 / 0.5); }
  50%      { opacity: .7; box-shadow: 0 0 0 5px rgb(15 227 125 / 0); }
}

/* Down: no second hue for it, same as everywhere else on this site - the dot
   goes the same muted grey the label text already is, and the pulse stops
   rather than keeping a "the bot is alive and breathing" animation running
   on a badge that is telling you it is not. */
.status--down::before {
  background: var(--text-faint);
  animation: none;
}

.iconlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  color: var(--accent);
  transition: background-color .18s var(--ease);
}
.iconlink:hover { background: var(--accent-soft); }
.iconlink .icon { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- panels
   One tab panel per section. Nothing is hidden until JS says so, so a
   crawler and a no-JS browser both get the whole page.
*/

.panel {
  display: flex;
  flex-direction: column;
}
.panel[hidden] { display: none; }
.js .panel + .panel { border-top: 0; }
.panel + .panel { border-top: 1px solid var(--line); }

.wrap {
  width: 100%;
  max-width: 1160px;
  padding: clamp(44px, 7vw, 88px) var(--gutter) clamp(60px, 8vw, 104px);
}

.wrap--narrow { max-width: 860px; }

/* -------------------------------------------------------------- section */

.shead { max-width: 54ch; }

.shead__title {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.15;
  text-wrap: balance;
}

.shead__title--icon {
  display: flex;
  align-items: center;
  gap: 12px;
}
.shead__title--icon .icon { width: 0.8em; height: 0.8em; fill: var(--accent); }

.shead__lede {
  margin-top: 14px;
  font-size: clamp(0.94rem, 1.5vw, 1rem);
  line-height: 1.85;
  color: var(--text-mute);
}
.shead__lede a { color: var(--accent); border-bottom: 1px solid transparent; }
.shead__lede a:hover { border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background-image: radial-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 100% at 92% -10%, rgb(15 227 125 / 0.12), transparent 58%);
  pointer-events: none;
  animation: hero-glow 9s ease-in-out infinite;
}

@keyframes hero-glow {
  0%, 100% { opacity: .65; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}

.hero__inner {
  position: relative;
  max-width: 1160px;
  padding: clamp(48px, 8vw, 104px) var(--gutter) clamp(44px, 7vw, 88px);
  display: flex;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
}

.hero__content { flex: 1 1 480px; min-width: 0; }

.hero__kicker {
  margin-bottom: 14px;
  font-size: clamp(0.9rem, 1.5vw, 1.05rem);
  font-weight: 600;
  color: var(--accent);
}

/* A real scale jump over the section headings below it - the hero is the
   one place on the page allowed to be this loud. */
.hero__title {
  font-size: clamp(2.6rem, 6.8vw, 4.5rem);
  line-height: 1.08;
  max-width: 15ch;
  text-wrap: balance;
}

.hero__sub {
  margin-top: clamp(18px, 3vw, 30px);
  max-width: 46ch;
  font-size: clamp(0.97rem, 1.6vw, 1.1rem);
  line-height: 1.9;
  color: var(--text-dim);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(26px, 4vw, 40px);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 4vw, 50px);
  margin-top: clamp(36px, 6vw, 60px);
  padding-top: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
}

.fact { display: flex; flex-direction: column; gap: 4px; }
.fact__value { font-size: 1.5rem; font-weight: 600; color: var(--accent); }
/* Digits read as figures, same reasoning as .stat__value and .cmd__name. */
.fact__value bdi { font-family: var(--mono); }
.fact__label { font-size: 0.8rem; color: var(--text-faint); }

/* ------------------------------------------------------------- hero mock
   Decorative only (aria-hidden): a small illustrative "console" showing real
   command names and real features (docs/claude/copy-accuracy.md), not a
   claim about specific logged events. Hidden below 1024px - supplementary,
   not load-bearing content, so a phone hero just doesn't grow one.
*/

.hero__mock {
  display: none;
  flex: 1 1 360px;
  max-width: 420px;
}

@media (min-width: 1024px) {
  .hero__mock { display: block; }
}

.mock {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.04),
    0 30px 60px -30px rgb(0 0 0 / 0.8),
    0 0 0 1px rgb(15 227 125 / 0.05);
  overflow: hidden;
  transform: rotate(-1.1deg);
}

.mock__bar {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.mock__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.mock__dot:first-child { background: rgb(255 255 255 / 0.16); }

.mock__body {
  padding: 20px clamp(18px, 2.4vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mock__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  font-size: 0.86rem;
}
.mock__cmd { font-family: var(--mono); color: var(--accent); unicode-bidi: isolate; }
.mock__arg { color: var(--text-dim); }
.mock__val { font-family: var(--mono); color: var(--text-faint); unicode-bidi: isolate; }

.mock__row--trap {
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px dashed var(--line);
  color: var(--text-faint);
  font-size: 0.78rem;
}

.mock__log {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -6px;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.mock__log .icon { width: 14px; height: 14px; fill: var(--accent); flex: none; }
.mock__log--warn .icon { fill: var(--text-dim); }

/* ----------------------------------------------------------------- cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 14px;
}

.grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: clamp(22px, 3vw, 28px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.035),
    0 18px 34px -26px rgb(0 0 0 / 0.7);
  transition: transform .22s var(--ease),
              border-color .22s var(--ease),
              background-color .22s var(--ease),
              box-shadow .22s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: var(--bg-2);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.05),
    0 22px 40px -22px rgb(0 0 0 / 0.75),
    0 0 0 1px rgb(15 227 125 / 0.06);
}

.card__icon {
  width: 24px;
  height: 24px;
  box-sizing: content-box;
  padding: 10px;
  fill: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  margin-bottom: 14px;
}

.card__title { font-size: 1.06rem; font-weight: 600; line-height: 1.5; text-wrap: balance; }

.card__body {
  margin-top: 10px;
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--text-mute);
}

/* ---------------------------------------------------------------- accent
   The one full-width call-out. Same two radii, same single hue.
*/

.callout {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  background: linear-gradient(120deg, rgb(15 227 125 / 0.07), rgb(17 20 19 / 0) 62%);
}

.callout__copy { max-width: 58ch; }
.callout__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.14rem;
  font-weight: 600;
}
.callout__title .icon { width: 22px; height: 22px; fill: var(--accent); }
.callout__body {
  margin-top: 10px;
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--text-dim);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  padding: 8px 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
}

/* Plex Mono carries no Arabic glyphs — an Arabic chip left on --mono falls
   back part-way through the string and opens a gap mid-word. */
.chip--ar { font-family: var(--sans); }

/* -------------------------------------------------------------- commands */

.filters {
  display: flex;
  gap: 8px;
  margin-top: clamp(22px, 3vw, 32px);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }

/* Nothing filters without JS, so the controls would be dead chrome. */
.no-js .filters { display: none; }

.filter {
  min-height: 44px;
  padding: 9px 17px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s var(--ease),
              border-color .18s var(--ease),
              color .18s var(--ease);
}
.filter:hover { border-color: var(--line-strong); color: var(--text); }

.filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.cmds {
  margin-top: 18px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.03);
  overflow: hidden;
}

.cmd {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 16px clamp(18px, 2.4vw, 28px);
  border-bottom: 1px solid var(--line);
  transition: background-color .16s var(--ease);
}
.cmd:last-child { border-bottom: 0; }
.cmd:hover { background: rgb(15 227 125 / 0.04); }
.cmd[hidden] { display: none; }

/* Latin in RTL prose needs both halves: dir="ltr" isolates the token so the
   leading slash stays on its left, and text-align:end then resolves against
   that ltr direction to put the token on the page's reading edge. */
.cmd__name {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  unicode-bidi: isolate;
  text-align: end;
}

/* Kept for a future Arabic-named command: right-aligns without a dir
   override, and drops --mono because Plex Mono has no Arabic glyphs. */
.cmd__name--ar { font-family: var(--sans); text-align: start; }

/* A Latin token inside a sentence. Deliberately NOT .cmd__name — that class
   means "a registered slash command" and things assert on it. */
.code {
  display: inline;
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--accent);
  unicode-bidi: isolate;
}

.cmd__desc { font-size: 0.86rem; line-height: 1.8; color: var(--text-dim); }

.cmd__scope {
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.cmds__note {
  margin-top: 18px;
  font-size: 0.86rem;
  color: var(--text-faint);
}
.cmds__note a { color: var(--accent); border-bottom: 1px solid transparent; }
.cmds__note a:hover { border-bottom-color: var(--accent); }

/* -------------------------------------------------- dashboard-only systems */

.dashfeat {
  margin-top: clamp(32px, 5vw, 48px);
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

.dashfeat__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.06rem;
  font-weight: 600;
}
.dashfeat__title .icon { width: 22px; height: 22px; fill: var(--accent); }

.dashfeat__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.dashfeat__list li {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ plans
   Two pricing cards, built on the same card visual language (--bg-1, --line,
   --r-md) rather than a <table> — matches how the rest of the page presents
   grouped info (.cmds, .stats) and stays readable in RTL without column
   juggling on phones.
*/

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: clamp(24px, 3vw, 32px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.035),
    0 18px 34px -26px rgb(0 0 0 / 0.7);
  transition: transform .22s var(--ease),
              border-color .22s var(--ease),
              box-shadow .22s var(--ease);
}
.plan:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.05),
    0 22px 40px -22px rgb(0 0 0 / 0.75);
}

.plan--pro {
  border-color: var(--accent-line);
  background:
    radial-gradient(70% 90% at 100% 0%, rgb(15 227 125 / 0.1), transparent 60%),
    var(--bg-1);
}
.plan--pro:hover { border-color: var(--accent); }

.plan__badge {
  position: absolute;
  top: clamp(24px, 3vw, 32px);
  inset-inline-end: clamp(24px, 3vw, 32px);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 700;
  animation: status-pulse 2.6s ease-in-out infinite;
}

.plan__name { font-size: 1.3rem; font-weight: 700; }

.plan__tag {
  margin-top: 6px;
  max-width: 30ch;
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-mute);
}

.plan__price {
  margin-top: 18px;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.plan__price--pending { font-size: 1.1rem; color: var(--text-dim); }

.plan__list {
  margin-top: 20px;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.plan__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  font-size: 0.86rem;
}
.plan__row-label { color: var(--text-dim); }
.plan__row-val {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.plan__delta {
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
/* Arabic in a delta badge falls back part-way through on Plex Mono, same
   reason .chip--ar exists. */
.plan__delta--ar { font-family: var(--sans); }

.plan__note {
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-faint);
}
.plan__note a { color: var(--accent); border-bottom: 1px solid transparent; }
.plan__note a:hover { border-bottom-color: var(--accent); }

.plan .btn { margin-top: 24px; }

/* A compact free-vs-pro table, same div-grid approach as .cmds rather than
   a <table> - matches how the rest of the page presents tabular info and
   needs no separate mobile stack, since every value here is short. */

.compare {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.03);
  overflow: hidden;
}

.compare__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px clamp(14px, 2vw, 24px);
  align-items: center;
  padding: 12px clamp(16px, 2.4vw, 24px);
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  transition: background-color .16s var(--ease);
}
.compare__row:last-child { border-bottom: 0; }
.compare__row:not(.compare__head):hover { background: rgb(15 227 125 / 0.04); }

.compare__head {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-faint);
}

.compare__label { color: var(--text-dim); }

.compare__col {
  min-width: 60px;
  text-align: center;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.compare__col--pro { color: var(--accent); }
.compare__head .compare__col { color: var(--text-faint); font-weight: 700; }
.compare__head .compare__col--pro { color: var(--accent); }
/* Pure-number cells read as figures, same reasoning as .cmd__name's mono
   default; cells holding an Arabic word/phrase stay on --sans. */
.compare__col--mono { font-family: var(--mono); }

/* ------------------------------------------------------------ why musaed
   The "ليش مساعد؟" panel. One .vs block visible at a time (initVersus);
   all rendered so a no-JS visitor stacks them. Reuses .compare but the
   cells here hold sentences, not short values, so the row grid and the
   column alignment are overridden for prose.
*/

.vs { margin-top: clamp(26px, 4vw, 40px); }
.vs[hidden] { display: none; }

.vs__title { font-size: 1.2rem; font-weight: 700; }

.vs__verdict {
  margin-top: 10px;
  max-width: 62ch;
  font-size: 0.92rem;
  line-height: 1.9;
  color: var(--text-dim);
}

.vs .compare { margin-top: 18px; }

.vs .compare__row {
  grid-template-columns: minmax(7rem, 1fr) 1fr 1fr;
  align-items: start;
}

.vs .compare__label { font-weight: 600; color: var(--text); }

.vs .compare__col {
  min-width: 0;
  text-align: start;
  white-space: normal;
  font-weight: 500;
  color: var(--text-dim);
}
.vs .compare__col--pro { color: var(--text); }
.vs .compare__head .compare__col { color: var(--text-faint); font-weight: 700; }
.vs .compare__head .compare__col--pro { color: var(--accent); }

.vs__foot {
  margin-top: 28px;
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text-faint);
}

/* Switching comparison blocks: initVersus toggles [hidden], so a block going
   from display:none back to shown replays this - title, verdict and table
   cascade in. The reduced-motion block's global animation clamp flattens it. */
.vs:not([hidden]) > * {
  animation: vs-in 0.34s var(--ease) both;
}
.vs:not([hidden]) > *:nth-child(2) { animation-delay: 0.06s; }
.vs:not([hidden]) > *:nth-child(3) { animation-delay: 0.12s; }

@keyframes vs-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------- faq
   Native <details>, so it opens with JS off and gets the disclosure
   semantics for free. name="faq" makes it an exclusive accordion where
   supported; where it is not, more than one can sit open. Harmless.
*/

.faq { margin-top: clamp(22px, 3vw, 36px); border-top: 1px solid var(--line); }

.faq__item { border-bottom: 1px solid var(--line); }

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 44px;
  padding: 18px 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color .18s var(--ease);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { color: var(--accent); }

.faq__sign {
  flex: none;
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-faint);
  transition: transform .18s var(--ease), color .18s var(--ease);
}
.faq__item[open] .faq__sign { transform: rotate(45deg); color: var(--accent); }

.faq__a {
  padding: 0 4px 22px;
  max-width: 66ch;
  font-size: 0.92rem;
  line-height: 1.95;
  color: var(--text-dim);
}
.faq__item[open] .faq__a { animation: faq-in .3s var(--ease) both; }

@keyframes faq-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ about */

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(26px, 4vw, 52px);
  align-items: start;
  margin-top: clamp(20px, 3vw, 30px);
}

.prose p {
  font-size: 1rem;
  line-height: 2.05;
  color: var(--text-dim);
  text-wrap: pretty;
}
.prose p + p { margin-top: 18px; }

.community__logo { width: 44px; height: 44px; margin-bottom: 16px; }
.community .btn { margin-top: 22px; }

/* ----------------------------------------------------------------- stats
   #stats is `hidden` on index.html. The markup, its three data-mock values
   and initStats() are all intact — remove the attribute to bring it back.
*/

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
}

.stat {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 26px;
  text-align: center;
}
.stat__icon { width: 24px; height: 24px; fill: var(--accent); margin: 0 auto 12px; }
.stat__value { font-family: var(--mono); font-size: 1.9rem; color: var(--text); }
.stat__label { margin-top: 6px; font-size: 0.85rem; color: var(--text-faint); }

/* ---------------------------------------------------------------- footer
   Carries every tab destination, because without JS the phone toggle is
   hidden and this is the only navigation left.
*/

.foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 20px var(--gutter) 24px;
}

.foot__nav,
.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.foot__nav a,
.foot__links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: 0.8rem;
  color: var(--text-faint);
  transition: color .18s var(--ease);
}
.foot__nav a:hover,
.foot__links a:hover { color: var(--accent); }

.foot__nav .icon,
.foot__links .icon { width: 15px; height: 15px; }

.foot__nav a { color: var(--text-dim); }

.foot__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ================================================================ subpages
   privacy.html / terms.html / 404.html. legal.css builds on this; 404.html
   carries its own small block inline.
*/

.subpage {
  background:
    radial-gradient(85% 55% at 50% 0%, rgb(15 227 125 / 0.07), transparent 70%),
    var(--bg);
  min-height: 100dvh;
}

/* ============================================================== responsive
   Mobile is the base above. Everything below is the widening enhancement.
*/

/* Phone header: brand row, then a scrollable tab strip. Both stay pinned so
   navigation is always one tap away — a tabbed page whose tabs scroll off
   the top strands you inside whichever section you are reading. */
@media (max-width: 899.98px) {
  .side {
    display: block;
    padding: 10px var(--gutter);
  }

  .side__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  /* The dropped menu. Hidden with visibility, not opacity alone — that is
     what keeps its links out of the tab order and the accessibility tree
     while closed. */
  .side__menu {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: min(70dvh, 560px);
    overflow-y: auto;
    padding: 14px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    /* The panel and the page share a background, so without an edge it reads
       as part of the content rather than as something laid over it. */
    box-shadow: 0 18px 34px -18px rgb(0 0 0 / 0.85);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s var(--ease), transform .2s var(--ease),
                visibility 0s linear .2s;
  }

  .side.is-open .side__menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s, 0s, 0s;
  }

  /* The header already carries an invite; a second one in the panel would be
     the same button twice on one screen. */
  .side__foot-invite { display: none; }

  .side__legal { padding-top: 16px; }

  /* 320px is the tightest the bar gets: brand + invite + toggle. Trimming the
     invite here is what keeps it off the toggle. */
  .side__invite { padding-inline: 12px; font-size: 0.8rem; }
}

@media (max-width: 359.98px) {
  .side__invite { padding-inline: 10px; font-size: 0.75rem; gap: 0.35em; }
  .side__brand { gap: 7px; }
  .side__name { font-size: 0.9rem; }
}

@media (min-width: 900px) {
  .app { grid-template-columns: var(--side-w) minmax(0, 1fr); }

  .side {
    display: flex;
    flex-direction: column;
    gap: 26px;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(18px, 2vw, 26px) clamp(14px, 1.6vw, 20px);
    border-bottom: 0;
    border-inline-end: 1px solid var(--line);
  }

  .side__top { padding-inline: 8px; }

  /* No disclosure at this width: the menu is simply the sidebar's body. */
  .side__actions { display: none; }

  .side__menu {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 26px;
    min-height: 0;
  }

  .tabs { flex: none; }
  .tab { padding-inline: 14px; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--bar-h);
    padding: 0 var(--gutter);
    border-bottom: 1px solid var(--line);
    background: rgb(11 13 12 / 0.88);
    backdrop-filter: blur(12px);
  }

  .split { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

  /* One asymmetric beat in an otherwise uniform grid - the closing meta-card
     runs wide instead of tiling like the other nine. CSS-only, no markup
     change: the meta-card is reliably #features' last card. */
  .grid--wide .card:last-child { grid-column: span 2; }
}

/* The command rows only earn three columns once there is room for the
   description to stay readable beside a fixed-width name. Below that they
   stack, which is why .cmd's base state is a single column. */
@media (min-width: 700px) {
  .cmd {
    grid-template-columns: minmax(140px, 175px) 1fr auto;
    gap: clamp(14px, 2vw, 26px);
    align-items: baseline;
    padding-block: 18px;
  }
}

/* ----------------------------------------------------------------- motion
   Opacity and transform only, and nothing scroll-linked that also carries
   .reveal — they would fight over transform.
*/

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .62s var(--ease), transform .62s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

.no-js .reveal { opacity: 1; transform: none; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero::before {
      animation: hero-glow 9s ease-in-out infinite, glow-drift linear both;
      animation-timeline: auto, scroll(root block);
      animation-range: normal, 0 100vh;
    }
  }
}

@keyframes glow-drift {
  to { transform: translateY(30%) scale(1.15); opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .btn:active { transform: none; }
  .card:hover { transform: none; }
  .plan:hover { transform: none; }
  dialog.modal { transform: none; }
  /* ::backdrop isn't reached by the `*, *::before, *::after` rule below -
     it's its own pseudo-element, not one of those two - so its transition
     needs its own line here or reduced motion would still fade it. */
  dialog.modal::backdrop { transition-duration: 0.01ms !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
