/* =====================================================================
   Study pages added on 2026-10-03: articles (js/articles.js), lectures (js/lectures.js), exam prep (js/exam-prep.js),
   can-do lists (app.js candoList/candoMe), unit tests and the writing task (js/write-task.js).
   One look with the rest of the site: a page header, cards from the design system, readable text at 68ch,
   tasks as numbered panels. Built on css/ui-kit.css tokens; looks-only rules sit in :where(html:not(.a11y-contrast)).
   ===================================================================== */

/* ---------- 1. Shared page frame for articles and lectures ---------- */
.lec-page { max-width: 880px; margin-inline: auto; padding-block: var(--sp-2) var(--sp-10); }
.lec-page > h1 { margin: var(--sp-2) 0 var(--sp-2); font: 700 var(--fs-h1)/1.12 var(--font-display); letter-spacing: -.01em; }
.lec-page > .lead { max-width: 62ch; margin: 0 0 var(--sp-6); font-size: var(--fs-lg); line-height: 1.6; }
:where(html:not(.a11y-contrast)) .lec-page > .lead { color: var(--ink-2); }
.lec-page .lv-chip { justify-self: start; align-self: start; width: auto; }
.lec-page .linkish { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: none; font: 600 var(--fs-sm)/1.3 var(--font-ui); cursor: pointer; }
:where(html:not(.a11y-contrast)) .lec-page .linkish { color: var(--accent); }
.lec-page .linkish::before { content: "→"; }
:lang(ru) .lec-page .linkish::before, [dir="ltr"] .lec-page .linkish::before { content: "←"; }
.lec-page .linkish:hover { text-decoration: underline; }

/* the list: cards with the level chip, the English title, its translation and the reading time */
.lec-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--sp-4); }
.lec-list > li { display: flex; }
.lec-card { display: grid; grid-template-rows: auto 1fr auto; gap: var(--sp-3); width: 100%; margin: 0; padding: var(--sp-5); font: inherit; text-align: start; cursor: pointer; }
:where(html:not(.a11y-contrast)) .lec-card { color: var(--ink); border-radius: var(--r-lg); transition: border-color var(--dur-1), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
:where(html:not(.a11y-contrast)) .lec-card:hover { border-color: var(--accent-line); box-shadow: var(--e3); transform: translateY(-2px); }
.lec-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lec-t { display: grid; gap: 4px; min-width: 0; }
.lec-t b { font: 700 1.08rem/1.3 var(--font-display); }
.lec-t small { font-size: var(--fs-sm); line-height: 1.4; }
:where(html:not(.a11y-contrast)) .lec-t small { color: var(--ink-2); }
.lec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding-top: var(--sp-3); }
:where(html:not(.a11y-contrast)) .lec-meta { border-top: 1px solid var(--hairline); }
@media (prefers-reduced-motion: reduce) { .lec-card:hover { transform: none; } }

