@font-face{
  font-family:Qamus;
  src:url(fonts/qamus.woff2?v=1795940271) format("woff2");
  font-weight:400;font-style:normal;
  /* optional, not block or swap. Every page here is pure text, so:
       swap  -> paints system mono first, repaints when Qamus lands = flicker
                on every navigation, since these are separate documents.
       block -> paints NOTHING until the font resolves. On an all-text page that
                is a blank screen, and first-contentful-paint never even fires
                — measured: FCP was null on every click navigation. That reads
                as a a full second of lag.
       optional -> ~100ms block period, then the fallback for that pageview with
                NO later swap. With the <link rel=preload> below and a cached
                font it resolves in ~3ms, so the real font is what paints; when
                it cannot, the page still paints instantly and never flashes.
     The layout cannot shift either way: --c is rem-based, never `ch`. */
  font-display:optional;
}

/* The masthead art and wordmarks are pixel drawings authored on Kawkab's
   0.7em cell. They are set in their own one-glyph font (Kawkab's █, built by
   sitefont.py) so their proportions stay exact; see .art/.mark/.logo. */
@font-face{
  font-family:QamusDraw;
  src:url(fonts/draw.woff2?v=1795940271) format("woff2");
  font-weight:400;font-style:normal;
  font-display:block;      /* 1KB and preloaded; never paint the art in a fallback */
}

/* قاموس — a text-mode interface.
   Every visible mark on this page is a character. There are no CSS borders,
   no backgrounds, no rounded corners, no shadows. CSS positions text; it never
   draws. Structure comes from rules, indentation and blank lines. */
:root{
  --ink:#000;
  --bg:#fff;
  --hover:#006400;        /* dark green — the only colour on the page */
  --c:.66rem;             /* ONE CELL. Readex Mono Wide's advance is 660/1000
                             upem, so 1 cell = 0.66em ≈ 12.9px at the 19.5px
                             root.
                             Deliberately not `ch`: `ch` resolves against
                             whatever font has loaded and reflows on swap. */
  --lh:1.7;               /* >=1.6 or shadda+fathatan clips. Non-negotiable. */
  --cem:.66;               /* the cell as a bare number of em, for calc()s
                             that need to divide by it (see .map below) */
}

*{box-sizing:border-box;margin:0;padding:0}

html{
  /* ONE font size. Nothing on this site is larger or smaller than this. */
  /* 19.5px: Readex's Arabic body matched to Kawkab's at 16px, then x1.125
     (the site was enlarged on 2026-11-29). */
  font:400 19.5px/var(--lh) Qamus,ui-monospace,monospace;
  font-synthesis:none;              /* one weight — never let the browser fake one */
  background:var(--bg);color:var(--ink);
  -webkit-text-size-adjust:100%;
}
body{
  position:relative;                /* anchor for the out-of-flow wordmark */
  max-width:calc(116*var(--c));   /* 112 cells of content + 2 cells padding a side.
                                     The GRID still measures 104 (5 name columns
                                     of 20 + 4 gaps of 1) and stays centred; the
                                     extra 8 cells are breathing room at the
                                     edges, where the pinned top block and the
                                     wordmark share a line. On the فصحى pages the
                                     framed map is 40 cells wide and that pair
                                     came within one cell of touching.

                                     Ceiling is 124 content cells, NOT a matter
                                     of taste: at 125 the .cols auto-fill fits a
                                     SIXTH column (6*20 + 5 = 125) and the whole
                                     index reflows into a different shape.
                                     The masthead art is 100 and sits inside. */
  margin-inline:auto;
  padding:calc(3*var(--lh)*1rem) calc(2*var(--c))   /* three lines above the title */;
}

/* Headings are structural, not typographic: same size, same weight as body. */
h1,h2,h3,h4{font-size:1rem;font-weight:400;line-height:var(--lh)}

/* ── the only interaction on the site ── */
a{color:inherit;text-decoration:none}
a:hover,a:focus-visible{color:var(--hover)}
a:focus-visible{outline:2px solid var(--hover);outline-offset:2px}
/* No pseudo-element gutter on links: it prepended a one-cell figure space to
   every <a>, including the one wrapping the logo art, which shoved that art's
   first line exactly one cell sideways. Focus uses an outline instead, which
   paints outside the box and so cannot move anything on the grid. */

/* ── rules. A long run of box characters clipped to the container, so it fills
      any width without being padded to a character count — which cannot be done
      reliably in Arabic anyway: tashkeel has zero advance and لا is two
      codepoints in one cell, so counting characters never matches cells.
      Box characters are bidi class ON and reorder in RTL, hence the isolate. ── */
