/* learn.css: the Learn Arabic tool (/learn and /learn/words) in the Rahti design system (revamp, 2026-10-14).
 * Loads after site.css only: its class names (.card, .tile, .step, .grid, .cell) are the tool's own and must never meet the home
 * page's. The whole tool sits on one fixed night field (like the app's own screens), so the card, the tiles and the buttons are
 * steps of tone, not outlines. Class names and state classes are the ones the page scripts already toggle.
 */

/* ============================================================ the page head (same arched band as the other inner pages) */
.page-head{position:relative;overflow:clip;margin-top:clamp(16px,3vw,44px);padding:clamp(88px,9vw,150px) var(--margin) clamp(48px,6vw,96px);clip-path:url(#arch-band)}
.page-head__ar{position:absolute;right:var(--margin);bottom:clamp(20px,3vw,48px);font-size:calc(var(--step-giant) * 1.15);line-height:1.2;color:var(--cream);pointer-events:none}
@media (max-width:860px){.page-head__ar{display:none}}
.page-head h1{font-size:var(--step-xl);max-width:16ch}
.page-head .lede{font-size:var(--step-lead);line-height:1.45;max-width:52ch;margin-top:clamp(14px,2vw,26px);color:var(--cream)}
.page-head .when{font-size:var(--step-s);margin-top:clamp(14px,2vw,22px);color:var(--cream-dim)}
.page-head .back{display:inline-flex;align-items:center;min-height:44px;margin-top:clamp(10px,1.4vw,18px);font-size:var(--step-s);font-weight:600;text-decoration:underline;text-underline-offset:.25em;text-decoration-thickness:.07em}

/* ============================================================ the tool's field */
.learn{padding:clamp(40px,6vw,96px) var(--margin) clamp(48px,6vw,96px)}
.learn[hidden],[hidden]{display:none!important}
.learn__in{max-width:780px;margin:0 auto}
.learn section+section{margin-top:clamp(56px,8vw,120px)}

/* position + tools. Visual order: tools, the card, the position counter, previous/next (the counter reads as a caption of the card, not a label above it) */
.learn__in--tool{display:flex;flex-direction:column}
.learn__in--tool>*{align-self:stretch}
.learn__in--tool>.tools{order:1}
.learn__in--tool>.card{order:2}
.learn__in--tool>.pos{order:3;margin:14px 0 0}
.learn__in--tool>.steps,.learn__in--tool>.voice-note{order:4}
.pos{display:flex;align-items:center;gap:14px;margin:0 0 12px}
.pos-label{font-size:var(--step-s);font-weight:600;white-space:nowrap}
.track{flex:1;height:6px;background:var(--ink-3);border-radius:3px;overflow:hidden}
.fill{height:100%;background:var(--gold);width:0;transition:width var(--t-ui) var(--ease-out)}
.tools{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin:0 0 14px}
.mode{display:inline-flex;align-items:center;gap:8px;min-height:48px;padding:0 20px;background:var(--ink-3);color:var(--cream);border-radius:999px;
  font:600 var(--step-s)/1 var(--sans);white-space:nowrap;transition:background-color var(--t-hover) ease,color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.mode svg{flex:none}
.mode:active{transform:scale(.97)}
.mode[aria-pressed="true"]{background:var(--btn-bg);color:var(--btn-ink)}
@media (hover:hover) and (pointer:fine){.mode:hover{background:var(--ink-2)}.mode[aria-pressed="true"]:hover{background:var(--btn-bg-hover)}}

/* ============================================================ the letter card */
.card{background:var(--ink-2);border-radius:28px;padding:clamp(22px,3vw,40px) clamp(16px,3vw,40px) clamp(28px,3.4vw,44px);text-align:center}
/* line-height has to clear Amiri's descenders: ج ح خ ع غ م ن ه ي all drop well below the baseline at display size. */
.glyph{font-size:clamp(104px,23vw,168px);line-height:1.5;color:var(--gold-text);margin-bottom:2px;font-weight:400}
.card.is-asking{min-height:430px;display:flex;flex-direction:column;justify-content:center;align-items:center}
.card.is-asking .glyph{cursor:pointer;border-radius:28px;transition:background-color var(--t-hover) ease}
@media (hover:hover) and (pointer:fine){.card.is-asking .glyph:hover{background:var(--ink-3)}}
.ask{font-size:var(--step-t);margin-top:8px;color:var(--cream-dim)}
.reveal{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:68px;min-width:240px;margin-top:22px;padding:0 32px;
  background:var(--btn-bg);color:var(--btn-ink);border-radius:999px;font:600 var(--step-lead)/1 var(--sans);
  transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.reveal:active{transform:scale(.97)}
@media (hover:hover) and (pointer:fine){.reveal:hover{background:var(--btn-bg-hover)}}
.lname{font-family:var(--serif);font-size:clamp(34px,5vw,48px);font-weight:500;line-height:1.1;letter-spacing:-.02em}
.lname-ar{font-size:clamp(28px,4vw,36px);color:var(--cream-dim);line-height:1.7}
.translit{font-size:var(--step-t);margin-top:4px;color:var(--cream-dim)}
.translit b{color:var(--cream);font-weight:600}

.hear{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:76px;min-width:260px;margin-top:22px;padding:0 36px;
  background:var(--btn-bg);color:var(--btn-ink);border-radius:999px;font:700 var(--step-lead)/1 var(--sans);
  transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.hear svg{flex:none}
.hear:active{transform:scale(.97)}
@media (hover:hover) and (pointer:fine){.hear:hover{background:var(--btn-bg-hover)}}
.hear[disabled]{opacity:.45;cursor:not-allowed}
.hear.speaking{background:var(--gold-text);color:var(--ink)}
.voice-note{font-size:var(--step-t);color:var(--cream);margin:16px auto 0;line-height:1.6;max-width:56ch}

/* card blocks: one idea each, spacing instead of rules */
.block{margin-top:clamp(32px,4vw,52px)}
.block h3{font-family:var(--serif);font-weight:500;font-size:var(--step-m);line-height:1.15;letter-spacing:-.015em;margin-bottom:18px}

/* picture word */
.pic{display:flex;align-items:center;gap:20px;width:100%;max-width:460px;min-height:112px;margin:0 auto;padding:14px 22px 14px 16px;
  background:var(--ink-3);border-radius:24px;color:var(--cream);text-align:left;transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.pic:active{transform:scale(.985)}
@media (hover:hover) and (pointer:fine){.pic:hover{background:var(--ink-2)}}
.pic.speaking{background:var(--btn-bg);color:var(--btn-ink)}
.pic.speaking .pic-gloss,.pic.speaking .pic-word,.pic.speaking .pic-speaker{color:var(--btn-ink)}
.pic-emoji{flex:none;width:80px;height:80px;border-radius:50%;background:var(--ink-2);display:flex;align-items:center;justify-content:center;
  font-size:46px;line-height:1;font-family:'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif}
.pic-text{flex:1;display:flex;flex-direction:column;align-items:flex-start}
.pic-word{font-family:var(--arabic);font-size:38px;line-height:1.5;color:var(--cream);direction:rtl}
.pic-gloss{font-size:var(--step-s);color:var(--cream-dim)}
.pic-speaker{flex:none;color:var(--gold-text)}

/* vowel sounds (right-to-left like the script: fatha on the right, then kasra, then damma) */
.vtiles{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:0 auto;max-width:560px;direction:rtl}
.vtile{direction:ltr;min-height:170px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;padding:14px 8px 14px;
  background:var(--ink-3);border-radius:20px;color:var(--cream);transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.vtile:active{transform:scale(.97)}
@media (hover:hover) and (pointer:fine){.vtile:hover{background:var(--ink-2)}}
.vtile.playing{background:var(--btn-bg);color:var(--btn-ink)}
.vtile.playing .vtile-ar,.vtile.playing .vtile-name,.vtile.playing .vtile-say,.vtile.playing .vtile-say b,.vtile.playing svg{color:var(--btn-ink)}
.vtile-ar{font-family:var(--arabic);font-size:54px;line-height:2;height:112px;display:flex;align-items:center;justify-content:center;color:var(--gold-text);direction:rtl}
.vtile-name{font-size:var(--step-s);font-weight:600;color:var(--cream-dim)}
.vtile-say{font-size:var(--step-s);color:var(--cream-dim);margin-top:2px}
.vtile-say b{color:var(--cream);font-weight:600}
.vtile svg{margin-top:8px;color:var(--gold-text)}
.vowels-src{font-size:var(--step-s);color:var(--cream);margin:16px auto 0;line-height:1.6;max-width:56ch}

/* reference, folded away */
.more{margin-top:12px;background:var(--ink-3);border-radius:20px;text-align:center}
.more+.more{margin-top:8px}
.more summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:64px;padding:14px 22px;
  cursor:pointer;font-size:var(--step-t);font-weight:600;border-radius:20px;text-align:left}
.more summary::-webkit-details-marker{display:none}
.more summary svg{flex:none;color:var(--gold-text);transition:transform var(--t-ui) var(--ease-out)}
.more[open] summary svg{transform:rotate(180deg)}
.more-body{padding:2px 22px 26px}
.chip{display:inline-block;font-size:var(--step-s);font-weight:600;color:var(--btn-ink);background:var(--btn-bg);border-radius:999px;padding:6px 16px;margin-bottom:14px}
.makhraj-text{color:var(--cream);font-size:var(--step-t);line-height:1.7;max-width:52ch;margin:0 auto}

/* connected forms */
.forms-note{color:var(--cream);font-size:var(--step-t);line-height:1.7;max-width:46ch;margin:0 auto}
.tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:18px}
.tiles.dual{grid-template-columns:repeat(2,1fr);max-width:440px;margin-left:auto;margin-right:auto}
.tile{background:var(--ink-2);border-radius:18px;padding:18px 10px 16px;display:flex;flex-direction:column}
.tile-label{order:5;margin-top:6px}
.tile-label{font-size:13px;font-weight:600;color:var(--cream-dim)}
.tile-shape{font-family:var(--arabic);font-size:52px;line-height:1.8;color:var(--gold-text);direction:rtl}
.tile-word{font-family:var(--arabic);font-size:28px;line-height:1.9;direction:rtl;color:var(--cream);display:block;width:100%;background:none;border:0;padding:0}
.tile-word.can-play{cursor:pointer;border-radius:12px;transition:background-color var(--t-hover) ease}
@media (hover:hover) and (pointer:fine){.tile-word.can-play:hover{background:var(--ink-3)}}
.tile-word.speaking{background:var(--btn-bg);color:var(--btn-ink)}
.tile-gloss{font-size:13px;color:var(--cream-dim);line-height:1.5;margin-top:2px}
.tile-empty{font-size:13px;color:var(--cream-dim);line-height:1.5;margin-top:2px;font-style:italic}

/* previous / next */
.steps{display:flex;gap:8px;margin:12px 0 0}
.step{flex:1;min-height:72px;display:flex;align-items:center;justify-content:center;gap:10px;background:var(--ink-3);color:var(--cream);border-radius:999px;
  font:600 var(--step-lead)/1 var(--sans);padding:0 20px;transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.step:active{transform:scale(.98)}
@media (hover:hover) and (pointer:fine){.step:hover{background:var(--ink-2)}}
.step[disabled]{opacity:.35;cursor:not-allowed}

/* all 28 letters */
.all h2,.path h2{font-size:var(--step-l);text-align:left;margin-bottom:12px}
.all-note{font-size:var(--step-t);color:var(--cream-dim);margin-bottom:24px}
/* The alphabet is Arabic, so it reads right to left: alif sits top-right. Grid placement follows the container's direction, so rtl here
   reorders the cells without touching the source order (still alphabetical, and what a screen reader follows). */
.grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;direction:rtl}
.cell{direction:ltr;aspect-ratio:1;min-height:64px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  background:var(--ink-2);border-radius:16px;color:var(--cream);transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.cell:active{transform:scale(.96)}
@media (hover:hover) and (pointer:fine){.cell:hover{background:var(--ink-3)}}
.cell[aria-current="true"]{background:var(--btn-bg);color:var(--btn-ink)}
.cell[aria-current="true"] .cell-glyph,.cell[aria-current="true"] .cell-name{color:var(--btn-ink)}
.cell-glyph{font-family:var(--arabic);font-size:30px;line-height:1.55;color:var(--gold-text)}
.cell-name{font-size:13px;color:var(--cream-dim)}

/* the path to reading */
.path-lede{max-width:60ch;margin:0 0 28px;font-size:var(--step-t);line-height:1.7}
.path-list{max-width:none;display:flex;flex-direction:column;gap:8px}
.path-list li{display:flex;align-items:center;gap:16px;padding:18px 20px;background:var(--ink-2);border-radius:20px}
.path-num{flex:none;width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:23px;font-weight:600;background:var(--ink-3);color:var(--cream)}
.path-list li.here .path-num{background:var(--btn-bg);color:var(--btn-ink)}
.path-text{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
.path-text b{font-size:var(--step-t);font-weight:600}
.path-text span{font-size:var(--step-s);color:var(--cream-dim);line-height:1.5}
.path-tag{flex:none;font-size:13px;font-weight:600;color:var(--cream);background:var(--ink-3);border-radius:999px;padding:6px 14px}
.path-list li.here .path-tag{background:var(--btn-bg);color:var(--btn-ink)}
.path-link{display:inline-flex;align-items:center;min-height:44px;margin-top:6px;font-size:var(--step-s);font-weight:600;color:var(--cream);text-decoration:underline;text-decoration-color:var(--gold-text);text-underline-offset:.25em;text-decoration-thickness:.08em}
.path-app{margin:12px 0 0;padding:clamp(22px,3vw,36px);background:var(--ink-3);border-radius:24px}
.path-app h3{font-size:var(--step-m);margin-bottom:8px}
.path-app p{font-size:var(--step-t);line-height:1.7;max-width:60ch}
.path-app a{text-decoration:underline;text-decoration-color:var(--gold-text);text-underline-offset:.22em}

/* ============================================================ /learn/words: build a word */
.empty-title{font-family:var(--serif);font-weight:500;font-size:var(--step-l);line-height:1.05;letter-spacing:-.02em}
.empty-note{font-size:var(--step-t);line-height:1.7;max-width:48ch;margin:14px auto 0}
.empty-note a{text-decoration:underline;text-decoration-color:var(--gold-text);text-underline-offset:.22em}
.badge{display:inline-block;font-size:13px;font-weight:600;color:var(--ink);background:var(--err);border-radius:999px;padding:5px 14px;margin-bottom:14px}
.hint{font-size:var(--step-t);margin-top:16px;min-height:1.6em}
.slots{display:flex;justify-content:center;gap:10px;margin:24px auto 0;direction:rtl;flex-wrap:wrap}
.slot{width:96px;height:108px;border-radius:20px;background:var(--ink-3);display:flex;align-items:center;justify-content:center;
  font-family:var(--arabic);font-size:52px;line-height:1;color:var(--cream);cursor:default;padding:0;
  outline:2px dashed var(--cream-faint);outline-offset:-4px;transition:background-color var(--t-hover) ease,outline-color var(--t-hover) ease}
.slot.up{outline:2px solid var(--gold-text);outline-offset:-4px}
.slot.filled{outline:0;cursor:pointer;background:var(--ink-3)}
@media (hover:hover) and (pointer:fine){.slot.filled:hover{background:var(--ink)}}
.slot.fixed{outline:0;background:var(--btn-bg);color:var(--btn-ink)}
.slot.locked{cursor:default}
.slot:focus-visible{outline:3px solid var(--cream);outline-offset:3px}
.bank{display:grid;grid-template-columns:repeat(3,112px);justify-content:center;gap:10px;margin:28px auto 0;direction:rtl}
.bank .tile{width:112px;height:124px;border-radius:22px;background:var(--ink-3);color:var(--gold-text);
  font-family:var(--arabic);font-size:56px;line-height:1;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;
  transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out),opacity var(--t-hover) ease}
.bank .tile:active{transform:scale(.96)}
@media (hover:hover) and (pointer:fine){.bank .tile:hover{background:var(--ink)}}
.bank .tile.playing{background:var(--btn-bg);color:var(--btn-ink)}
.bank .tile.used{opacity:.22;cursor:default}
.bank .tile[disabled]{cursor:default}
.result{margin-top:clamp(28px,4vw,44px)}
.result-title{font-family:var(--serif);font-weight:500;font-size:var(--step-l);line-height:1.05;letter-spacing:-.02em}
.result-word{margin-top:10px;font-size:var(--step-t)}
.result-word .ar{font-size:36px;line-height:1.6;color:var(--cream);display:block}
.next-word{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:72px;min-width:240px;margin-top:20px;padding:0 32px;
  background:var(--btn-bg);color:var(--btn-ink);border-radius:999px;font:600 var(--step-lead)/1 var(--sans);
  transition:background-color var(--t-hover) ease,transform var(--t-press) var(--ease-out)}
.next-word:active{transform:scale(.97)}
@media (hover:hover) and (pointer:fine){.next-word:hover{background:var(--btn-bg-hover)}}

/* ============================================================ phone */
@media (max-width:860px){
  .tiles{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:620px){
  .tools .mode{flex:1;justify-content:center}
  .card{border-radius:22px}
  .pic{gap:14px;padding:12px 16px 12px 12px}
  .pic-emoji{width:68px;height:68px;font-size:40px}
  .pic-word{font-size:32px}
  .card.is-asking{min-height:340px}
  .tile-shape{font-size:46px}
  .vtiles{gap:6px}
  .vtile-ar{font-size:44px;height:96px}
  .tile-word{font-size:25px}
  .grid{grid-template-columns:repeat(4,1fr)}
  .steps{flex-direction:column}
  .hear,.reveal,.next-word{min-width:0;width:100%}
  .slot{width:84px;height:96px;font-size:46px}
  .bank{grid-template-columns:repeat(3,1fr);width:100%}
  .bank .tile{width:100%;height:112px;font-size:50px}
  /* number | text on the first row, the tag tucked under the text on the next */
  .path-list li{display:grid;grid-template-columns:42px 1fr;gap:6px 14px;align-items:start}
  .path-list .path-num{grid-row:1 / span 2}
  .path-tag{grid-column:2;justify-self:start}
}

/* the dark tool field runs straight into the footer (no stripe of page ground between them) */
.footer{margin-top:0}

@media (forced-colors: active){
  .mode,.reveal,.hear,.next-word,.step{border:1px solid}
  .mode[aria-pressed="true"]{forced-color-adjust:none;background:Highlight;color:HighlightText}
}
