/* Library of Dr. Mohammed Al-Jameel — site styles
   Palette: paper, ink navy, manuscript gold, four theme colours (one per research axis). */
:root{
  --paper:#F5F0E6; --paper-2:#FFFDF8; --paper-3:#EDE4D1; --rule:#DED2BA; --rule-2:#CFC2A6;
  --ink:#13233A; --text:#1E1A14; --text-2:#3A332A; --muted:#5B5346; --muted-2:#776A52;
  --gold:#8A5F17; --gold-light:#D9B26A; --on-dark:#F5F0E6; --on-dark-2:#E3D9C3;
  --t-sira:#1F3A5F; --t-yahud:#5A2E2A; --t-madi:#2F4A3A; --t-hadara:#4A3B5C;
  --solid:#13233A; --on-solid:#F5F0E6; --band:#13233A; --mark:#F1DFA9; --ok:#2F6B45; --err:#A3342B;
  --display:'Amiri',serif; --ui:'IBM Plex Sans Arabic',system-ui,sans-serif;
  --wrap:1200px; --r:4px;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --paper:#13171E; --paper-2:#1A1F28; --paper-3:#222935; --rule:#2E3644; --rule-2:#3A4454;
  --ink:#EFE5CF; --text:#E6DECD; --text-2:#CFC6B4; --muted:#ABA290; --muted-2:#9A9180;
  --gold:#D9B26A; --solid:#D9B26A; --on-solid:#13233A; --band:#0D1826; --mark:#6B5524; --ok:#7FC79A; --err:#F09A8F; color-scheme:dark}}
:root[data-theme="dark"]{
  --paper:#13171E; --paper-2:#1A1F28; --paper-3:#222935; --rule:#2E3644; --rule-2:#3A4454;
  --ink:#EFE5CF; --text:#E6DECD; --text-2:#CFC6B4; --muted:#ABA290; --muted-2:#9A9180;
  --gold:#D9B26A; --solid:#D9B26A; --on-solid:#13233A; --band:#0D1826; --mark:#6B5524; --ok:#7FC79A; --err:#F09A8F; color-scheme:dark}
[hidden]{display:none!important}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--text);font-family:var(--ui);font-size:17px;line-height:1.85}
img{max-width:100%;display:block}
a{color:var(--ink);text-decoration-thickness:1px;text-underline-offset:4px}
a:hover{color:var(--gold)}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px;border-radius:2px}
.wrap{max-width:var(--wrap);margin:0 auto;padding-inline:max(20px,env(safe-area-inset-left,0px)) max(20px,env(safe-area-inset-right,0px))}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
h1,h2,h3{font-family:var(--display);color:var(--ink);font-weight:700;line-height:1.35;margin:0}
p{margin:0}
button{font:inherit;cursor:pointer}

