/* Shared ledger language — monochrome, bordered, documentary */

/* ---------- Self-hosted fonts (bypasses iOS Lockdown Mode CDN block) ---------- */
/* Fraunces italic — variable font, covers wght 300–400 */
@font-face {
  font-family: 'Fraunces'; font-style: italic; font-weight: 300 400; font-display: swap;
  src: url('fonts/fraunces-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces'; font-style: italic; font-weight: 300 400; font-display: swap;
  src: url('fonts/fraunces-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Fraunces normal — variable font, covers wght 300–400 */
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 300 400; font-display: swap;
  src: url('fonts/fraunces-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 300 400; font-display: swap;
  src: url('fonts/fraunces-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono — variable font, covers wght 300–600 */
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('fonts/jbm-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('fonts/jbm-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* No Arabic italic — the script has no italic tradition, so the Amiri italic
   faces are gone entirely. Disallowing style synthesis keeps Arabic glyphs
   upright even inside italic Latin runs (Fraunces still carries a true italic
   face for English, so Latin italics are untouched). */
html { font-synthesis: weight; }

/* Amiri — static font */
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/amiri-normal-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/amiri-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/amiri-bold-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/amiri-bold-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --killed: #d01e0c;
  --living: rgba(232,228,220,0.5);
  --bg: #07080a;
  --bg-2: #0b0d10;
  --bg-3: #0f1115;
  --ink: #e8e4dc;
  --ink-dim: #8a8478;
  --ink-fainter: #807a6e;
  --ink-faint2: #2a2824;
  --line: rgba(232,228,220,0.07);
  --line-2: rgba(232,228,220,0.14);
  --line-3: rgba(232,228,220,0.22);
  --danger: #d05a50;
  --line-control: rgba(232,228,220,0.42);
  --withheld-deep: #b89364;
  --withheld-deep-line: #a07a4a;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --serif: 'Fraunces', 'Times New Roman', serif;
  --arabic: 'Amiri', 'Times New Roman', serif;
  /* Withheld-body accent — muted ochre / burial earth. Desaturated (sat ~60%,
     anti-slop: never an alarmist >80% accent) and distinct from both the cream
     of the living field and the red of the killed bloom. One source of truth. */
  --withheld: #d4a23c;
  /* ---- Motion system: one easing + duration scale, used site-wide -------
     Restrained for the subject — enters decelerate (ease-out), exits are
     faster and accelerate (ease-in), state changes are symmetric. */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);        /* enters */
  --ease-in:   cubic-bezier(0.55, 0.06, 0.68, 0.19); /* exits only */
  --ease-soft: cubic-bezier(0.45, 0, 0.55, 1);       /* hover / state change */
  --dur-fast: 140ms;
  --dur:      240ms;
  --dur-slow: 360ms;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 999;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  overflow: visible;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  /* Some pages expose an accessible data table. Without containment, a table's
     intrinsic columns can widen the document despite this visual clip and
     create an invisible horizontal scroll area on phones. */
  contain: layout paint;
}
/* Tables honour their intrinsic column widths even when visually clipped.
   Keep the accessible fallback tables in the accessibility tree without letting
   long headings create a horizontal page scroll on narrow screens. */
table.sr-only {
  width: 1px !important;
  min-width: 0 !important;
  table-layout: fixed;
}
table.sr-only caption,
table.sr-only th,
table.sr-only td {
  width: 1px !important;
  min-width: 0 !important;
  max-width: 1px !important;
  overflow: hidden;
}
::selection { background: var(--ink); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Global top bar ---------- */
/* Fixed on every page. Scrollable pages reserve header height via
   body { padding-top: var(--nav-h) } — set dynamically by header.js. */
.ledger-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7,8,10,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
body { padding-top: var(--nav-h, 60px); }
body[data-page="archive"] { padding-top: 0; }
.ledger-nav .brand {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-transform: none;
}
.ledger-nav .brand-logo {
  display: block;
  width: 78px;
  aspect-ratio: 480.2 / 238.9;
  flex: 0 0 auto;
  background: var(--ink);
  /* The supplied artwork is a negative-space wordmark: invert its alpha mask
     so only the Qyood/قيود lettering becomes white on the dark header. */
  -webkit-mask-image: linear-gradient(#000 0 0), url('/brand/logo.svg');
  mask-image: linear-gradient(#000 0 0), url('/brand/logo.svg');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.ledger-nav .brand .mark {
  display: inline-block; width: 6px; height: 6px; background: var(--ink);
  margin-right: 4px;
}
.ledger-nav .brand .ar {
  font-family: var(--arabic);
  font-size: 17px;
  color: var(--ink);
}
.ledger-nav nav {
  display: flex; gap: 20px;
}
.ledger-nav nav a {
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  transition: color var(--dur-fast) var(--ease-soft);
  position: relative;
  padding: 4px 0;
}
.ledger-nav nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
  background: var(--ink);
  transform: scaleX(0); transform-origin: left center;
  transition: transform var(--dur) var(--ease-out);
}
.ledger-nav nav a.on { color: var(--ink); }
.ledger-nav nav a.on::after { transform: scaleX(1); }
/* Language switcher — two visible targets on desktop; mobile keeps only the
   selected language mark visible and turns that mark into a toggle. */
.ledger-nav .lang-toggle {
  display: inline-flex; align-items: stretch; gap: 4px;
  margin-inline-start: 8px;
}
.ledger-nav .lang-toggle [data-set-lang] {
  display: inline-grid; place-items: center;
  min-height: 32px; min-width: 42px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 0;
  background: transparent; color: var(--ink-fainter); cursor: pointer;
  transition: color 160ms var(--ease-soft), background-color 160ms var(--ease-soft),
              border-color 160ms var(--ease-soft);
}
.ledger-nav .lang-toggle [data-set-lang="en"] {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em;
}
.ledger-nav .lang-toggle [data-set-lang="ar"] {
  /* The Arabic control is a compact language mark, not a text label.  Its
     glyph lives on its own fixed artboard so it is positioned by its visible
     silhouette rather than by the font's baseline and line-box metrics. */
  min-width: 42px;
  position: relative;
  font-size: 0;
  letter-spacing: normal;
  text-transform: none;
}
.ledger-nav .lang-toggle [data-set-lang="ar"]::before {
  content: '\0639';
  position: absolute;
  left: 50%; top: 50%;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  font-family: 'Almarai', 'SF Arabic', 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  /* Position the visible mark, not the font box: lower it 3px to meet the
     optical middle of the 42 × 32 control beside EN. */
  transform: translate(-50%, -80%);
}
.ledger-nav .lang-toggle [data-set-lang].on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.ledger-nav .lang-toggle [data-set-lang]:focus-visible { outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .ledger-nav .lang-toggle [data-set-lang]:not(.on):hover {
    background-color: rgba(232, 228, 220, 0.08); border-color: var(--ink-dim); color: var(--ink);
  }
}

/* Mobile header: a deliberate two-row layout, never a clipped nav. */
@media (max-width: 820px) {
  .ledger-nav {
    flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 10px 14px;
    /* position stays FIXED (base rule) — a fixed header is already the
       containing block for the corner-tucked absolute lang toggle. */
  }
  .ledger-nav .brand { font-size: 16px; }
  .ledger-nav .brand .ar { font-size: 16px; }
  .ledger-nav .brand-logo { width: 72px; }
  .ledger-nav nav {
    width: 100%;
    display: flex;
    /* Never a clipped link: the row WRAPS so every link (Support included)
       is always on screen — no hidden horizontal scroll on phones. */
    flex-wrap: wrap;
    justify-content: flex-start;
    column-gap: 18px;
    row-gap: 4px;
  }
  .ledger-nav nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .ledger-nav .lang-toggle {
    /* Tucked into the brand row's far corner: reachable, but not a full-width
       row shouting between the nav and the field. */
    position: absolute;
    top: 10px;
    inset-inline-end: 14px;
    min-height: 0;
    margin-inline-start: 0;
  }
  .ledger-nav .lang-toggle [data-set-lang] {
    min-height: 30px;
    min-width: 34px;
    padding: 0 6px;
  }
  .ledger-nav .lang-toggle [data-set-lang]:not(.on) { display: none; }
  .ledger-nav .lang-toggle [data-set-lang="ar"]::before {
    width: 16px; height: 16px;
    font-size: 13px;
    transform: translate(-50%, -70%);
  }
  html[lang="ar"] .ledger-nav nav a {
    font-size: 12px;
    letter-spacing: normal;
    text-align: center;
  }
}

/* ---------- Eyebrow / titles ---------- */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.headline {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(36px, 6vw, 72px);

  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.headline .plain { font-style: normal; }
.headline-ar {
  font-family: var(--arabic);
  font-weight: 400;
  font-size: clamp(22px, 3vw, 34px);
  color: var(--ink-dim);
  direction: rtl;
  text-align: right;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.4;
  margin-top: 8px;
}
/* In Arabic, the primary headline is already translated. The companion line
   exists only to pair English headings with their Arabic counterpart. */
html[lang="ar"] .headline-ar { display: none; }

.lead {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  font-weight: 300;
  color: var(--ink-dim);
  max-width: 56ch;
  line-height: 1.6;
}

.rule { border-bottom: 1px solid var(--line); }

/* ---------- Buttons / chips ---------- */
.chip {
  font-family: var(--mono);
  font-size: 14px;
  padding: 7px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line-control);
  color: var(--ink-dim);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color var(--dur-fast) var(--ease-soft),
              background-color var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft),
              transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  border-radius: 0;
}
.chip.active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}
@media (pointer: coarse) {
  .chip { min-height: 44px; }
}

.btn {
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--line-control);
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color var(--dur-fast) var(--ease-soft),
              background-color var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft),
              transform var(--dur-fast) var(--ease-out);
}
/* ---------- Footer ---------- */
.ledger-foot {
  border-top: 1px solid var(--line);
  padding: 28px;
  display: flex; justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-fainter);
  gap: 40px;
  flex-wrap: wrap;
}
/* "Data as of" provenance line — sits on its own row, quieter than the rest. */
.foot-asof {
  flex-basis: 100%;
  opacity: 0.75;
  letter-spacing: 0.16em;
}
/* ---------- Generic page shell ---------- */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 40px 120px;
}

