/* Study interface. Idea: matn and sharh — the book's text is set as an inset
   book page; the lecture is the commentary around it, with rubric (red) time
   marks in the margin and one playback console at the foot of the screen. */

@font-face { font-family: "Scheherazade New"; src: url("fonts/scheherazade-new/ScheherazadeNew-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Scheherazade New"; src: url("fonts/scheherazade-new/ScheherazadeNew-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Scheherazade New"; src: url("fonts/scheherazade-new/ScheherazadeNew-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Scheherazade New"; src: url("fonts/scheherazade-new/ScheherazadeNew-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f6f7f4;
  --surface: #ffffff;
  --ink: #1a211e;
  --muted: #59635e;
  --line: #d8dcd5;
  --rubric: #9c2a1f;
  --vellum: #efead9;
  --gold: #a98a3d;
  --latin-serif: "Iowan Old Style", Charter, "Bitstream Charter", "Noto Serif", "Palatino Linotype", Georgia, serif;
  --latin-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --arabic: "Scheherazade New", "Noto Naskh Arabic", serif;
  --serif: var(--latin-serif);
  --ui: var(--latin-ui);
  --read: 1.125rem;
  --leading: 1.68;
  --gutter: 1.25rem;
  --indent: 0rem;
  --page: 92rem;
  --reader-scale: 1;
}
/* Dark tokens: the device setting by default, or the reader's explicit choice. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; --paper: #141917; --surface: #1c2220; --ink: #e5e8e2; --muted: #9aa49e; --line: #2e3632; --rubric: #ea8f82; --vellum: #2d2a1d; --gold: #b99b52; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #141917; --surface: #1c2220; --ink: #e5e8e2; --muted: #9aa49e; --line: #2e3632; --rubric: #ea8f82; --vellum: #2d2a1d; --gold: #b99b52; }
}
html[dir="rtl"] { --serif: var(--arabic); --ui: var(--arabic); --read: 1.3rem; --leading: 2; font-size: 112.5%; }
@media (min-width: 600px) { :root { --gutter: 2rem; --read: 1.1875rem; } html[dir="rtl"] { --read: 1.36rem; } }
@media (min-width: 1000px) { :root { --indent: 5.5rem; } }
@media (min-width: 1340px) { :root { --indent: 20.5rem; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body[data-page="article"] { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
[lang="ar"] { font-family: var(--arabic); }
html[dir="rtl"] :is([lang="da"], [lang="en"]) { font-family: var(--latin-ui); }
html[dir="rtl"] .flip { transform: scaleX(-1); }
.i { flex: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 50; background: var(--ink); color: var(--paper); padding: .6rem 1rem; font: 600 .9rem var(--ui); border-radius: 0 0 6px 6px; }
.skip-link:focus { top: 0; }

/* Shared pieces */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: var(--page); margin: 0 auto; padding: .75rem var(--gutter); font: .875rem var(--ui); }
.home { display: inline-flex; align-items: center; gap: .3rem; min-height: 2.75rem; text-decoration: none; font-weight: 600; margin-inline-start: -.3rem; }
.home.static { margin: 0; }
.home:hover span { text-decoration: underline; }
.top-end { display: flex; align-items: center; gap: .5rem; }
.top-end .ic { border: 1px solid var(--line); }
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; font: 600 .75rem var(--latin-ui); letter-spacing: .03em; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu[open] summary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lang-menu nav { position: absolute; z-index: 30; inset-inline-end: 0; top: calc(100% + .4rem); min-width: 9.5rem; padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgb(0 0 0 / .14); }
.lang-menu a { display: flex; align-items: center; min-height: 2.6rem; padding: 0 .75rem; border-radius: 5px; text-decoration: none; }
.lang-menu a[lang="ar"] { font-size: 1.2em; }
.lang-menu a:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.lang-menu a[aria-current] { font-weight: 600; box-shadow: inset 2px 0 var(--rubric); }
html[dir="rtl"] .lang-menu a[aria-current] { box-shadow: inset -2px 0 var(--rubric); }
.theme-toggle { display: none; }
.enhanced .theme-toggle { display: grid; }
.langs a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .55rem; text-decoration: none; color: var(--muted); }
.langs a[lang="ar"] { font-size: 1.2em; }
.langs a:hover { color: var(--ink); }
.langs a[aria-current] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px var(--rubric); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.875rem; padding: 0 1.15rem; border: 1px solid var(--ink); border-radius: 6px; font: 600 .9375rem var(--ui); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn:hover { box-shadow: 0 0 0 1px var(--ink); }
.ic { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; }
.ic:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.toast { position: fixed; z-index: 60; inset-inline: 0; bottom: calc(5.25rem + env(safe-area-inset-bottom)); width: fit-content; max-width: calc(100% - 2rem); margin: 0 auto; padding: .6rem 1rem; background: var(--ink); color: var(--paper); font: .875rem var(--ui); border-radius: 6px; }
.toast:empty { display: none; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 2rem; max-width: var(--page); margin: 4rem auto 0; padding: 1.5rem var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font: .8125rem var(--ui); }

/* The entry row: "begin here", "continue studying", next and previous Halaqa */
.start { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 1rem; padding: 1rem 0; border-block: 1px solid var(--ink); text-decoration: none; }
.start small { grid-column: 1; font: 600 .8125rem var(--ui); color: var(--rubric); }
.start strong { grid-column: 1; font: 600 .875rem var(--ui); color: var(--muted); }
.start strong span { display: block; font: 400 1.45rem/1.25 var(--serif); color: var(--ink); margin-top: .1rem; text-wrap: balance; }
.start .i { grid-column: 2; grid-row: 1 / span 2; color: var(--muted); }
.start:hover strong span { text-decoration: underline; text-decoration-thickness: 1px; }
html[dir="rtl"] .start strong span { line-height: 1.6; }

/* Library: the book's title page, then its contents */
.title-page, .library { max-width: 46rem; margin: 0 auto; padding-inline: var(--gutter); }
.title-page { padding-block: clamp(1.5rem, 7vw, 4.5rem) 2.5rem; }
.book-name { margin: 0 0 .5rem; font-weight: 700; font-size: clamp(3.6rem, 15vw, 7.5rem); line-height: 1.3; }
html[dir="ltr"] .book-name { text-align: left; }
.title-page h1 { margin: 0; font-weight: 400; font-size: clamp(1.55rem, 1rem + 2.4vw, 2.3rem); line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
html[dir="rtl"] .title-page h1 { letter-spacing: 0; line-height: 1.6; }
.lede { margin: .6rem 0 2rem; font-size: 1.125rem; color: var(--muted); max-width: 34rem; }
.continue p { margin: .6rem 0 0; font: .8125rem var(--ui); color: var(--muted); }
.continue button, .end-tools button, .end-tools a, .book-foot button, .book-foot a { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.search label { display: block; font: 600 .875rem var(--ui); }
.search-field { display: flex; align-items: center; gap: .6rem; border-bottom: 1.5px solid var(--ink); color: var(--muted); }
.search-field:focus-within { border-color: var(--rubric); box-shadow: 0 1.5px 0 var(--rubric); color: var(--ink); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 1.25rem var(--serif); padding: .7rem 0; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field input::-webkit-search-cancel-button { display: none; }
#search-help, #search-status, .demo-note { font: .8125rem var(--ui); color: var(--muted); margin: .5rem 0 0; }
#search-status { color: var(--ink); min-height: 1.2em; margin-top: 1rem; }
.library h2 { margin: 2.2rem 0 .5rem; font: italic 400 1.2rem var(--serif); }
html[dir="rtl"] .library h2 { font-style: normal; font-weight: 600; }
.rows, .results { list-style: none; margin: 0; padding: 0; }
.rows li, .results li { border-top: 1px solid var(--line); }
.rows li:last-child, .results li:last-child { border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; column-gap: .5rem; padding: 1.1rem 0; text-decoration: none; }
.num { font-size: 2.3rem; line-height: 1; color: var(--rubric); font-variant-numeric: oldstyle-nums; }
.row-text strong { display: block; font-weight: 400; font-size: 1.35rem; line-height: 1.25; text-wrap: balance; }
html[dir="rtl"] .row-text strong { line-height: 1.6; }
.row-text small { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; margin-top: .3rem; font: .8125rem var(--ui); color: var(--muted); }
.row-state { color: var(--rubric); font-weight: 600; }
.row .i { color: var(--muted); }
.row:hover strong { text-decoration: underline; text-decoration-thickness: 1px; }
.demo-note { margin-top: 1rem; }
.results a { display: block; padding: 1.1rem 0; text-decoration: none; }
.results small { display: block; font: .8125rem var(--ui); color: var(--muted); }
.results strong { display: block; font-weight: 600; font-size: 1.15rem; margin: .15rem 0 .3rem; }
.results .excerpt { display: block; color: var(--muted); }
.results a:hover strong { text-decoration: underline; }
mark { background: color-mix(in srgb, var(--rubric) 20%, transparent); color: var(--ink); padding: 0 .1em; }

/* Study page head */
.head { max-width: var(--page); margin: 0 auto; padding: clamp(1rem, 4vw, 2.5rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem); padding-inline-start: calc(var(--gutter) + var(--indent)); }
.kicker, .byline { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; margin: 0; font: .9375rem var(--ui); color: var(--muted); }
.kicker span:first-child { color: var(--rubric); font-weight: 600; }
.head h1 { margin: .35rem 0 .7rem; max-width: 22ch; font-weight: 400; font-size: clamp(2.1rem, 1.2rem + 4vw, 3.6rem); line-height: 1.08; letter-spacing: -.015em; text-wrap: balance; }
html[dir="rtl"] .head h1 { letter-spacing: 0; line-height: 1.45; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.about { margin-top: 1.1rem; font: .875rem var(--ui); color: var(--muted); max-width: 40rem; }
.about summary { cursor: pointer; width: fit-content; padding-block: .4rem; }
.about p { margin: .5rem 0; }

/* Study layout */
.study { max-width: var(--page); margin: 0 auto; border-top: 1px solid var(--line); }
.reading { padding: 2rem var(--gutter) 0; min-width: 0; }
.rail { padding: 1.5rem var(--gutter) 0; }
.rail h2, .sheet-head h2 { margin: 0; font: 600 .875rem var(--ui); }
.rail nav { margin-top: .6rem; }
.rail nav a, .sheet-toc a { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: baseline; padding: .5rem .75rem; border-inline-start: 2px solid var(--line); font: .875rem/1.35 var(--ui); color: var(--muted); text-decoration: none; }
.rail nav a.toc-3, .sheet-toc a.toc-3 { padding-inline-start: 1.6rem; }
.rail nav a bdi, .sheet-toc a bdi { font-size: .75rem; font-variant-numeric: tabular-nums; }
.rail nav a:hover, .sheet-toc a:hover { color: var(--ink); }
.rail nav a[aria-current], .sheet-toc a[aria-current] { border-color: var(--rubric); color: var(--ink); font-weight: 600; }
.rail nav a[data-playing] bdi, .sheet-toc a[data-playing] bdi { color: var(--rubric); font-weight: 700; }
.rail nav a[data-playing] bdi::before, .sheet-toc a[data-playing] bdi::before { content: "▶ "; font-size: .6em; vertical-align: .15em; }
.enhanced .rail { display: none; }

.stage { background: #000; }
.video-frame { aspect-ratio: 16 / 9; max-height: 40dvh; margin: 0 auto; background: #000; }
.video-frame video { display: block; width: 100%; height: 100%; }
#rumble-player { width: 100%; height: 100%; }
.rumble-link { position: relative; display: grid; place-items: center; width: 100%; height: 100%; color: #fff; font: 600 .9375rem var(--ui); text-decoration: none; }
.rumble-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.rumble-link span { position: relative; display: grid; gap: .3rem; max-width: min(30rem, calc(100% - 2rem)); padding: .6rem 1rem; border-radius: 6px; background: rgb(0 0 0 / .6); text-align: center; }
.rumble-link small { font-weight: 400; font-size: .8125rem; opacity: .85; }
video::cue { font-size: clamp(12px, 3.4vw, 22px); }
#stage-extra { background: var(--paper); }
.stage-status { display: none; }
.media-error { padding: .75rem var(--gutter); font: .875rem var(--ui); color: var(--rubric); }
.media-error button, .media-error a { text-decoration: underline; color: var(--ink); }
.enhanced .stage { display: none; position: sticky; top: 0; z-index: 10; }
.enhanced .video-open .stage { display: block; }

@media (min-width: 1000px) {
  .study { display: grid; grid-template-columns: minmax(0, 46rem) minmax(18rem, 28rem); grid-template-areas: "reading stage"; justify-content: space-between; padding-inline: var(--gutter); }
  .reading { grid-area: reading; padding: 2.5rem 0 0; padding-inline-start: 5.5rem; }
  .stage, .enhanced .stage { grid-area: stage; display: block; position: sticky; top: 1.5rem; z-index: 1; align-self: start; margin-block: 2.5rem 0; margin-inline-start: 3rem; background: none; }
  .video-frame { max-height: none; border-radius: 4px; overflow: hidden; }
  video::cue { font-size: 14px; }
  .enhanced .stage-status { display: block; width: 100%; padding: .7rem 0; text-align: start; font: .8125rem var(--ui); color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .25em; }
  .stage-status:hover { color: var(--ink); }
  .media-error { padding-inline: 0; }
  .rail { display: none; }
}
@media (min-width: 1340px) {
  .study { grid-template-columns: 15rem minmax(0, 46rem) minmax(18rem, 28rem); grid-template-areas: "rail reading stage"; }
  .rail, .enhanced .rail { grid-area: rail; display: block; position: sticky; top: 1.5rem; align-self: start; max-height: calc(100dvh - 7rem); overflow-y: auto; padding: 0; margin-top: 2.5rem; overscroll-behavior: contain; }
}
video:fullscreen::cue { font-size: 2.6vw; }

/* The transcript */
.transcript { max-width: 40.5rem; font-size: calc(var(--read) * var(--reader-scale)); line-height: var(--leading); text-wrap: pretty; overflow-wrap: break-word; }
.transcript p { margin: 0 0 1.1em; }
.sec-head { position: relative; margin: 3em 0 .8em; }
.transcript > .sec-head:first-child { margin-top: 0; }
.sec-head h2, .sec-head h3 { margin: 0; font-weight: 700; line-height: 1.22; text-wrap: balance; scroll-margin-top: 2rem; }
.sec-head h2 { font-size: 1.42em; letter-spacing: -.005em; }
.sec-head h3 { font-size: 1.16em; }
.sec-head :is(h2, h3):focus { outline: 0; }
html[dir="rtl"] .sec-head :is(h2, h3) { line-height: 1.6; letter-spacing: 0; }
.mark { display: flex; align-items: center; gap: .25rem; margin-bottom: .1rem; margin-inline-start: -.45rem; font-family: var(--latin-ui); }
.tc { display: inline-flex; align-items: center; gap: .3rem; min-height: 2.25rem; padding: 0 .55rem 0 .45rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--rubric); }
.tc:hover { background: color-mix(in srgb, var(--rubric) 12%, transparent); }
.tc[data-playing] { background: var(--rubric); color: var(--paper); }
.ln { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--muted); }
.ln:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
@media (min-width: 1000px) {
  /* Time marks hang in the margin beside their heading. */
  .mark { position: absolute; inset-inline-end: 100%; top: -.25rem; flex-direction: column; align-items: flex-end; gap: 0; margin: 0; margin-inline-end: .9rem; }
}
.transcript blockquote { margin: 1.5em 0; padding-inline-start: 1.1em; border-inline-start: 2px solid var(--gold); }
.transcript blockquote p { margin: 0; }
.transcript span[lang="ar"] { font-size: 1.36em; line-height: 1.85; unicode-bidi: isolate; }
html[dir="rtl"] .transcript span[lang="ar"] { font-size: 1.08em; line-height: inherit; }
.honorific { font-family: var(--arabic); line-height: 0; }

/* Follow-along: the phrase being spoken. Literal colours, because custom
   properties are not reliably available inside ::highlight(). */
::highlight(now) { background-color: rgb(156 42 31 / .15); }
:root[data-theme="dark"] ::highlight(now) { background-color: rgb(234 143 130 / .26); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) ::highlight(now) { background-color: rgb(234 143 130 / .26); } }
.transcript p.now { box-shadow: -.75rem 0 0 -.6rem var(--rubric); }
html[dir="rtl"] .transcript p.now { box-shadow: .75rem 0 0 -.6rem var(--rubric); }

/* The matn: a page from the book, with running head and its own margin */
.book-excerpt { margin: 2.6em calc(-1 * var(--gutter)); padding: 0 var(--gutter) 1rem; background: var(--vellum); }
.book-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; padding-block: .9rem .8rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); font: .8125rem var(--ui); color: var(--muted); }
.book-head cite { font: italic 1.0625rem var(--serif); color: var(--ink); }
html[dir="rtl"] .book-head cite { font-style: normal; font-weight: 600; }
.book-page { margin-inline-start: auto; color: var(--ink); font-weight: 600; font-variant-numeric: oldstyle-nums; }
.book-excerpt .sec-head { margin-top: 1.5em; }
.book-foot { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-top: 1.6em; padding-top: .8rem; border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); font: .875rem var(--ui); }
.book-foot > * { min-height: 2rem; display: inline-flex; align-items: center; }
@media (min-width: 1000px) {
  .book-excerpt { margin-inline: -5.5rem -1.75rem; padding-inline: 5.5rem 1.75rem; border-radius: 3px; }
}

/* End of the Halaqa */
.reading-end { max-width: 40.5rem; margin-top: 4rem; }
.end-note { margin: 0 0 1rem; font: .9375rem var(--ui); color: var(--muted); }
.adjacent .start + .start { border-top: 0; }
.adjacent .prev small { color: var(--muted); }
.adjacent .prev strong span { font-size: 1.15rem; }
.end-tools { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; margin-top: 1.5rem; font: .875rem var(--ui); }
.end-tools > * { min-height: 2.5rem; display: inline-flex; align-items: center; }
.saved-note { margin: .3rem 0 0; font: .8125rem var(--ui); color: var(--muted); }

/* Console: one place for playback, position, contents and settings */
.console { display: none; position: fixed; inset: auto 0 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); font-family: var(--ui); }
.enhanced .console { display: block; }
.seek { position: relative; height: 0; }
#seek { position: absolute; inset-inline: 0; top: -11px; width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; --played: 0%; }
#seek::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(to right, var(--rubric) var(--played), var(--line) var(--played)); }
#seek::-moz-range-track { height: 3px; background: linear-gradient(to right, var(--rubric) var(--played), var(--line) var(--played)); }
html[dir="rtl"] #seek::-webkit-slider-runnable-track { background: linear-gradient(to left, var(--rubric) var(--played), var(--line) var(--played)); }
html[dir="rtl"] #seek::-moz-range-track { background: linear-gradient(to left, var(--rubric) var(--played), var(--line) var(--played)); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: var(--rubric); border: 2px solid var(--surface); }
#seek::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--rubric); border: 2px solid var(--surface); }
#seek:focus-visible { outline-offset: -4px; }
.ticks i { position: absolute; top: 3px; width: 1px; height: 4px; background: var(--muted); opacity: .6; }
.console-row { display: flex; align-items: center; gap: .15rem; max-width: var(--page); margin: 0 auto; padding: .55rem calc(var(--gutter) - .4rem) .4rem; }
.console .play { background: var(--ink); color: var(--paper); }
.console .play:hover { background: var(--ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 25%, transparent); }
body[data-playing] .i-play, body:not([data-playing]) .i-pause { display: none; }
.back10 { display: none; }
.console .time { min-width: 3.4rem; min-height: 2.75rem; padding: 0 .4rem; font-size: .875rem; font-variant-numeric: tabular-nums; font-family: var(--latin-ui); border-radius: 6px; }
.console .time:disabled { opacity: 1; color: var(--muted); }
.console .time:not(:disabled) { color: var(--rubric); font-weight: 600; }
.where { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; padding: 0 .5rem; text-align: start; border-radius: 6px; }
.where:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.where .i { color: var(--muted); }
.where > span { min-width: 0; }
.where small { display: block; font-size: .6875rem; line-height: 1.2; color: var(--muted); }
.current-section { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 600; line-height: 1.35; }
.video-toggle[aria-pressed="true"] { color: var(--rubric); }
@media (min-width: 600px) { .back10 { display: grid; } }
@media (min-width: 1000px) { .video-toggle { display: none; } }

/* Sheets: contents and settings */
dialog.sheet { width: 100%; max-width: 30rem; max-height: min(85dvh, 46rem); margin: auto auto 0; padding: 0 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); border: 0; border-radius: 14px 14px 0 0; background: var(--surface); color: var(--ink); font-family: var(--ui); overscroll-behavior: contain; box-shadow: 0 -8px 40px rgb(0 0 0 / .18); }
dialog.sheet::backdrop { background: rgb(12 16 14 / .4); }
dialog.sheet[open] { animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { transform: translateY(1.5rem); opacity: 0; } }
@media (min-width: 700px) {
  dialog.sheet { margin-bottom: 5.5rem; border-radius: 12px; padding-bottom: 1.25rem; }
  #settings-dialog { margin-inline: auto 1.5rem; }
}
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding-block: .6rem .4rem; margin-inline-end: -.6rem; background: var(--surface); }
.sheet-head h2 { font-size: 1rem; }
.seg { border: 0; padding: 0; margin: 1.1rem 0 0; min-width: 0; }
.seg legend, .seg-legend { display: block; padding: 0; margin-bottom: .45rem; font-size: .8125rem; color: var(--muted); }
.seg-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg label span, .sizes button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem; min-width: 3rem; padding: 0 .9rem; border: 1px solid var(--line); border-radius: 6px; font-size: .9375rem; }
.seg label[lang="ar"] span { font-size: 1.15rem; }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.sizes button { font-family: var(--latin-serif); min-width: 4rem; }
.a-small { font-size: .9rem; }
.a-large { font-size: 1.4rem; }
.sheet-tools { display: grid; margin-top: 1.4rem; border-top: 1px solid var(--line); }
.sheet-tools > * { display: flex; align-items: center; gap: .5rem; min-height: 2.9rem; border-bottom: 1px solid var(--line); font-size: .9375rem; text-align: start; text-decoration: none; }
.sheet-tools > *:hover { text-decoration: underline; }
.sheet-tools bdi { color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet-toc { margin-top: .3rem; }
#copy-dialog { padding-top: 1.25rem; }
#copy-dialog h2 { margin: 0 0 .5rem; font-size: 1rem; }
#copy-dialog label { display: block; font-size: .875rem; color: var(--muted); }
#copy-dialog textarea { width: 100%; margin: .5rem 0 1rem; padding: .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: .875rem var(--latin-ui); }

@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

@media print {
  :root { --paper: #fff; --ink: #000; --muted: #333; --vellum: #fff; --line: #999; --rubric: #000; }
  body[data-page="article"] { padding: 0; }
  :root, :root[data-theme] { color-scheme: light; }
  ::highlight(now) { background-color: transparent; }
  .transcript p.now { box-shadow: none; }
  .top, .actions, .about summary, .rail, .stage, .console, dialog, .toast, .mark, .book-foot, .end-note, .adjacent, .end-tools, .saved-note, .skip-link { display: none !important; }
  .about > div { display: block; }
  .study { display: block; border: 0; }
  .head, .reading { padding: 0; }
  .transcript { max-width: none; font-size: 11.5pt; }
  .book-excerpt { margin-inline: 0; padding: 0 1rem .5rem; border: 1px solid #000; break-inside: auto; }
  .sec-head { break-after: avoid; }
  .transcript blockquote { break-inside: avoid; }
}
