/* ============================================================
   THE DOCUMENT READER — "فتح المستند" opens here.

   The same reading environment as the 2D view of the Digital Book
   Reader (four themes, TOC + notebook panels, customization, text
   highlights and notes, in-document search, magnify), rebuilt as a
   site-owned stylesheet so it ships in the update package: the book
   reader is a separate Vite project that deliberately stays out of
   it (see lib/reader.py), and opening a law must not depend on
   whether that project happens to be installed.

   What is NOT shared with the book reader is the typography below
   the fold: a book is chapters and prose, a law is a numbered
   instrument with a preamble, a hierarchy of أبواب / فصول / فروع and
   articles. Those get their own type scale here — see "THE
   DOCUMENT" — driven by the semantic classes lib/docreader.py emits
   from the export's own Word style names.

   Everything is scoped to #lxreader.
   ============================================================ */

/* Arabic serif faces, offered as a reading choice (the site's own Almarai
   stays the default). Only downloaded if the reader actually picks one —
   an unused @font-face costs nothing. */
@font-face {
  font-family: 'Noto Naskh Arabic'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/static/fonts/noto-naskh-arabic-arabic-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Naskh Arabic'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('/static/fonts/noto-naskh-arabic-arabic-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/static/fonts/amiri-arabic-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('/static/fonts/amiri-arabic-700-normal.woff2') format('woff2');
}

/* ══════════════ THEME TOKENS ══════════════
   ONE accent on every theme — var(--lx-accent), which is per-country
   (crimson for Lebanon, gold for the Emirates) — and tints are alpha over
   it, never a lighter mix. On the dark grounds that rules the accent OUT as
   text colour (2.4:1 against #14140F), so there it works as a fill and a rail
   and the text on top stays near-white: --accent-ink is the ink that
   goes ON an accented surface, and it is the token that moves, not the red. */
#lxreader, #lxreader[data-theme="light"] {
  --bg: #FFFFFF; --bg-2: #F8F7F5; --sidebar: #FBFAF8;
  --text: #16140F; --text-2: #55514A; --muted: #8A857C;
  --border: #E6E2DB; --border-2: #F0EDE7;
  --accent: var(--lx-accent);
  --accent-ink: var(--lx-accent);                 /* accent used as TEXT */
  --accent-soft: rgba(var(--lx-accent-rgb),.07); --accent-glow: rgba(var(--lx-accent-rgb),.14);
  /* SOLID, never rgba — the band is drawn as a background PLUS a spread
     shadow in the same colour, and a translucent tint would double-darken
     wherever two blocks' shadows meet (same trap as lib/corpus.py). color-mix
     keeps it solid while still following the country's accent. */
  --hit: color-mix(in srgb, var(--lx-accent) 13%, #FFFFFF);
  --hit-2: color-mix(in srgb, var(--lx-accent) 26%, #FFFFFF);
  --topbar: rgba(255,255,255,.90); --shadow: rgba(20,18,12,.10); --track: #EDEAE4;
}
#lxreader[data-theme="sepia"] {
  --bg: #F6F0E2; --bg-2: #EFE8D8; --sidebar: #EFE8D8;
  --text: #33291D; --text-2: #5E5342; --muted: #8B8171;
  --border: #DACFBB; --border-2: #E4DBC9;
  --accent: var(--lx-accent);
  --accent-ink: var(--lx-accent-shade);
  --accent-soft: rgba(var(--lx-accent-rgb),.08); --accent-glow: rgba(var(--lx-accent-rgb),.16);
  --hit: color-mix(in srgb, var(--lx-accent) 9%, #F6F0E2);
  --hit-2: color-mix(in srgb, var(--lx-accent) 24%, #F6F0E2);
  --topbar: rgba(246,240,226,.92); --shadow: rgba(60,45,20,.13); --track: #DACFBB;
}
#lxreader[data-theme="dark"] {
  --bg: #14140F; --bg-2: #1C1C17; --sidebar: #1A1A15;
  --text: #E9E4D9; --text-2: #ADA89B; --muted: #7C786E;
  --border: #33322C; --border-2: #26251F;
  --accent: var(--lx-accent);
  --accent-ink: #F2EDE3;                 /* crimson can't carry text here */
  --accent-soft: rgba(var(--lx-accent-rgb),.26); --accent-glow: rgba(var(--lx-accent-rgb),.34);
  --hit: rgba(var(--lx-accent-rgb),.32); --hit-2: rgba(var(--lx-accent-rgb),.52);
  --topbar: rgba(20,20,15,.92); --shadow: rgba(0,0,0,.45); --track: #33322C;
}
#lxreader[data-theme="saderlex"] {
  --bg: #0C0C0D; --bg-2: #151516; --sidebar: #121213;
  --text: #F0EEE9; --text-2: #B8B4AD; --muted: #7F7C75;
  --border: #2A2A2A; --border-2: #1F1F1F;
  --accent: var(--lx-accent);
  --accent-ink: #F5F1EA;
  --accent-soft: rgba(var(--lx-accent-rgb),.30); --accent-glow: rgba(var(--lx-accent-rgb),.40);
  --hit: rgba(var(--lx-accent-rgb),.36); --hit-2: rgba(var(--lx-accent-rgb),.58);
  --topbar: rgba(12,12,13,.92); --shadow: rgba(0,0,0,.55); --track: #2A2A2A;
}

/* ══════════════ SHELL ══════════════ */
html.lxr-host, body.lxr-host { height: 100%; overflow: hidden; margin: 0; padding: 0; }

#lxreader {
  --lxr-right-w: 400px;
  --lxr-left-w: 300px;
  /* The header's height, and the offset .lxr-reading and .lxr-right hang from.
     56px is the FLOOR — the two-line header (title + section) and the button
     rows both fit inside it. fitHead() in docreader.js raises it when the
     content needs more. Measured rather than guessed: the lines are Arabic, at
     a font size the reader can change, so the height that fits is not a number
     this file can know in advance. */
  --lxr-head-h: 56px;
  --ui: 'Almarai', system-ui, 'Segoe UI', sans-serif;
  position: fixed; inset: 0; z-index: 1;
  background: var(--bg); color: var(--text);
  font-family: var(--ui); line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  transition: background .4s, color .4s;
}
#lxreader ::selection { background: var(--accent-glow); }

