/* Maktoob — your library (Batch 9): reading and download status on owned cards, the "Reading with Plus" shelf, and
   the new-device sync. The Arabic page loads this file too; every rule here targets classes only the English page uses. */

/* ---------- owned (and Plus) cards: line 1 where you are, line 2 whether it's on this device ---------- */
.bk.is-plus .bk__buy { display: none; }
.bk.is-plus .bk__owned { display: inline-flex; }
.bk.is-plus .bk__acts, .bk.is-plus-off .bk__acts { display: none; }
:root:is([lang="en"], [lang="ar"]) .bk__owned { min-width: 0; min-height: 32px; }
:root:is([lang="en"], [lang="ar"]) .bk__owned svg { color: var(--blue); }
.bk__owned > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bk__dlrow { display: flex; align-items: center; min-height: 36px; margin-top: 2px; }
.bk__dl { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: 500 13px/1.2 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.bk__dl svg { flex: none; width: 15px; height: 15px; }
.bk__dl.is-ready svg { color: var(--blue); }
.bk__dl.is-busy { display: grid; grid-template-columns: auto minmax(40px, 1fr); gap: 10px; width: 100%; color: var(--ink); font-variant-numeric: tabular-nums; }
.bk__dlbar { position: relative; display: block; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.bk__dlbar i { position: absolute; inset: 0; background: var(--blue); transform-origin: left; transition: transform 300ms var(--ease-out); }
.bk__dlb {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-inline-start: -8px; padding: 0; padding-inline: 8px 10px; border-radius: var(--r-pill);
  font: 600 13px/1 var(--f-ui); color: var(--ink); transition: background-color var(--t-micro);
}
.bk__dlb:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.bk__dlb svg { width: 16px; height: 16px; }
.bk__place { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: 500 13px/1.2 var(--f-ui); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.bk__place:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.bk__place svg { flex: none; width: 15px; height: 15px; }

/* ---------- "Reading with Plus" ---------- */
.libpage__plus { margin-top: var(--s8); }
.libpage__plus .label { margin-bottom: var(--s2); }
.libpage__plusp { max-width: 62ch; margin-bottom: var(--s5); font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.libpage__plusp .link { font-weight: 600; }

/* ---------- a new device: the skeleton shelf while the library comes in ---------- */
html.is-syncing [data-continue], html.is-syncing [data-libtabs], html.is-syncing .libpanel, html.is-syncing [data-plusshelf], html.is-syncing [data-way], html.is-syncing [data-lib-sign] { display: none !important; }
.libsync { margin-top: var(--s7); }
.libsync__head { display: flex; align-items: flex-start; gap: 14px; }
.libsync__head > svg { flex: none; width: 26px; height: 26px; margin-top: 2px; color: var(--blue); }
.motion .libsync__head > svg { animation: libsync-spin 1.6s linear infinite; }
@keyframes libsync-spin { to { transform: rotate(360deg); } }
.libsync__txt { display: grid; gap: 4px; }
.libsync__t { font: 700 20px/1.3 var(--f-ui); color: var(--ink); }
.libsync__p { font-size: 15px; color: var(--ink-2); }
:root .libsync__wl { display: block; max-width: 420px; margin: var(--s4) 0 var(--s6); margin-inline-start: 40px; }
.libsync__wl .wline__fill { animation: none !important; }
.libsk { display: grid; gap: 10px; }
.libsk__cv { display: block; aspect-ratio: 2 / 3; border-radius: var(--r-sm); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.libsk__l { display: block; height: 12px; width: 80%; border-radius: 6px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.libsk__l--s { width: 50%; }
.motion .libsk > span { animation: libsk-pulse 1.2s ease-in-out infinite alternate; }
@keyframes libsk-pulse { from { opacity: 1; } to { opacity: .45; } }

@media (max-width: 599px) {
  .bk__dl.is-busy { grid-template-columns: 1fr; gap: 6px; }
  :root .libsync__wl { margin-inline-start: 0; }
  .libsync__t { font-size: 18px; }
}
/* the download bar fills from the reading side */
.bk__dlbar i:dir(rtl) { transform-origin: right; }

@media (prefers-reduced-motion: reduce) {
  .libsync__head > svg, .libsk > span { animation: none; }
  .bk__dlbar i { transition: none; }
}

/* ---------- Plus ended or paused: the card is closed. "Plus ended" and where you stopped, then "Own it · price" ---------- */
.bk.is-plus-off .bk__cv img, .bk.is-plus-off .bk__cv .cover { filter: saturate(.55); opacity: .82; }
.bk.is-plus-off:hover .bk__cv, .bk.is-plus-off:focus-within .bk__cv { transform: none; }
.bk__ended { flex-wrap: wrap; gap: 6px 8px; min-height: 0; margin-top: 8px; }
/* the tag and where you stopped come first (under the author), then the way back in */
.bk.is-plus-off .bk__ended { order: 1; margin-top: 0; }
.bk.is-plus-off .bk__row { order: 2; }
.bk__ended .bk__place { min-width: 0; white-space: normal; line-height: 1.35; }
.bk__tag, .cont__tag { flex: none; padding: 3px 10px; font-size: 12px; }
.bk__ownit { font-weight: 700; font-variant-numeric: tabular-nums; }
.cont__item.is-locked .cont__cv { filter: saturate(.55); opacity: .82; }
.cont__item.is-locked .cont__wl { opacity: .55; }
.cont__item.is-locked .cont__p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cont__item.is-locked .cont__tag { font-weight: 700; }