/* Header */
.site-head{border-bottom:1px solid var(--rule);background:var(--paper)}
.site-head .wrap{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 24px;padding-top:14px;padding-bottom:14px}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none}
.brand-mark{width:44px;height:44px;flex:none}
.brand-name{font-family:var(--display);font-size:21px;font-weight:700;color:var(--ink);line-height:1.2}
.brand-sub{display:block;font-family:var(--ui);font-size:12px;font-weight:400;color:var(--muted)}
.nav{display:flex;flex-wrap:wrap;gap:2px;font-size:15px;font-weight:500}
.nav a{padding:10px 14px;border-radius:var(--r);text-decoration:none;color:var(--text-2)}
.nav a[aria-current=page]{background:var(--solid);color:var(--on-solid)}
.nav a:hover{background:var(--paper-3);color:var(--ink)}
.nav a[aria-current=page]:hover{background:var(--solid);color:var(--on-solid)}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 22px;border-radius:var(--r);border:1px solid var(--solid);background:var(--solid);color:var(--on-solid);font-weight:600;font-size:16px;text-decoration:none;white-space:nowrap}
.btn:hover{filter:brightness(1.12);color:var(--on-solid)}
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--rule-2)}
.btn.ghost:hover{background:var(--paper-3);color:var(--ink);filter:none}
.btn.gold{background:var(--gold-light);border-color:var(--gold-light);color:#13233A}
.btn.light{background:transparent;border-color:rgba(245,240,230,.55);color:var(--on-dark)}
.btn svg{width:18px;height:18px;flex:none}
.link{font-weight:600;text-decoration:none}
.link:hover{text-decoration:underline}

/* Hero */
.hero{padding:64px 0 56px}
.hero .wrap{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:56px;align-items:center}
.hero-role{font-size:15px;font-weight:600;color:var(--gold)}
.hero h1{font-size:clamp(40px,6vw,66px);line-height:1.2;margin:14px 0 18px}
.hero-lead{font-size:19px;color:var(--text-2);max-width:36em}
.search{display:flex;gap:8px;margin-top:28px;max-width:640px}
.search input{flex:1;min-width:0;height:56px;padding:0 18px;border:1px solid var(--rule-2);border-radius:var(--r);background:var(--paper-2);font:inherit;font-size:16px;color:var(--text)}
.search input::placeholder{color:#7A705F}
.chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:14px;font-size:14px}
.chips span{color:var(--muted)}
.chip{padding:7px 14px;border:1px solid var(--rule);border-radius:999px;background:var(--paper-2);color:var(--text-2);text-decoration:none}
.chip:hover{border-color:var(--ink);color:var(--ink)}
.portrait{margin:0}
.portrait img{width:100%;aspect-ratio:4/5;object-fit:cover;border-radius:var(--r);background:var(--paper-3);filter:saturate(.9)}
.portrait figcaption{font-size:14px;color:var(--muted);margin-top:10px;line-height:1.7}

/* Facts */
.facts{background:var(--paper-2);border-block:1px solid var(--rule)}
.facts dl{margin:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px;padding:28px 0}
.facts dt{font-size:14px;color:var(--muted);order:2}
.facts dd{margin:0;font-family:var(--display);font-size:36px;font-weight:700;color:var(--ink);line-height:1.2}
.facts div{display:flex;flex-direction:column;gap:4px}

/* Sections */
.sec{padding:72px 0}
.sec-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:12px 24px;margin-bottom:32px}
.sec-head h2{font-size:38px}
.sec-head p{color:var(--muted);margin-top:6px}
.band{background:var(--band);color:var(--on-dark)}
.band h2,.band h1{color:var(--on-dark)}
.sand{background:var(--paper-3)}

/* Feature */
.feature .wrap{display:grid;grid-template-columns:280px minmax(0,1fr);gap:56px;align-items:center}
.feature-kicker{font-size:15px;font-weight:600;color:var(--gold-light)}
.feature h2{font-size:44px;margin:10px 0 14px}
.feature p{color:var(--on-dark-2);font-size:18px;max-width:38em}
.feature .meta{font-size:15px;color:#C9BEA6;margin-top:12px}
.feature .actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}

/* Typographic cover */
.cover{position:relative;aspect-ratio:2/3;border-radius:3px;padding:20px 18px;display:flex;flex-direction:column;justify-content:space-between;color:var(--on-dark);box-shadow:0 18px 30px -18px rgba(19,35,58,.6);overflow:hidden;text-align:center}
.cover::before{content:"";position:absolute;inset:8px;border:1px solid rgba(217,178,106,.55);border-radius:2px;pointer-events:none}
.cover .c-top{font-size:12px;color:var(--gold-light);display:flex;justify-content:space-between;gap:8px}
.cover .c-title{font-family:var(--display);font-weight:700;font-size:22px;line-height:1.45}
.cover .c-star{width:28px;height:28px;margin:0 auto 10px;display:block}
.cover .c-author{font-size:11.5px;color:var(--on-dark-2)}
.cover.lg{padding:30px 26px}.cover.lg .c-title{font-size:30px}.cover.lg .c-star{width:38px;height:38px}
.t-sira{background:var(--t-sira)}.t-yahud{background:var(--t-yahud)}.t-madi{background:var(--t-madi)}.t-hadara{background:var(--t-hadara)}

/* Themes */
.themes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}
.theme{display:flex;flex-direction:column;gap:12px;padding:24px;background:var(--paper-2);border:1px solid var(--rule);border-radius:var(--r);text-decoration:none;color:var(--text)}
.theme:hover{border-color:var(--ink);color:var(--text)}
.theme .swatch{width:40px;height:6px;border-radius:3px}
.theme h3{font-size:24px}
.theme .n{font-size:14px;color:var(--muted)}
.theme ul{margin:0;padding:0;list-style:none;font-size:14px;color:var(--muted);line-height:1.9}