/* ---------- 2. One article ---------- */
.ar-one > h1 { margin: var(--sp-3) 0 var(--sp-1); font: 700 clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem)/1.15 var(--font-display); }
.ar-one > h1 + .muted { margin: 0 0 var(--sp-4); }
.ar-text { max-width: 68ch; margin: var(--sp-4) 0; padding: var(--sp-6) var(--sp-6) var(--sp-4); font-size: 1.08rem; line-height: 1.8; }
:where(html:not(.a11y-contrast)) .ar-text { border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--e2); }
.ar-p { position: relative; margin: 0 0 1.1em; padding-inline-start: 38px; }
.ar-pn { position: absolute; inset-inline-start: 0; top: .3em; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font: 700 .72rem/1 var(--font-ui); }
:where(html:not(.a11y-contrast)) .ar-pn { color: var(--accent); background: var(--accent-soft); }
.ar-gl { padding: 0 2px; border-radius: 4px; transition: background-color var(--dur-1); }
:where(html:not(.a11y-contrast)) .ar-gl { border-bottom: 2px dotted var(--accent); }
:where(html:not(.a11y-contrast)) .ar-gl:hover { background: var(--accent-soft); }
.ar-pop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; max-width: 68ch; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-lg); }
:where(html:not(.a11y-contrast)) .ar-pop { border-color: var(--accent-line); box-shadow: var(--e3); }
/* Skim and scan (js/articles.js): first sentences, then tap the sentence that answers */
.ar-first { max-width: 68ch; margin: var(--sp-4) 0; padding-inline-start: 1.4em; line-height: 1.7; }
.ar-first li { margin-bottom: var(--sp-2); }
.ar-ask { max-width: 68ch; font-size: var(--fs-lg); }
.ar-sent { display: inline; padding: 1px 2px; margin: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.ar-sent:hover, .ar-sent:focus-visible { background: var(--accent-soft); }
.ar-sent.wrong { background: color-mix(in srgb, var(--bad) 18%, transparent); }
@media (max-width: 760px) {
  .ar-text { padding: var(--sp-4) var(--sp-4) var(--sp-2); font-size: 1.04rem; line-height: 1.75; }
  .ar-p { padding-inline-start: 32px; }
  .ar-pop { bottom: calc(var(--dock-h, 64px) + 12px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 3. Tasks under a text or a recording: numbered panels ---------- */
.lec-page { counter-reset: task; }
:is(.ar-task, .lec-notes, .lec-qs, .lec-tr) { counter-increment: task; margin: var(--sp-6) 0 0; padding: var(--sp-5) var(--sp-5) var(--sp-4); }
:where(html:not(.a11y-contrast)) :is(.ar-task, .lec-notes, .lec-qs, .lec-tr) { border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--e1); }
html.a11y-contrast :is(.ar-task, .lec-notes, .lec-qs, .lec-tr) { border: 2px solid var(--ink); }
:is(.ar-task, .lec-notes, .lec-qs, .lec-tr) > h2 { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-2); font: 700 var(--fs-h3)/1.25 var(--font-display); }
:is(.ar-task, .lec-notes, .lec-qs, .lec-tr) > h2::before { content: counter(task); flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  font: 700 .9rem/1 var(--font-ui); color: #fff; background: var(--accent); }
.lec-q { min-width: 0; margin: var(--sp-4) 0 0; padding: var(--sp-4) 0 0; border: 0; }
:where(html:not(.a11y-contrast)) .lec-q { border-top: 1px solid var(--hairline); }
.lec-q > legend { float: inline-start; width: 100%; margin: 0 0 var(--sp-3); padding: 0; font-weight: 600; line-height: 1.5; }
.lec-q > legend + * { clear: both; }
.ar-tf, .lec-opts { display: grid; gap: var(--sp-2); }
.ar-tf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lec-page .opt { min-height: 48px; padding: 10px 14px; font: 600 var(--fs-sm)/1.35 var(--font-ui); text-align: center; }
.lec-opts .opt { text-align: start; }
:where(html:not(.a11y-contrast)) .lec-page .opt.picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
html.a11y-contrast .lec-page .opt.picked { outline: 3px solid var(--ink); }
.lec-q .st-fb { margin-top: var(--sp-2); font-size: var(--fs-sm); line-height: 1.5; }
.lec-q .st-why { display: block; margin-top: 2px; font-weight: 400; }
:where(html:not(.a11y-contrast)) .lec-q .st-why { color: var(--ink-2); }
.ar-hd { display: grid; gap: 6px; margin: var(--sp-3) 0 0; }
.ar-hd label { font-weight: 600; }
:is(.ar-hd select, .lec-page select) { min-height: 44px; max-width: 100%; padding: 8px 12px; font: inherit; border-radius: var(--r-sm); }
:where(html:not(.a11y-contrast)) :is(.ar-hd select, .lec-page select) { color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-strong); }
.ar-sum { max-width: 68ch; line-height: 2.4; }
.lec-gap { width: 9em; max-width: 100%; margin: 0 4px; padding: 2px 6px; font: inherit; text-align: center; border: 0; border-radius: 6px 6px 0 0; }
:where(html:not(.a11y-contrast)) .lec-gap { color: var(--ink); background: var(--surface-2); border-bottom: 2px solid var(--hairline-strong); }
:where(html:not(.a11y-contrast)) .lec-gap:focus { outline: none; border-bottom-color: var(--accent); background: var(--accent-soft); }
:where(html:not(.a11y-contrast)) .lec-gap.right { border-bottom-color: var(--ok); background: var(--ok-soft); }
:where(html:not(.a11y-contrast)) .lec-gap.wrong { border-bottom-color: var(--bad); background: var(--bad-soft); }
.lec-fix { font-weight: 700; }
:where(html:not(.a11y-contrast)) .lec-fix { color: var(--ok); }
.lec-score { display: flex; align-items: center; justify-content: center; margin: var(--sp-6) 0 0; padding: var(--sp-4) var(--sp-5); font: 700 var(--fs-h3)/1.3 var(--font-display); text-align: center; }
:where(html:not(.a11y-contrast)) .lec-score { border-radius: var(--r-lg); color: var(--ink); background: linear-gradient(135deg, var(--ok-soft), var(--accent-soft)); border: 1px solid var(--accent-line); }
.lec-page .actions.center { justify-content: center; margin-top: var(--sp-6); }
.lec-page p.center { text-align: center; }
@media (max-width: 420px) {
  :is(.ar-task, .lec-notes, .lec-qs, .lec-tr) { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
  .ar-tf .opt { padding-inline: 6px; }
}

/* ---------- 4. One lecture: the player and the note sheet ---------- */
.lec-player { margin: var(--sp-4) 0 0; padding: var(--sp-5); justify-items: start; }
:where(html:not(.a11y-contrast)) .lec-player { border-radius: var(--r-xl); background: linear-gradient(150deg, var(--accent-soft), var(--surface) 70%); }
.lec-speed { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.lec-items { margin: var(--sp-3) 0 0; padding-inline-start: 1.4em; display: grid; gap: var(--sp-3); line-height: 2.1; }
.lec-tr p { margin: 0 0 4px; }
.lec-line { display: block; width: 100%; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; font: inherit; line-height: 1.6; text-align: start; cursor: pointer; }
:where(html:not(.a11y-contrast)) .lec-line { color: var(--ink); }
:where(html:not(.a11y-contrast)) .lec-line:hover { background: var(--surface-2); }

/* ---------- 5. Can-do lists (level card and #me) ---------- */
.cando > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; list-style: none; cursor: pointer; }
.cando > summary::-webkit-details-marker { display: none; }
.cando > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-inline-start: auto; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform var(--dur-1); }
.cando[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.cando-list { gap: var(--sp-2); }
.cando-list li { gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r); }
:where(html:not(.a11y-contrast)) .cando-list li { background: var(--surface-2); }
.cando-list .cd-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; font-size: 1.05rem; }
:where(html:not(.a11y-contrast)) .cando-list .cd-ic { background: var(--surface); box-shadow: var(--e1); }
/* "planned" said in words; fading the whole row made the note unreadable */
.cando-list .cover-planned { opacity: 1; }
:where(html:not(.a11y-contrast)) .cando-list .cover-planned { background: none; border: 1px dashed var(--hairline-strong); }
.cando-list .cover-planned em { color: var(--ink-2); }
.cando-me .cando { padding: var(--sp-1) 0; }

/* ---------- 6. Exam prep ---------- */
/* an exam still in preparation keeps full contrast (its badge says "soon") */
.ds-card.ep-exam.soon { opacity: 1; }
:where(html:not(.a11y-contrast)) .ds-card.ep-exam.soon { border-style: dashed; box-shadow: none; }
:where(html:not(.a11y-contrast)) .ds-card.ep-exam:not(.soon):hover { box-shadow: var(--e3); transform: translateY(-2px); }
.ds-card.ep-exam { transition: border-color var(--dur-1), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.ep-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 1.7rem; }
:where(html:not(.a11y-contrast)) .ep-ic { background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { .ds-card.ep-exam:hover { transform: none; } }
/* On phones the tile's three columns (icon, text, arrow) left the text about 230 px, so each tile ran 300 px tall and
   seven of them filled five screens. The icon, name and arrow now share the top row and the rest of the text uses the
   tile's full width. The text wrapper steps aside (display: contents) so its parts can sit in the tile's own grid. */
@media (max-width: 560px) {
  .ds-card.ep-exam { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; column-gap: var(--sp-3); row-gap: var(--sp-1); }
  .ds-card.ep-exam .ep-exam-b { display: contents; }
  .ds-card.ep-exam > .ds-ico.ep-ico { grid-row: 1; width: 40px; height: 40px; border-radius: 12px; font-size: 1.25rem; }
  .ds-card.ep-exam .ep-exam-b > strong { grid-row: 1; grid-column: 2; font-size: var(--fs-h3); line-height: 1.3; }
  .ds-card.ep-exam > .ep-go { grid-row: 1; grid-column: 3; }
  .ds-card.ep-exam .ep-exam-b > :not(strong) { grid-column: 1 / -1; }
  .ds-card.ep-exam .ep-exam-b > small.muted:not(.ep-have) { margin-top: var(--sp-1); }
}

/* ---------- 7. Unit tests and the writing task ---------- */
.unit-parts li { padding: var(--sp-2) 0; }
.write-task { display: grid; gap: var(--sp-4); }

/* ---------- 8. Songs (js/songs.js injects its base styles; these sit one class deeper so they win) ---------- */
/* the page icon and every song's icon are tiles, like the exam pages */
.sg .sg-head .sg-ic { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 16px; font-size: 1.8rem; }
:where(html:not(.a11y-contrast)) .sg .sg-head .sg-ic { background: var(--accent-soft); }
/* desktop: the icon sits beside the title; wider song cards keep their chips on one line */
@media (min-width: 761px) {
  .sg .sg-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: var(--sp-4); }
  .sg .sg-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.sg .sg-head h1 { margin: 0; }
.sg .sg-head .lead { margin: 2px 0 var(--sp-2); }
.sg > h2 { margin: var(--sp-2) 0 0; font-size: var(--fs-h3); }
/* a song card: icon tile beside its titles and chips, so a list reads in rows instead of tall empty boxes */
.sg .sg-tile { grid-template-columns: 48px minmax(0, 1fr); column-gap: var(--sp-3); row-gap: 2px; align-items: center; align-content: start; padding: var(--sp-3) var(--sp-4); }
.sg .sg-tile > :not(:first-child) { grid-column: 2; }
.sg .sg-tile > :first-child { grid-row: 1 / span 3; align-self: start; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; font-size: 1.5rem !important; }
:where(html:not(.a11y-contrast)) .sg .sg-tile > :first-child { background: var(--surface-2); }
.sg .sg-tile > .muted { justify-self: start; }
.sg .sg-tile .sg-row { margin-top: var(--sp-1); }
:where(html:not(.a11y-contrast)) .sg .sg-tile:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .sg .sg-tile:hover { transform: none; } }
/* the song's words: compact two-up cards (the base grid gave each word a tall card with an empty row) */
.sg .sg-words { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.sg .sg-word { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-4); }
.sg .sg-word br { display: none; }
.sg .sg-word strong { align-self: start; }
.sg .sg-word span { color: var(--ink-2); font-size: var(--fs-sm); }
/* the tip and the score keep their paragraph direction around English words */
.sg .sg-tip { unicode-bidi: plaintext; line-height: 1.6; }
/* lyrics: a calm reading column, the current line marked at the start edge */
.sg .sg-part { padding: var(--sp-4) var(--sp-5); }
.sg .sg-line { padding: var(--sp-1) var(--sp-3); border-inline-start: 3px solid transparent; }
.sg .sg-line.now { border-inline-start-color: var(--accent); }
.sg .sg-gap { min-height: 40px; }
.sg .sg-gap:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* My Words (js/mywords.js): the form, and the sentence a personal word came from */
.mw-form { display: grid; gap: 10px; margin-bottom: 14px; }
.mw-form label { display: grid; gap: 4px; font-weight: 600; }
.mw-form input { font: inherit; padding: 10px 12px; min-height: 44px; border-radius: 12px; border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink); }
.my-ctx { margin: 6px 0 0; font-size: .95rem; color: var(--muted, inherit); font-style: italic; }

