/* Warraq docs: one stylesheet, phone first, RTL first (logical properties throughout). */

@font-face {
  font-family: "Readex Pro";
  src: url("../fonts/readex-pro-var.woff2") format("woff2");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "Kawkab Mono";
  src: url("../fonts/kawkab-mono-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kawkab Mono";
  src: url("../fonts/kawkab-mono-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f7f4ee;
  --bg-deep: #efe8db;
  --card: #fffdf8;
  --ink: #1f1b16;
  --ink-soft: #3d342b;
  --muted: #6b6358;
  --line: #e4ddd0;
  --line-strong: #d3c8b6;
  --accent: #7a4b1e;
  --accent-strong: #61230d;
  --terra: #9a3e1d;
  --teal: #1e5c67;
  --teal-soft: rgba(30, 92, 103, 0.1);
  --chip: #efe7d8;
  --code-bg: #f1ebe0;
  --mark-bg: #ece2d1;
  --hl: #fff1c2;
  --shadow: 0 18px 50px rgba(54, 39, 24, 0.1);
  --radius: 14px;
  --sans: "Readex Pro", "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --mono: "Kawkab Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --body-w: 340;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f;
    --bg-deep: #1b1813;
    --card: #1f1c16;
    --ink: #ece6da;
    --ink-soft: #d6cebf;
    --muted: #a59c8d;
    --line: #332e25;
    --line-strong: #474034;
    --accent: #e0a86a;
    --accent-strong: #f0c08c;
    --terra: #e48d68;
    --teal: #7cc3cf;
    --teal-soft: rgba(124, 195, 207, 0.1);
    --chip: #2a261e;
    --code-bg: #24201a;
    --mark-bg: #2a261e;
    --hl: #4a3d1a;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --body-w: 300;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16140f;
  --bg-deep: #1b1813;
  --card: #1f1c16;
  --ink: #ece6da;
  --ink-soft: #d6cebf;
  --muted: #a59c8d;
  --line: #332e25;
  --line-strong: #474034;
  --accent: #e0a86a;
  --accent-strong: #f0c08c;
  --terra: #e48d68;
  --teal: #7cc3cf;
  --teal-soft: rgba(124, 195, 207, 0.1);
  --chip: #2a261e;
  --code-bg: #24201a;
  --mark-bg: #2a261e;
  --hl: #4a3d1a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --body-w: 300;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: var(--body-w);
  font-size: 1.0625rem;
  line-height: 1.9;
  overflow-x: hidden;
}
[dir="ltr"] body, body:lang(en) { line-height: 1.7; }
a { color: var(--accent); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
strong, b { font-weight: 600; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

.skip { position: absolute; inset-inline-start: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--bg); padding: 6px 12px; border-radius: 8px; }
.skip:focus { inset-inline-start: 8px; }

/* ── Header ─────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  display: flex; align-items: center; gap: 10px;
  max-width: 1240px; margin: 0 auto;
  padding: 8px max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left));
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 1.2rem; }
.brand .mark { flex: none; }
.top-nav { display: none; gap: 4px; margin-inline-start: 18px; }
.top-nav a { color: var(--ink-soft); text-decoration: none; padding: 4px 12px; border-radius: 999px; font-size: 0.95rem; }
.top-nav a:hover { background: var(--chip); color: var(--ink); }
.top-tools { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid transparent; border-radius: 12px; background: none; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--chip); color: var(--ink); }
.lang { font-size: 0.85rem; color: var(--ink-soft); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; }
.lang:hover { border-color: var(--line-strong); color: var(--ink); }
@media (min-width: 760px) { .top-nav { display: flex; } }

/* ── Buttons and chips ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 20px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}
.btn:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { color: var(--bg); background: var(--accent-strong); border-color: var(--accent-strong); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 11px 2px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink); text-decoration: none; font-size: 0.85rem; line-height: 1.8;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
[dir="ltr"], code, kbd, .chip span[dir="ltr"] { unicode-bidi: isolate; }

/* ── Landing ────────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(900px 380px at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(700px 360px at 0% 110%, color-mix(in srgb, var(--teal) 12%, transparent), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero-in { max-width: 1080px; margin: 0 auto; padding: 44px var(--gutter) 36px; }
.kicker { margin: 0 0 6px; color: var(--terra); font-weight: 500; font-size: 0.95rem; }
.hero h1 { margin: 0; font-size: clamp(2.1rem, 8vw, 3.6rem); line-height: 1.35; font-weight: 650; letter-spacing: 0; }
.hero-lead { margin: 14px 0 0; max-width: 46rem; font-size: clamp(1.08rem, 3.6vw, 1.3rem); color: var(--ink-soft); line-height: 1.95; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; }
.cta .btn { flex: 1 1 200px; }
@media (min-width: 560px) { .cta .btn { flex: 0 0 auto; } }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 30px 0 0; padding: 0; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stats dt { color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.stats dd { margin: 0; font-size: clamp(1.15rem, 4.6vw, 1.6rem); font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; }

.band { border-bottom: 1px solid var(--line); }
.band:nth-of-type(odd) { background: var(--bg-deep); }
.band-in { max-width: 1080px; margin: 0 auto; padding: 44px var(--gutter); }
.band h2 { margin: 0; font-size: clamp(1.45rem, 5vw, 2rem); font-weight: 620; line-height: 1.5; }
.band-lead { margin: 8px 0 24px; color: var(--muted); max-width: 46rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.step-n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 600; font-variant-numeric: tabular-nums; }
.steps h3 { margin: 0; font-size: 1.08rem; font-weight: 600; line-height: 1.6; }
.steps p { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.97rem; line-height: 1.85; }
.step-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }
.path-note { margin: 18px 0 0; color: var(--muted); font-size: 0.95rem; }
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-link:hover { color: inherit; }
.card-media { aspect-ratio: 16 / 10; background: var(--chip); border-bottom: 1px solid var(--line); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-art {
  display: grid; place-items: center; color: var(--accent);
  background:
    repeating-linear-gradient(90deg, transparent 0 27px, color-mix(in srgb, var(--line) 70%, transparent) 27px 28px),
    repeating-linear-gradient(0deg, transparent 0 27px, color-mix(in srgb, var(--line) 70%, transparent) 27px 28px),
    linear-gradient(160deg, var(--card), var(--chip));
}
.card-art .ticon { width: 76px; height: 76px; padding: 14px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: var(--shadow); stroke-width: 1.8; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 0; font-size: 1.2rem; font-weight: 620; font-family: var(--sans); }
.card h3 span { font-family: var(--mono); font-size: 1.02rem; font-weight: 700; }
.card h3 small { color: var(--muted); font-weight: 400; font-size: 0.85rem; margin-inline-start: 4px; }
.card-body p { margin: 6px 0 0; color: var(--ink-soft); font-size: 0.97rem; line-height: 1.85; }
.card-body .card-step { margin-top: auto; padding-top: 10px; color: var(--teal); font-size: 0.82rem; font-weight: 500; }

.value-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .value-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.value-grid li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-inline-start: 4px solid var(--accent); }
.value-grid h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.value-grid p { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.85; }

.compare table { min-width: 620px; }
.compare tbody th { white-space: nowrap; font-weight: 600; }
.compare td:last-child { color: var(--ink); background: color-mix(in srgb, var(--teal-soft) 100%, transparent); }
.compare thead th:last-child { color: var(--teal); }

.story .band-in { max-width: 820px; }
.band .prose h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; font-size: clamp(1.45rem, 5vw, 2rem); }
.story .prose { max-width: none; }

/* The seventh card (and value) fills the last row instead of standing alone. */
@media (min-width: 620px) and (max-width: 979px) {
  .cards > li:last-child:nth-child(odd), .value-grid > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .cards > li:last-child:nth-child(odd) .card-link { flex-direction: row; }
  .cards > li:last-child:nth-child(odd) .card-media { flex: 0 0 50%; aspect-ratio: auto; min-height: 220px; border-bottom: 0; border-inline-end: 1px solid var(--line); }
}
@media (min-width: 980px) {
  .cards > li:last-child:nth-child(3n+1), .value-grid > li:last-child:nth-child(3n+1) { grid-column: 1 / -1; }
  .cards > li:last-child:nth-child(3n+1) .card-link { flex-direction: row; }
  .cards > li:last-child:nth-child(3n+1) .card-media { flex: 0 0 calc((100% - 28px) / 3); aspect-ratio: 16 / 10; border-bottom: 0; border-inline-end: 1px solid var(--line); }
  .cards > li:last-child:nth-child(3n+1) .card-body { justify-content: center; padding: 20px 26px; }
}

/* ── Docs layout ────────────────────────────────────────── */
.doc-grid { max-width: 1240px; margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 1fr); }
.content { min-width: 0; padding: 14px 0 56px; }
.content.narrow { max-width: 760px; margin: 0 auto; padding: 40px var(--gutter) 70px; }
.side { padding-top: 12px; }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.side-box > summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink);
}
.side-box > summary::-webkit-details-marker { display: none; }
.side-box > summary::after { content: "▾"; margin-inline-start: auto; color: var(--muted); font-size: 0.85rem; transition: transform 160ms; }
.side-box:not([open]) > summary::after { transform: rotate(90deg); }
[dir="rtl"] .side-box:not([open]) > summary::after { transform: rotate(-90deg); }
.side-box > summary { flex-wrap: wrap; }
.side-box > summary span[dir="ltr"] { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.side-box > summary small { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.side-box .ticon { color: var(--accent); flex: none; }
.side-nav ul, .side-tools { list-style: none; margin: 0; padding: 0 8px 8px; }
.side-nav ul ul { padding: 0 10px 0 0; }
[dir="ltr"] .side-nav ul ul { padding: 0 0 0 10px; }
.side-nav a, .side-tools a {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 9px;
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; line-height: 1.7;
}
.side-nav a:hover, .side-tools a:hover { background: var(--chip); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--chip); color: var(--accent-strong); font-weight: 550; }
.side-nav details > summary { padding: 5px 10px; cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.side-label { margin: 6px 18px 2px; color: var(--muted); font-size: 0.8rem; border-top: 1px dashed var(--line); padding-top: 8px; }
.side-tools a span { font-family: var(--mono); font-size: 0.86rem; }
.side-tools .ticon { color: var(--muted); }
.toc { display: none; }

@media (min-width: 900px) {
  .has-nav .doc-grid { grid-template-columns: 250px minmax(0, 1fr); gap: 36px; }
  .side { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 72px); overflow: auto; padding: 20px 0 30px; }
  .side-box { background: none; border: 0; }
  .side-box > summary { pointer-events: none; padding: 4px 10px 10px; }
  .side-box > summary::after { display: none; }
  .content { padding-top: 22px; }
}
@media (min-width: 1240px) {
  .has-nav.has-toc .doc-grid { grid-template-columns: 250px minmax(0, 1fr) 210px; }
  .has-toc .toc { display: block; position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 72px); overflow: auto; padding: 26px 0; font-size: 0.86rem; }
  .toc p { margin: 0 0 6px; color: var(--muted); font-weight: 500; }
  .toc ul { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line); }
  .toc ul ul { border: 0; padding-inline-start: 10px; }
  .toc a { display: block; padding: 3px 12px; color: var(--muted); text-decoration: none; line-height: 1.6; }
  .toc a:hover, .toc a.on { color: var(--accent); }
}

