/* المكتبة (lib/shelf.js, lib/shelf-book.js, lib/shelf-reader.js): the sheikh's shelves, and the book rows and book view
   both apps share (the student's «كتبي»). Phone first, wider on the sheikh's laptop. Tokens and buttons come from
   base.css; the poem's own look stays with each app (sheikh/library.css, student/books.css). The navy canvas: white
   cards on a soft shadow, navy pills, gold for the words found; on the shelves each book is a cover in its section's colour. */
.sf-search, .sf-view, .sf-books, .sf-book, .sf-card, .sf-panel {
  --sf-ink-3: var(--ink-3);      /* captions (5.5:1 on white) */
  --sf-fill: var(--fill);       /* quiet inner fills */
  --sf-wash: var(--navy-wash);       /* the row in view, hovers */
  --sf-lift: 0 0 0 1px rgba(16, 27, 58, .07), 0 2px 4px rgba(16, 27, 58, .04), 0 14px 30px -14px rgba(16, 27, 58, .22);
  --sf-ease: cubic-bezier(.23, 1, .32, 1);
}
.sf-search, .sf-browse, .sf-group, .sf-found { display: flex; flex-direction: column; }
.sf-search { gap: 16px; }
.sf-browse { gap: 28px; container-type: inline-size; }
.sf-group, .sf-found { gap: 12px; }
.sf-found:empty, .sf-status:empty { display: none; }
.sf-group > h2, .sf-sub { margin: 0; font-size: var(--text-lg); font-weight: 700; line-height: 1.4; }
.sf-status { margin: 0; font-size: var(--text-md); line-height: 1.7; color: var(--ink-2); }
.sf-card a.btn { color: var(--ink); }

/* a search field: a white pill; the library's own is taller and says where it looks */
.sf-field { position: relative; display: flex; align-items: center; gap: 10px; min-height: 50px; padding-inline: 16px 8px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow); transition: box-shadow 200ms ease-out; }
.sf-field:focus-within { box-shadow: 0 0 0 1px var(--navy-2), 0 0 0 5px var(--brand-soft); }
.sf-field > svg { flex: none; color: var(--sf-ink-3); }
.sf-q { flex: 1; min-width: 0; height: 46px; padding: 0; border: 0; background: transparent; font-size: var(--text-input); color: var(--ink); }
.sf-q:focus { outline: none; }
.sf-q::placeholder { color: var(--sf-ink-3); }
.sf-search > .sf-field { min-height: 56px; padding-inline: 20px 8px; }
.sf-search > .sf-field .sf-q { font-size: 17px; }
.sf-scope { flex: none; display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: var(--radius-pill); background: var(--sf-fill); font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.sf-scope:empty { display: none; }

/* the sections as tabs: a white pill, the one shown navy */
.sf-shelf-tabs { display: flex; flex-wrap: wrap; gap: 4px; width: max-content; max-width: 100%; padding: 4px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.sf-shelf-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--radius-pill); font-size: var(--text-md); font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap; transition: background-color 150ms ease-out, color 150ms ease-out; }
.sf-shelf-tabs .n { font-weight: 700; color: var(--sf-ink-3); }
.sf-shelf-tabs svg { width: 15px; height: 15px; }
.sf-shelf-tabs a[aria-current] { background: var(--grad); color: var(--on-accent); font-weight: 700; box-shadow: var(--shadow-navy); }
.sf-shelf-tabs a[aria-current] .n { color: rgba(255, 255, 255, .75); }

@container (max-width: 959px) {   /* too narrow for every tab: one row that scrolls */
  .sf-shelf-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, transparent, #000 28px); mask-image: linear-gradient(to right, transparent, #000 28px); }
  .sf-shelf-tabs::-webkit-scrollbar { display: none; }
}