/* Coverage meter for graded books (js/coverage.js) */
.cov-line { margin: 4px 0 0; }
.cov-b98 { color: var(--ok); }
.cov-b95, .cov-b90 { color: var(--ink); }
.cov-low { color: var(--ink); font-weight: 700; } /* the band is always written out: colour is never the only signal */
.cov-reader { margin: var(--sp-3, 12px) 0; padding: var(--sp-3, 12px) var(--sp-4, 16px); }
.cov-head { margin: 0 0 4px; }
.cov-new { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.cov-new li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.cov-what summary { cursor: pointer; font-size: var(--fs-sm, .85rem); }

/* ---------- Premium polish (2026-10-20): reading cards and Ear lab on phones ----------
   QA's phone shots showed article and lecture cards 153 px tall for a title and "1 min read", so four fit on a screen.
   On phones a card becomes one row: the level chip beside the title, the reading time under it, no divider line.
   Ear lab (js/ear-lab.js keeps its base styles inline; `.el` in front outranks them): the emoji sits on a quiet plate
   beside the title instead of above it, the count pill no longer stretches across the tile, and the list arrow
   sits in a small round badge. Sizes only change below 560 px, so desktop keeps its grid. */
.el .el-tile .pill { justify-self: start; }
.el button.el-item > span[aria-hidden="true"]:last-child { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; font-size: 1.15rem; line-height: 1; }
:where(html:not(.a11y-contrast)) .el button.el-item > span[aria-hidden="true"]:last-child { color: var(--accent); background: var(--accent-soft); }
/* an English title inside a Hebrew card lines up with the Hebrew text under it */
[dir="rtl"] .lec-t b[dir="ltr"] { text-align: right; }
@media (max-width: 560px) {
  .lec-list { gap: var(--sp-3); }
  .lec-card { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto; column-gap: var(--sp-3); row-gap: 2px; padding: var(--sp-4); }
  .lec-card > .lv-chip { grid-row: 1 / span 2; align-self: start; margin-top: 2px; }
  .lec-card > .lec-meta { grid-column: 2; padding-top: 2px; }
  :where(html:not(.a11y-contrast)) .lec-card > .lec-meta { border-top: 0; }
  .el .el-grid { gap: var(--sp-2); }
  .el .el-tile { grid-template-columns: 44px minmax(0, 1fr); column-gap: var(--sp-3); row-gap: 2px; padding: var(--sp-3) var(--sp-4); }
  .el .el-tile > * { grid-column: 2; }
  .el .el-tile > .el-ic { grid-column: 1; grid-row: 1 / span 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); font-size: 1.4rem; }
  :where(html:not(.a11y-contrast)) .el .el-tile > .el-ic { background: var(--surface-2); }
  .el .el-tile > .pill { margin-top: var(--sp-1); }
}

