/* ============================================================================
   The ARABIC WEBSITE's own stylesheet (the site round, 2026-09-29).

   WHY A FILE OF ITS OWN. theme-ar.css is the v4 book's look, and the PRINT
   document (dist/ar/print.html → the PDF) links it too: every rule there reaches
   the printed book, which must keep every pixel (npm run verify:print). This file
   is linked by the Arabic SITE pages only (web/html.js pageAr), after
   theme-ar.css, and never by the print document — so nothing here can move a
   printed page. It is written to dist/ar/site-ar.css; dist/assets/styles.css is
   the frozen English site's (D13). Every rule is scoped to html[lang="ar"].

   WHAT IT HOLDS — the site audit's screen fixes, each held by
   src/scripts/check_site.js (npm run check:site) on every Arabic page:
     · a focus ring that shows on every ground (3:1 at least against what is
       around it): navy on paper, the paper colour on the ink and navy grounds;
     · the skip link as a paper tab over the ink header;
     · 16px at least for every text on the screen (the owner, 2026-09-29) —
       the raised note markers excepted, superscripts by nature;
     · reflow at 320 CSS px (addresses break, tables never scroll);
     · the notes as the one-page guide's (a note reached is marked; no smooth
       scroll); links that look like links (theme-ar.css draws a few as text,
       as the printed page does);
     · the phone menu (≤ 48rem) and the parts as groups in the nav and contents;
     · the home page, the downloads, the checklist's status and actions;
     · forced colours (the filled badges and the dark bands keep a frame);
     · printing a SITE page: A4 with margins (theme-ar.css sets the book's
       zero-margin page, for the print document).
   ========================================================================== */

/* ---------- focus ------------------------------------------------------------ */
@media screen {
  html[lang="ar"] :focus-visible,
  html[lang="ar"] a:focus-visible,
  html[lang="ar"] button:focus-visible,
  html[lang="ar"] [tabindex]:focus-visible {
    outline: 3px solid var(--v4-field);
    outline-offset: 2px;
  }
  /* The dark grounds — the header (ink), chapter 11's e-appendix strip (ink), the
     introduction's navy box, a part band (navy): the ring in the paper colour
     (14.6:1 on ink, 12.4:1 on navy). */
  html[lang="ar"] .site-header :focus-visible,
  html[lang="ar"] .content .callout--strip :focus-visible,
  html[lang="ar"] .content .callout--field :focus-visible,
  html[lang="ar"] .part-divider :focus-visible { outline-color: var(--v4-bg); }
  /* A skip link or a note's marker leads focus to <main> or to a note (tabindex
     -1): not a Tab stop, so no ring round the whole block — a note reached is
     marked below. */
  html[lang="ar"] main[tabindex="-1"]:focus { outline: none; }
  /* A Tab stop the browser scrolls into view comes to rest with room for its
     ring (3px + 2px outside it) — a link, and the checklist's answers and
     buttons, whose rings had stopped 5px past the window's lower edge. */
  html[lang="ar"] :is(a, button, input, select, textarea, summary) { scroll-margin-block: 1rem; }
  html[lang="ar"] [id] { scroll-margin-top: 1rem; }
}

/* No smooth scrolling for anyone: a screen reader's focus stays on an in-page link
   while an animated scroll carries the page away beneath it (the owner's test of
   the one-page guide, 2026-09-26). */
html[lang="ar"] { scroll-behavior: auto; }

/* ---------- the skip link: a paper tab over the ink header ------------------------ */
/* It is the banner's first element (web/html.js), so its ring is drawn on the
   header's ink — in the paper colour, above. Its TEXT is ink on its paper tab:
   theme-ar.css paints every header link in the paper colour
   (`html[lang="ar"] .site-header a`, 0,2,2), so the selector names the header
   too (0,3,2) — the tab had printed paper on paper, 1:1 (the site review, B1;
   check_site measures a focused element's own text since). */
@media screen {
  html[lang="ar"] .skip-link,
  html[lang="ar"] .site-header a.skip-link {
    background: var(--v4-bg);
    color: var(--v4-ink);
    font: 600 1rem/1.5 var(--v4-sans);
    text-decoration: underline;
    border-radius: 0 0 4px 4px;
  }
  html[lang="ar"] .skip-link:focus { top: 0.35rem; }
}