/* Form fields */
input[type=text], input[type=email], textarea, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-control);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 0;
  outline: none;
  transition: border-color .15s ease;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 2px; }
input::placeholder,
textarea::placeholder { color: var(--ink-dim); opacity: 1; }

/* Small table */
table.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ledger-table th, .ledger-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.ledger-table th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-fainter);
  font-weight: 500;
}
.ledger-table td { color: var(--ink); }

/* ===== RTL (Arabic) overrides — only apply when <html dir="rtl">. ===== */
html[lang="ar"] .skip-link { left: auto; right: 16px; }
html[lang="ar"] .ledger-nav .brand .mark { margin-right: 0; margin-left: 4px; }
html[lang="ar"] .ledger-nav nav a::after { transform-origin: right center; }
html[lang="ar"] .ledger-table th,
html[lang="ar"] .ledger-table td { text-align: right; }

/* ----- RTL typography -----
   The chrome's tracked mono micro-labels are a Latin device: letter-spacing
   breaks Arabic's cursive joining, and the 9–11px label sizes are illegible in
   Arabic. Kill tracking site-wide in Arabic and lift the label sizes. All
   html[lang="ar"]-scoped, so the English layout is untouched. */
/* RTL UI labels use a crisp system Arabic SANS. Amiri is a delicate Naskh serif
   that looks thin/weak at small label sizes; the system sans (SF Arabic on
   macOS) is built for UI legibility. Display text (headings/names/prose) keeps
   Amiri via --arabic elsewhere — only the small label tier switches. Feed the
   sans into --mono too so every var(--mono) label gets it for Arabic while
   Latin/digits stay tabular in JetBrains Mono. */