/* ---------- 9. Arabic script: letter cards and the writing pad (docs/plan/2026-10-28-arabic-look.md) ----------
   Classes only; the Arabic course builds the markup, for example:
   <article class="ds-card ds-letter"><b class="ds-ar ds-letter-big" lang="ar">ب</b>
     <div class="ds-letter-t"><strong class="ds-ar" lang="ar">باء</strong><span class="muted">b · like b in "bed"</span></div>
     <ol class="ds-forms"><li><button class="ds-form" type="button"><b class="ds-ar" lang="ar">ب</b><small>alone</small></button></li>
       … start, middle, end …</ol></article>
   The four forms run right to left in every interface, the way a word is read: alone, start, middle, end. */
.ds-letter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-4); }
.ds-letter-big { min-width: 1.3em; font-size: clamp(3rem, 2.5rem + 2.5vw, 4.25rem); font-weight: 400; text-align: center; }
.ds-letter-t { display: grid; gap: 2px; min-width: 0; }
.ds-letter-t > strong { font-size: var(--fs-h3); }
/* the Arabic name lines up with the sound line under it, on the interface's side (on its own it would run to the other) */
.ds-letter-t > * { justify-self: start; }
.ds-forms { grid-column: 1 / -1; direction: rtl; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
.ds-forms > li { display: flex; }
.ds-form { display: grid; justify-items: center; align-content: center; gap: 0; width: 100%; min-height: 76px; padding: var(--sp-1); border-radius: var(--r-sm); text-align: center; }
button.ds-form { font: inherit; color: inherit; cursor: pointer; }
:where(html:not(.a11y-contrast)) .ds-form { background: var(--surface-2); border: 1px solid var(--hairline); color: var(--ink); }
html.a11y-contrast .ds-form { border: 2px solid currentColor; } /* high contrast keeps a frame round every form, not only the buttons */
:where(html:not(.a11y-contrast)) button.ds-form:hover { border-color: var(--accent-line); }
button.ds-form:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ds-form > .ds-ar { font-size: 1.9rem; }
/* a label keeps its own direction inside the right-to-left row, so a Russian or English label keeps its punctuation */
.ds-form > small { font-size: var(--fs-xs); line-height: 1.3; unicode-bidi: plaintext; }
:where(html:not(.a11y-contrast)) .ds-form > small { color: var(--muted); }
/* the form the card is teaching right now */
:where(html:not(.a11y-contrast)) .ds-form.on { background: var(--accent-soft); border-color: var(--accent-line); }
/* under the row: a quiet line, e.g. that ا د ذ ر ز و never join the letter after them */
.ds-letter-note { grid-column: 1 / -1; margin: 0; font-size: var(--fs-sm); }
:where(html:not(.a11y-contrast)) .ds-letter-note { color: var(--muted); }

/* The writing pad frame; a child svg or canvas fills it. Arabic sits on a line and its tails drop below it, so the frame
   draws three guides: dashed for the top of the tall letters, solid for the line letters sit on, dashed for the tails.
   The arrow in the top corner says writing starts on the right. --ar-top, --ar-base and --ar-tail move the guides. */
.ds-wpad { --ar-top: 24%; --ar-base: 62%; --ar-tail: 82%; --ar-guide: var(--hairline-strong); --ar-line: color-mix(in srgb, var(--accent) 45%, transparent);
  position: relative; width: min(100%, 420px); aspect-ratio: 4 / 3; margin-inline: auto; overflow: hidden; direction: rtl; touch-action: none;
  border: 1px solid var(--hairline-strong); border-radius: var(--r);
  background:
    linear-gradient(var(--ar-line), var(--ar-line)) 0 var(--ar-base) / 100% 2px no-repeat,
    repeating-linear-gradient(to left, var(--ar-guide) 0 10px, transparent 10px 18px) 0 var(--ar-top) / 100% 1px no-repeat,
    repeating-linear-gradient(to left, var(--ar-guide) 0 10px, transparent 10px 18px) 0 var(--ar-tail) / 100% 1px no-repeat,
    var(--surface-2); }
.ds-wpad::after { content: "←" / ""; position: absolute; inset-block-start: var(--sp-2); inset-inline-start: var(--sp-3); font-size: 1.1rem; line-height: 1; color: var(--muted); pointer-events: none; }
.ds-wpad > :is(svg, canvas) { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
/* a faint letter to trace, standing on the solid line: text-box trims the box to the letter's baseline, so the box's
   bottom edge is the line (browsers without text-box set it a little high) */
.ds-wpad-ghost { position: absolute; inset-inline: 0; inset-block-end: calc(100% - var(--ar-base)); margin: 0; font-family: var(--font-ar); font-size: clamp(5.5rem, 26vw, 8.5rem); line-height: 1;
  text-box: trim-both cap alphabetic; text-align: center; color: var(--ink); opacity: .13; pointer-events: none; user-select: none; }