/* ── header ── */
.lxr-head {
  position: absolute; top: 0; left: 0; right: 0; height: var(--lxr-head-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 10px;
  background: var(--topbar); color: var(--text);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: background .4s, border-color .4s;
}
.lxr-lead, .lxr-acts { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lxr-brand { display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0; color: inherit; text-decoration: none; border-radius: 6px; transition: opacity .2s; }
.lxr-brand:hover { opacity: .72; }
.lxr-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* Two logo inks. The wordmark is near-black artwork by default (light/sepia
   grounds); the dark themes swap to the off-white file. */
.lxr-logo { height: 28px; width: auto; display: block; }
.lxr-logo--d { display: none; }
#lxreader[data-theme="dark"] .lxr-logo--l,
#lxreader[data-theme="saderlex"] .lxr-logo--l { display: none; }
#lxreader[data-theme="dark"] .lxr-logo--d,
#lxreader[data-theme="saderlex"] .lxr-logo--d { display: block; }
.lxr-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.lxr-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: lxrLive 1.8s ease-out infinite; }
@keyframes lxrLive { 0% { transform: scale(1); opacity: .55; } 70% { opacity: 0; } 100% { transform: scale(3); opacity: 0; } }

/* The title takes the space the two button groups leave, rather than being
   absolutely centred over them: absolute centring is truer, but at a narrow
   width (the /search modal's frame) the title ran under the buttons. */
.lxr-titleblock { flex: 1 1 auto; min-width: 0; text-align: center; pointer-events: none; padding: 0 8px; }
/* EXPLICIT line-height, because #lxreader sets 1.9 — that is the DOCUMENT's
   reading leading, and this is a single line of UI chrome. Inherited, it made
   the header block ~50px of the 56 available on its own. */
/* unicode-bidi:plaintext: the title is DB data and can be English — let its
   first strong character pick the direction instead of the page's RTL. */
.lxr-title { font-size: 15px; line-height: 1.3; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
/* The type and the first two folders, one muted line under the title. Each
   item is a button that opens its tree in «الموقع» (docreader.js subWire).
   The titleblock is pointer-events:none so the title never eats a click aimed
   at the header buttons; the items opt back in, the separators do not.
   fitHead() gives the header the extra line. The type holds its width; the
   folders shrink and ellipse first. */
.lxr-sub {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  margin-top: 2px; font-size: 11.5px; line-height: 1.35; color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.lxr-sub__type, .lxr-sub__i {
  margin: 0; padding: 0 4px; border: 0; border-radius: 4px;
  background: none; color: inherit; font: inherit; white-space: nowrap;
  pointer-events: auto; cursor: pointer; transition: color .15s, background .15s;
}
.lxr-sub__type { flex: 0 0 auto; font-weight: 700; color: var(--accent-ink, var(--accent)); }
.lxr-sub__type.is-static { cursor: default; pointer-events: none; }
.lxr-sub__i { flex: 0 1 auto; min-width: 0; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
button.lxr-sub__type:hover, button.lxr-sub__type:focus-visible,
.lxr-sub__i:hover, .lxr-sub__i:focus-visible { color: var(--accent); background: var(--accent-soft); }
.lxr-sub button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lxr-sub__s { flex: 0 0 auto; opacity: .45; }

/* «الموقع»'s two trees: المجلدات (or an article's اجتهادات) and السنوات. */
.lxr-tree-views { display: flex; gap: 3px; margin: 0 10px 4px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; }
.lxr-tree-views[hidden] { display: none; }
.lxr-tree-views button {
  flex: 1; min-width: 0; padding: 5px 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-family: var(--ui); font-size: 12.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: color .15s, background .15s;
}
.lxr-tree-views button:hover { color: var(--text-2); }
.lxr-tree-views button.is-on { background: var(--accent-soft); color: var(--accent-ink, var(--accent)); }
.lxr-tree-wrap[hidden] { display: none; }

/* The document's place in المجلدات, as a slashed path under the title.
   It makes the header a THREE-line block, which 56px cannot hold — so the
   height is a variable now and fitHead() raises it to whatever the three lines
   actually measure. Do not go back to a hardcoded number here: the lines are
   Arabic and the reader can change the type size.
   The titleblock is pointer-events:none so the title never eats a click aimed
   at the buttons behind it; the crumb has to opt back in, because unlike the
   two lines above it, it IS interactive. */
.lxr-crumb {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; margin-top: 2px; pointer-events: auto;
  font-size: 11px; line-height: 1.35; color: var(--muted);
  overflow: hidden; white-space: nowrap;
}
.lxr-crumb__s { flex: 0 0 auto; opacity: .45; }
.lxr-crumb__i {
  /* shrinkable, so a deep path degrades by ellipsing its rungs rather than by
     overflowing the header or pushing the buttons out of place */
  flex: 0 1 auto; min-width: 0; max-width: 16ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 0; padding: 0 3px; border: 0; border-radius: 4px;
  background: none; color: inherit; font: inherit; cursor: pointer;
  transition: color .15s, background .15s;
}
/* Brand red on hover — var(--accent), so it follows the country the way every
   other accent does (crimson for Lebanon, gold for the Emirates) instead of
   hardcoding one of them. .is-hot is the same state driven from script. */
.lxr-crumb__i:hover,
.lxr-crumb__i:focus-visible,
.lxr-crumb__i.is-hot {
  color: var(--accent); background: var(--accent-soft);
}
.lxr-crumb__i:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* No narrow-screen rule of its own: .lxr-titleblock is already display:none
   under 920px (see the media block near the end of this file), which takes the
   title, the section line and this with it. A second breakpoint here would be
   dead code. The الموقع panel still answers "where am I" in full at any width. */

.lxr-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  font-family: var(--ui); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .1s;
}
.lxr-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.lxr-btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.lxr-btn:active { transform: scale(.95); }
.lxr-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.lxr-btn--icon { padding: 8px; }
.lxr-btn--icon svg { width: 17px; height: 17px; }
.lxr-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

/* ── reading pane ── */
/* Panels and pane insets are PHYSICAL (left/right), not logical: the two panels
   sit either side of the screen and stay there, while the text inside flips
   with `dir`. Logical insets would swap the whole furniture with the language. */
.lxr-reading {
  position: absolute; inset: var(--lxr-head-h) 0 0 0; overflow: auto; scroll-behavior: smooth;
  transition: left .35s cubic-bezier(.4,0,.2,1), right .35s cubic-bezier(.4,0,.2,1);
}
.lxr-reading:focus, .lxr-reading:focus-visible { outline: none; }
#lxreader.is-right-open .lxr-reading { right: var(--lxr-right-w); }
#lxreader.is-left-open  .lxr-reading { left: var(--lxr-left-w); }
/* A hop between documents (goDoc) keeps the page, so nothing else would say
   that the text is being replaced. The panel and header stay at full strength
   — they are not what is changing — and the cue is deliberately faint: on a
   fast fetch it should read as a blink, not a flash. */
#lxreader.is-loading .lxr-reading { opacity: .45; transition: opacity .12s linear; }
@media (prefers-reduced-motion: reduce) {
  #lxreader.is-loading .lxr-reading { transition: none; }
}
.lxr-canvas { position: relative; }
.lxr-canvas[hidden] { display: none; }

/* The exported original, framed (see setView in docreader.js). It fills the
   reading box and scrolls ITSELF — the box must not scroll as well, or the
   page gains a second scrollbar that moves nothing. White is the DEFAULT, not
   a rule: the export ships its own colours and is left in them until the reader
   asks for a theme, at which point origApplyPrefs sets this element's ground
   inline to match the one it injects into the frame — otherwise a dark page
   read through a white frame looks like a rendering fault. */
.lxr-orig {
  display: block; width: 100%; height: 100%; border: 0; background: #fff;
}
.lxr-orig[hidden] { display: none; }
#lxreader.is-orig .lxr-reading { overflow: hidden; }

/* Nothing in the header is disabled over the framed original any more — every
   tool reaches into it (see READER_TOOLS, now empty). Kept because it is the
   look a disabled header button has, and it is one array entry away. */
.lxr-btn:disabled, .lxr-btn.is-off {
  opacity: .38; pointer-events: none; cursor: default;
}
.lxr-content {
  max-width: var(--reader-width, 820px); margin: 0 auto; padding: 46px 40px 160px;
  zoom: var(--reader-zoom, 1); transform-origin: 0 0;
}
/* Magnify = transform:scale inside a canvas sized to the scaled bounds, so panning
   is plain native scroll. Done in an LTR context: an RTL scroll container puts
   scrollLeft:0 at the RIGHT edge, which slides the page sideways as you zoom. The
   TEXT is put back to RTL explicitly.
   :not(.is-orig) because none of this describes the framed original — that copy
   is zoomed inside the frame and pans on the frame's own scrollbar (see applyMag
   in docreader.js). Only the accent cue on the pill below is common to both. */
#lxreader.is-mag:not(.is-orig) .lxr-reading { direction: ltr; }
#lxreader.is-mag:not(.is-orig) .lxr-canvas { margin: 0 auto; }
#lxreader.is-mag:not(.is-orig) .lxr-content { margin: 0; direction: rtl; user-select: none; cursor: grab; }
#lxreader.is-mag:not(.is-orig) .lxr-content.is-grabbing { cursor: grabbing; }

.lxr-msg { text-align: center; padding: 110px 20px; color: var(--muted); font-size: 17px; }
.lxr-msg--err { color: var(--accent-ink); }

/* no JavaScript: the reader never builds, so this is the whole page */
.lxr-noscript { max-width: 640px; margin: 12vh auto; padding: 0 24px; text-align: center; font-family: var(--ui); color: var(--text); }
.lxr-noscript h1 { font-size: 1.3rem; line-height: 1.6; margin: 0 0 .8em; }
.lxr-noscript p { color: var(--text-2); line-height: 1.9; }
.lxr-noscript a { color: var(--accent); font-weight: 700; }

/* ══════════════ THE DOCUMENT ══════════════
   The type scale of a legal instrument, driven by the semantic classes
   lib/docreader.py decodes out of the export's Word style names. */
.lxr-doc {
  font-family: var(--reader-font, var(--ui));
  font-size: 17px; line-height: var(--reader-lh, 2.05);
  color: var(--text); text-align: justify; text-justify: inter-word;
}
.lxr-b { margin: 0 0 .85em; }
.lxr-b:last-child { margin-bottom: 0; }

/* identity: number, date, subject — the instrument's own masthead */
.lxr-num {
  text-align: center; font-weight: 800; font-size: 1.5em; line-height: 1.45;
  color: var(--text); margin-bottom: .15em; letter-spacing: -.01em;
}
.lxr-date { text-align: center; color: var(--muted); font-size: .92em; margin-bottom: 1.6em; }
.lxr-subj {
  text-align: center; font-weight: 700; font-size: 1.16em; line-height: 1.7;
  color: var(--text); margin: 0 auto 1.9em; max-width: 34em;
  padding-bottom: 1.2em; border-bottom: 1px solid var(--border);
}
.lxr-court, .lxr-parties { text-align: center; color: var(--text-2); font-size: .97em; margin-bottom: .6em; }
/* a judgment's headnotes: a numbered run of settled principles. Read as a
   list, not as 25 title pages — hence start-aligned with a hairline above. */
.lxr-hno {
  font-weight: 700; font-size: 1.02em; line-height: 1.85; color: var(--text);
  margin: 1.5em 0 .9em; padding-top: 1.1em; border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--lxr-head-h) + 24px);
}
.lxr-hno:first-child { padding-top: 0; border-top: 0; }
.lxr-parties { font-weight: 700; }

/* preamble ("ان رئيس الجمهورية، بناء على…") — a run of short clauses; set them
   apart from the enacting text without shouting. */
.lxr-pre { color: var(--text-2); margin-bottom: .45em; padding-inline-start: 1.2em; }

/* hierarchy: باب / فصل / فرع / مطلب. Centred with a hairline above, so the
   document's spine is visible when you scroll past at speed. */
.lxr-h1, .lxr-h2, .lxr-h3, .lxr-h4 {
  text-align: center; font-weight: 800; color: var(--text);
  margin: 2.4em auto 1.1em; max-width: 30em; scroll-margin-top: calc(var(--lxr-head-h) + 24px);
}
.lxr-h1 { font-size: 1.28em; padding-top: 1.1em; border-top: 2px solid var(--accent); }
.lxr-h2 { font-size: 1.16em; padding-top: .9em; border-top: 1px solid var(--border); }
.lxr-h3 { font-size: 1.06em; }
.lxr-h4 { font-size: 1em; color: var(--text-2); }

/* an article — the unit a lawyer actually cites. A crimson rail on the reading
   edge marks where each one starts. */
.lxr-art {
  font-weight: 800; font-size: 1.04em; color: var(--text);
  margin: 1.9em 0 .7em; padding-inline-start: .72em;
  border-inline-start: 3px solid var(--accent); scroll-margin-top: calc(var(--lxr-head-h) + 24px);
}
.lxr-p { margin-bottom: .85em; }
.lxr-cell { margin: 0; text-align: start; font-size: .94em; line-height: 1.75; }

/* apparatus: amendment notes, signatures, publication line, references */
.lxr-amend {
  font-size: .87em; color: var(--text-2); background: var(--accent-soft);
  border-inline-start: 2px solid var(--accent); border-radius: 0 6px 6px 0;
  padding: .5em .8em; margin-bottom: .5em; text-align: start;
}
.lxr-sign { text-align: center; color: var(--text-2); font-size: .93em; margin: .35em 0; }
.lxr-pub, .lxr-ref { font-size: .87em; color: var(--muted); text-align: start; }
.lxr-note { color: var(--text-2); }
.lxr-noteh { font-weight: 800; color: var(--text); margin: 1.6em 0 .6em; scroll-margin-top: calc(var(--lxr-head-h) + 24px); }

.lxr-anchor { display: inline; }
.lxr-x { color: var(--accent-ink); text-decoration: none; border-bottom: 1px dotted currentColor; }
.lxr-img { display: block; max-width: 100%; height: auto; margin: 1.3em auto; border-radius: 4px; }
#lxreader[data-theme="dark"] .lxr-img,
#lxreader[data-theme="saderlex"] .lxr-img { filter: invert(1) hue-rotate(180deg); opacity: .92; }

.lxr-doc table {
  border-collapse: collapse; margin: 1.5em auto; max-width: 100%;
  display: block; overflow-x: auto;                 /* a wide table scrolls itself */
}
.lxr-doc td, .lxr-doc th {
  border: 1px solid var(--border); padding: .42em .65em; vertical-align: top;
}
.lxr-doc hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0 1.2em; }

