/* أوراد السمانية — one stylesheet for the whole library.
 *
 * The typography is the app's: Noto Naskh Arabic for everything that is read
 * (--read: the passages, the أبيات, prose), Cairo for everything around it
 * (--ui: headings, navigation, cards, contents), 2.1 for running Arabic at
 * --fs, and headings on one scale in Cairo SemiBold. Every page links this
 * file, so a change to a token changes the library rather than one corner of
 * it.
 *
 * Published as /style.css by scripts/build_image_book.py, linked with a hash so
 * a change reaches readers despite the thirty-day cache on stylesheets.
 *
 * What is NOT here: the books are photographs of printed pages, and the type in
 * those photographs is the printer's, set long before this site existed. This
 * file governs everything around them — headings, navigation, contents,
 * captions — and the one section that is real text.
 */

/* Self-hosted: the library asks nothing of its readers, and a font from
 * someone else's CDN would hand that party an address on every visit.
 * All SIL OFL 1.1 — /fonts/*-OFL.txt. Only the weights the site sets are
 * declared: Naskh 400 and 700 (the rubricated names), Cairo 400 and 600. */
@font-face{font-family:"Noto Naskh Arabic";font-weight:400;font-display:swap;
  src:url("/fonts/NotoNaskhArabic-Regular.woff2") format("woff2"),
      url("/fonts/NotoNaskhArabic-Regular.ttf") format("truetype")}
@font-face{font-family:"Noto Naskh Arabic";font-weight:700;font-display:swap;
  src:url("/fonts/NotoNaskhArabic-Bold.woff2") format("woff2"),
      url("/fonts/NotoNaskhArabic-Bold.ttf") format("truetype")}
@font-face{font-family:"Cairo";font-weight:400;font-display:swap;
  src:url("/fonts/Cairo-Regular.woff2") format("woff2"),
      url("/fonts/Cairo-Regular.ttf") format("truetype")}
@font-face{font-family:"Cairo";font-weight:600;font-display:swap;
  src:url("/fonts/Cairo-SemiBold.woff2") format("woff2"),
      url("/fonts/Cairo-SemiBold.ttf") format("truetype")}
/* Noto Naskh Arabic draws no Latin and no ASCII punctuation — not even a
 * bracket — so those fall through to Amiri, cut down to just that range. The
 * unicode-range means a page without them never fetches it. */
/* The names — the library's title, a featured card's heading — are set in
 * Amiri. The file is the one already published here; only its Latin cut was
 * declared before, for the brackets Noto Naskh does not draw. Bold alone,
 * because that is the only weight any name is set in. */
@font-face{font-family:"Amiri Display";font-weight:700;font-display:swap;
  src:url("/fonts/Amiri-Bold.woff2") format("woff2")}
@font-face{font-family:"Amiri";font-weight:400;font-display:swap;
  src:url("/fonts/Amiri-Latin-Regular.woff2") format("woff2");
  unicode-range:U+0020-007E,U+00A0-00FF,U+0100-017F,U+02B0-02FF,U+1E00-1EFF,U+2000-206F}
@font-face{font-family:"Amiri";font-weight:700;font-display:swap;
  src:url("/fonts/Amiri-Latin-Bold.woff2") format("woff2");
  unicode-range:U+0020-007E,U+00A0-00FF,U+0100-017F,U+02B0-02FF,U+1E00-1EFF,U+2000-206F}

