
:root {
  --bg: #0e1116;
  --panel: #161b22;
  --text: #d8dee9;
  --muted: #8b95a3;
  --link: #88c0d0;
  --link-hover: #b5d8e6;
  --accent: #ebcb8b;
  --rule: #2a313c;
  --code-bg: #0a0d12;
  --hl: #2e3440;
  --warn: #bf616a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Charter", "Iowan Old Style", "Apple Garamond", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
nav.side {
  background: var(--panel);
  border-right: 1px solid var(--rule);
  padding: 24px 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
nav.side h1 {
  font-size: 16px; margin: 0 0 4px 0; color: var(--accent);
  font-family: "Charter", Georgia, serif; font-weight: 600;
}
nav.side .sub { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
nav.side .group { margin-top: 18px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 11px; font-weight: 600; margin-bottom: 6px; }
nav.side a {
  display: block; padding: 4px 8px; color: var(--text);
  text-decoration: none; border-radius: 4px; line-height: 1.3;
}
nav.side a:hover { background: var(--hl); color: var(--link-hover); }
nav.side a.current { background: var(--hl); color: var(--accent); }
main {
  padding: 48px 56px; max-width: 880px;
}
h1, h2, h3, h4 {
  font-family: "Charter", Georgia, serif;
  color: #eceff4; line-height: 1.25;
  margin-top: 1.6em; margin-bottom: 0.6em;
}
h1 { font-size: 30px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-top: 0; }
h2 { font-size: 23px; color: var(--accent); }
h3 { font-size: 18px; }
h4 { font-size: 16px; color: var(--muted); }
p { margin: 0.7em 0; }
a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
code {
  background: var(--code-bg); color: #e5e9f0;
  padding: 2px 6px; border-radius: 3px;
  font-family: "SF Mono", "Menlo", Consolas, monospace;
  font-size: 14px;
}
pre {
  background: var(--code-bg); padding: 14px 16px; border-radius: 6px;
  overflow-x: auto; border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; font-size: 13px; }
blockquote {
  margin: 1em 0; padding: 6px 18px;
  border-left: 3px solid var(--accent); color: #cdd5e0;
  background: rgba(235, 203, 139, 0.04);
}
blockquote p { margin: 0.4em 0; }
table {
  border-collapse: collapse; width: 100%; margin: 1.2em 0;
  font-size: 14px; font-family: -apple-system, system-ui, sans-serif;
}
th, td {
  padding: 7px 10px; border: 1px solid var(--rule);
  text-align: left; vertical-align: top;
}
th { background: var(--panel); color: var(--accent); font-weight: 600; }
tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
hr { border: none; border-top: 1px solid var(--rule); margin: 2em 0; }
ul, ol { margin: 0.6em 0; padding-left: 1.6em; }
li { margin: 0.25em 0; }
strong { color: #eceff4; }
em { color: #d8dee9; }
/* Arabic text — use a serif font that handles vowel marks well */
[lang="ar"], .ar {
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Arabic Typesetting", serif;
  font-size: 1.15em; line-height: 1.85;
  direction: rtl; text-align: right;
}
/* Tag any blockquote that starts with Arabic with the .ar class via JS, or
   manually by paragraph. For now, keep blockquotes LTR; Arabic works fine
   inline since modern fonts handle bidirectional text. */
.frontmatter-summary {
  background: var(--panel); border: 1px solid var(--rule);
  padding: 14px 18px; border-radius: 6px;
  margin: 1.4em 0; font-size: 14px;
  font-family: -apple-system, system-ui, sans-serif;
}
.frontmatter-summary dt { font-weight: 600; color: var(--accent); display: inline; }
.frontmatter-summary dd { display: inline; margin: 0 12px 0 4px; color: var(--text); }
.frontmatter-summary dd::after { content: ""; display: block; }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.rawlink {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 12px; color: var(--muted);
  margin-bottom: 18px; text-align: right;
}
.rawlink a { color: var(--muted); }
.rawlink a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
.rawlink code { font-size: 11px; background: transparent; padding: 0; }
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; max-height: none;
    border-right: none; border-bottom: 1px solid var(--rule); }
  main { padding: 28px 22px; }
}
