:root {
  --brand-50: #fff1f2;
  --brand-100: #ffe1e4;
  --brand-200: #ffc8ce;
  --brand-300: #ff9ea8;
  --brand-400: #fc6476;
  --brand-600: #dc1a35;
  --brand-700: #b8102a;
  --ink-50: #f8f8f9;
  --ink-100: #f1f1f3;
  --ink-200: #e4e4e8;
  --ink-300: #d1d1d7;
  --ink-400: #a3a3ad;
  --ink-500: #6b6b76;
  --ink-600: #565661;
  --ink-700: #3f3f48;
  --ink-900: #18181d;
}

/*
 * Mulabbe docs site. The :root design tokens are injected by build.mjs from
 * apps/dashboard/src/app/globals.css so the site always matches the product's white + red brand.
 * Logical properties only (margin-inline-start…), so the same sheet serves RTL and LTR pages.
 */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink-900);
  font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, serif;
  font-size: 1.0625rem;
  line-height: 1.9;
}

[lang='en'] { font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif; line-height: 1.7; }

h1, h2, h3, h4, .btn, .site-nav, .brand, .sidebar, .pager, .breadcrumbs, .step-no, .chapter-no {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

h1 { font-size: 2rem; line-height: 1.4; margin: 0 0 0.75rem; }
h2 { font-size: 1.45rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
h4 { font-size: 1rem; margin: 1.25rem 0 0.25rem; }
p { margin: 0 0 0.9rem; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--ink-200); margin: 2rem 0; }
img { max-width: 100%; height: auto; }

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

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -3rem;
  z-index: 20;
  background: var(--brand-600);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem;
  transition: top 120ms ease-out;
}
.skip-link:focus { top: 0; }

.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 16px; }

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--ink-200);
}

.header-row { display: flex; align-items: center; gap: 1.25rem; min-height: 3.5rem; flex-wrap: wrap; padding-block: 0.4rem; }

.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink-900); font-weight: 800; font-size: 1.2rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.6rem; background: var(--brand-600); color: #fff; }
.brand-docs { font-size: 0.8rem; font-weight: 600; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 999px; padding: 0 0.6rem; }

.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a { color: var(--ink-600); font-weight: 600; padding: 0.35rem 0.7rem; border-radius: 0.6rem; }
.site-nav a:hover { color: var(--ink-900); background: var(--ink-50); text-decoration: none; }
.site-nav a[aria-current='page'] { color: var(--brand-700); background: var(--brand-50); }
.lang-switch { border: 1px solid var(--ink-200); }

.nav-toggle { position: absolute; width: 2.2rem; height: 2.2rem; opacity: 0; cursor: pointer; display: none; }
.nav-burger { display: none; width: 2.2rem; height: 2.2rem; padding: 0.55rem 0.45rem; flex-direction: column; justify-content: space-between; cursor: pointer; border-radius: 0.5rem; }
.nav-burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink-700); }
.nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--brand-600); outline-offset: 2px; }

.search { position: relative; margin-inline-start: auto; flex: 0 1 19rem; min-width: 11rem; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink-900);
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 0.35rem 1rem;
}
.search input:focus { background: #fff; border-color: var(--brand-400); outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
#search-results {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 0.4rem);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 0.9rem;
  box-shadow: 0 12px 32px -8px rgb(16 16 24 / 0.18);
  max-height: 60vh;
  overflow: auto;
  min-width: min(26rem, calc(100vw - 32px));
}
#search-results li.empty { padding: 0.6rem 0.9rem; color: var(--ink-500); font-size: 0.9rem; }
#search-results a { display: block; padding: 0.5rem 0.9rem; border-radius: 0.6rem; color: var(--ink-900); }
#search-results a:hover, #search-results a:focus { background: var(--brand-50); text-decoration: none; }
#search-results .r-title { font-weight: 700; font-size: 0.95rem; }
#search-results .r-head { color: var(--brand-700); font-size: 0.85rem; margin-inline-start: 0.5rem; }
#search-results .r-snip { display: block; color: var(--ink-500); font-size: 0.82rem; line-height: 1.6; }

@media (max-width: 860px) {
  .nav-toggle, .nav-burger { display: flex; }
  .nav-toggle { position: static; margin-inline-start: auto; order: 3; }
  .nav-burger { order: 4; margin-inline-start: -2.2rem; }
  .site-nav { display: none; order: 5; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-block: 0.5rem; border-top: 1px solid var(--ink-100); }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .search { order: 6; flex-basis: 100%; margin-block-end: 0.5rem; }
}