/* ---------------------------------------------------------------- tokens */
:root{
  --bg:#F6F1E7; --surface:#FFFDF8; --ink:#2A2A24; --soft:#6B6354;
  --emerald:#1F4D3A; --crimson:#9E2B25; --line:#E8DFCC;
  /* The gold is two colours, not one. --gold is the ornament: rings, rules,
     rosettes, the tiled khātam. --gold-ink is the same gold darkened until a
     line of type set in it clears contrast against the page — counts,
     bylines, the «المؤلف:» label, anything gold that is read rather than
     looked at. Leaf gold on ivory is not a colour anyone can read a number
     in. The app splits them the same way. */
  --gold:#C9A45C; --gold-ink:#7A5C22;
  --bar:rgba(246,241,231,.94);
  /* The tinted square a card's glyph sits in, and the pill behind the
     current item. */
  --tile:#EFE6D2; --pill:#E7EFE9;
  /* The green field the homepage's head and its featured card are set on,
     and the three inks that are set on it. Not --emerald: in dark mode
     --emerald is a light mint, which is the colour of text *on* green
     rather than the field itself. */
  --head:#1F4D3A; --head-title:#F3E6C4; --head-gold:#E2C987; --head-body:#D9CFB4;
  --fs:25px;              /* running Arabic text */
  --read:"Noto Naskh Arabic","Amiri",Georgia,"Times New Roman",serif;
  --ui:"Cairo","Noto Naskh Arabic","Amiri",system-ui,sans-serif;
  /* The face for the names — the library's own title, a section's name on
     its card. Amiri is the book's hand; it is not the face the prayers are
     set in, here or in the app. */
  --display:"Amiri Display","Noto Naskh Arabic",Georgia,serif;
  --measure:780px;        /* the reading column */
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#14150F; --surface:#1C1E17; --ink:#EDE7D8; --soft:#A9A392;
    --emerald:#6FBF92; --crimson:#E0756C; --line:#2E3126;
    /* On a near-black page the ornament gold is already legible as type;
       the light theme's darkened gold would disappear into the paper. */
    --gold:#C9A45C; --gold-ink:#D8B45A;
    --bar:rgba(20,21,15,.94);
    --tile:#26291F; --pill:#24332A;
    /* Deeper than the light theme's field so it does not glow in a dark
       room, and still unmistakably the same green. */
    --head:#16311F;
  }
}

/* ------------------------------------------------------------------ base */
*{box-sizing:border-box}
html{scroll-behavior:smooth;scroll-padding-top:72px}
@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto}}
body{margin:0;background:var(--bg);color:var(--ink);
     font-family:var(--ui);line-height:1.8;
     -webkit-text-size-adjust:100%}

/* English pages, and any English passage inside an Arabic one. Cairo's Latin
   is serviceable but it was cut for UI; English gets a Latin face chosen
   for reading, and a line height suited to it. No extra font is downloaded —
   these are the faces a reader's own device already has. */
:root[lang="en"] body,[lang="en"]{
  font-family:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,
              "Times New Roman",serif;line-height:1.75}
