/* Mihrab Methods — the documentation site's stylesheet.
 *
 * One file, no JavaScript, no webfonts, nothing from another origin: the
 * same promises the Mihrab site makes about itself. The palette is
 * Mihrab's (branding/IDENTITY.md in the app repository): the green of the
 * icon's tile on the cream of its arch by day, the navy the app's sky
 * settles into after Isha by night.
 */
:root {
  --paper: #FBF8F2;
  --surface: #FFFFFF;
  --surface-2: #F4EEE3;
  --ink: #14231D;
  --ink-soft: #4A5C54;
  --line: #E3DACB;
  --accent: #1F5F4A;
  --accent-strong: #123A2D;
  --accent-wash: rgba(31, 95, 74, .08);
  --tile: #0F4D44;
  --cream: #F2E7D2;
  --code-bg: #F4EEE3;
  --code-ink: #1B2A24;
  --shadow: 0 1px 2px rgba(20, 35, 29, .05), 0 10px 28px -14px rgba(20, 35, 29, .22);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --top: 60px;
  /* Syntax colours, light. */
  --tok-key: #8A3B12;
  --tok-str: #1F6B3A;
  --tok-num: #6B3FA0;
  --tok-com: #7A857F;
  --tok-fn: #1F4E8A;
  --tok-type: #0E6B6B;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F162F;
    --surface: #161E38;
    --surface-2: #1C2541;
    --ink: #EDE6DA;
    --ink-soft: #AEB8CC;
    --line: #283047;
    --accent: #8ED1B5;
    --accent-strong: #B9E6D3;
    --accent-wash: rgba(142, 209, 181, .10);
    --code-bg: #0B1126;
    --code-ink: #E3DED3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -14px rgba(0, 0, 0, .7);
    --tok-key: #F0A97A;
    --tok-str: #9AD8A6;
    --tok-num: #C9A7F2;
    --tok-com: #7D879E;
    --tok-fn: #9DB7E6;
    --tok-type: #7ED3D3;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ── The bar ─────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  background: color-mix(in srgb, var(--paper) 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 { max-width: 1320px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; letter-spacing: -.01em; }
.brand b { font-weight: 650; }
.brand span { font-weight: 450; }
.mark { width: 30px; height: 30px; flex: none; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.top-links { display: flex; gap: 4px; margin-left: auto; }
.top-links a { color: var(--ink-soft); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.top-links a:hover { color: var(--ink); background: var(--accent-wash); }
.top-links .gh { border: 1px solid var(--line); margin-left: 6px; }
.menu { display: none; margin-left: auto; }
.menu summary { list-style: none; cursor: pointer; width: 40px; height: 40px; display: grid; place-content: center; gap: 4px; border-radius: 10px; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.menu[open] summary { background: var(--accent-wash); }
.menu summary span { transition: transform .2s, opacity .2s; }
/* Open, the three bars are a cross: the same button closes it. */
.menu[open] summary span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu[open] summary span:nth-child(2) { opacity: 0; }
.menu[open] summary span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
/* Absolute under the bar, not fixed: the bar's backdrop-filter makes it the
   containing block of anything fixed inside it, so a fixed panel was sized
   to the bar's 60 px and the page showed through (Safari, Chrome, phones). */
.menu-panel {
  position: absolute; top: 100%; left: 0; right: 0;
  height: calc(100vh - var(--top)); height: calc(100dvh - var(--top));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); padding: 12px 20px 40px; border-top: 1px solid var(--line);
}

/* ── The documentation's three columns ──────────────────────────────── */
.shell { max-width: 1320px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 248px minmax(0, 1fr) 220px; gap: 48px; }
.side, .toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 28px 0 40px; }
.side-head { margin: 22px 0 6px; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.side-head:first-child { margin-top: 0; }
.side ul, .toc ul, .menu-panel ul, .foot ul { list-style: none; margin: 0; padding: 0; }
.side-nav a, .menu-panel a {
  display: block; padding: 5px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; font-size: 14.5px; line-height: 1.4;
}
.side-nav a:hover, .menu-panel a:hover { color: var(--ink); background: var(--accent-wash); }
.side-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-wash); font-weight: 600; }
.toc ul { border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--ink-soft); text-decoration: none; font-size: 13.5px; line-height: 1.4; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.doc { min-width: 0; padding: 36px 0 64px; }
.edit { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-soft); }