/* ---- Landing ---- */

.hero { background: linear-gradient(180deg, var(--brand-50), #fff 70%); border-bottom: 1px solid var(--ink-100); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2.5rem; align-items: center; padding-block: 3.5rem 3rem; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--brand-600); }
.lead { font-size: 1.15rem; color: var(--ink-700); }
.channel-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1.25rem 0; }
.channel-chips li { background: #fff; border: 1px solid var(--ink-200); border-radius: 999px; padding: 0.15rem 0.9rem; font-size: 0.9rem; color: var(--ink-700); }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.btn { display: inline-block; font-weight: 700; border-radius: 0.8rem; padding: 0.6rem 1.5rem; border: 1px solid transparent; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 8px 24px -8px rgb(220 26 53 / 0.45); }
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost { color: var(--brand-700); border-color: var(--brand-200); background: #fff; }
.btn-ghost:hover { background: var(--brand-50); }
.btn-inverse { background: #fff; color: var(--brand-700); }
.btn-inverse:hover { background: var(--brand-50); }

.hero-shot { margin: 0; }
.hero-shot img { display: block; border: 1px solid var(--ink-200); border-radius: 1.125rem; box-shadow: 0 12px 32px -8px rgb(16 16 24 / 0.18); }

.features-band { padding-block: 3rem; }
.features-band h2, .how h2 { font-size: 1.7rem; margin-top: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.feature { background: #fff; border: 1px solid var(--ink-200); border-radius: 1.125rem; padding: 1.25rem 1.25rem 1rem; box-shadow: 0 1px 2px rgb(16 16 24 / 0.04), 0 1px 3px rgb(16 16 24 / 0.06); }
.feature h3 { margin: 0.75rem 0 0.35rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--ink-600); font-size: 0.95rem; }
.feature-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 0.8rem; background: var(--brand-50); color: var(--brand-600); }
.feature-icon svg { width: 1.4rem; height: 1.4rem; }

.how { padding-block: 1rem 3rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; list-style: none; padding: 0; margin: 1.5rem 0 0; counter-reset: step; }
.step { position: relative; background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: 1.125rem; padding: 1.25rem; }
.step-no { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; background: var(--brand-600); color: #fff; font-weight: 800; }
.step h3 { margin: 0.75rem 0 0.35rem; }
.step p { margin: 0; color: var(--ink-600); font-size: 0.95rem; }
.honesty { margin-top: 2rem; padding: 1rem 1.25rem; background: var(--brand-50); border: 1px solid var(--brand-100); border-inline-start: 4px solid var(--brand-600); border-radius: 0.9rem; color: var(--ink-700); }

.cta-band { background: var(--brand-700); color: #fff; text-align: center; padding-block: 3rem; }
.cta-band h2 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.cta-band p { color: var(--brand-100); margin-bottom: 1.5rem; }

/* ---- Docs layout (guide / dev / changelog) ---- */

.docs-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2.5rem; padding-block: 2rem 3rem; align-items: start; }

.sidebar { position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow: auto; border-inline-end: 1px solid var(--ink-100); padding-inline-end: 1rem; }
.sidebar-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-500); margin: 0 0 0.5rem; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0; }
.sidebar a { display: flex; align-items: baseline; gap: 0.5rem; color: var(--ink-600); font-size: 0.92rem; padding: 0.3rem 0.6rem; border-radius: 0.6rem; line-height: 1.5; }
.sidebar a:hover { background: var(--ink-50); color: var(--ink-900); text-decoration: none; }
.sidebar a[aria-current='page'] { background: var(--brand-50); color: var(--brand-700); font-weight: 700; }
.chapter-no { color: var(--ink-400); font-size: 0.8rem; min-width: 1.1rem; }
.sidebar a[aria-current='page'] .chapter-no { color: var(--brand-400); }

.doc-main { min-width: 0; }
.docs-single { grid-template-columns: minmax(0, 1fr); max-width: 56rem; }
.doc-content h1 { border-bottom: 3px solid var(--brand-600); padding-bottom: 0.5rem; }
.doc-content h2 { scroll-margin-top: 5rem; }
.doc-content h2::before { content: ''; display: inline-block; width: 4px; height: 0.9em; background: var(--brand-600); border-radius: 2px; margin-inline-end: 0.6rem; vertical-align: -0.1em; }
.doc-content h3, .doc-content h4 { scroll-margin-top: 5rem; }

.doc-content figure { margin: 1.25rem 0 1.5rem; }
.doc-content figure img { display: block; width: 100%; border: 1px solid var(--ink-200); border-radius: 0.9rem; box-shadow: 0 1px 2px rgb(16 16 24 / 0.04), 0 1px 3px rgb(16 16 24 / 0.06); }
.doc-content figcaption { font-size: 0.85rem; color: var(--ink-500); text-align: center; margin-top: 0.4rem; }

.doc-content ul, .doc-content ol { margin: 0 0 0.9rem; padding-inline-start: 1.6rem; }
.doc-content li { margin-bottom: 0.25rem; }

.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }
.doc-content table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.doc-content th, .doc-content td { border: 1px solid var(--ink-200); padding: 0.45rem 0.7rem; text-align: start; vertical-align: top; }
.doc-content th { background: var(--brand-50); font-family: 'Cairo', sans-serif; }

code { font-family: Consolas, 'Courier New', monospace; font-size: 0.86em; background: var(--ink-50); border: 1px solid var(--ink-200); border-radius: 4px; padding: 0 0.3em; unicode-bidi: embed; }
pre { background: var(--ink-900); color: var(--ink-50); border-radius: 0.9rem; padding: 1rem 1.25rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.7; text-align: left; }
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

aside.tip { margin: 1rem 0 1.25rem; padding: 0.8rem 1.1rem; background: var(--brand-50); border: 1px solid var(--brand-100); border-inline-start: 4px solid var(--brand-600); border-radius: 0.7rem; }
aside.tip > :last-child { margin-bottom: 0; }

.breadcrumbs { font-size: 0.88rem; margin-bottom: 1.25rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: '›'; color: var(--ink-400); margin-inline-end: 0.35rem; }
[dir='rtl'] .breadcrumbs li + li::before { content: '‹'; }
.breadcrumbs a { color: var(--ink-500); }
.breadcrumbs [aria-current='page'] { color: var(--ink-700); font-weight: 600; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--ink-200); padding-top: 1.25rem; }
.pager a { display: flex; flex-direction: column; max-width: 48%; color: var(--ink-900); border: 1px solid var(--ink-200); border-radius: 0.9rem; padding: 0.7rem 1.1rem; }
.pager a:hover { border-color: var(--brand-300); background: var(--brand-50); text-decoration: none; }
.pager-next { margin-inline-start: auto; text-align: end; }
.pager-kind { font-size: 0.78rem; color: var(--ink-500); }
.pager-title { font-weight: 700; font-size: 0.95rem; color: var(--brand-700); }

.content-note { background: var(--ink-50); border: 1px dashed var(--ink-300); border-radius: 0.9rem; padding: 1rem 1.25rem; color: var(--ink-600); }

.doc-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.75rem; }
.doc-list a { display: block; border: 1px solid var(--ink-200); border-radius: 0.9rem; padding: 0.8rem 1.1rem; color: var(--ink-900); }
.doc-list a:hover { border-color: var(--brand-300); background: var(--brand-50); text-decoration: none; }
.doc-list .doc-title { font-weight: 700; font-family: 'Cairo', sans-serif; }
.doc-list .doc-sub { display: block; color: var(--ink-500); font-size: 0.88rem; }

/* ---- Footer ---- */

.site-footer { border-top: 1px solid var(--ink-200); background: var(--ink-50); margin-top: 3rem; }
.footer-row { padding-block: 1.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--ink-600); font-size: 0.92rem; font-weight: 600; }
.site-footer p { margin: 0; color: var(--ink-500); font-size: 0.88rem; }
.version { color: var(--ink-600); font-weight: 600; unicode-bidi: embed; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; padding-block: 2.5rem 2rem; }
  .docs-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  /* On small screens the chapter list moves below the article; prev/next stays the primary navigation. */
  .sidebar { order: 2; position: static; max-height: none; border-inline-end: 0; border-top: 1px solid var(--ink-200); padding-top: 1.25rem; }
  .doc-main { order: 1; }
}

@media print {
  .site-header, .site-footer, .sidebar, .pager, .breadcrumbs, .skip-link { display: none; }
  body { font-size: 11pt; }
  .hero, .cta-band { background: #fff; color: var(--ink-900); }
  a { color: var(--ink-900); text-decoration: underline; }
  pre { background: #fff; color: var(--ink-900); border: 1px solid var(--ink-300); }
}
