/* Fadak's look, shared by every app (loaded after each app's own styles): Tilework colours, muted, on a pale limestone page, light
   and dark, and each app's own colour (html[data-app]). On screen only: printing keeps each app's own print colours.
   The home page (index.html) carries the same colours in its own styles. Every colour used for words passes 4.5:1
   on the page and on cards. */
@media screen {
  :root {
    --bg: #f0f3f2; --bg-2: #e5eceb; --card: #ffffff; --ink: #1f2322; --ink-2: #515a58; --line: #dce4e2;
    --done: #617146; --done-bg: #e8eedd;
    --shadow: 0 1px 2px rgba(20, 40, 40, .05), 0 8px 22px -6px rgba(20, 40, 40, .12);
  }
  :root[data-theme="dark"] {
    --bg: #0d1416; --bg-2: #111b1d; --card: #172124; --ink: #eef2ef; --ink-2: #b2bfbc; --line: #293638;
    --done: #a7be8b; --done-bg: #24301e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -6px rgba(0, 0, 0, .45);
  }

  /* Each app's colour: terracotta (the checklist), teal (Dhikr; doubts, travel, obligations), lapis (Qaḍāʾ, fasting),
     saffron (prayer times), green (food), rose (periods) */
  html[data-app="wird"] { --accent: #995845; --accent-soft: #f5e4dc; }
  html[data-app="wird"][data-theme="dark"] { --accent: #ce8e78; --accent-soft: #3a2620; }
  html[data-app="dhikr"], html[data-app="yaqin"], html[data-app="safar"], html[data-app="faraid"], html[data-app="calendar"], html[data-app="alif"], html[data-app="lab"] { --accent: #3a7276; --accent-soft: #dcecec; }
  html[data-app="dhikr"][data-theme="dark"], html[data-app="yaqin"][data-theme="dark"], html[data-app="safar"][data-theme="dark"], html[data-app="faraid"][data-theme="dark"],
  html[data-app="calendar"][data-theme="dark"], html[data-app="alif"][data-theme="dark"], html[data-app="lab"][data-theme="dark"] { --accent: #6dbbbe; --accent-soft: #183234; }
  html[data-app="qada"], html[data-app="imsak"] { --accent: #4c6188; --accent-soft: #e3e8f2; }
  html[data-app="qada"][data-theme="dark"], html[data-app="imsak"][data-theme="dark"] { --accent: #97a9cc; --accent-soft: #1f2940; }
  html[data-app="miqat"] { --accent: #88652a; --accent-soft: #f3e9d4; }
  html[data-app="miqat"][data-theme="dark"] { --accent: #d0b071; --accent-soft: #33291a; }
  html[data-app="imsak"] { --moon: #4c6188; } html[data-app="imsak"][data-theme="dark"] { --moon: #97a9cc; }
  html[data-app="safar"] { --moon: #3a7276; } html[data-app="safar"][data-theme="dark"] { --moon: #6dbbbe; }
  html[data-app="tayyib"] { --accent: #617146; --accent-soft: #e8eedd; }
  html[data-app="tayyib"][data-theme="dark"] { --accent: #a7be8b; --accent-soft: #24301e; }
  html[data-app="qamar"] { --accent: #99566c; --accent-soft: #f4e3e9; }
  html[data-app="qamar"][data-theme="dark"] { --accent: #cd92a3; --accent-soft: #3a2630; }

  /* The checklist's kinds of item (Dawām and Dhikr): dhikr terracotta, Qurʾān teal, duʿāʾ rose, prayer lapis */
  html[data-app="wird"], html[data-app="dhikr"] {
    --dhikr: #995845; --dhikr-bg: #f5e4dc; --quran: #3a7276; --quran-bg: #dcecec;
    --dua: #99566c; --dua-bg: #f4e3e9; --prayer: #4c6188; --prayer-bg: #e3e8f2;
  }
  html[data-app="wird"][data-theme="dark"], html[data-app="dhikr"][data-theme="dark"] {
    --dhikr: #ce8e78; --dhikr-bg: #3a2620; --quran: #6dbbbe; --quran-bg: #183234;
    --dua: #cd92a3; --dua-bg: #3a2630; --prayer: #97a9cc; --prayer-bg: #1f2940;
  }

  /* Words that read well: headings break into even lines, paragraphs don't leave one word alone on their last line,
     and hints in an empty box are as readable as the words around them */
  h1, h2, h3 { text-wrap: balance; }
  p, li, dd, small, .ar, .tr, .en { text-wrap: pretty; }
  ::placeholder { color: var(--ink-2); opacity: 1; }

  /* The fiqh guides' result colours: "all clear" green dark enough to read on white; their spare tone a lapis, not violet */
  html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"] { --tahir: #3f7452; }
  html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"] { --nifas: #4c6188; --nifas-bg: #e3e8f2; }
  html[data-app="yaqin"][data-theme="dark"], html[data-app="imsak"][data-theme="dark"], html[data-app="safar"][data-theme="dark"], html[data-app="tayyib"][data-theme="dark"] { --nifas: #97a9cc; --nifas-bg: #1f2940; }

  /* Easy to tap: every small button and in-line action at least 44px tall (a link inside a sentence gets a taller hit
     area without moving the words around it) */
  .tickall, .qa-go, .link[data-all], .rd-bm, .read-acts .fav, .read-head .fav { min-height: 44px; }
  .tickall, .link[data-all] { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .rd-bm, .read-acts .fav, .read-head .fav { min-width: 44px; width: 44px; height: 44px; }
  p a, p .link, small a { padding-block: 12px; margin-block: -12px; }

  /* The fiqh guides: a question is a plain section, its answers the only cards (no cards inside a card); one column on
     the narrowest phones; an answer's verdict shown once, by its badge; the advice to ask beside the answer */
  :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .card:not(.result) { background: none; border: 0; box-shadow: none; padding: 6px 2px 0; }
  :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .card.result { border-top: 1px solid var(--line); }
  :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .ask-note { margin: 8px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); color: var(--ink); font-size: 15.5px; }
  :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .intro .private { margin-top: 6px; font-size: 15px; color: var(--ink-2); }
  @media (max-width: 360px) { :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .tiles { grid-template-columns: 1fr; } :is(html[data-app="qamar"], html[data-app="yaqin"], html[data-app="imsak"], html[data-app="safar"], html[data-app="tayyib"]) .tile { min-height: 0; flex-direction: row; align-items: center; } }

  /* More that is easy to tap: the app's name in the bar (back to its start), "About this duʿāʾ" and other folds, the
     welcome's Done, the day arrows, an item's pen, the āyāt steppers */
  header.top a.brand { display: inline-flex; align-items: center; min-height: 44px; }
  summary { min-height: 44px; box-sizing: border-box; padding-block: 10px; }
  .su-next { min-height: 44px; }
  .items li > .more { min-width: 44px; min-height: 44px; }
  .daybar .nav { height: 44px; }   /* 44px tall; kept 40px wide, so with the largest text the day's line beside them doesn't re-wrap when ticked */
  .ayat-step button, .ayat-set button { min-width: 44px; min-height: 44px; }
  .foot a { padding-block: 12px; margin-block: -12px; }
  /* Narrow phones: an item's small line breaks inside a long word rather than spilling past its box; Farāʾiḍ's Arabic
     name goes under the English, so neither is squeezed */
  .items .txt small { overflow-wrap: anywhere; }
  @media (max-width: 400px) {
    html[data-app="faraid"] .items li > a { flex-wrap: wrap; }
    html[data-app="faraid"] .items .ar { order: 3; flex-basis: 100%; text-align: right; margin-top: 2px; }
  }

  /* Reading a text in Dhikr (or Dawām): the words as dark as they go on a near-white card, or as light as they go on
     the dark one, so the Arabic stands clear of its background */
  html[data-app="dhikr"], html[data-app="wird"] { --read-ink: #14120f; --read-card: #fffefb; }
  html[data-app="dhikr"][data-theme="dark"], html[data-app="wird"][data-theme="dark"] { --read-ink: #f7f9f7; --read-card: #121b1d; }
  .lines { background: var(--read-card); }
  .lines .ar, .lines .ar.q { color: var(--read-ink); }
  .lines .en { color: var(--read-ink); }
}
