/* قدراتي — the content pages (qudrat/*.html, qudrat-methods.html).
   A small stylesheet of its own so a reader of a lesson page never downloads
   the app's 300 KB of game CSS. The tokens are copied from the top of
   css/style.css (Duolingo's palette, read off Figma); keep them in step with
   it by hand, never import it. Written by hand; the pages that use it are
   generated by tools/build_lesson_pages.js. */
/* Baloo Bhaijaan 2, cut for these pages and preloaded by each of them (FONT_URL in the generator:
   the ?v= is the file's hash, and the build stops when this line names another).
   font-display: optional — the font is preloaded, so it is there for the first paint on most
   loads and on every later page; when it is late, the page keeps the fallback below for that
   visit instead of swapping and re-wrapping its lines (with swap, holding the font 1.5 s moved
   the pages by 0.10 to 0.30 at 320–412px, whatever the fallback's size: a line break that
   depends on the font moves everything under it). Its family has a name of its own, so a computer
   with Baloo Bhaijaan 2 installed never mixes the two (Chrome fell through to the installed font
   once the late file had failed the optional wait, and swapped all the same). */
@font-face { font-family: "Baloo Bhaijaan 2 Web"; src: url(/qudrat/assets/baloo-bhaijaan-2.woff2?v=4725b14b) format("woff2");
  font-weight: 500 800; font-style: normal; font-display: optional; }
/* Local fonts sized to Baloo, for a visit that keeps them: Arial (Windows, macOS) and Noto Naskh
   Arabic (Android's Arabic face), the same faces as the guide pages (qudrat-kami.html). A family
   whose font is not installed fails to load and the next one is used. The overrides are Baloo's
   ascent and descent (1080 and 632 of 1000) divided by each size, so a line sits where Baloo's
   would. */
@font-face { font-family: QFallback; src: local("Arial"), local("ArialMT");
  font-weight: 100 600; size-adjust: 115%; ascent-override: 93.9%; descent-override: 55%; line-gap-override: 0%; }
@font-face { font-family: QFallback; src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 700 900; size-adjust: 117%; ascent-override: 92.3%; descent-override: 54%; line-gap-override: 0%; }
@font-face { font-family: QFallbackN; src: local("Noto Naskh Arabic UI"), local("NotoNaskhArabicUI-Regular"), local("Noto Naskh Arabic"), local("NotoNaskhArabic-Regular");
  font-weight: 100 600; size-adjust: 104%; ascent-override: 103.8%; descent-override: 60.8%; line-gap-override: 0%; }
@font-face { font-family: QFallbackN; src: local("Noto Naskh Arabic UI Bold"), local("NotoNaskhArabicUI-Bold"), local("Noto Naskh Arabic Bold"), local("NotoNaskhArabic-Bold");
  font-weight: 700 900; size-adjust: 105%; ascent-override: 102.9%; descent-override: 60.2%; line-gap-override: 0%; }

:root {
  --green: #58CC02;      --green-dk: #58A700;   --green-lip: #478700;
  --green-bg: #D6FFB8;   --green-pale: #A5ED6E;  --green-ink: #2E6B00;  --btn: #3B8200;  --btn-lip: #2A5E00;
  --blue: #1CB0F6;       --blue-dk: #1899D6;    --blue-ink: #0B6E9C;
  --blue-light: #DDF4FF; --blue-border: #63C9F9;
  --gold: #FFC800;       --gold-dk: #E6A000;    --gold-bg: #FFF4BF;
  --brown: #AA572A;      --brown-dk: #7A3B12;
  --red: #FF4B4B;        --red-bg: #FFDFE0;
  --ink: #4B4B4B;        --gray: #6B6B6B;       --gray-icon: #AFAFAF;
  --line: #E5E5E5;       --snow: #FFFFFF;       --surface: #F7F7F7;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--snow); color: var(--ink);
  font-family: 'Baloo Bhaijaan 2 Web', QFallback, QFallbackN, 'Segoe UI', Tahoma, 'Geeza Pro', sans-serif; font-size: 16px; line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue-ink); text-underline-offset: 3px; }