/* the rebuild path (lib/docbuild.py) — its own class names */
.lxr-rebuilt .dvr-num { text-align: center; font-size: 1.5em; font-weight: 800; margin: 0 0 .15em; }
.lxr-rebuilt .dvr-date { text-align: center; color: var(--muted); font-size: .92em; margin-bottom: 1.6em; }
/* The bench that decided the case, under the date, where the printed judgment
   sets it. Derived from the file path (lib/docbuild.py) because no column holds
   it. The date normally carries the gap that closes the masthead, so it hands
   that over when the bench follows it. */
.lxr-rebuilt .dvr-date--tight { margin-bottom: .45em; }
.lxr-rebuilt .dvr-court { text-align: center; color: var(--text-2); font-size: .97em; margin: 0 0 1.6em; }
.lxr-rebuilt .dvr-subj { text-align: center; font-size: 1.16em; font-weight: 700; margin: 0 auto 1.9em; max-width: 34em; padding-bottom: 1.2em; border-bottom: 1px solid var(--border); }
.lxr-rebuilt .dvr-head { text-align: center; font-weight: 800; margin: 2.4em auto 1.1em; max-width: 30em; padding-top: .9em; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--lxr-head-h) + 24px); }
.lxr-rebuilt .dvr-art { margin: 1.9em 0 .7em; scroll-margin-top: calc(var(--lxr-head-h) + 24px); }
.lxr-rebuilt .dvr-arth { font-size: 1.04em; font-weight: 800; margin: 0 0 .55em; padding-inline-start: .72em; border-inline-start: 3px solid var(--accent); }
.lxr-rebuilt .dvr-p { margin: 0 0 .85em; }
.lxr-rebuilt .is-here { background: var(--hit); box-shadow: 0 0 0 .38rem var(--hit); border-radius: 2px; }