/* ---------- the header, the nav and the footer --------------------------------- */
@media screen {
  html[lang="ar"] .site-standard { font-size: 1rem; }
  html[lang="ar"] .lang-toggle { font-size: 1rem; }
  html[lang="ar"] .site-nav { font-size: 1rem; }
  /* The nav's own name (a <p>, not a heading: the h1 is the page's first heading). */
  html[lang="ar"] .site-nav__title {
    font: 600 1rem/1.4 var(--v4-sans);
    text-transform: none;
    letter-spacing: normal;
    color: var(--v4-muted);
    margin: 0.25rem 0 0.5rem;
  }
  /* The menu scrolls with the page (styles.css made the list sticky). A sticky
     menu taller than the window keeps its last links below the window's edge at
     every scroll position: at 16px the menu is ~920px tall, so on a 1280×900,
     1366×768 or 150%-zoomed window Tab reached «التنزيلات» out of sight (the
     site review, S1; check_site fails a Tab stop whose ring is not in the
     window, at 1366×768 too). */
  html[lang="ar"] .site-nav .nav-list,
  html[lang="ar"] .site-nav__menu { position: static; }
  html[lang="ar"] .site-nav__toggle { display: none; }
  /* A part is a group: its label, then its chapters. */
  html[lang="ar"] .site-nav .nav-sub { list-style: none; margin: 0; padding: 0; }
  html[lang="ar"] .site-nav .nav-group { margin: 0.8rem 0 0.2rem; }
  html[lang="ar"] .site-nav .nav-group__label {
    display: block;
    padding: 0.2rem 0.6rem;
    font: 600 1rem/1.4 var(--v4-sans);
    color: var(--v4-muted);
  }
  html[lang="ar"] .pager__dir { font-size: 1rem; text-transform: none; letter-spacing: normal; }
  /* (A part band's title stays at body size, as before this round: set large and bold, a
     <p> reads as a heading — axe p-as-heading, which check:site fails — and the band stands
     before the chapter's h1, so it cannot be a heading either.) */
  html[lang="ar"] .site-footer { font-size: 1rem; }
  html[lang="ar"] .footer-nav a { color: var(--v4-title); }
}

/* THE PHONE MENU (≤ 48rem, where the nav stands above the page): a <details>
   whose button is «القائمة»; web/html.js closes it on a narrow screen and keeps it
   open above 48rem, where the button is hidden. Without the script it stays open. */
@media screen and (max-width: 48rem) {
  html[lang="ar"] .site-nav__title { display: none; }
  html[lang="ar"] .site-nav__toggle {
    display: list-item;
    list-style-position: inside;
    cursor: pointer;
    padding: 0.55rem 0.9rem;
    border: 2px solid var(--v4-ink);
    font: 600 1rem/1.5 var(--v4-sans);
    color: var(--v4-ink);
    background: var(--v4-bg);
  }
  html[lang="ar"] .site-nav__menu[open] > .site-nav__toggle { margin-bottom: 0.5rem; }
}

/* ---------- 16 CSS px at least, for every text on the screen -------------------- */
/* Each selector is theme-ar.css's (or styles.css's) own, so this later rule wins at
   the same specificity; the line heights stay the rules' own ratios. */
@media screen {
  html[lang="ar"] .kicker,
  html[lang="ar"] .content .kicker,
  html[lang="ar"] .part-kicker,
  html[lang="ar"] .muted { font-size: 1rem; }
  html[lang="ar"] .content p.standfirst,
  html[lang="ar"] .content p.heading-note { font-size: 1rem; }
  html[lang="ar"] .content figcaption { font-size: 1rem; }
  html[lang="ar"] .content .figure__key { font-size: 1rem; }
  html[lang="ar"] .content table,
  html[lang="ar"] .content thead th,
  html[lang="ar"] .content td,
  html[lang="ar"] .content tbody th,
  html[lang="ar"] .content table.table--tools thead th { font-size: 1rem; }
  html[lang="ar"] .content td > bdi[dir="ltr"] { font-size: 1rem; }
  html[lang="ar"] .content table.table--reference thead th,
  html[lang="ar"] .content table.table--reference tbody th,
  html[lang="ar"] .content table.table--reference tbody td:nth-child(2),
  html[lang="ar"] .content ul.cell-checklist { font-size: 1rem; }
  html[lang="ar"] .content .glossary dt,
  html[lang="ar"] .content .glossary dd { font-size: 1rem; }
  html[lang="ar"] .content .link-list__title,
  html[lang="ar"] .content .link-list__url { font-size: 1rem; }
  html[lang="ar"] .content .callout p.callout__label { font-size: 1rem; }
  html[lang="ar"] .content .practical .practical__kicker { font-size: 1rem; }
  html[lang="ar"] .content .kv__label,
  html[lang="ar"] .content .kv__value,
  html[lang="ar"] .content ul.kv__list,
  html[lang="ar"] .content .info-group__line,
  html[lang="ar"] .content .info-group__link--label { font-size: 1rem; }
  html[lang="ar"] .cl-sc { font-size: 1rem; }
  /* The badges: their numbers at 16px, in circles grown to hold them. */
  html[lang="ar"] .content .step-badge { font-size: 1rem; }
  html[lang="ar"] .content .figure__badge { width: 7mm; height: 7mm; font-size: 1rem; line-height: 7mm; }
}