/* Shelf / grid of works */
.shelf{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:40px 28px}
.work{display:flex;flex-direction:column;gap:12px}
.work a.cover{text-decoration:none}
.work h3{font-family:var(--ui);font-size:17px;font-weight:600;line-height:1.6}
.work h3 a{text-decoration:none}
.work h3 a:hover{text-decoration:underline}
.work .sub{font-size:14px;color:var(--muted);line-height:1.7}
.work .pub{font-size:13px;color:var(--muted-2);line-height:1.7}
.work .acts{display:flex;gap:8px;margin-top:auto}
.work .acts .btn{flex:1;min-height:44px;font-size:14px;padding:0 10px}

/* Quote */
.quote{text-align:center;max-width:860px;margin:0 auto}
.quote .star{width:40px;height:40px;margin:0 auto 18px}
.quote blockquote{margin:0;font-family:var(--display);font-size:clamp(24px,3vw,32px);line-height:1.8;color:var(--ink)}
.quote cite{display:block;font-style:normal;color:var(--muted);margin-top:14px;font-size:15px}

/* Timeline */
.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.6fr);gap:56px}
.timeline{margin:0;padding:0;list-style:none}
.timeline li{display:grid;grid-template-columns:120px minmax(0,1fr);gap:20px;padding:16px 0;border-bottom:1px solid var(--rule)}
.timeline .y{font-family:var(--display);font-size:22px;font-weight:700;color:var(--gold)}

/* Footer */
.site-foot{background:var(--band);color:var(--on-dark-2);font-size:15px}
.site-foot .wrap{display:grid;grid-template-columns:2fr 1fr 1fr;gap:40px;padding-top:56px;padding-bottom:40px}
.site-foot a{color:var(--on-dark-2);text-decoration:none}
.site-foot a:hover{color:var(--gold-light)}
.site-foot h2{font-size:22px;color:var(--on-dark);margin-bottom:8px}
.site-foot h3{font-family:var(--ui);font-size:15px;color:var(--on-dark);margin-bottom:8px}
.site-foot ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.foot-base{border-top:1px solid rgba(227,217,195,.18);padding:18px 0 26px;font-size:13px;color:#BFB49C}

/* Page title */
.page-title{padding:44px 0 20px}
.crumbs{font-size:14px;color:var(--muted);margin-bottom:12px}
.crumbs a{color:var(--muted);text-decoration:none}
.crumbs a:hover{color:var(--ink);text-decoration:underline}
.page-title h1{font-size:clamp(38px,5vw,54px)}
.page-title p{color:var(--text-2);font-size:18px;max-width:40em;margin-top:8px}

/* Library controls */
.controls{display:flex;flex-direction:column;gap:16px;padding:8px 0 20px}
.controls .row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.controls input[type=search]{flex:999 1 380px;min-width:0;height:52px;padding:0 16px;border:1px solid var(--rule-2);border-radius:var(--r);background:var(--paper-2);font:inherit;font-size:16px}
.controls select{height:52px;padding:0 12px;border:1px solid var(--rule-2);border-radius:var(--r);background:var(--paper-2);font:inherit;font-size:15px;color:var(--text)}
.controls .lbl{font-size:14px;color:var(--muted);min-width:56px}
.pill{min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--rule);background:var(--paper-2);color:var(--text-2);font-size:14px;display:inline-flex;align-items:center;gap:8px}
.pill[aria-pressed=true]{background:var(--solid);border-color:var(--solid);color:var(--on-solid)}
.pill .dot{width:10px;height:10px;border-radius:2px}
.toggle{display:inline-flex;align-items:center;gap:10px;font-size:15px;color:var(--text-2);min-height:44px}
.toggle input{width:20px;height:20px;accent-color:var(--solid)}
.status{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 0 22px;border-top:1px solid var(--rule);color:var(--muted);font-size:15px}
.empty{padding:56px 20px;text-align:center;background:var(--paper-2);border:1px dashed var(--rule-2);border-radius:var(--r)}
.empty h2{font-size:26px;margin-bottom:6px}