/* the shelves: a section's colour on its swatch and its covers' spines */
.sf-book, .sf-shelf, .sf-cat { --sp: var(--brand); }
.sf-c-mushafs { --sp: #7B2D26; }
.sf-c-mutoon { --sp: var(--gold-ink); }
.sf-c-tajweed { --sp: #23707A; }
.sf-c-shuruh { --sp: var(--brand); }
.sf-c-mufrada { --sp: #8C3A5B; }
.sf-c-tahrirat { --sp: #1F6AA5; }
.sf-c-tawjih { --sp: #2E6B4F; }
.sf-c-tarajim { --sp: #5A4E8C; }
.sf-c-tafsir { --sp: #4A5470; }
.sf-shelves { display: flex; flex-direction: column; gap: 32px; }
.sf-shelf { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sf-shelf-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.sf-shelf-h h2 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: var(--text-lg); font-weight: 700; line-height: 1.35; white-space: nowrap; }
.sf-shelf-h h2::before, .sf-cat::before { content: ""; flex: none; width: 9px; height: 18px; border-radius: 2px 4px 4px 2px; background: var(--sp); }
.sf-shelf-h small { font-size: var(--text-sm); font-weight: 500; color: var(--sf-ink-3); }
.sf-shelf-all { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 3px; min-height: 32px; font-size: var(--text-md); font-weight: 700; color: var(--brand); text-decoration: none; }
.sf-shelf-all:hover { text-decoration: underline; text-underline-offset: 4px; }
.sf-shelf.sf-c-tafsir { order: 1; padding-top: 28px; border-top: 1px solid var(--line); }   /* last, set apart */
/* the laptop: seven covers to a row, the short shelves (and his uploads) sharing one */
@container (min-width: 940px) {
  .sf-shelves { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 34px 12px; }
  .sf-shelf { grid-column: span var(--span, 7); display: grid; grid-template-columns: subgrid; align-content: start; row-gap: 12px; }
  .sf-shelf-h, .sf-shelf > .sf-books { grid-column: 1 / -1; }
  .sf-shelves .sf-shelf > .sf-books { grid-template-columns: subgrid; }   /* over the covers' own columns, below */
  .sf-shelves > :not(.sf-shelf) { grid-column: span 3; align-self: start; }
  .sf-shelves > .sf-c-tafsir { grid-column: 1 / -1; }
}

/* the books: a card a book (the student's «كتبي»; the sheikh's shelves draw them as covers, below) */
.sf-books, .sf-hit-list { list-style: none; margin: 0; padding: 0; }
.sf-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.sf-book { height: 100%; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; line-height: 1.5; transition: box-shadow 200ms ease-out, transform 200ms var(--sf-ease); }
.sf-book b { font-size: var(--text-input); font-weight: 700; }
.sf-book small { font-size: var(--text-sm); color: var(--ink-2); }
.sf-book .sf-meta { color: var(--sf-ink-3); }
a.sf-book:hover { box-shadow: var(--sf-lift); }
a.sf-book:hover b { color: var(--brand); }
.sf-said { margin-top: 4px; font-size: var(--text-md); line-height: 1.6; color: var(--ink); }
.sf-at { align-self: flex-start; margin-top: 6px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--gold); color: var(--gold-ink); font-size: var(--text-sm); font-weight: 700; line-height: 1.9; }
/* the sheikh's «أرسل لطالب» under each book (sheikh/library.js) */
.sf-acting { display: flex; flex-direction: column; gap: 6px; }
.sf-acting > .sf-book { flex: 1; }
.sf-acting > .lb-send-row { align-self: flex-start; height: 36px; padding: 0 12px; font-size: var(--text-md); }
.lb-no-send { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--ink-2); }

/* the sheikh's covers: on his shelves, a section's page and the titles his search finds */
.sf-search .sf-books { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }
.sf-search .sf-book { position: relative; height: 254px; align-items: center; gap: 6px; padding: 18px 8px 12px; padding-inline-start: 19px; overflow: hidden; border-radius: 14px; border-start-start-radius: 4px; border-end-start-radius: 4px; background: color-mix(in srgb, var(--sp) 5%, #fff); text-align: center; }
.sf-search .sf-book::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 11px; background: linear-gradient(to left, color-mix(in srgb, var(--sp) 82%, #000), var(--sp) 55%, color-mix(in srgb, var(--sp) 78%, #fff)); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .22); }
.sf-search .sf-book::after { content: ""; order: -1; flex: none; width: 46px; height: 7px; margin-bottom: 4px; border-block: 1.5px solid color-mix(in srgb, var(--sp) 55%, #fff); }
.sf-search .sf-book b { font-size: 13.5px; line-height: 1.5; color: color-mix(in srgb, var(--sp) 62%, var(--ink)); display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.sf-search .sf-book small { font-size: 11.5px; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-search .sf-book .sf-meta { margin-top: auto; }
.sf-search .sf-book .sf-at { align-self: center; margin-top: 0; padding: 0 8px; background: var(--brand-soft); color: var(--brand); font-size: var(--text-2xs); line-height: 20px; white-space: nowrap; }
.sf-search .sf-book .sf-modern { align-self: center; }
.sf-search a.sf-book:hover b { color: color-mix(in srgb, var(--sp) 62%, var(--ink)); }
.sf-search a.sf-book:active { transform: scale(.985); }
.sf-search .sf-acting > .sf-book { flex: none; }
.sf-search .sf-acting > .lb-send-row { align-self: stretch; height: 32px; gap: 6px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--brand); font-size: 12.5px; font-weight: 700; }
.sf-search .sf-acting > .lb-send-row svg { width: 14px; height: 14px; }
.sf-search .sf-acting > .lb-send-row:hover { background: var(--brand-soft); color: var(--brand); }
.sf-search .sf-acting > .lb-no-send { align-self: center; min-height: 32px; font-size: 12.5px; font-weight: 700; color: var(--sf-ink-3); }
.sf-search .sf-acting > .lb-no-send svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) {
  .sf-search a.sf-book:hover { transform: translateY(-2px); }
  .sf-shelf-tabs a:not([aria-current]):hover { background: var(--sf-wash); color: var(--ink); }
}

/* the search's hits (links on the shelves, buttons inside a book) */
.sf-hits { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px 8px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.sf-hits h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; font-size: var(--text-input); font-weight: 700; line-height: 1.5; }
.sf-hits h3 a { color: var(--brand); text-decoration: none; }
.sf-hits h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.sf-hits h3 small { font-size: var(--text-sm); font-weight: 500; color: var(--sf-ink-3); }
.sf-hit-list li + li { border-top: 1px solid var(--divider); }
.sf-found > .sf-hit-list { padding: 0 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.sf-hit { width: 100%; min-height: 44px; display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border: 0; background: none; color: var(--ink); text-align: start; text-decoration: none; }
.sf-hit b { flex: none; min-width: 64px; font-size: var(--text-sm); font-weight: 700; color: var(--brand); }
.sf-hit span { min-width: 0; font-size: var(--text-base); line-height: 1.75; color: var(--ink-2); overflow-wrap: anywhere; }
.sf-found > .sf-hit-list .sf-hit span { font-family: var(--quran); font-size: var(--text-lg); line-height: 1.8; color: var(--ink); }   /* the ayat */
.sf-hit:hover span { color: var(--brand); }
.sf-hit mark { border-radius: 4px; background: var(--gold); box-shadow: 0 0 0 2px var(--gold); color: var(--gold-ink); font-weight: 700; }
.sf-all { align-self: flex-start; padding: 6px 0; font-size: var(--text-md); font-weight: 700; color: var(--brand); text-decoration: none; }
.sf-all:hover { text-decoration: underline; text-underline-offset: 4px; }
.sf-more { align-self: center; }

/* a book: the search and its steps in one card, the book, and the panel («الفهرس», «نتائج البحث»): a sheet over the
   page on the phone, beside it on the sheikh's laptop (.sf-wide; under it on a narrow screen) */
.sf-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.sf-card > p { margin: 0; }
.sf-view, .sf-main, .sf-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sf-cat { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 10px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.sf-cat::before { width: 8px; height: 15px; border-radius: 2px 3px 3px 2px; }
.page-head:has(~ .sf-view) h1 { max-width: 34ch; text-wrap: balance; }

.sf-findrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); transition: box-shadow 200ms ease-out; }
.sf-findrow:has(.sf-q:focus) { box-shadow: 0 0 0 1px var(--navy-2), 0 0 0 5px var(--brand-soft); }
.sf-findrow > .sf-field { flex: 1 1 260px; min-width: 0; min-height: 44px; padding-inline: 12px 4px; background: none; box-shadow: none; }
.sf-open { flex: none; height: 42px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sf-steps { flex: 0 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px; padding-inline-start: 14px; border-radius: var(--radius-pill); background: var(--sf-fill); font-size: var(--text-md); }
.sf-where { flex: 1; min-width: 0; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-steps .sf-all { flex: none; align-self: center; padding: 0 6px; border: 0; background: none; }
.sf-step { height: 34px; gap: 4px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 700; }
.sf-step:not(.primary) { border-color: transparent; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.sf-step:disabled { border-color: transparent; background: var(--neutral-bg); color: #8E96AE; box-shadow: none; filter: none; cursor: default; }

.sf-panel { display: none; flex-direction: column; background: var(--surface); }
.sf-panel.open { display: flex; position: fixed; z-index: 61; inset: auto 0 0; max-width: 480px; max-height: 82dvh; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom, 0px); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: 0 -12px 34px -10px rgba(16, 27, 58, .3); animation: sf-sheet 320ms cubic-bezier(.32, .72, 0, 1); }
.sf-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(16, 27, 58, .4); animation: sf-fade 200ms ease-out; }
@keyframes sf-sheet { from { transform: translateY(100%); } }
@keyframes sf-fade { from { opacity: 0; } }
.sf-tabs { flex: none; display: flex; align-items: center; gap: 6px; padding: 12px 12px 8px; }
.sf-tab { flex: 1; height: 40px; border: 0; border-radius: var(--radius-pill); background: var(--sf-fill); font-size: var(--text-base); font-weight: 500; color: var(--ink-2); transition: background-color 150ms ease-out, color 150ms ease-out; }
.sf-tab[aria-pressed="true"] { background: var(--grad); color: var(--on-accent); font-weight: 700; box-shadow: var(--shadow-navy); }
.sf-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--sf-fill); }
.sf-pane { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 12px; }
.sf-pane .sf-field { min-height: 42px; padding-inline: 14px 6px; background: var(--sf-fill); box-shadow: inset 0 0 0 1px var(--line); }
.sf-pane .sf-field:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--navy-2), 0 0 0 4px var(--brand-soft); }
.sf-pane .sf-q { height: 40px; }
.sf-pane .sf-status { padding-inline: 6px; }
.sf-pane .sf-more { align-self: stretch; flex: none; height: 40px; border: 0; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-weight: 700; }

/* «الفهرس»: an entry and its page; the one being read navy, with «أنت هنا» */
.sf-toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sf-entry { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: start; font-size: var(--text-md); font-weight: 500; line-height: 1.45; transition: background-color 150ms ease-out; }
.sf-entry-t { min-width: 0; }
.sf-entry-at { order: 2; flex: none; margin-inline-start: auto; font-size: var(--text-xs); font-weight: 500; color: var(--sf-ink-3); white-space: nowrap; }
.sf-toc .sub .sf-entry { padding-inline-start: 28px; color: var(--ink-2); }
.sf-entry[aria-current] { background: var(--grad); color: var(--on-accent); font-weight: 700; box-shadow: var(--shadow-navy); }
.sf-entry[aria-current] .sf-entry-at { color: rgba(255, 255, 255, .75); }
.sf-here { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--gold); color: var(--gold-ink); font-size: var(--text-2xs); font-weight: 700; }
.sf-entry[aria-current] .sf-here { background: rgba(255, 255, 255, .18); color: var(--on-accent); }

/* «نتائج البحث» in the panel: the place over its words, the one shown washed navy */
.sf-pane .sf-hit-list { display: flex; flex-direction: column; gap: 2px; }
.sf-pane .sf-hit-list li + li { border-top: 0; }
.sf-pane .sf-hit { flex-direction: column; align-items: stretch; gap: 3px; padding: 10px 12px; border-radius: 12px; transition: background-color 150ms ease-out; }
.sf-pane .sf-hit b { min-width: 0; font-size: var(--text-sm); }
.sf-pane .sf-hit span { font-size: var(--text-md); line-height: 1.65; }
.sf-pane .sf-hit:hover span { color: var(--ink-2); }
.sf-pane .sf-hit[aria-current] { background: var(--sf-wash); box-shadow: inset 0 0 0 1px #DCE3F4; }
.sf-pane .sf-hit[aria-current] span { color: var(--ink); }
.sf-pane .sf-hit[aria-current] b::after { content: "، معروضة"; font-weight: 500; color: var(--sf-ink-3); }
@media (hover: hover) and (pointer: fine) {
  .sf-entry:not([aria-current]):hover, .sf-pane .sf-hit:not([aria-current]):hover { background: var(--sf-fill); }
  .sf-tab:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--sf-wash); }
}

/* the sheikh's panel: one card, «نتائج البحث» over «الفهرس», each list scrolling inside it */
.sf-wide .sf-panel { display: flex; order: 1; border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.sf-box { display: flex; flex-direction: column; min-height: 0; }
.sf-box + .sf-box { border-top: 1px solid var(--line); }
.sf-box > h2 { flex: none; margin: 0; display: flex; align-items: center; gap: 8px; padding: 16px 18px 8px; font-size: 16.5px; font-weight: 700; line-height: 1.35; }
.sf-box > h2 svg { color: var(--brand); }
.sf-wide .sf-pane { flex: 0 1 auto; overflow: hidden; padding: 0 0 10px; }
.sf-wide .sf-pane > .sf-field, .sf-wide .sf-pane > .sf-status { flex: none; margin-inline: 18px; }
.sf-wide .sf-pane > .sf-status { padding-inline: 0; }
.sf-wide .sf-pane > .sf-toc, .sf-wide .sf-pane > .sf-hit-list { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px; }
.sf-wide .sf-pane > .sf-more { margin-inline: 12px; width: auto; }
.sf-wide .sf-toc { max-height: 320px; padding-bottom: 24px; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
@media (min-width: 1100px) {
  .sf-wide .sf-main { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; gap: 18px; }
  .sf-wide .sf-panel { order: 0; position: sticky; top: 0; max-height: calc(100dvh - 64px); }   /* with the bar, under the page's own padding */
  .sf-wide .sf-box-results { flex-shrink: 0; max-height: 46dvh; }
  .sf-wide .sf-box-toc { flex: 0 1 auto; }
  .sf-wide .sf-toc { max-height: none; }
}

/* the reader: one card, its controls on top, the page on a soft desk */
.sf-reader { width: 100%; max-width: 900px; margin-inline: auto; display: flex; flex-direction: column; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.sf-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); border-radius: 20px 20px 0 0; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); }
.sf-turn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.sf-turn:hover { color: var(--brand); box-shadow: var(--sf-lift); }
.sf-turn:disabled { background: var(--neutral-bg); color: #8E96AE; box-shadow: none; cursor: default; }
.sf-zoom { margin-inline-start: auto; font-size: var(--text-2xl); font-weight: 500; }
.sf-zoom[aria-pressed="true"] { background: var(--grad); color: var(--on-accent); box-shadow: var(--shadow-navy); }
.sf-go { flex: none; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.sf-go-n { width: 58px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--sf-fill); text-align: center; font-size: var(--text-input); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; transition: border-color 150ms ease-out, box-shadow 150ms ease-out; }
.sf-go-n:focus { outline: none; border-color: var(--navy-2); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.sf-caption { margin: 0; padding: 10px 16px 0; font-size: var(--text-sm); font-weight: 500; color: var(--sf-ink-3); }
.sf-caption:empty, .sf-msg:empty { display: none; }
.sf-page { position: relative; overflow: auto; padding: 20px; border-radius: 0 0 20px 20px; background: var(--sf-fill); touch-action: manipulation; }
.sf-img { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--surface); box-shadow: 0 0 0 1px rgba(16, 27, 58, .06), 0 24px 48px -28px rgba(16, 27, 58, .45); transition: opacity 200ms ease-out; }
.sf-page.loading .sf-img { opacity: .35; }
.sf-page.zoomed .sf-img { width: 200%; max-width: none; }
.sf-msg { position: absolute; top: 14px; inset-inline: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--sf-lift); font-size: var(--text-base); text-align: center; }
.sf-msg p { margin: 0; }

/* a tafsir book (lib/tafsir.js): its rights tag on the shelf, and its page as text */
.sf-modern { align-self: flex-start; margin-top: 4px; padding: 0 8px; border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--text-xs); line-height: 1.8; color: var(--ink-2); }
.tf-field { display: flex; align-items: center; gap: 4px; }
.tf-go { height: 38px; padding: 0 14px; border-radius: var(--radius-pill); font-size: var(--text-md); font-weight: 700; }
.tf-page { padding: 20px 26px; background: var(--surface); }
.tf-page.loading .tf-body { opacity: .4; }
.tf-body { font-family: var(--quran); font-size: var(--text-xl); line-height: 2; color: var(--ink); overflow-wrap: anywhere; }
.tf-body p { margin: 0 0 10px; }
.tf-body h3 { margin: 14px 0 8px; font-size: var(--text-xl); font-weight: 700; color: var(--brand); }
.tf-body h3:first-child { margin-top: 0; }
.tf-notes { font-size: var(--text-base); line-height: 1.8; color: var(--ink-2); }
.tf-notes hr { width: 30%; margin: 14px 0 8px; border: 0; border-top: 1px solid var(--line); }
.tf-notes p { margin: 0 0 4px; }

/* the phone: the steps on their own row; the student's page uses the screen's whole width; the long label is for
   screen readers only */
@media (max-width: 760px) {
  .sf-scope { display: none; }
  .sf-search > .sf-field { padding-inline: 16px 6px; }
  .sf-search > .sf-field .sf-q { font-size: var(--text-input); }
  .sf-findrow > .sf-field { flex-basis: 150px; }
  /* where he is and «كل النتائج» over the two steps, each half the row */
  .sf-steps { flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; padding-inline-start: 14px; border-radius: 20px; }
  .sf-steps .sf-all { justify-self: end; }
  .sf-step { height: 38px; }
  .sf-page { padding: 12px 10px; }
}
@media (max-width: 599px) {
  .sf-search .sf-books { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sf-go-more { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sapp .sf-reader { margin-inline: -16px; width: auto; border-radius: 0; }   /* apply.css .app's padding */
  .sapp .sf-bar { border-radius: 0; }
  .sapp .sf-page { padding: 0; border-radius: 0; background: var(--paper); }
  .sapp .sf-img { border-radius: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sf-book, .sf-panel.open, .sf-backdrop { transition: none; animation: none; }
  .sf-search a.sf-book:hover, .sf-search a.sf-book:active { transform: none; }
}