/* the record card: catalogue facts, above the document's own masthead */
.lxr-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1.8em; }
.lxr-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-2); font-family: var(--ui); font-size: 12px; line-height: 1.6;
}
.lxr-chip i { font-style: normal; color: var(--muted); }
.lxr-chip b { color: var(--text); font-weight: 700; unicode-bidi: isolate; }

/* ── the search hit ──
   A result links to ONE article inside a document that can run to 2,000
   anchors. The whole article run is banded as ONE block: each block carries
   its own margin, so a plain background leaves a white stripe between
   paragraphs — a spread-only shadow in the same colour fills the gap from
   both sides and adjacent blocks meet in it. */
.lxr-hit { background: var(--hit); box-shadow: 0 0 0 .38rem var(--hit); scroll-margin-top: calc(var(--lxr-head-h) + 34px); }
.lxr-hit.is-flash { animation: lxrHit 1.1s ease-out 2; }
@keyframes lxrHit {
  0%, 100% { background: var(--hit); box-shadow: 0 0 0 .38rem var(--hit); }
  45%      { background: var(--hit-2); box-shadow: 0 0 0 .38rem var(--hit-2); }
}
@media (prefers-reduced-motion: reduce) { .lxr-hit.is-flash { animation: none; } }

/* ── footnotes ── */
.lxr-fnref {
  display: inline; vertical-align: super; font-size: .62em; line-height: 0;
  padding: 0 2px; border: 0; background: transparent; cursor: pointer;
  color: var(--accent-ink); font-weight: 800; font-family: var(--ui);
}
.lxr-fnref:hover { text-decoration: underline; }
.lxr-fnstore { display: none; }
.lxr-fnpop {
  position: fixed; z-index: 80; max-width: min(440px, 88vw); max-height: 46vh; overflow-y: auto;
  background: var(--sidebar); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; box-shadow: 0 12px 40px var(--shadow); font-size: 14.5px; line-height: 1.75;
  direction: rtl; text-align: justify; font-family: var(--reader-font, var(--ui));
}
.lxr-fnpop[hidden] { display: none; }
.lxr-fnnum {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  margin-inline-end: 8px; padding: 0 6px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 800; vertical-align: 2px;
}