a:hover { color: var(--blue-dk); }
/* the focus ring in --blue-ink: 5.6:1 on white, over 3:1 on the green chips and the gold cards (WCAG 1.4.11) */
:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 5; background: var(--snow);
  padding: 8px 14px; border-radius: 10px; border: 2px solid var(--blue); font-weight: 700; }
.skip:focus { top: 8px; }

.page { max-width: 720px; margin: 0 auto; padding: 18px 16px calc(36px + env(safe-area-inset-bottom)); }

/* breadcrumb */
.crumb ol { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; align-items: center;
  gap: 2px 6px; font-size: 14px; font-weight: 700; }
.crumb li { display: flex; align-items: center; gap: 6px; }
.crumb li + li::before { content: "‹"; color: var(--gray-icon); font-weight: 800; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--green-ink); text-decoration: none; }
.crumb img { border-radius: 6px; }
.crumb [aria-current] { color: var(--gray); }

/* headings and text */
h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.5; color: var(--ink); }
h1 { font-size: 27px; text-wrap: balance; }
h2 { font-size: 21px; margin: 38px 0 12px; scroll-margin-top: 12px; }
h3 { font-size: 18px; margin: 0 0 6px; scroll-margin-top: 12px; }
p, li, dd { font-weight: 500; }
p { margin: 0; }
p + p { margin-top: 10px; }
.kicker { margin: 0 0 4px; font-size: 14px; font-weight: 800; color: var(--green-ink); }
.lead { margin-top: 12px; font-size: 17px; font-weight: 600; }
.updated { margin-top: 10px; font-size: 13.5px; color: var(--gray); font-weight: 600; }
.note { font-size: 14.5px; }
b, strong { font-weight: 800; }
/* an exponent drawn raised, without opening up its line */
sup, sub { font-size: .72em; line-height: 0; }
sup { vertical-align: .55em; }
sub { vertical-align: -.2em; }
/* a power of a power (أ^ب^ج) is raised once more but not shrunk twice: never under 10.5px */
sup sup, sup sub, sub sup, sub sub { font-size: max(.9em, 10.5px); }

/* in-page contents */
.toc { margin-top: 20px; }
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 14px 2px; border-radius: 999px;
  background: var(--green-bg); color: var(--green-ink); font-weight: 800; font-size: 14.5px; text-decoration: none; }
.toc a:hover { background: var(--green-pale); }

/* a rule: the app's yellow rule card (gold border on a 5px lip) */
.rule { margin: 16px 0 0; padding: 16px 16px 14px; background: var(--gold-bg); border: 2px solid var(--gold);
  border-bottom-width: 5px; border-radius: 16px; scroll-margin-top: 12px; }
.rule h3 { color: var(--brown-dk); }
.rule p { margin-top: 8px; }
.rule .f { margin-top: 6px; padding: 10px 12px; background: var(--snow); border: 2px solid var(--gold); border-radius: 12px;
  font-size: 17.5px; font-weight: 800; color: var(--ink); line-height: 2; overflow-wrap: anywhere; }