/* ---------- reflow at 320 CSS px (WCAG 1.4.10) and wider spacing (1.4.12) --------- */
/* A word longer than its line breaks rather than push the page wider than the
   screen. An Arabic word is never cut between its letters to make a column
   narrower: only an ADDRESS (a Latin-only link) may break anywhere — and it breaks
   first before a «/», a «.» or a hyphen (web/onepage.js addressHtml: <wbr>), never
   after a hyphen (.nobr holds a hyphen and the character after it together). */
@media screen {
  html[lang="ar"] body { overflow-wrap: break-word; }
  html[lang="ar"] a[lang="en"],
  html[lang="ar"] .content .link-list__url,
  html[lang="ar"] .content .callout--strip bdi { overflow-wrap: anywhere; }
  html[lang="ar"] .nobr { white-space: nowrap; }
  /* A table never scrolls sideways (html.js names it and gives it no scroll
     region): its cells wrap, an English word in a cell breaks where it must. */
  html[lang="ar"] .content td,
  html[lang="ar"] .content th { overflow-wrap: break-word; }
  html[lang="ar"] .content td [lang="en"],
  html[lang="ar"] .content th [lang="en"] { overflow-wrap: anywhere; }
}
/* The quick reference on a phone: theme-ar.css lets the table size its columns
   from their content there, with the chapter numbers on one line; at 320px that
   ran the table wider than the screen. Its fixed proportions come back, and the
   numbers may wrap between themselves. */
@media screen and (max-width: 40rem) {
  html[lang="ar"] .content table.table--reference { table-layout: fixed; }
  html[lang="ar"] .content table.table--reference thead th:nth-child(2),
  html[lang="ar"] .content table.table--reference tbody td:nth-child(2) { white-space: normal; }
}

/* ---------- links look like links ------------------------------------------------- */
/* theme-ar.css draws chapter 12's tool addresses and chapter 11's strip address as
   the printed page draws them — text. On the screen they are links, marked as
   every link of the site is. */
@media screen {
  html[lang="ar"] .content td > bdi[dir="ltr"] a { color: var(--v4-title); text-decoration: underline; }
  html[lang="ar"] .content .callout--strip a { color: var(--v4-bg); text-decoration: underline; }
}

/* ---------- notes (the one-page guide's) ------------------------------------------ */
/* The heading «الهوامش» stands before the notes (web/html.js siteEndnotesHtml);
   the rule above the notes is now the heading's. */