/* ══════════════ PANELS ══════════════ */
.lxr-right, .lxr-left {
  position: absolute; top: var(--lxr-head-h); bottom: 0; z-index: 40; display: flex; flex-direction: column;
  background: var(--sidebar); overflow: hidden;
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .25s, background .4s, border-color .4s;
}
.lxr-right { right: 0; width: var(--lxr-right-w); border-left: 1px solid var(--border); box-shadow: -12px 0 34px var(--shadow); }
.lxr-left  { left: 0;  width: var(--lxr-left-w);  border-right: 1px solid var(--border); box-shadow: 12px 0 34px var(--shadow); }
.lxr-right.is-off { transform: translateX(100%);  opacity: 0; pointer-events: none; }
.lxr-left.is-off  { transform: translateX(-100%); opacity: 0; pointer-events: none; }

.lxr-panel-head { padding: 15px 18px 13px; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; }
.lxr-panel-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--text); }
.lxr-x-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.lxr-x-btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.lxr-x-btn svg { width: 15px; height: 15px; }

.lxr-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 14px; flex-shrink: 0; }
.lxr-tab { flex: 1; padding: 13px 6px 11px; font-family: var(--ui); font-size: 13.5px; font-weight: 700; color: var(--muted); background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: color .2s, border-color .2s; }
.lxr-tab:hover { color: var(--text-2); }
.lxr-tab.is-on { color: var(--accent-ink); border-bottom-color: var(--accent); }
/* المحتويات / دفتر الملاحظات over the original export: they read markup the
   frame does not share. الموقع stays live — it describes the file, not the text. */
.lxr-tab:disabled, .lxr-tab.is-off {
  opacity: .38; pointer-events: none; cursor: default;
}
.lxr-pane { display: none; flex: 1; overflow-y: auto; padding: 12px 10px; }
.lxr-pane.is-on { display: block; }

/* TOC */
.lxr-toc { list-style: none; margin: 0; padding: 0; }
.lxr-toc-i { display: flex; align-items: baseline; gap: 9px; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--text-2); transition: background .18s, color .18s; margin-bottom: 1px; }
.lxr-toc-i:hover { background: var(--accent-soft); color: var(--text); }
.lxr-toc-i.is-on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; box-shadow: inset -2px 0 0 var(--accent); }
.lxr-toc-i.lvl-1 { font-size: 15px; font-weight: 800; color: var(--text); padding-top: 11px; margin-top: 6px; }
.lxr-toc-i.lvl-2 { font-size: 13.8px; font-weight: 700; padding-inline-start: 20px; }
.lxr-toc-i.lvl-3 { font-size: 13.2px; padding-inline-start: 34px; }
.lxr-toc-i.lvl-4 { font-size: 12.8px; color: var(--muted); padding-inline-start: 48px; }
.lxr-toc-i.is-on.lvl-4 { color: var(--accent-ink); }
.lxr-toc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lxr-toc-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.8; }