.crumb { margin: 0 0 4px; font-size: 0.85rem; color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb a[dir="ltr"] { font-family: var(--mono); }

/* ── Prose ──────────────────────────────────────────────── */
.prose { max-width: 46rem; }
.prose h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.45; margin: 6px 0 4px; font-weight: 640; }
.prose .lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 22px; line-height: 1.9; }
.prose h2 { font-size: 1.42rem; font-weight: 620; line-height: 1.5; margin: 2.1em 0 0.5em; padding-top: 0.6em; border-top: 1px solid var(--line); }
.prose h3 { font-size: 1.16rem; font-weight: 600; line-height: 1.55; margin: 1.7em 0 0.4em; }
.prose h4 { font-size: 1rem; font-weight: 600; margin: 1.4em 0 0.3em; }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 1em; }
.prose ul, .prose ol { padding-inline-start: 1.5em; }
.prose li { margin: 0.25em 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 1.2em 0; padding: 4px 16px; border-inline-start: 4px solid var(--line-strong); color: var(--ink-soft); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose img { border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.prose .anchor { margin-inline-start: 0.35em; color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 120ms; }
.prose :is(h2, h3):hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose dt { font-weight: 600; }
.prose dd { margin: 0 0 0.8em; margin-inline-start: 1.2em; color: var(--ink-soft); }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); padding: 0.05em 0.4em; border-radius: 6px; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 0.4em; background: var(--card); }
pre {
  direction: ltr; text-align: left; position: relative;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 64px 14px 16px; margin: 0 0 1.2em; overflow-x: auto; line-height: 1.7; font-size: 0.86rem;
  -webkit-overflow-scrolling: touch;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; unicode-bidi: plaintext; }