.rule .f .k { display: block; font-size: 12.5px; color: var(--brown-dk); line-height: 1.4; }
.rule .lab { color: var(--brown-dk); font-weight: 800; }
.rule .fig { margin: 10px 0 2px; padding: 8px; background: var(--snow); border-radius: 12px; text-align: center; }
.rule .fig svg { display: inline-block; }
.hook { margin-top: 10px !important; padding: 8px 12px; background: var(--blue-light); border-radius: 12px; font-size: 15px; }
.hook .lab { color: var(--blue-ink); }
/* a rule with no teaching card: the same card, lighter */
.rule.sm { padding: 12px 14px 10px; border-bottom-width: 3px; background: #FFFBE8; }
.rule.sm h3 { font-size: 17px; }
/* the trap a card names: red on its own lip, right after the rules it is about */
.traps { margin-top: 14px; display: grid; gap: 10px; }
.trap { padding: 10px 14px 8px; background: var(--red-bg); border: 2px solid #F7B5B7; border-bottom-width: 4px; border-radius: 14px; font-weight: 600; }
.trap .lab { color: #B42318; font-weight: 800; }
/* inside the rule card it is about; the ones no single rule owns under their own heading */
.rule .traps { margin-top: 12px; }
.traps.free h4 { margin: 0; font-size: 15.5px; font-weight: 800; color: #B42318; }
.rule .see { font-weight: 600; }
/* the eight angles of two parallels and a transversal, numbered */
.fig.nums { margin: 14px 0 0; padding: 10px 8px 8px; background: var(--snow); border: 2px solid var(--line); border-radius: 14px; text-align: center; }
.fig.nums svg { display: inline-block; max-width: 100%; height: auto; }
.fig.nums figcaption { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--gray); }

/* a quick check after a group of rules */
.check { margin: 14px 0 0; padding: 14px 16px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; }
.check .q { font-weight: 700; }
.chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-weight: 700; }
.chips li:not(:last-child)::after { content: "،"; color: var(--gray); }

/* show-the-answer, without script */
details { margin-top: 10px; }
summary { display: inline-flex; align-items: center; min-height: 44px; padding: 2px 16px 0; cursor: pointer;
  border-radius: 12px; background: var(--blue-ink); color: #fff; font-weight: 800; box-shadow: 0 4px 0 #08547A;
  list-style: none; user-select: none; }
summary::-webkit-details-marker { display: none; }
summary:hover { background: #0A6390; }
details[open] summary { background: var(--snow); color: var(--blue-ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.ans { margin-top: 12px; padding: 12px 14px; background: var(--green-bg); border-radius: 12px; }
.ans .ok { color: var(--green-ink); font-weight: 800; }
.ans p + p { margin-top: 4px; }

/* a practice question */
.qs { counter-reset: q; }
.qcard { margin: 16px 0 0; padding: 16px; border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 18px; scroll-margin-top: 12px; }
/* the heading is the question itself, after its number */
.qcard h3 { font-size: 16.5px; line-height: 1.6; color: var(--ink); }
.qcard h3 .qn { color: var(--gray); font-size: 15px; }
.qfrom { margin-top: 2px !important; font-size: 13.5px; font-weight: 700; color: var(--gray); }
.stem { margin-top: 6px !important; font-size: 17px; font-weight: 700; }
.qfig { margin: 10px 0 0; text-align: center; }
.qfig svg { display: inline-block; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cmp div { padding: 8px 10px; border: 2px solid var(--blue-border); background: var(--blue-light); border-radius: 12px; text-align: center; }
.cmp span { display: block; font-size: 13px; font-weight: 800; color: var(--blue-ink); }
.cmp b { font-size: 17px; }
.choices { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
/* a list of choices that is only read (the guide's four, a sample) has no box: only a choice
   that can be picked looks like the app's answer card */
.choices li { display: flex; gap: 10px; align-items: baseline; padding: 2px 4px; font-weight: 700; }
.choices .l { flex: none; min-width: 1.6em; color: var(--blue-ink); font-weight: 800; }

/* pick an answer, without script (pickInput): the radio is hidden but stays in the tab order */
.pick li { display: block; padding: 0; }
.chips.pick li:not(:last-child)::after { content: none; }
.pick label { position: relative; display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 6px 12px 4px;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; background: #fff; cursor: pointer; }
.chips.pick label { padding: 4px 14px 2px; }
.pick label:hover { background: var(--snow); }
.pick input { position: absolute; inset-inline-start: 8px; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.pick label:has(input:focus-visible) { outline: 3px solid var(--blue-ink); outline-offset: 2px; }
.pick input:checked + .l { color: #fff; background: var(--blue-ink); border-radius: 8px; text-align: center; }
.pick label:has(input:checked) { border-color: var(--blue-border); background: var(--blue-light); }
/* once one is picked: the right one green, a wrong pick red, each with its mark */
.pick:has(input:checked) li.c label { border-color: var(--green-pale); background: var(--green-bg); color: var(--green-ink); }
.pick li:not(.c) label:has(input:checked) { border-color: #F7B5B7; background: var(--red-bg); color: #A3171A; }
.pick:has(input:checked) li.c label::after { content: "✓"; content: "✓" / "الإجابة الصحيحة"; margin-inline-start: auto; font-weight: 800; color: var(--green-ink); }
.pick li:not(.c) label:has(input:checked)::after { content: "✗"; content: "✗" / "إجابة خاطئة"; margin-inline-start: auto; font-weight: 800; color: #A3171A; }

/* tables: the rules of a lesson, the tables to memorise */
.tw { overflow-x: auto; margin: 10px 0 0; border: 2px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
caption { caption-side: top; text-align: start; padding: 10px 12px 4px; font-weight: 800; color: var(--ink); }
th, td { padding: 8px 12px; border-top: 2px solid var(--line); text-align: start; vertical-align: top; }
thead th { background: var(--green-bg); color: var(--green-ink); font-weight: 800; border-top: 0; }
tbody th { font-weight: 800; }
td { font-weight: 600; }
td.f { font-weight: 700; }
.memo td, .memo th { text-align: center; }
.rule .tw { background: var(--snow); border-color: var(--gold); }
.rule thead th { background: var(--gold-bg); color: var(--brown-dk); }
tr[id] { scroll-margin-top: 12px; }
.lh { margin-top: 22px; }
/* the laws sheet: the formula column takes what the name leaves */
.laws th { width: 38%; }
/* a narrow phone: a smaller table type and tighter cells */
@media (max-width: 359px) {
  table { font-size: 14.5px; }
  /* a long word wraps only where it would overflow; a short one keeps its column (anywhere let the
     table shrink a column to one letter); a table wider still scrolls inside .tw */
  th, td { padding: 7px 8px; overflow-wrap: break-word; word-break: normal; }
  .laws th { width: 40%; }
}

/* lists */
.tips { margin: 0; padding-inline-start: 22px; }
.tips li { margin-top: 8px; }
.tips li::marker { color: var(--green); font-weight: 800; }

/* FAQ: every answer is on the page, open to read */
.faq dt { margin-top: 16px; font-weight: 800; font-size: 17px; }
.faq dd { margin: 4px 0 0; }

/* cards that link to a lesson */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cards a { display: flex; flex-direction: column; padding: 14px 16px 12px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px;
  text-decoration: none; color: var(--ink); }
.cards a:hover { border-color: var(--blue-border); background: var(--blue-light); }
.cards .t { display: block; font-size: 17.5px; font-weight: 800; color: var(--blue-ink); }
.cards .m { order: -1; display: block; font-size: 13.5px; font-weight: 700; color: var(--gray); }
.cards .s { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; }
.unit { margin-top: 30px; }
.unit > h2 { padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.ms { margin-top: 28px; scroll-margin-top: 12px; }
.ms > h3 { font-size: 20px; }
.report { margin-top: 14px !important; }

/* related links, and the site's links at the foot */
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.links a { display: flex; align-items: center; min-height: 44px; padding: 4px 14px 2px; border: 2px solid var(--line);
  border-radius: 12px; text-decoration: none; font-weight: 700; }
.links a:hover { background: var(--surface); }
.links .dir { color: var(--gray); font-size: 13px; font-weight: 800; margin-inline-end: 8px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pn a { display: flex; flex-direction: column; min-height: 44px; padding: 8px 12px 6px; border: 2px solid var(--line); border-bottom-width: 4px;
  border-radius: 14px; text-decoration: none; font-weight: 800; }
.pn a span { order: -1; display: block; font-size: 12.5px; color: var(--gray); }
.pn .next { text-align: end; }

/* the call to play */
.cta { margin-top: 36px; padding: 22px 18px 20px; text-align: center; background: var(--green-bg); border-radius: 20px; }
.cta img { border-radius: 16px; }
.cta h2 { margin: 8px 0 6px; color: var(--green-ink); }
.cta p { margin-bottom: 16px; }
.btn { display: block; max-width: 320px; margin: 0 auto; padding: 0 16px; border-radius: 14px; background: var(--btn);
  box-shadow: 0 5px 0 var(--btn-lip); color: #fff; font-size: 17px; font-weight: 800; line-height: 50px;
  text-decoration: none; }
.btn:hover { color: #fff; background: #357700; }
.btn:active { transform: translateY(5px); box-shadow: none; }

/* the early call to play: one line and the button, in the flow under the page's contents */
.cta-in { margin-top: 18px; padding: 14px 16px 16px; background: var(--green-bg); border-radius: 18px; text-align: center; }
.cta-in p { margin: 0 0 12px; font-weight: 700; color: var(--green-ink); }
/* back up to the index, at the end of each unit of the long pages */
.up { margin-top: 14px !important; }
.up a { display: inline-flex; align-items: center; min-height: 44px; padding: 2px 14px 0; border: 2px solid var(--line);
  border-radius: 12px; text-decoration: none; font-weight: 800; font-size: 14.5px; }
.cond .lab, .rule .cond .lab { color: #B42318; }
td .cond { font-weight: 700; color: var(--gray); }

.src { padding-inline-start: 22px; font-size: 14.5px; }
.src li { margin-top: 6px; overflow-wrap: anywhere; }

.foot { margin-top: 36px; padding-top: 18px; border-top: 2px solid var(--line); }
.foot h2 { margin: 0 0 10px; font-size: 16px; }
.foot .links { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.foot .note { margin-top: 16px; }

/* a fraction as the exam prints it: the top number over a bar over the bottom one (fracs() in app.js) */
.fr { display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: middle; position: relative;
  font-size: .82em; line-height: 1.08; text-align: center; margin: 0 .12em; unicode-bidi: isolate; white-space: nowrap; }
.fr-n { padding: 0 .22em .08em; border-bottom: .11em solid currentColor; }
.fr-d { padding: .1em .22em 0; }
.fr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 600px) {
  .page { padding-inline: 24px; }
  h1 { font-size: 31px; }
  .cards.two { grid-template-columns: 1fr 1fr; }
}
/* a narrow phone: a figure takes the card's whole width, and its smallest labels a step up, so no
   number on it is drawn under 10px at 320px (the figures are 230–300 units wide, their labels 10–13) */
@media (max-width: 420px) {
  .rule .fig { margin-inline: -14px; padding: 6px 0; border-radius: 0; }
  .qcard .qfig { margin-inline: -14px; }
  .fig svg text[font-size="10"], .qfig svg text[font-size="10"] { font-size: 11.5px; }
  .fig svg text[font-size="11"], .qfig svg text[font-size="11"] { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* print: the laws as a sheet to keep («ورقة قوانين القدرات») */
@media print {
  @page { margin: 14mm 12mm; }
  body { font-size: 11.5pt; line-height: 1.6; color: #000; }
  .page { max-width: none; padding: 0; }
  .crumb, .toc, .cta, .cta-in, .up, .foot .links, .foot h2, .skip, details summary, .pn { display: none !important; }
  details { display: block; } details > * { display: block; }
  /* a closed <details> keeps its content out of print unless its content box is shown */
  details::details-content { content-visibility: visible; display: block; }
  a { color: #000; text-decoration: none; }
  h2 { margin-top: 18pt; break-after: avoid; }
  h3 { break-after: avoid; }
  .rule, .qcard, .check, .trap, tr { break-inside: avoid; }
  .report { display: none; }
  .tw { overflow: visible; border-color: #999; }
  th, td { border-color: #999; padding: 4pt 6pt; }
  thead th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