/* notebook */
.lxr-nbf { display: flex; gap: 6px; padding: 4px 4px 12px; margin-bottom: 10px; border-bottom: 1px solid var(--border-2); flex-wrap: wrap; }
.lxr-nbf button { padding: 5px 12px; border-radius: 100px; border: 1px solid var(--border); background: transparent; font-family: var(--ui); font-size: 12px; color: var(--muted); cursor: pointer; transition: all .2s; }
.lxr-nbf button:hover { border-color: var(--muted); color: var(--text-2); }
.lxr-nbf button.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.lxr-nb-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.lxr-nb-empty svg { width: 36px; height: 36px; opacity: .4; margin-bottom: 12px; }
.lxr-nb-empty p { font-size: 13.5px; line-height: 1.8; margin: 0; }
.lxr-nb-i { padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border-2); margin-bottom: 9px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.lxr-nb-i:hover { border-color: var(--border); box-shadow: 0 2px 8px var(--shadow); }
.lxr-nb-k { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.lxr-nb-k svg { width: 11px; height: 11px; flex-shrink: 0; }
.lxr-nb-t { font-size: 13px; line-height: 1.75; color: var(--text-2); }
.lxr-nb-n { font-size: 12.5px; color: var(--accent-ink); font-style: italic; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-2); }
.lxr-dot-c { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.lxr-nb-acts { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0; }
.lxr-nb-act { width: 22px; height: 22px; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; opacity: .68; transition: background .15s, color .15s, opacity .15s; }
.lxr-nb-act:hover { opacity: 1; background: var(--accent-soft); color: var(--accent-ink); }
.lxr-nb-act svg { width: 13px; height: 13px; }
.lxr-nb-del:hover { background: rgba(229,72,77,.16); color: #E5484D; }
.lxr-nb-i:hover .lxr-nb-act { opacity: 1; }

/* customization */
.lxr-custom { flex: 1; overflow-y: auto; padding: 18px; }
.lxr-grp { margin-bottom: 22px; }
.lxr-grp-l { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.lxr-grp-v { font-size: 12px; color: var(--accent-ink); letter-spacing: 0; }
.lxr-opts { display: flex; gap: 6px; }
.lxr-opt { flex: 1; padding: 9px 6px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font-family: var(--ui); font-size: 12px; cursor: pointer; transition: all .2s; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lxr-opt:hover { border-color: var(--muted); }
.lxr-opt.is-on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.lxr-opt.is-on .lxr-sw { border-color: var(--accent); }
.lxr-sw { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(128,128,128,.35); }
.lxr-slider-row { display: flex; align-items: center; gap: 12px; }
.lxr-slider-a { color: var(--text-2); }
.lxr-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: var(--track); outline: none; }
.lxr-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg); box-shadow: 0 1px 4px var(--shadow); }
.lxr-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg); }
.lxr-reset { width: 100%; margin-top: 6px; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font-family: var(--ui); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s; }
.lxr-reset:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

/* ══════════════ FLOATING BITS ══════════════ */
.lxr-hl-yellow { background: rgba(255,214,10,.34); border-radius: 2px; }
.lxr-hl-blue   { background: rgba(66,165,245,.30); border-radius: 2px; }
.lxr-hl-green  { background: rgba(102,187,106,.30); border-radius: 2px; }
.lxr-hl-rose   { background: rgba(236,64,122,.26); border-radius: 2px; }
#lxreader[data-theme="dark"] [class^="lxr-hl-"], #lxreader[data-theme="dark"] [class^="lxr-hl-"] *,
#lxreader[data-theme="saderlex"] [class^="lxr-hl-"], #lxreader[data-theme="saderlex"] [class^="lxr-hl-"] * { color: #2A2A2A !important; }
@keyframes lxrFlash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 25% { box-shadow: 0 0 0 3px var(--accent-glow); } }
.lxr-hl-flash { animation: lxrFlash 1.3s ease; border-radius: 3px; }