pre .copy {
  position: absolute; top: 8px; right: 8px; font: 500 0.75rem var(--sans); color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; cursor: pointer; opacity: 0.85;
}
pre .copy:hover { color: var(--ink); opacity: 1; }

.table-wrap { overflow-x: auto; margin: 0 0 1.3em; border: 1px solid var(--line); border-radius: 12px; background: var(--card); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.75; }
th, td { padding: 9px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: var(--chip); font-weight: 600; font-size: 0.88rem; color: var(--ink-soft); }
tbody tr:last-child > * { border-bottom: 0; }

.admonition { margin: 1.2em 0; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); border-inline-start: 4px solid var(--teal); }
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { margin: 0 0 4px; font-weight: 600; color: var(--teal); }
.admonition.tip { border-inline-start-color: #3c7a3a; }
.admonition.tip .admonition-title { color: #3c7a3a; }
.admonition.warning, .admonition.caution, .admonition.danger { border-inline-start-color: var(--terra); }
.admonition.warning .admonition-title, .admonition.caution .admonition-title, .admonition.danger .admonition-title { color: var(--terra); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .admonition.tip { border-inline-start-color: #8bc68a; } :root:not([data-theme="light"]) .admonition.tip .admonition-title { color: #8bc68a; } }
:root[data-theme="dark"] .admonition.tip { border-inline-start-color: #8bc68a; }
:root[data-theme="dark"] .admonition.tip .admonition-title { color: #8bc68a; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 46rem; margin: 40px 0 0; }
.pager a { display: flex; flex-direction: column; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; line-height: 1.6; }
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--muted); font-size: 0.78rem; }
.pager .next { text-align: end; grid-column: 2; }
.edit { max-width: 46rem; margin: 18px 0 0; font-size: 0.85rem; }
.edit a { color: var(--muted); }

/* ── Footer ─────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); background: var(--bg-deep); }
.foot-in { max-width: 1080px; margin: 0 auto; padding: 26px var(--gutter) 34px; font-size: 0.9rem; color: var(--muted); }
.foot-brand { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; color: var(--ink-soft); }
.foot-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; }
.foot-tools a { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-soft); text-decoration: none; }
.foot-tools a:hover { color: var(--accent); }
.foot-meta { margin: 0; }
.foot-meta a { color: var(--muted); }

/* ── Search dialog ──────────────────────────────────────── */
dialog.search {
  width: min(680px, calc(100vw - 16px)); max-height: min(78vh, 720px); margin: 8vh auto auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 18px; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  overflow: hidden; flex-direction: column;
}
dialog.search[open] { display: flex; }
dialog.search::backdrop { background: rgba(20, 16, 10, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 1.08rem; padding: 6px 0; }
.search-box input::-webkit-search-cancel-button { display: none; }
.esc { font: 500 0.75rem var(--mono); color: var(--muted); background: var(--chip); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; cursor: pointer; }
.results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.results a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; line-height: 1.65; }
.results a:hover, .results a[aria-selected="true"] { background: var(--chip); }
.results .r-t { font-weight: 550; }
.results .r-s { display: block; color: var(--teal); font-size: 0.75rem; line-height: 1.5; }
.results .r-x { display: block; color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.results mark { background: var(--hl); color: inherit; border-radius: 3px; }
.no-results { margin: 0; padding: 18px; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .top, .side, .toc, .foot, .pager, .edit, dialog { display: none !important; } body { background: #fff; color: #000; } }
[dir="ltr"] .hero-lead, [dir="ltr"] .prose .lead { line-height: 1.7; }