@media screen {
  html[lang="ar"] .content h2.endnotes__title {
    margin: 2.4rem 0 0.6rem;
    padding: 0.8rem 0 0;
    border: 0;
    border-top: 2px solid var(--v4-ink);
    font: 600 1rem/1.4 var(--v4-sans);
    letter-spacing: normal;
    color: var(--v4-title);
  }
  html[lang="ar"] .endnotes__title + .endnotes { margin-top: 0; padding-top: 0; border-top: 0; }
  html[lang="ar"] .endnotes li { font-size: 1rem; }
  html[lang="ar"] .endnotes li::before { font-size: 1rem; }
  html[lang="ar"] .endnotes .endnote-back {
    font: 400 1rem/1.55 var(--v4-sans);
    color: var(--v4-title);
    text-decoration: underline;
    white-space: nowrap;
    margin-inline-start: 0.35rem;
  }
  /* A note a marker leads to takes focus (tabindex -1) and is marked; so is the
     marker a back-link returns to. Gold on white: 5.6:1. */
  html[lang="ar"] .endnotes li:target,
  html[lang="ar"] .endnotes li:focus { outline: 2px solid var(--v4-title); outline-offset: 3px; background: #fff; }
  html[lang="ar"] .content a.noteref:target { outline: 2px solid var(--v4-title); outline-offset: 2px; background: #fff; }
  /* …and on a dark ground (the introduction's navy box holds two markers) the
     ring in the paper colour, as every ring there (gold on navy is 2.35:1), and
     no white ground: the marker's own number is white there (it had printed
     white on white, 1:1). */
  html[lang="ar"] .content .callout--strip a.noteref:target,
  html[lang="ar"] .content .callout--field a.noteref:target,
  html[lang="ar"] .part-divider a.noteref:target { outline-color: var(--v4-bg); background: transparent; }
}

/* ---------- the home page ------------------------------------------------------------ */
@media screen {
  html[lang="ar"] .home-head { margin: 0 0 1rem; }
  html[lang="ar"] .content .home-head .home-head__project {
    font: 600 1rem/1.5 var(--v4-sans);
    letter-spacing: normal;
    text-transform: none;
    color: var(--v4-title);
    margin: 0 0 0.5rem;
    padding-inline-start: 0.7rem;
    border-inline-start: 3px solid var(--v4-field);
  }
  html[lang="ar"] .content .home-head h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 0.5rem; }
  html[lang="ar"] .content .home-head p.lead { font: 600 1.25rem/1.45 var(--v4-sans); color: var(--v4-field); margin: 0; }
  html[lang="ar"] .content p.start-here { margin: 0 0 1.5rem; }
  html[lang="ar"] .content ul.toc,
  html[lang="ar"] .content ul.toc-sub { list-style: none; margin: 0; padding: 0; }
  html[lang="ar"] .content ul.toc { margin: 0 0 1.5rem; }
  html[lang="ar"] .content ul.toc li { margin: 0; }
  html[lang="ar"] .content .toc-group { margin: 0.9rem 0 0.3rem; }
  html[lang="ar"] .content .toc-group__label {
    display: block;
    font: 600 1rem/1.5 var(--v4-sans);
    color: var(--v4-title);
    border-top: 2px solid var(--v4-field);
    padding-top: 0.35rem;
  }
  html[lang="ar"] .content .home-credits { margin-top: 2.5rem; padding-top: 1rem; border-top: 2px solid var(--v4-ink); }
  html[lang="ar"] .content .home-credits__logos { display: block; width: 427px; max-width: 100%; height: auto; margin-top: 1rem; }
}

/* ---------- the downloads ------------------------------------------------------------- */
@media screen {
  html[lang="ar"] .content ul.downloads { list-style: none; margin: 0 0 1.5rem; padding: 0; }
  html[lang="ar"] .content ul.downloads > li { margin: 0 0 1rem; }
  html[lang="ar"] .content .download__link { font-weight: 600; }
  html[lang="ar"] .content .download__meta,
  html[lang="ar"] .content .download__desc { display: block; color: var(--v4-muted); }
  html[lang="ar"] .content .download__meta { color: var(--v4-ink); }
}

/* ---------- the checklist's status and actions ------------------------------------- */
@media screen {
  html[lang="ar"] .content .cl-status { margin: 1rem 0 1.2rem; }
  html[lang="ar"] .content p.verdict { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.4rem; }
  html[lang="ar"] .content p.cl-summary { margin: 0; color: var(--v4-muted); }
  html[lang="ar"] .content p.cl-note { margin: 0.4rem 0 0; font-weight: 600; }
}

/* ---------- forced colours (Windows High Contrast) ------------------------------------ */
/* A band or a filled badge drawn by its ground alone vanishes when the system
   repaints the grounds: each keeps a frame in the text colour. */
@media (forced-colors: active) {
  html[lang="ar"] .part-divider,
  html[lang="ar"] .content .callout--field,
  html[lang="ar"] .content .callout--strip,
  html[lang="ar"] .site-header {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }
  html[lang="ar"] .content .step-badge--filled,
  html[lang="ar"] .content .figure__badge { border: 2px solid CanvasText; }
}

/* ---------- printing a SITE page -------------------------------------------------------- */
/* theme-ar.css gives the book's print document a zero-margin A4 page (its page
   boxes ARE the sheet). A site page printed from the browser — the checklist, a
   chapter — gets margins: this @page rule, later in the cascade, wins. */
@media print {
  @page { size: A4; margin: 15mm 16mm; }
  html[lang="ar"] body { padding: 0; }
  html[lang="ar"] .skip-link,
  html[lang="ar"] .site-nav,
  html[lang="ar"] .site-nav__toggle { display: none; }
}