.lxr-pop { position: fixed; display: none; z-index: 90; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 24px var(--shadow); padding: 6px; gap: 4px; align-items: center; }
.lxr-pop.is-on { display: flex; }
.lxr-c { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform .15s; }
.lxr-c:hover { transform: scale(1.16); }
.lxr-c.yellow { background: #FFD60A; } .lxr-c.blue { background: #42A5F5; } .lxr-c.green { background: #66BB6A; } .lxr-c.rose { background: #EC407A; }
.lxr-pop-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.lxr-pop-a { width: 26px; height: 26px; border-radius: 6px; border: none; background: transparent; color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.lxr-pop-a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.lxr-pop-a svg { width: 14px; height: 14px; }

.lxr-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 95; display: none; align-items: center; justify-content: center; }
.lxr-modal-bg.is-on { display: flex; }
.lxr-modal { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: 380px; max-width: 90vw; box-shadow: 0 16px 48px var(--shadow); }
.lxr-modal h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); }
.lxr-modal textarea { width: 100%; height: 84px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: var(--ui); font-size: 14px; color: var(--text); background: var(--bg-2); resize: none; outline: none; }
.lxr-modal textarea:focus { border-color: var(--accent); }
.lxr-modal-acts { display: flex; justify-content: flex-start; gap: 8px; margin-top: 12px; }
.lxr-modal-btn { padding: 8px 18px; border-radius: 6px; border: none; font-family: var(--ui); font-size: 13px; font-weight: 700; cursor: pointer; transition: opacity .2s; }
.lxr-modal-btn.cancel { background: var(--bg-2); color: var(--text-2); }
.lxr-modal-btn.save { background: var(--accent); color: #fff; }
.lxr-modal-btn:hover { opacity: .88; }

/* ══════════════ THE المرجع PREVIEW ══════════════
   The cited document, over the reader rather than in a tab of its own. Deliberately
   the same shape as the overlay lib/corpus.py opens inside the ORIGINAL view for
   the same link, so a cross-reference behaves identically whichever copy is showing:
   a titled bar, a close button, and the file itself in a same-origin frame. */
.lxr-prev { position: fixed; inset: 0; z-index: 96; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.lxr-prev[hidden] { display: none; }
.lxr-prev-box { display: flex; flex-direction: column; width: 100%; max-width: 1100px; height: 92vh; overflow: hidden; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 56px var(--shadow); }
.lxr-prev-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--accent); color: #fff; }
.lxr-prev-title { flex: 1; font-family: var(--ui); font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lxr-prev-x { padding: 2px 7px; border: 0; border-radius: 6px; background: none; color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.lxr-prev-x:hover { background: rgba(255,255,255,.18); }
/* White, not var(--bg): the frame carries the export's own stylesheet and its
   text is black — a dark reader theme behind it would leave black on near-black. */
.lxr-prev-frame { flex: 1; width: 100%; border: 0; background: #fff; }

.lxr-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: var(--track); z-index: 35; }
.lxr-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.lxr-toast { position: fixed; bottom: 38px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 8px; font-family: var(--ui); font-size: 13.5px; box-shadow: 0 4px 16px var(--shadow); opacity: 0; transition: opacity .3s, transform .3s; z-index: 99; pointer-events: none; }
.lxr-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.lxr-mark { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 9.5px; letter-spacing: .08em; color: var(--muted); opacity: .5; z-index: 34; pointer-events: none; }

.lxr-zoom { position: fixed; bottom: 20px; left: 20px; z-index: 55; display: inline-flex; align-items: center; gap: 3px; padding: 5px 6px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); box-shadow: 0 8px 26px var(--shadow); }
.lxr-zoom button { width: 34px; height: 34px; border-radius: 50%; border: none; background: transparent; color: var(--text); font-size: 21px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.lxr-zoom button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.lxr-zoom button:active { transform: scale(.9); }
.lxr-zoom span { min-width: 52px; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
#lxreader.is-mag .lxr-zoom { border-color: var(--accent); }

/* in-document search bar */
.lxr-find {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 85;
  display: none; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 12px; direction: rtl;
  background: var(--bg); border: 1px solid var(--border); box-shadow: 0 10px 34px var(--shadow);
  opacity: 0; transition: opacity .2s, transform .2s;
}
.lxr-find.is-on { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.lxr-find svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; margin-inline-start: 4px; }
.lxr-find input { border: none; background: transparent; outline: none; color: var(--text); font-family: var(--ui); font-size: 14px; width: min(240px, 44vw); }
.lxr-find input::placeholder { color: var(--muted); }
.lxr-find-n { font-size: 12px; color: var(--muted); min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
.lxr-find button { width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent; color: var(--text-2); cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background .15s, color .15s; }
.lxr-find button:hover { background: var(--accent-soft); color: var(--accent-ink); }
::highlight(lxr-find) { background: rgba(255,214,10,.45); }
::highlight(lxr-find-cur) { background: rgba(255,145,0,.8); }

/* «كلمات بحثك» — the words the reader searched for, marked where they appear.
   Same family as بحث (to the reader this IS a search inside the document, only
   one they did not have to type) with an UNDERLINE to say it was automatic,
   and a lighter ground so a reader's own highlight still reads through it.
   Its own registry, so the two never erase each other — see docreader.js. */
::highlight(lxr-term) {
  background: rgba(255,214,10,.26);
  text-decoration: underline;
  text-decoration-color: rgba(190,140,0,.9);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
::highlight(lxr-term-cur) { background: rgba(255,145,0,.8); }

/* Under بحث's bar rather than behind it: the two are independent, and with a
   query in the URL both can be open at once. `+` does that with no JS, because
   the markup puts them in this order. */
.lxr-terms {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 84;
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px; direction: rtl;
  max-width: min(760px, 94vw); padding: 6px 8px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: 0 10px 34px var(--shadow);
}
.lxr-terms[hidden] { display: none; }
.lxr-find.is-on + .lxr-terms { top: 112px; }
.lxr-terms-l { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-inline-start: 2px; }
.lxr-terms-c { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.lxr-terms-n { font-size: 12px; color: var(--muted); min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
.lxr-terms > button { width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent; color: var(--text-2); cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background .15s, color .15s; }
.lxr-terms > button:hover { background: var(--accent-soft); color: var(--accent-ink); }
/* A chip is a switch, and it shows the state it is IN: marked words carry the
   marker's own colour, a switched-off one is struck through. */
.lxr-term {
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-family: var(--ui); font-size: 12.5px; line-height: 1.6; color: var(--text);
  background: rgba(255,214,10,.30); transition: background .15s, color .15s, opacity .15s;
}
.lxr-term:hover { border-color: var(--accent); }
.lxr-term.is-off { background: var(--bg-2); color: var(--muted); text-decoration: line-through; opacity: .75; }

/* themed scrollbars */
.lxr-reading, .lxr-pane, .lxr-custom { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.lxr-reading::-webkit-scrollbar, .lxr-pane::-webkit-scrollbar, .lxr-custom::-webkit-scrollbar { width: 11px; }
.lxr-reading::-webkit-scrollbar-thumb, .lxr-pane::-webkit-scrollbar-thumb, .lxr-custom::-webkit-scrollbar-thumb {
  border: 3px solid transparent; background-clip: content-box; border-radius: 999px; background-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .lxr-reading { scroll-behavior: auto; }
  #lxreader, .lxr-right, .lxr-left { transition: none; }
  .lxr-dot::after { animation: none; }
}
@media (max-width: 920px) {
  #lxreader { --lxr-right-w: 340px; --lxr-left-w: 270px; }
  .lxr-titleblock { display: none; }
  .lxr-btn__t { display: none; }
  .lxr-btn { padding: 8px; }
  .lxr-content { padding: 34px 22px 120px; }
}
@media print {
  html.lxr-host, body.lxr-host { height: auto; overflow: visible; }
  #lxreader { position: static; }
  .lxr-head, .lxr-right, .lxr-left, .lxr-zoom, .lxr-progress, .lxr-find, .lxr-terms, .lxr-pop, .lxr-toast { display: none !important; }
  .lxr-reading { position: static; inset: auto; overflow: visible; }
}

/* Revived law-to-law cross-references (were dead GetLinkUrl onclicks). */
.lxr-xref { color: #0645AD; text-decoration: underline; }
.lxr-xref:hover { color: var(--accent, #981B31); }

/* The reference markers the export draws as little icons: the cassation
   scales, the treaty glyph, the scanned-PDF badge. They are the clickable
   part of a revived link, so they sit ON the line with the text rather than
   centred as a figure the way .lxr-img does — and they are NOT inverted in
   the dark themes, because these five are flat coloured glyphs that invert
   into unrecognisable pastels. */
.lxr-reficon {
  display: inline-block; width: 16px; height: 16px;
  vertical-align: -3px; margin: 0 .25em; border-radius: 0;
}
.lxr-xref.lxr-cass, .lxr-xref.lxr-pdf { text-decoration: none; }
.lxr-xref.lxr-cass:hover .lxr-reficon,
.lxr-xref.lxr-pdf:hover .lxr-reficon { opacity: .7; }

/* ── الموقع: this document's place in المجلدات ─────────────────────────
   THE BROWSE PAGE'S TREE, MOUNTED IN THE PANEL — the markup is built by
   static/foldertree.js, the same module the المجلدات tab mounts, so these rules
   are static/site.css's `.tree / .tnode / .trow / .ttog / .tn / .tkids / .tdoc`
   block, translated into this panel's variables (--border for --hair, --text
   for --ink) and its narrower measure. Change a rule there and it belongs here
   too — the two are meant to be the same tree, and a reader who has used one
   should not have to learn the other.

   The one thing this copy adds is `.tdoc.is-cur`: the document being read, which
   the tree opens to and scrolls to. The browse page has no such row. */
.lxr-tree-wrap { padding: 8px 10px 16px; font-size: 13px; }
.lxr-tree-load,
.lxr-tree-note { padding: 10px 2px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* The count at the head of the panel when it is showing an article's اجتهادات
   rather than المجلدات — the same line the popup prints over the same tree
   (.cat-count on /cassation). It is the panel's headline there, so it is not
   muted the way a note is. */
.lxr-tree-count { padding: 2px 2px 9px; margin-bottom: 7px; font-size: 12.5px;
  font-weight: 700; line-height: 1.6; color: var(--text);
  border-bottom: 1px solid var(--border); }

.tree { display: flex; flex-direction: column; gap: 1px; }
.tnode { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 6px;
  transition: background .15s ease; }
.trow:hover { background: rgba(var(--lx-accent-rgb), .06); }
.ttog { appearance: none; background: none; border: 0; cursor: pointer; flex: 0 0 auto;
  inline-size: 20px; block-size: 20px; display: grid; place-items: center; color: var(--muted);
  border-radius: 4px; padding: 0; }
.ttog:hover { color: var(--accent); background: rgba(var(--lx-accent-rgb), .1); }
/* +/−, not a rotating caret: the glyph itself is swapped in foldertree.js, so
   nothing here may rotate it — a rotated − is a vertical bar. */
.tcaret { display: inline-block; font-size: 14px; font-weight: 700; line-height: 1; }
.tname { display: flex; align-items: center; gap: 7px; flex: 1; min-inline-size: 0; cursor: pointer;
  font-weight: 700; color: var(--text); }
.tname:hover .tlabel { color: var(--accent); }
/* Two lines, not one ellipsed line. This is the ONE place this copy parts from
   the browse page's measure: at 340-400px an Arabic folder name is regularly
   cut before the part that identifies it, and "which folder is this" is the
   question the panel exists to answer. */
.tlabel { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; }
.tn { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums; }
.tkids { display: flex; flex-direction: column; gap: 1px; padding-inline-start: 12px;
  margin-inline-start: 10px; border-inline-start: 1px solid var(--border); margin-block: 2px; }
.tkids[hidden] { display: none; }

.tdoc { appearance: none; background: none; border: 0; cursor: pointer; font: inherit;
  text-align: start; display: flex; align-items: flex-start; gap: 7px; padding: 5px 6px;
  border-radius: 6px; inline-size: 100%; text-decoration: none;
  transition: background .15s ease; }
.tdoc:hover { background: rgba(var(--lx-accent-rgb), .07); }
.tdoc-ic { flex: 0 0 auto; opacity: .5; font-size: 14px; line-height: 1.5; color: var(--muted); }
.tdoc-main { display: flex; flex-direction: column; min-inline-size: 0; gap: 1px; }
.tdoc-title { font-weight: 700; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tdoc:hover .tdoc-title { color: var(--accent); }
.tdoc-sub { font-size: 11px; color: var(--muted); }
.ltrn { direction: ltr; unicode-bidi: isolate; }

.tload, .tempty { color: var(--muted); font-size: 12px; padding: 5px 6px; }
.tmore { appearance: none; background: none; border: 1px dashed var(--border); border-radius: 6px;
  cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent);
  padding: 5px 10px; margin: 4px 0; align-self: flex-start; transition: .15s ease; }
.tmore:hover { background: rgba(var(--lx-accent-rgb), .07); border-color: var(--accent); }
.tmore:disabled { color: var(--muted); cursor: default; }

/* THE DOCUMENT BEING READ. The tree opens to it and scrolls to it, so it has to
   be findable at a glance in a folder of sixty — filled, weighted, and a bar on
   the start edge. An inset shadow follows the corner radius, which turns a 3px
   edge bar into a curved bracket, so the two corners the bar runs between are
   flattened — logical, i.e. the RIGHT pair in this RTL panel. */
.tdoc.is-cur { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent);
  border-start-start-radius: 2px; border-end-start-radius: 2px; }
.tdoc.is-cur .tdoc-title { color: var(--accent-ink); font-weight: 800; }
.tdoc.is-cur .tdoc-ic { color: var(--accent); opacity: 1; }

/* the way out to the full browse page */
.lxr-tree-cat { display: block; margin: 14px 2px 2px; padding: 8px 10px;
  border: 1px dashed var(--border); border-radius: 6px;
  font-size: 12.5px; font-weight: 700; text-align: center;
  color: var(--accent-ink); text-decoration: none;
  transition: border-color .18s, background .18s; }
.lxr-tree-cat:hover { border-color: var(--accent); background: var(--accent-soft); }

/* The row a hovered crumb rung points at. Deliberately quieter than the crumb
   itself: the crumb is what the pointer is on, this is the echo. */
.trow.is-crumb-hot { background: var(--accent-soft); }

/* Arriving somewhere flashes the row: the document the tree opened to, and any
   rung opened from the crumb. Without it a click that lands on a row already on
   screen looks like a no-op. */
@keyframes lxrRungPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%  { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
.trow.is-pulse, .tdoc.is-pulse { animation: lxrRungPulse 1s ease-out 2; }
@media (prefers-reduced-motion: reduce) {
  /* Still confirm the arrival, without the ring expanding twice. */
  .trow.is-pulse, .tdoc.is-pulse { animation: none;
    box-shadow: 0 0 0 2px var(--accent-glow); }
}