/* ── The prose ───────────────────────────────────────────────────────── */
.prose { max-width: 760px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: clamp(30px, 3.4vw, 40px); line-height: 1.15; letter-spacing: -.025em; font-weight: 700; margin: 0 0 18px; }
.prose h1 + p { font-size: 18.5px; color: var(--ink-soft); }
.prose h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; margin: 52px 0 12px; padding-top: 6px; }
.prose h3 { font-size: 18.5px; font-weight: 650; margin: 34px 0 8px; }
.prose h4 { font-size: 16px; font-weight: 650; margin: 26px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose strong { font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose blockquote {
  margin: 20px 0; padding: 14px 18px; background: var(--accent-wash); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink);
}
.prose blockquote > :last-child { margin-bottom: 0; }

/* Code */
code, pre { font-family: var(--mono); }
:not(pre) > code {
  font-size: .86em; background: var(--surface-2); border: 1px solid var(--line);
  padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere;
}
.prose a code { color: inherit; }
pre, div.highlight {
  background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.8px; line-height: 1.6;
}
pre { padding: 16px 18px; overflow-x: auto; margin: 0 0 20px; tab-size: 2; }
div.highlighter-rouge { margin: 0 0 20px; position: relative; }
div.highlighter-rouge div.highlight { border: 0; background: none; }
div.highlighter-rouge pre.highlight { margin: 0; }
/* Which language a block is: the class kramdown gives it, written above it. */
div[class*="language-"].highlighter-rouge pre.highlight { padding-top: 30px; }
div[class*="language-"].highlighter-rouge::before {
  position: absolute; top: 8px; right: 12px; font: 600 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--tok-com);
}
div.language-ts::before, div.language-typescript::before { content: "TypeScript"; }
div.language-tsx::before { content: "TSX"; }
div.language-js::before, div.language-javascript::before { content: "JavaScript"; }
div.language-sh::before, div.language-bash::before, div.language-shell::before { content: "Shell"; }
div.language-python::before, div.language-py::before { content: "Python"; }
div.language-swift::before { content: "Swift"; }
div.language-kotlin::before { content: "Kotlin"; }
div.language-dart::before { content: "Dart"; }
div.language-json::before { content: "JSON"; }
div.language-yaml::before { content: "YAML"; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cp, .highlight .cd { color: var(--tok-com); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .kp, .highlight .ow { color: var(--tok-key); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl { color: var(--tok-str); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: var(--tok-num); }
.highlight .nf, .highlight .fm, .highlight .nx + .p + .nx { color: var(--tok-fn); }
.highlight .kt, .highlight .nc, .highlight .nn, .highlight .bp, .highlight .nb { color: var(--tok-type); }
.highlight .na, .highlight .nt { color: var(--tok-fn); }
.highlight .err { color: inherit; background: none; }
.highlight .gd { color: #B4362F; }
.highlight .gi { color: var(--tok-str); }

/* Tables: their own scroller, so a wide one never widens the page. */
.prose table {
  display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0;
  margin: 0 0 22px; font-size: 14.5px; line-height: 1.5; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.prose th, .prose td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td[style*="right"], .prose th[style*="right"] { font-variant-numeric: tabular-nums; }

/* ── The home page ───────────────────────────────────────────────────── */
.home { overflow-x: clip; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
.hero { position: relative; padding: 84px 0 64px; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(31, 95, 74, .16), transparent 60%),
    radial-gradient(700px 380px at 0% 10%, rgba(242, 231, 210, .9), transparent 60%);
}
@media (prefers-color-scheme: dark) {
  .hero::before { background: radial-gradient(900px 420px at 85% -10%, rgba(142, 209, 181, .14), transparent 60%), radial-gradient(700px 380px at 0% 10%, rgba(157, 183, 230, .10), transparent 60%); }
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--accent); background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); padding: 5px 12px; border-radius: 999px; margin: 0 0 20px; }
.hero h1 { font-size: clamp(36px, 5.2vw, 60px); line-height: 1.05; letter-spacing: -.035em; font-weight: 750; margin: 0 0 20px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--ink-soft); margin: 0 0 28px; max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 28px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 15.5px; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--tile); color: var(--cream); box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { background: var(--accent); color: #0B1126; } .btn-primary:hover { background: var(--accent-strong); color: #0B1126; } }
.btn-quiet { color: var(--ink); border-color: var(--line); background: var(--surface); }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }
.install { display: flex; flex-wrap: wrap; gap: 8px 16px; font: 14px/1.4 var(--mono); color: var(--ink-soft); }
.install code { background: none; border: 0; padding: 0; font-size: 14px; color: var(--ink); }
.install span::before { content: "$ "; color: var(--tok-com); }
.hero-code { margin: 0; min-width: 0; }
.hero-code div.highlighter-rouge { margin: 0; box-shadow: var(--shadow); }
.hero-code pre { margin: 0; font-size: 13.5px; }
.hero-code > :not(div) { display: none; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 8px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat b { display: block; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 6px; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }
.stat.good b { color: var(--accent); }
.band { padding: 72px 0; }
.band + .band { padding-top: 0; }
.band h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.025em; font-weight: 700; margin: 0 0 12px; }
.band .sub { color: var(--ink-soft); font-size: 18px; margin: 0 0 32px; max-width: 42em; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 20px;
  color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.card p { margin: 0; font-size: 15px; color: var(--ink-soft); line-height: 1.5; }
.card .go { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--accent); }
.icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.icon svg { width: 20px; height: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.checks li { position: relative; padding-left: 30px; color: var(--ink-soft); }
.checks li b { color: var(--ink); font-weight: 650; }
.checks li::before { content: ""; position: absolute; left: 0; top: .32em; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%231F5F4A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.langs span { font-size: 13.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.note { font-size: 14px; color: var(--ink-soft); }
.prose-home { max-width: 760px; }
.prose-home h2 { font-size: 24px; margin: 0 0 12px; }

/* ── The footer ──────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 24px; }
.is-home .foot { margin-top: 0; }
.foot-in { max-width: 1320px; margin: 0 auto; padding: 44px 20px 20px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.foot-brand p { color: var(--ink-soft); font-size: 14.5px; margin: 14px 0 0; max-width: 30em; }
.foot ul a { color: var(--ink-soft); text-decoration: none; font-size: 14.5px; line-height: 2; }
.foot ul a:hover { color: var(--accent); }
.foot-note { max-width: 1320px; margin: 0 auto; padding: 16px 20px 36px; color: var(--ink-soft); font-size: 13px; }

/* ── Narrower screens ────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr); gap: 40px; }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .side { display: none; }
  .top-links { display: none; }
  .menu { display: block; }
  .doc { padding-top: 24px; }
  .hero { padding: 48px 0 40px; }
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .band { padding: 52px 0; }
}
@media (max-width: 560px) {
  .top-in, .shell, .wrap { padding-left: 16px; padding-right: 16px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .stat b { font-size: 24px; }
  .prose h2 { margin-top: 40px; }
  pre { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top, .side, .toc, .foot, .edit { display: none; } .shell { display: block; } }