.r,.rr{
  display:block;overflow:hidden;white-space:nowrap;
  unicode-bidi:isolate;direction:ltr;
  height:calc(var(--lh)*1rem);
  -webkit-user-select:none;user-select:none;
}

/* ── a section head sits inside its rule: ─── عنوان ─────────── ── */
.head{display:flex;align-items:baseline;gap:var(--c);white-space:nowrap}
.head .r{flex:1;min-width:0}          /* min-width:0 or the rule run refuses to
                                         shrink and pushes the row off-page —
                                         and in RTL that overflow goes LEFT,
                                         where nobody ever finds it. */
.head .n{flex:none}


.ind{padding-inline-start:calc(2*var(--c))}

/* ── search: a framed TUI field, drawn entirely in box characters.
      The frame is generated to exact cell counts in build.py, so the corners,
      the side bars and the rules all land on the same grid. ── */
/* One line above, none below: the result count under the field already
   supplies the line that separates it from the register. */
.find{width:calc(60*var(--c));margin-block:calc(var(--lh)*1rem) 0;margin-inline:auto}
/* The rules are pure box characters — bidi ON, so isolate with an explicit
   direction or the corners swap ends. line-height 1 makes them tile against
   the field row instead of floating in a tall line box. */
.fr{unicode-bidi:isolate;direction:ltr;white-space:pre;line-height:1;
    -webkit-user-select:none;user-select:none}
.fm{display:flex;align-items:center;line-height:var(--lh);height:calc(var(--lh)*1rem)}
/* The bar's ink is 1.166em but the row is 1.7em, so it would leave a gap at
   each end. Stretching the glyph vertically bridges it and keeps the frame a
   character rather than a CSS border. */
.fb{flex:none;unicode-bidi:isolate;direction:ltr;display:inline-block;
    transform:scaleY(1.5);-webkit-user-select:none;user-select:none}
.find input{
  flex:1;min-width:0;
  font:inherit;color:inherit;background:none;border:0;padding:0;outline:none;
  padding-inline:var(--c);          /* keep the text off the side bars */
}
.find input::placeholder{color:currentColor;opacity:.4}

/* Every frame exists twice, generated at build time: full width (.sw) and a
   24-cell phone version (.sn). A drawn frame cannot be squeezed by CSS
   without coming off the character grid, so the narrow screen gets its own. */
.sn{display:none}

/* ── completion popup. It lives INSIDE the frame: the box grows a ├───┤ and
      the rows sit above the closing └───┘, so the whole thing reads as one
      continuous drawn box rather than a panel floating over the page.
      Rows are pre-padded to exact cells in build.py — the browser cannot
      measure shaped Arabic, so it never computes a width here. ── */
.sug{list-style:none;margin:0;padding:0}
.sug li{
  display:flex;align-items:center;white-space:pre;line-height:var(--lh);
  height:calc(var(--lh)*1rem);cursor:pointer;
}
.sug .mk{flex:none;unicode-bidi:isolate;direction:ltr}
.sug .tx{flex:1;min-width:0;white-space:pre}
.sug li.on{color:var(--hover)}
/* Focus turns the whole field green — frame, label and text together. The
   frame is the focus indicator, so no separate outline is needed. */
.find:focus-within{color:var(--hover)}

/* ── word page ── */
.qir{list-style:none}
/* Tashkeel has ZERO advance, so every vocalisation of a rasm is exactly as wide
   as the bare rasm. This column self-aligns with no layout code at all. */
.qw{display:inline-block;width:calc(10*var(--c))}
.qn{display:inline-block;width:calc(3*var(--c))}
.geo{list-style:none}
/* Rows in نفسه في / يختلف في are padded with real spaces to exact cell counts,
   so the whitespace has to survive. */
.geo li{white-space:pre}
.gp{display:inline-block;width:calc(18*var(--c))}
.gl{display:inline-block;width:calc(7*var(--c))}
.gm{display:inline-block;width:calc(6*var(--c));unicode-bidi:isolate;direction:rtl}
.ga{display:inline-block;width:calc(11*var(--c))}

/* Latin/Arabizi inside Arabic prose, or its trailing punctuation flies to the
   far end of the line. */
.lat{unicode-bidi:isolate;direction:ltr}

.sub{text-align:center}
/* The result count sits under the field and shares its centring, so it has a
   fixed place instead of drifting at the start edge. */
#stat{text-align:center}
.dim{opacity:.55}

/* ── revision history: collapsed to one line, expandable. <details> gives this
      for free with no JS, and the disclosure marker is a character like
      everything else on the page. ── */