html[lang="ar"] {
  --arabic-ui: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', sans-serif;
  --mono: 'JetBrains Mono', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', sans-serif;
  /* Arabic labels need far more contrast than the Latin micro-label grays give:
     the dim/fainter inks are near-invisible on small Arabic. Brighten them hard
     in RTL only (EN keeps the subtle grays). */
  --ink-dim: #d4cfc4;
  --ink-fainter: #bdb7ab;
}
html[lang="ar"] * { letter-spacing: normal !important; font-style: normal !important; }
/* Slightly heavier weight so small Arabic labels read solid, not hairline. */
html[lang="ar"] .ledger-nav nav a,
html[lang="ar"] .eyebrow,
html[lang="ar"] .filter-label,
html[lang="ar"] .chip,
html[lang="ar"] .seg button,
html[lang="ar"] .legend,
html[lang="ar"] .foot,
html[lang="ar"] .bignum .sub,
html[lang="ar"] .bignum .l,
html[lang="ar"] .bw-headline .sub,
html[lang="ar"] .bw-subsets .cell .of,
html[lang="ar"] .bar-row .lbl,
html[lang="ar"] .year-row .y-lbl { font-weight: 500; }
/* Third axis for light-on-dark Arabic (per the typography reference): the
   multi-line stat sublabels need more leading so they breathe, and the primary
   stat sublabel reads better a touch larger. */