:root[lang="en"] h1,:root[lang="en"] h2,:root[lang="en"] h3{line-height:1.25}
:root[lang="en"] h1{font-size:clamp(34px,7vw,52px)}
:root[lang="en"] .crumbs li+li::before{content:"→"}
/* The ornament and the breadcrumb arrow both point the way the language runs. */
:root[lang="en"] .card .chev{transform:scaleX(-1)}
:root[lang="en"] .card:hover .chev{transform:scaleX(-1) translateX(-4px)}
a{color:var(--emerald)}
:focus-visible{outline:3px solid var(--gold);outline-offset:3px;border-radius:6px}
.wrap{max-width:var(--measure);margin:0 auto;padding:0 20px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------------------------------------------------------- the headings */
/* Cairo SemiBold, about a tenth smaller than the Amiri these were set for:
   Cairo's letters stand much taller at the same size. */
h1,h2,h3{font-weight:600}
h1{font-size:clamp(36px,8vw,54px);line-height:1.35;color:var(--emerald);margin:0 0 4px}
h2{font-size:clamp(20px,4.6vw,25px);line-height:1.45;color:var(--emerald);margin:0 0 12px}
h3{font-size:clamp(18px,4vw,20px);line-height:1.5;color:var(--emerald);margin:0 0 8px}

/* ------------------------------------------------------ the reading face
 * Everything that is read rather than navigated, wherever its builder put
 * it: سر الأسرار's passages, front matter and references (.ar .prose .bayt
 * .ref .sajda .repeat), the قصائد and أوراد (.poem .single), search snippets,
 * and the library's own prose pages (.prose). */
.ar,.ref,.prose,.bayt,.poem,.single,.sajda,.repeat,.results a{font-family:var(--read)}
.sub{color:var(--soft);font-size:clamp(16px,3.6vw,20px);margin:0 auto 18px;max-width:32em}
.by{color:var(--soft);margin:0;font-size:clamp(16px,3.8vw,19px)}
/* The poet, under the title. Separate from .by, which carries what the
   source prints on its title page — sometimes a mosque, sometimes the
   form of the work, not always a person. */
.author{margin:3px 0 0;font-size:clamp(14px,3.2vw,16px);color:var(--emerald);line-height:1.9}
.author .k{color:var(--gold-ink)}
p{margin:0 0 14px}

/* A page's opening block: rosette, title, attribution. */
.intro,header.page-head{text-align:center;padding:40px 0 10px}
.rosette{width:13px;height:13px;margin:0 auto 18px;border-radius:50%;
         background:var(--gold);opacity:.85}

/* ------------------------------------------------------------------- bar */
.bar{position:sticky;top:0;z-index:20;background:var(--bar);backdrop-filter:blur(8px);
     border-bottom:1px solid var(--line)}
.bar .wrap{display:flex;align-items:center;gap:10px 12px;min-height:58px;
           flex-wrap:wrap;padding-block:8px;max-width:1040px}
.home{display:inline-flex;align-items:center;gap:8px;background:var(--surface);
      border:1px solid var(--gold);border-radius:999px;padding:6px 15px;
      color:var(--emerald);text-decoration:none;font-weight:600;font-size:16px;
      white-space:nowrap;transition:background .15s,color .15s}
.home:hover,.home:focus-visible{background:var(--gold);color:var(--bg)}
.home .dot{width:9px;height:9px;border-radius:50%;background:var(--gold);flex:none}
.home:hover .dot,.home:focus-visible .dot{background:var(--bg)}
.crumbs{margin-inline-end:auto;min-width:0}
.crumbs ol{list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;
           margin:0;padding:0;color:var(--soft);font-size:16px}
.crumbs a{color:var(--emerald);text-decoration:none}
.crumbs a:hover{text-decoration:underline}
.crumbs li+li::before{content:"←";margin-inline-end:8px;color:var(--gold-ink);opacity:.75}
.crumbs [aria-current="page"]{color:var(--soft)}
/* The language switch: a quiet control, never louder than the way home. */
.lang{background:var(--surface);border:1px solid var(--line);border-radius:999px;
      padding:5px 13px;color:var(--soft);text-decoration:none;font-size:15px;
      white-space:nowrap}
.lang:hover,.lang:focus-visible{border-color:var(--gold);color:var(--emerald)}
/* The homepage carries no bar, so its switcher sits in the hero's corner,
   light enough to read on the green and quiet enough not to compete. */
.langbar{position:absolute;top:14px;inset-inline-end:16px;z-index:2}
.langbar a{display:inline-block;background:rgba(255,253,248,.10);
           border:1px solid rgba(233,217,166,.45);border-radius:999px;
           padding:5px 14px;color:#EFE6CE;text-decoration:none;font-size:15px;
           backdrop-filter:blur(4px)}
.langbar a:hover,.langbar a:focus-visible{background:rgba(255,253,248,.2);color:#FFFDF8}
/* The page's own controls. They wrap rather than run on: on a phone a poem's
   six — English, رجوع, الرئيسية, السابق, التالي, تصويب النص — are wider than
   the screen, and in one unbroken row they pushed the whole page sideways. */
.nav{display:flex;flex-wrap:wrap;gap:6px;align-items:center;color:var(--soft);font-size:15px}
.nav>*{white-space:nowrap}
.nav select,.nav a,.nav span,.nav button{background:var(--surface);border:1px solid var(--line);
     border-radius:10px;padding:4px 10px;color:var(--ink);font:inherit;text-decoration:none}
.nav button{cursor:pointer}
.nav a:hover,.nav select:hover,.nav button:hover{border-color:var(--gold)}
.nav span{color:var(--soft);opacity:.55}
.nav .now{color:var(--gold-ink);border-color:transparent;background:transparent;
          font-variant-numeric:tabular-nums}
@media (max-width:520px){
  .home{font-size:15px;padding:5px 13px}
  .crumbs ol{font-size:14px}
}

/* ------------------------------------------------------------ الفهرس */
/* The work's own contents, from the button in the bar. Written once here
   rather than in each builder's <style>, so every page's فهرس is the same
   one: see scripts/toc.py for what goes in it and why.

   The list is `.work-toc` — the very block a work prints at its head — so
   there is one فهرس on this site in one set of rules, and the panel cannot
   drift away from the page it belongs to. Those rules used to live inside
   build_poems.py's own <style>, where only a قصيدة could reach them. */
/* The same control the bar has always shown — `.nav button`'s appearance,
   written out here as well so the button looks identical on the two pages
   whose bars have no `.nav` row of their own (سر الأسرار, عن الطريقة). */
.toc-btn{background:var(--surface);border:1px solid var(--line);border-radius:10px;
         padding:4px 10px;color:var(--ink);font:inherit;font-size:15px;
         white-space:nowrap;cursor:pointer}
.toc-btn:hover{border-color:var(--gold)}
.toc-btn[aria-expanded="true"]{border-color:var(--gold);color:var(--gold-ink)}
/* Hung from the bar itself, which is `position:sticky` and so is already the
   containing block for this. It therefore stays with the bar while the page
   scrolls under it, and inherits the bar's z-index rather than fighting it. */
.toc-panel{position:absolute;inset-inline:0;top:100%;
           background:var(--bar);backdrop-filter:blur(8px);
           border-bottom:1px solid var(--line);
           box-shadow:0 14px 28px rgba(0,0,0,.09);
           /* Taller than the app's sheet is allowed to be, because جامع
              الأوراد lists thirteen sections and a phone shows about eight. */
           max-height:min(70vh,560px);overflow:auto;
           padding:clamp(14px,3vw,22px) 0 clamp(16px,3vw,22px)}
.toc-panel[hidden]{display:none}
/* The panel sits inside `.bar`, so `.bar .wrap` above would otherwise lay
   its contents out as a centred flex row 58px tall. Same specificity, so
   this has to come after it — and it does. The width is the bar's own, not
   the page's `--measure`, so the panel lines up with the button it hangs
   from rather than with the text column. */
.toc-panel .wrap{display:block;min-height:0;padding-block:0;max-width:1040px}
.toc-h{margin:0 0 12px;color:var(--gold-ink);font-family:var(--ui);
       font-size:clamp(16px,3.4vw,18px);font-weight:600}
.work-toc{margin:0 0 clamp(26px,5vw,38px)}
/* Two columns where there is room, one on a phone — «جامع الأوراد» has
   thirteen named sections and رياض الخيرات fifteen. */
.work-toc ol{list-style:none;margin:0;padding:0;display:grid;gap:6px 18px;
             grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.work-toc a{color:var(--emerald);text-decoration:none;font-size:17px;
            line-height:1.9;display:block;padding:2px 0}
.work-toc a:hover{text-decoration:underline}
/* Inside the panel the list closes the panel, so it needs no bottom margin
   of its own; the menu under it provides the parting. */
.toc-panel .work-toc{margin:0}
/* The panel is as wide as the bar, which is wider than the text column, so
   200px columns would make five of them. Most entries are short — fourteen
   letters is the median — but «سيدي الدكتور الشيخ محمد… حاليًا» on عن
   الطريقة is a hundred and ten, and in a fifth of the screen it stacks
   nine lines deep. Wider columns, fewer of them. */
.toc-panel .work-toc ol{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.toc-menu{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:14px;
          padding-top:12px;border-top:1px solid var(--line)}
.toc-menu a{color:var(--soft);text-decoration:none;font-family:var(--ui);
            font-size:15px}
.toc-menu a:hover{color:var(--gold-ink);text-decoration:underline}

/* ----------------------------------------------------------------- cards */
.cards{display:grid;gap:14px}
@media (min-width:720px){.cards{grid-template-columns:1fr 1fr}}
.card{display:flex;align-items:center;gap:16px;background:var(--surface);
      border:1px solid var(--line);border-radius:18px;padding:20px 20px 20px 16px;
      text-decoration:none;color:inherit;
      transition:border-color .16s,box-shadow .16s,transform .16s}
.card:hover{border-color:var(--gold);box-shadow:0 10px 26px rgba(15,81,50,.10);
            transform:translateY(-3px)}
.card .mark{flex:none;width:46px;height:46px;border-radius:14px;display:grid;
            place-items:center;background:var(--tile)}
.card .mark svg{width:24px;height:24px;display:block;stroke:var(--gold-ink);fill:none;
                stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
/* The order's mark can stand in that box instead of a drawn glyph. The
   artwork runs to all four edges of its file with no transparent margin,
   so it is set two points smaller than the glyphs to keep the same air
   between it and the border. */
.card .mark img{width:22px;height:22px;display:block;object-fit:contain}
.card .body{flex:1;min-width:0}
.card .t{display:block;font-size:20px;font-weight:600;color:var(--emerald);line-height:1.5}
.card .s{display:block;color:var(--soft);font-size:15px;line-height:1.65}
.card .m{display:block;margin-top:5px;color:var(--gold-ink);font-size:14px}
.card .chev{flex:none;color:var(--gold-ink);font-size:22px;opacity:.75;transition:transform .16s}
.card:hover .chev{transform:translateX(-4px)}
@media (prefers-reduced-motion: reduce){
  .card,.card .chev{transition:none}
  .card:hover,.card:hover .chev{transform:none}
}
.sec{display:flex;align-items:center;gap:14px;margin:0 0 22px;
     font-size:clamp(20px,4.6vw,25px);font-weight:600;color:var(--emerald)}
.sec::after{content:"";flex:1;height:1px;background:var(--line)}
.sec .count{font-size:16px;color:var(--soft);font-weight:400}

/* ---------------------------------------------------------------- footer */
footer{margin-top:clamp(36px,8vw,58px);padding:26px 0 46px;text-align:center;
       color:var(--soft);font-size:15px;border-top:1px solid var(--line)}
.flinks{display:flex;justify-content:center;gap:8px 18px;flex-wrap:wrap;
        margin:0 0 8px;padding:0;list-style:none}
.flinks a{color:var(--emerald);text-decoration:none}
.flinks a:hover{text-decoration:underline}


/* ------------------------------------------------------------- ornament --
 * One mark for the whole library: a hairline broken by three ◈, under the
 * name in the hero and between the sections of a poem. It is a mask rather
 * than a picture, so its colour is the gold token and it follows the theme
 * without a second copy of the artwork; and it is drawn rather than set as ❦
 * or ◈, because none of the site's faces has such a glyph and a character would fall back to
 * whatever font the device happens to carry.
 */
.orn{display:block;width:clamp(150px,46vw,240px);height:14px;margin:0 auto;
     background:var(--gold);opacity:.55;
     -webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20240%2014%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.1%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%207H92%22%2F%3E%3Cpath%20d%3D%22M148%207H232%22%2F%3E%3Cpath%20d%3D%22M104%201L110%207L104%2013L98%207Z%22%2F%3E%3Cpath%20d%3D%22M120%201L126%207L120%2013L114%207Z%22%2F%3E%3Cpath%20d%3D%22M136%201L142%207L136%2013L130%207Z%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23000%22%3E%3Cpath%20d%3D%22M104%204.9L106.1%207L104%209.1L101.9%207Z%22%2F%3E%3Cpath%20d%3D%22M120%204.9L122.1%207L120%209.1L117.9%207Z%22%2F%3E%3Cpath%20d%3D%22M136%204.9L138.1%207L136%209.1L133.9%207Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center/contain no-repeat;
     mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20240%2014%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.1%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%207H92%22%2F%3E%3Cpath%20d%3D%22M148%207H232%22%2F%3E%3Cpath%20d%3D%22M104%201L110%207L104%2013L98%207Z%22%2F%3E%3Cpath%20d%3D%22M120%201L126%207L120%2013L114%207Z%22%2F%3E%3Cpath%20d%3D%22M136%201L142%207L136%2013L130%207Z%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23000%22%3E%3Cpath%20d%3D%22M104%204.9L106.1%207L104%209.1L101.9%207Z%22%2F%3E%3Cpath%20d%3D%22M120%204.9L122.1%207L120%209.1L117.9%207Z%22%2F%3E%3Cpath%20d%3D%22M136%204.9L138.1%207L136%209.1L133.9%207Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center/contain no-repeat}

/* Masks are everywhere current, but a browser without them would show nothing
   at all where the ornament belongs. A plain hairline is a poor ornament and a
   perfectly good divider. */
@supports not ((mask-image: none) or (-webkit-mask-image: none)){
  .orn{background:none;height:1px;border-top:1px solid var(--gold);opacity:.4}
}

/* --------------------------------------------------- thumb navigation ---
 * Phones and small tablets only; wider screens keep the bar at the top. */
.thumb{display:none}
@media (max-width: 860px){
  .thumb{display:flex;position:fixed;inset-inline:0;bottom:0;z-index:30;
         background:var(--bar);backdrop-filter:blur(10px);
         border-top:1px solid var(--line);
         padding:6px 6px calc(6px + env(safe-area-inset-bottom));
         box-shadow:0 -6px 20px rgba(0,0,0,.06)}
  .thumb a,.thumb span{flex:1;display:flex;flex-direction:column;align-items:center;
         justify-content:center;gap:3px;min-height:56px;border-radius:14px;
         text-decoration:none;color:var(--emerald);font-size:13px;line-height:1.2;
         -webkit-tap-highlight-color:transparent}
  .thumb span{color:var(--soft);opacity:.45}
  .thumb a:active{background:rgba(184,145,47,.16)}
  .thumb svg{width:23px;height:23px;stroke:currentColor;fill:none;stroke-width:1.8;
         stroke-linecap:round;stroke-linejoin:round}
  .thumb .gold{color:var(--gold-ink)}
  body{padding-bottom:calc(74px + env(safe-area-inset-bottom))}
}

/* A page whose text is Arabic, being read in English: said once, at the top,
   in plain words rather than as an apology. */
.pending{background:var(--surface);border:1px solid var(--line);
         border-inline-start:4px solid var(--gold);border-radius:12px;
         padding:14px 18px;margin:0 0 clamp(22px,4vw,32px);color:var(--soft);
         font-size:16px;line-height:1.7;text-align:start}

/* ------------------------------------------------------------ prose page
 * Policy pages and the library's own writing: the same measure and rhythm as
 * the reading column, one step down in size because it is prose, not liturgy. */
.prose p,.prose li{font-size:clamp(17px,4vw,18.5px);line-height:2}
.prose p{margin:0 0 16px;max-width:66ch;text-wrap:pretty}
.prose h2{margin:34px 0 10px}
.prose ul{padding-inline-start:22px;margin:10px 0}
.prose li{margin:6px 0}
.prose .box{background:var(--surface);border:1px solid var(--line);border-radius:16px;
            padding:18px 20px;margin:22px 0}