.hist summary{white-space:pre;cursor:pointer;list-style:none}
.hist summary::-webkit-details-marker{display:none}
.hist summary::before{content:"\25B8 "}          /* ▸ */
.hist[open] summary::before{content:"\25BE "}    /* ▾ */
.hist summary:hover{color:var(--hover)}
.revs{list-style:none;padding-inline-start:calc(2*var(--c))}
.revs li{white-space:pre}
/* The art carries the wordmark visually; this carries it for a screen reader,
   and becomes the visible title when the art steps aside on a narrow screen. */
.vh{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* ── the masthead art. @ and space are both bidi class ON: inside dir=rtl an
      un-isolated run of neutrals takes the paragraph direction and the whole
      block renders mirrored. Isolating it with an explicit ltr renders it
      exactly as authored, so the source file needs no pre-flipping. ── */
.art{
  /* <pre> carries a UA rule font-family:monospace that targets the element
     directly and so beats the inherited value from html. Without this the art
     silently renders in the system mono instead of the site font,
     and a 100-char line comes out 961px inside a 1120px box. */
  font:inherit;
  unicode-bidi:isolate;direction:ltr;
  white-space:pre;line-height:1;          /* the art is its own grid, 1 row = 1 line */
  overflow:hidden;                        /* never let it force a scrollbar */
  width:calc(100*var(--c));margin-inline:auto;   /* 104-100 = 4 cells -> 2 a side */
  margin-block-end:var(--lh)rem;
  -webkit-user-select:none;user-select:none;
}

/* The small wordmark standing in for the masthead on the index. Same file the
   dialect pages use in the corner, so the two never drift apart. Hidden until
   the masthead no longer fits — see the narrow-mode block at the end. */
.mark{
  font:inherit;                            /* same <pre> UA trap as .art */
  unicode-bidi:isolate;direction:ltr;
  white-space:pre;line-height:1;
  width:max-content;margin-inline:auto;
  margin-block-end:calc(var(--lh)*1rem);
  display:none;
  -webkit-user-select:none;user-select:none;
}

/* ── the register: one reflowing grid of fixed-width name cells.
      Each column is an exact multiple of the cell, so the columns land on the
      character grid at every viewport width; auto-fill drops from 5 columns to
      1 without ever breaking the alignment. ── */
.cols{
  display:grid;
  grid-template-columns:repeat(auto-fill,calc(20*var(--c)));
  column-gap:var(--c);                     /* one clear cell between columns */
  justify-content:center;                  /* centre the filled columns in the box */
  white-space:pre;                         /* keep the padding spaces */
}
.cols > *{display:block}

/* ── navigation is a plain document load, deliberately ────────────────────
   There is no View Transitions API here, and the dialect name still does not
   move: every page renders the SAME grid, so the name already occupies an
   identical box on both sides. checktransition.py measures this on every
   dialect at three widths and two zooms — it holds to under 0.75px. The
   stillness comes from the layout, never from an animation.

   @view-transition was removed rather than merely zeroed. It cross-faded the
   page, which was not wanted, and it broke the selected dialect's rules: an
   element with a view-transition-name is captured as a snapshot painted in
   the ::view-transition tree in the TOP LAYER, where .cols{overflow:hidden}
   — an ancestor in the ordinary DOM — no longer clips it. So the 80-character
   ::before/::after runs flanking the name painted at full length, spanning
   the whole viewport for the duration of the animation and snapping back at
   the end. Nothing clips a snapshot; the only fix is not to take one. ────── */

/* ── the wordmark, top of every page. In RTL the reading start is the right,
      so this sits top-right. Same <pre> font-inheritance trap as .art. ── */
.logo{
  font:inherit;
  unicode-bidi:isolate;direction:ltr;
  white-space:pre;line-height:1;
  width:max-content;                 /* exact: fit-content rounds 235.2 down to 235 */
  /* Out of flow, so it adds no height on dialect pages and the grid sits at the
     same y as on the index. It overlays the reserved (invisible) masthead. */
  /* PHYSICAL right, not inset-inline-start: the logical property resolves
     against this element's OWN direction, which the line above forces to ltr so
     the art does not reorder — so inset-inline-start lands on the LEFT. The page
     is always RTL and the wordmark always belongs top-right; say so directly. */
  position:absolute;top:calc(3*var(--lh)*1rem);right:calc(2*var(--c));
  -webkit-user-select:none;user-select:none;
}
.logo a{display:block;color:inherit}
.logo a:hover{color:var(--hover)}
.entry p{white-space:pre}
/* ...except the dialect metadata line, which is prose, not a padded grid
   row. Chadian Arabic's runs to 153 cells against 112 available, and
   white-space:pre sent the overflow off the LEFT edge — in RTL that is
   where nobody ever looks. Higher specificity than .entry p, or the pre
   above wins. */
.entry .meta{white-space:normal;text-align:center;text-wrap:balance}
.entry .sec{color:var(--ink);unicode-bidi:isolate;direction:ltr;
  text-align:start;-webkit-user-select:none;user-select:none}
.entry .ind{padding-inline-start:calc(2*var(--c))}

/* ── framed boxes, same drawing idiom as the search field ── */
/* The map and the boxes, pinned to the top-LEFT corner as the mirror of the
   wordmark at the top-right. Absolute for the same reason the wordmark is: in
   normal flow this block would sit above the dialect name and push the grid
   down, so the name would no longer land on the pixel it occupies on the
   index. RTL, so the first child (.boxes) is the RIGHT one and the map falls
   to its left. Physical `left`, not inset-inline-start — the children force
   direction:ltr and the logical property would resolve against that. */
.top{position:absolute;top:calc(3*var(--lh)*1rem);left:calc(2*var(--c));
  display:flex;gap:calc(2*var(--c));align-items:flex-start}
.boxes{display:flex;flex-direction:column;gap:calc(var(--lh)*1rem)}
.box{width:calc(38*var(--c))}
.box.nb{width:calc(24*var(--c))}   /* phone version, see BOXW_N */
.boxes.bn{display:none}   /* MUST equal BOXW in build.py: the rows are
     pre-padded to exact cells, so a wider container would stretch the flex
     row and pull the closing │ off the grid. */
.bl{display:flex;align-items:center;line-height:var(--lh);
    height:calc(var(--lh)*1rem)}
.bx{flex:1;min-width:0;white-space:pre}   /* no clipping: pre-padded to width */

/* ── region map: rendered to the character grid at build time ── */
.map{font:inherit;unicode-bidi:isolate;direction:ltr;white-space:pre;line-height:1;
  width:max-content;-webkit-user-select:none;user-select:none}

/* ── the selected dialect, flanked by rules — same idiom as the search
      field's top line. Both runs are absolutely positioned, so they add no
      inline space and cannot shift the cell off the grid; .cols clips them. ── */
.cols{position:relative;overflow:hidden}
.sel{position:static}
.sel .w{position:relative}
.sel .w::before,.sel .w::after{
  /* 130 cells, not 80. These runs are clipped to .cols, so their VISIBLE
     end is the container edge — but only if the run is long enough to
     reach it. At 80 the rule fell short for any dialect whose name sits
     near one end of the grid, so where the line stopped depended on the
     dialect's index. 130 > the 112-cell content box, so every rule now
     overflows and is clipped at exactly the same place: the content edge,
     which is where the pinned map box starts. Absolutely positioned, so
     the extra length costs no layout. */
  content:"──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
  position:absolute;top:0;white-space:pre;
  unicode-bidi:isolate;direction:ltr;pointer-events:none;
}
.sel .w::before{right:100%;padding-inline-end:var(--c)}   /* runs off to the left  */
.sel .w::after {left:100%; padding-inline-start:var(--c)} /* runs off to the right */

/* ── etymology ────────────────────────────────────────────────────────── */
.tree p{white-space:pre;margin:0}
.tree .cg{white-space:normal;display:inline-block;vertical-align:top;
  max-width:calc(46*var(--c))}   /* wraps inside the row, does not stretch it */
.tree .arrow{color:var(--ink);opacity:.5}
/* Only the padded COLUMN rows want pre. The gloss is prose and must wrap, or
   it becomes one 4800px line and drags the whole page sideways. Note the class
   is namespaced: bare .gl is the geography "level" column elsewhere. */
.tree .etym-gloss{white-space:normal;display:block;
  padding-inline-start:calc(2*var(--c));max-width:calc(74*var(--c))}
.hyp{margin-block:var(--lh)rem}
.hyp .rank{color:var(--ink);opacity:.55}
.hyp p{max-width:78ch}
.note{padding-inline-start:calc(3*var(--c));max-width:76ch}
.bib p{max-width:82ch;margin-block-end:calc(var(--lh)*.25rem)}
.bib .bn{display:inline-block;width:calc(4*var(--c))}
.bib .lat{unicode-bidi:isolate}
h4{color:var(--ink);opacity:.6;margin-block:var(--lh)rem calc(var(--lh)*.4rem)}

/* ── narrow mode ──────────────────────────────────────────────────────────
   1413px is not arbitrary. Pinned to opposite corners, the top block and the
   wordmark need 42 (framed map) + 2 + 38 (boxes) + 21 = 103 cells, which with
   padding at the 12.9px cell is ~1400px. Below that they would collide, so both come OUT of the
   corners and back into normal flow, stacked in one column.

   That does mean the dialect name no longer lands on its index pixel below
   this width — the top block is in the flow there, so it pushes the grid down
   on a dialect page and not on the index. Deliberate: reserving 14rem of empty
   space at the top of a narrow index to preserve a transition nicety would cost
   the reader an entire screen. checktransition.py only asserts the invariant
   above the breakpoint, and says so. ────────────────────────────────────── */
@media (max-width:1413px){
  /* Below the masthead's own 100 cells there is no honest way to show it on
     the grid — but it does NOT have to fall all the way to plain text. It
     steps down to the same 21-cell wordmark the dialect pages carry, which is
     still drawn, still on the grid, and fits anything wider than ~258px. */
  .art{display:none}
  .mark{display:block}

  /* Out of the corner and into the flow. Absolute positioning here read as a
     sticky wordmark sitting on top of the content. */
  .logo{position:static;margin-block-end:calc(var(--lh)*1rem)}
  .top{
    position:static;
    flex-direction:column;                 /* map, then the two boxes */
    align-items:flex-start;
    gap:calc(var(--lh)*1rem);
    margin-block-end:calc(var(--lh)*1rem);
  }
  /* DOM order is boxes-then-map, because side by side in RTL the first child is
     the RIGHT one. Stacked, the map has to climb back to the top. */
  .top .map{order:-1}
  /* The widest map is 42 cells (~470px) and the boxes 38 (~425px). Neither can
     reflow — they are fixed character grids — so on a phone they scroll inside
     their own box rather than dragging the whole page sideways, which in RTL
     scrolls off to the left where nobody looks. */
  .top .map,.top .boxes{max-width:100%;overflow-x:auto}
  /* The map is a picture drawn in characters, so unlike a text frame it CAN
     shrink: scale its font until its --mw cells (set per map in build.py)
     fit the screen. min() so it only ever gets smaller, never larger. */
  .map{font-size:min(1rem,calc((100vw - 4*var(--c)) / (var(--mw,42) * var(--cem))))}
  /* The word page's padded tables (etymology tree, cognates, readings,
     revisions, sources) are fixed character grids up to ~70 cells wide.
     On anything narrower they scroll inside their own box instead of
     widening the page — a wider page makes a phone zoom the whole site out. */
  .tree,.geo,.qir,.revs,.bib{max-width:100%;overflow-x:auto}
  /* the revision summary is one long padded line and a <summary> can't be
     a scroll box: let it wrap, keeping its runs of spaces */
  .hist summary{white-space:pre-wrap}
}
/* Below this the 60-cell search frame and the 38-cell boxes no longer fit
   (60 cells + 4 of padding at the 12.9px cell ≈ 827px), so the generated
   24-cell versions take over. */
@media (max-width:827px){
  .sw{display:none}
  .sn{display:inline}
  .find{width:calc(24*var(--c))}
  .boxes.bw{display:none}
  .boxes.bn{display:flex}
}
@media (max-width:643px){
  body{padding-inline:var(--c)}
  /* (The search frame used to be clipped here. It now has a generated
     24-cell phone version — see the 827px block above.) */
  .ind{padding-inline-start:var(--c)}    /* one cell of indent, not two */
}

/* Last resort. The 21-cell wordmark needs ~270px plus a cell of padding a
   side, so this only fires below ~295px — narrower than any shipping phone. Only then
   does the wordmark become plain text, and only on the index: a dialect page
   already shows قاموس in .logo, and its .vh holds the DIALECT name, so
   unhiding it there would print that name twice. */
@media (max-width:295px){
  .mark{display:none}
  html:not(.dialect) .vh{position:static;width:auto;height:auto;margin:0;
    clip-path:none;overflow:visible}
}

/* ── the pixel drawings: masthead, index wordmark, corner wordmark ────────
   Drawn in QamusDraw (Kawkab's █) at 0.66/0.7 of the root size, so one art
   pixel is exactly one site cell wide and the drawings keep the proportions
   they were authored at. The art keeps a 14rem box so the reserved masthead
   still holds the pinned top block on dialect pages. Later in the file than
   the rules above, which set font:inherit. */
.art,.mark,.logo{font-family:QamusDraw,monospace;font-size:calc(var(--cem) / .7 * 1rem)}
.art{height:14rem}