html[lang="ar"] .bignum .sub,
html[lang="ar"] .bw-headline .sub,
html[lang="ar"] .bw-overlap-note,
html[lang="ar"] .legend,
html[lang="ar"] .foot { line-height: 1.65; }
html[lang="ar"] .bignum .sub { font-size: 14px; }
/* COMPREHENSIVE Arabic label sizing — most stat-label classes were still at
   their original 9–11px (too small). Bump every Arabic TEXT label; leave number
   values (.val/.y-count/.g-val/.n/axes) at their small tabular sizes. */
html[lang="ar"] .ledger-nav nav a { font-size: 17px; }
html[lang="ar"] .eyebrow { font-size: 15px; }
html[lang="ar"] .filter-label { font-size: 15px; }
html[lang="ar"] .chip,
html[lang="ar"] .seg button { font-size: 15px; }
html[lang="ar"] .legend { font-size: 14px; }
html[lang="ar"] .foot { font-size: 14px; }
/* Statistics page — all the Arabic text labels that were never sized. */
html[lang="ar"] .bignum .l,
html[lang="ar"] .bw-headline .l { font-size: 14px; }
html[lang="ar"] .bignum .sub,
html[lang="ar"] .bw-headline .sub { font-size: 16px; }
html[lang="ar"] .chart-card .note,
html[lang="ar"] .bar-row .lbl,
html[lang="ar"] .bw-part-legend .t,
html[lang="ar"] .bw-subsets .cell .l,
html[lang="ar"] .bw-subsets .cell .of,
html[lang="ar"] .bw-overlap-note,
html[lang="ar"] .bw-sources { font-size: 14px; }
html[lang="ar"] .ledger-nav nav a,
html[lang="ar"] .eyebrow,
html[lang="ar"] .filter-label,
html[lang="ar"] .chip,
html[lang="ar"] .seg button,
html[lang="ar"] .legend,
html[lang="ar"] .foot,
html[lang="ar"] .mobile-filter-btn,
html[lang="ar"] .mobile-reset-btn,
html[lang="ar"] .drawer-title { font-family: var(--arabic-ui) !important; }
/* (Older duplicate size blocks removed — the comprehensive block above is the
   single source of truth for RTL label sizes. Only the lang-toggle and mobile
   drawer sizes, not set above, remain here.) */
html[lang="ar"] .ledger-nav .lang-toggle { font-size: 13px; }
html[lang="ar"] .mobile-filter-btn,
html[lang="ar"] .mobile-reset-btn,
html[lang="ar"] .drawer-title { font-size: 15px; }

/* Keep the compact four-column mobile navigation legible after the general
   Arabic UI sizing rules above. */
@media (max-width: 820px) {
  html[lang="ar"] .ledger-nav nav a { font-size: 13px; }
}

/* Arabic label bumps — panel, search results, about/contribute, detail page.
   12px Latin mono labels are fine; Arabic needs ≥14px to be legible. */