/* Full-text hits */
.hits{display:flex;flex-direction:column;gap:14px;margin-bottom:40px}
.hit{padding:18px 20px;background:var(--paper-2);border:1px solid var(--rule);border-radius:var(--r)}
.hit h3{font-family:var(--ui);font-size:17px;font-weight:600}
.hit h3 a{text-decoration:none}
.hit .snips{margin:8px 0 0;padding:0;list-style:none;font-size:15px;color:var(--text-2)}
.hit .snips li{padding:6px 0;border-top:1px dotted var(--rule)}
.hit .snips a{color:var(--muted-2);font-size:13px;margin-inline-start:8px;white-space:nowrap}
.hit mark{background:var(--mark);color:var(--text);padding:0 2px;border-radius:2px}
.hits-note{font-size:13px;color:var(--muted-2)}

/* Book page */
.book-head{padding:36px 0 56px}
.book-grid{display:grid;grid-template-columns:300px minmax(0,1fr);gap:48px;align-items:start}
.book-covers{display:flex;flex-direction:column;gap:14px}
.book-covers .orig{border-radius:3px;box-shadow:0 12px 24px -14px rgba(19,35,58,.5);border:1px solid var(--rule)}
.book-covers small{font-size:12px;color:var(--muted-2);text-align:center}
.tags{display:flex;flex-wrap:wrap;gap:8px}
.tag{padding:5px 12px;border-radius:999px;font-size:13px;font-weight:600;background:var(--paper-3);color:var(--text-2)}
.book-head h1{font-size:clamp(36px,5vw,54px);margin:14px 0 6px}
.book-head .subtitle{font-family:var(--display);font-size:24px;color:var(--text-2);line-height:1.6}
.facts-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px 20px;margin:22px 0;padding:18px 0;border-block:1px solid var(--rule)}
.facts-list dt{font-size:13px;color:var(--muted)}
.facts-list dd{margin:2px 0 0;font-weight:600;font-size:15px;line-height:1.7}
.book-actions{display:flex;flex-wrap:wrap;gap:10px}
.tabs{border-bottom:1px solid var(--rule);display:flex;flex-wrap:wrap;gap:4px}
.tab{min-height:56px;padding:0 18px;border:0;background:transparent;font-size:16px;font-weight:600;color:var(--muted);border-bottom:3px solid transparent;margin-bottom:-1px}
.tab[aria-selected=true]{color:var(--ink);border-bottom-color:var(--gold)}
.panel{max-width:820px;padding:36px 0 56px}
.panel[hidden]{display:none}
.panel p+p{margin-top:16px}
.panel p{font-size:18px;line-height:2}
.findings{margin:24px 0 0;padding:0 20px 0 0;display:flex;flex-direction:column;gap:10px}
.findings li{line-height:1.9}
.findings li::marker{color:var(--gold)}
.toc{margin:0;padding:0;list-style:none}
.toc li{display:flex;justify-content:space-between;align-items:baseline;gap:16px;border-bottom:1px dotted var(--rule-2)}
.toc li.sub a,.toc li.sub span:first-child{padding-inline-start:22px;font-weight:400;color:var(--text-2)}
.toc a,.toc span{padding:12px 0;text-decoration:none}
.toc a{font-weight:500}
.toc .pg{color:var(--muted-2);font-variant-numeric:tabular-nums}
.note{font-size:14px;color:var(--muted-2);margin-top:16px}
.excerpt{margin:0 0 18px;padding:22px 26px;background:var(--paper-3);border-radius:var(--r)}
.excerpt blockquote{margin:0;font-family:var(--display);font-size:23px;line-height:1.9;color:var(--ink)}
.excerpt figcaption{font-size:14px;color:var(--muted);margin-top:8px}
.excerpt figcaption a{margin-inline-start:6px}
.cite-box{padding:16px 18px;background:var(--paper-3);border-radius:var(--r);font-size:16px;line-height:1.9;margin:6px 0 10px}
.cite-label{font-size:14px;font-weight:600;color:var(--muted);margin-top:16px}

