/* Maktoob — reader access (Batch 9): the Plus-ended and offline gates, the offline chip, download progress along the
   top bar, the device-limit dialog and the install card. Loaded on reader.html (and library.html, for the dialog). */

/* ---------- gates (inside .rd__gate; .rd__gatein / .rd__card* come from reader.css) ---------- */
.rax-gate { padding: 8px 0 4px; }
.rax-gate .rd__cardt { max-width: 24ch; }
.rax-gate .rd__cardp { max-width: 42ch; }
.rax-gate .rd__cardacts { margin-top: 4px; }
.rax-gate .rd__cardacts .btn { min-height: 48px; }
.rax-gate__i { width: 34px; height: 34px; color: var(--raccent); }
.rax-gate__alt { margin-top: -2px; font-size: 14px; }
.rax-gate__alt .link--btn { min-height: 44px; padding: 0 6px; font: 600 14px/1 var(--f-ui); color: var(--rfg); text-decoration: underline; text-underline-offset: 3px; }

.rax-place { display: grid; gap: 8px; justify-items: center; width: min(100%, 260px); font: 500 13.5px/1.3 var(--f-ui); color: var(--rmeta); font-variant-numeric: tabular-nums; }
:root .rax-place .wline { display: block; width: 100%; margin: 0; max-width: none; }

/* books on this device, in the offline gate */
.rax-here { width: 100%; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rline); text-align: start; }
.rax-here__t { margin-bottom: 10px; font: 600 12.5px/1.2 var(--f-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--rmeta); text-align: center; }
.rax-here__l { display: grid; gap: 6px; }
.rax-here__i {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; min-height: 64px; padding: 8px 12px; border-radius: var(--r-md);
  background: var(--rcard); box-shadow: inset 0 0 0 1px var(--rline); color: var(--rfg); text-decoration: none;
  transition: box-shadow var(--t-micro);
}
.rax-here__i::after { content: ''; width: 8px; height: 8px; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); opacity: .55; margin-inline-end: 4px; }
.rax-here__i:hover { box-shadow: inset 0 0 0 1.5px var(--rfg); }
.rax-here__cv .cover { width: 40px; border-radius: 3px; box-shadow: var(--e1); }
.rax-here__b { display: grid; gap: 3px; min-width: 0; }
.rax-here__n { font: 700 15px/1.25 var(--f-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rax-here__n[lang="ar"] { font: 700 17px/1.3 var(--f-ar); }
.rax-here__s { font: 500 13px/1.2 var(--f-ui); color: var(--rmeta); }
.rax-here__none { margin-top: 10px; max-width: 40ch; font-size: 14px; color: var(--rmeta); }

/* ---------- the offline chip: in the top bar, after the back link, on wide screens; hanging under it (and hiding with it) below 900 ---------- */
.rax-chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 32px; padding: 0; padding-inline: 11px 14px; border-radius: var(--r-pill);
  background: var(--rpanel); color: var(--rfg); box-shadow: inset 0 0 0 1px var(--rline);
  font: 600 13px/1 var(--f-ui); white-space: nowrap; pointer-events: none;
}
.rax-chip svg { width: 16px; height: 16px; color: var(--raccent); }
.rax-chip--warn svg { color: var(--red-act); }
.rd[data-theme="night"] .rax-chip--warn svg { color: var(--sky); }
@media (min-width: 900px) {
  .rax-chip { position: absolute; top: 50%; inset-inline-start: 64px; transform: translateY(-50%); }
}
@media (max-width: 899px) {
  .rax-chip { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); box-shadow: var(--e1), inset 0 0 0 1px var(--rline); }
}

/* ---------- the Download tool and its progress along the bottom edge of the top bar ---------- */
[data-rd-tool="download"] { position: relative; }
.rax-tool-ok { position: absolute; inset-inline-end: 6px; bottom: 7px; width: 13px !important; height: 13px !important; padding: 1.5px; border-radius: 50%; background: var(--raccent); color: var(--rbg); display: none; }
[data-rd-tool="download"].is-ready .rax-tool-ok { display: block; }
[data-rd-tool="download"].is-busy > svg:first-child { color: var(--raccent); }
.rax-prog { position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; pointer-events: none; transition: opacity 400ms var(--ease-out); }
:root .rax-prog .wline { display: block; margin: 0; max-width: none; }
.rax-prog .wline__fill { animation: none !important; transition: clip-path 300ms var(--ease-out); }
.rax-prog.is-done { opacity: 0; }

/* ---------- the device-limit dialog (a .dlg; the reader's surfaces don't theme it) ---------- */
.rax-dlg h2 { text-wrap: balance; }
.rax-devs { display: grid; margin: 4px 0 0; }
.rax-dev { display: grid; grid-template-columns: 24px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 10%, transparent); }
.rax-dev:last-child { box-shadow: none; }
.rax-dev__i { width: 22px; height: 22px; color: var(--blue); }
.rax-dev__b { display: grid; gap: 3px; min-width: 0; }
.rax-dev__n { font: 600 15px/1.3 var(--f-ui); color: var(--ink); }
.rax-dev__w { font-size: 13.5px; color: var(--ink-2); }
.rax-dev .btn--sm { min-height: 44px; }

/* ---------- the install card in the Settings footer ---------- */
.rax-inst { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 16px; border-radius: var(--r-md); background: var(--rcard, var(--stone-50)); box-shadow: inset 0 0 0 1px var(--rline, color-mix(in srgb, var(--ink) 12%, transparent)); }
.rax-inst__mk { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--ink); color: var(--sky); }
.rax-inst__mk svg { width: 22px; height: 24px; }
.rd[data-theme="night"] .rax-inst__mk { background: var(--stone); color: var(--deep); }
.rax-inst__b { display: grid; gap: 4px; justify-items: start; }
.rax-inst__t { font: 700 15px/1.3 var(--f-ui); }
.rax-inst__p, .rax-inst__how { font: 400 13.5px/1.5 var(--f-ui); color: var(--rmeta, var(--ink-2)); }
.rax-inst__how { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--rline, color-mix(in srgb, var(--ink) 14%, transparent)); color: var(--rfg, var(--ink)); }
.rax-inst .btn { margin-top: 6px; }

@media (max-width: 599px) {
  .rax-gate .rd__cardacts { display: grid; justify-self: stretch; justify-content: stretch; width: auto; }
  .rax-gate .rd__cardacts .btn { width: 100%; }
  .rax-chip { font-size: 12.5px; }
  .rax-tool-ok { inset-inline-end: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .rax-prog, .rax-prog .wline__fill { transition: none; }
}