html[lang="ar"] .data-grid dt,
html[lang="ar"] .status-pill,
html[lang="ar"] .panel-id,
html[lang="ar"] .search-result .meta,
html[lang="ar"] .search-more,
html[lang="ar"] .touch-sheet .ts-meta,
html[lang="ar"] .defs dt,
html[lang="ar"] form.ledger-form .k,
html[lang="ar"] .ledger-table th,
html[lang="ar"] .entry-id,
html[lang="ar"] .entry-meta,
html[lang="ar"] .record .field-grid dt,
html[lang="ar"] .back-link { font-size: 14px; }

/* Hide scrollbars in chrome-y areas while keeping usable */
.lite-scroll { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.lite-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.lite-scroll::-webkit-scrollbar-thumb { background: var(--line-3); }
.lite-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Page transitions ----------
   SPA-style: header.js swaps ONLY the [data-ledger-page] region,
   never the header/footer. The fade is scoped to the content region
   so the chrome stays rock-still across navigation. */

html { background: var(--bg); -webkit-tap-highlight-color: rgba(232,228,220,0.08); }

[data-ledger-page] {
  transition: opacity var(--dur) var(--ease-out);
}
[data-ledger-page].is-leaving {
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-in);
}
/* Enter from slightly below — gives the swapped page a gentle upward settle
   (ease-out). Skipped on the archive page: its canvas/filters are
   position:fixed, and a transform on this ancestor would change their
   containing block mid-transition. Archive uses opacity only. */
body:not([data-page="archive"]) [data-ledger-page] {
  transition: opacity var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
}
body:not([data-page="archive"]) [data-ledger-page].is-leaving {
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-in),
              transform var(--dur-fast) var(--ease-in);
}
body:not([data-page="archive"]) [data-ledger-page].is-entering {
  opacity: 0;
  transform: translateY(8px);
  transition: none;
}

/* Staggered reveal — runs whenever new content is swapped in.
   JS assigns --i by visual position (bottom → top). */
[data-reveal] > *,
[data-reveal-item] {
  opacity: 0;
  transform: translateY(20px);
  animation: ledger-reveal 400ms cubic-bezier(.16,.84,.32,1) forwards;
  animation-delay: calc(60ms + var(--i, 0) * 55ms);
}
@keyframes ledger-reveal {
  to { opacity: 1; transform: none; }
}

/* Hover effects only for real pointer devices — not touch */
@media (hover: hover) and (pointer: fine) {
  .ledger-nav nav a:hover { color: var(--ink); }
  .ledger-nav nav a:hover::after { transform: scaleX(1); }   /* underline wipes in from left */
  .chip:hover { color: var(--ink); border-color: var(--line-3); transform: translateY(-1px); }
  .btn:hover { background: var(--ink); color: var(--bg); transform: translateY(-1px); }
  .ledger-foot a:hover { color: var(--ink); }
}

.btn:active  { transform: scale(0.97); transition: transform 80ms var(--ease-out); }
.chip:active { transform: scale(0.97); transition: transform 80ms var(--ease-out); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  body, [data-reveal] > *, [data-reveal-item] {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  /* Make everything else effectively instant without forcing transform:none
     globally (which would erase static transformed states like the active-nav
     underline or the poppy blooms). */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* Neutralize the page-enter/leave offsets so nothing slides. */
  [data-ledger-page].is-entering,
  [data-ledger-page].is-leaving { transform: none !important; }
}
@media (forced-colors: active) {
  .chip, .btn, input, textarea, select, .reset-btn, .close-btn { border-color: CanvasText; }
  .chip.active { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  :focus-visible { outline-color: Highlight; }
}

@media (pointer: coarse){ [data-set-lang] { min-height: 44px; } }

/* React bootstrap failures must remain visible above the archive canvas. */
.runtime-error { position:fixed; z-index:110; top:var(--nav-h, 80px); left:20px; right:20px; padding:12px 18px; background:var(--bg-2); color:var(--ink); border:1px solid var(--line-3); }
[hidden] { display:none !important; }