/* Reader */
.reader{border:1px solid var(--rule-2);border-radius:var(--r);overflow:hidden;background:#3B3A37}
.reader-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;background:var(--band);color:var(--on-dark)}
.reader-bar .grp{display:flex;align-items:center;gap:6px}
.rbtn{width:44px;height:44px;border:0;border-radius:var(--r);background:rgba(245,240,230,.12);color:var(--on-dark);display:inline-flex;align-items:center;justify-content:center;font-size:20px}
.rbtn:hover{background:rgba(245,240,230,.22)}
.rbtn svg{width:18px;height:18px}
.reader-bar input[type=number]{width:72px;height:40px;border:0;border-radius:var(--r);background:rgba(245,240,230,.14);color:var(--on-dark);font:inherit;text-align:center}
.reader-stage{min-height:520px;display:flex;justify-content:center;align-items:flex-start;padding:28px 12px;overflow:auto}
.reader-stage canvas{background:#fff;box-shadow:0 10px 30px rgba(0,0,0,.45);max-width:none}
.reader-msg{color:#E9E2D2;padding:80px 20px;text-align:center}
.reader:fullscreen{display:flex;flex-direction:column}
.reader:fullscreen .reader-stage{flex:1}

/* Author */
.bio-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:56px}
.bio-grid h2{font-size:30px;margin:36px 0 14px}
.bio-grid h2:first-child{margin-top:0}
.plain-list{margin:0;padding:0 20px 0 0;display:flex;flex-direction:column;gap:8px}
.video{position:relative;aspect-ratio:16/9;border-radius:var(--r);overflow:hidden;background:#000}
.video button{position:absolute;inset:0;border:0;padding:0;background:#000;color:#fff}
.video img{width:100%;height:100%;object-fit:cover;opacity:.8}
.video .play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}
.video .play span{width:72px;height:72px;border-radius:50%;background:rgba(19,35,58,.85);display:flex;align-items:center;justify-content:center}
.video iframe{position:absolute;inset:0;width:100%;height:100%;border:0}

/* Responsive */
@media (max-width:980px){
  .hero .wrap,.feature .wrap,.split,.bio-grid,.book-grid{grid-template-columns:minmax(0,1fr)}
  .hero .portrait{max-width:320px}
  .feature .wrap>div:first-child,.book-covers{max-width:260px}
  .themes{grid-template-columns:repeat(2,minmax(0,1fr))}
  .facts dl{grid-template-columns:repeat(2,minmax(0,1fr))}
  .site-foot .wrap{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:560px){
  body{font-size:16px}
  .themes{grid-template-columns:minmax(0,1fr)}
  .shelf{grid-template-columns:repeat(2,minmax(0,1fr));gap:28px 16px}
  .cover .c-title{font-size:17px}
  .search{flex-direction:column}
  .search input{flex:none}
  .facts dd{font-size:28px}
  .portrait{max-width:260px}
  .search .btn{width:100%}
  .timeline li{grid-template-columns:minmax(0,1fr);gap:2px}
  .sec{padding:52px 0}
  .sec-head h2{font-size:30px}
  .feature h2{font-size:34px}
}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
@media print{.site-head,.site-foot,.reader,.book-actions,.tabs{display:none}.panel[hidden]{display:block}}
bdi[dir=ltr]{white-space:nowrap;unicode-bidi:isolate}

/* Comments */
.comments>*{max-width:860px}
.c-list{list-style:none;margin:22px 0 32px;padding:0;display:flex;flex-direction:column;gap:14px}
.c-item{padding:18px 20px;background:var(--paper-2);border:1px solid var(--rule);border-radius:var(--r)}
.c-head{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline;font-size:15px}
.c-head span{color:var(--muted-2);font-size:13px}
.c-body{margin-top:6px;white-space:pre-line;line-height:1.9}
.c-reply{margin-top:12px;padding:12px 14px;background:var(--paper-3);border-radius:var(--r);font-size:15px;white-space:pre-line}
.c-empty{color:var(--muted);padding:6px 0}
.c-form{display:flex;flex-direction:column;gap:14px;padding:24px;background:var(--paper-2);border:1px solid var(--rule);border-radius:var(--r)}
.c-form h3{font-size:24px}
.c-row{display:flex;flex-direction:column;gap:6px}
.c-row label{font-size:14px;font-weight:600;color:var(--text-2)}
.c-row input,.c-row textarea{font:inherit;font-size:16px;padding:12px 14px;border:1px solid var(--rule-2);border-radius:var(--r);background:var(--paper);color:var(--text);width:100%}
.c-row textarea{resize:vertical;min-height:120px}
.c-actions{flex-direction:row;flex-wrap:wrap;align-items:center;gap:14px}
.c-msg{font-size:15px;color:var(--muted)}
.c-msg.ok{color:var(--ok)}.c-msg.err{color:var(--err)}
.c-hp{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
