/* Hanafi Biographical Atlas. A reference site: quiet page, colour reserved for the two genres. */
:root {
  --bg: #f5f7f5; --surface: #ffffff; --ink: #17212b; --ink2: #47535f; --muted: #6f7b86; --rule: #d7dde1;
  --land: #e2e8e4; --band: #eceff0; --accent: #0d5c66; --m: #2a78d6; --t: #eb6834; --shadow: rgba(16, 28, 38, .16);
  --serif: "Gentium Book Plus", "Gentium Plus", "Charis SIL", "Noto Serif", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151b; --surface: #17202a; --ink: #e8edf1; --ink2: #b4bfc9; --muted: #8b98a5; --rule: #2a3642;
    --land: #1c2832; --band: #141c24; --accent: #62c3cb; --m: #3987e5; --t: #e0703f; --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151b; --surface: #17202a; --ink: #e8edf1; --ink2: #b4bfc9; --muted: #8b98a5; --rule: #2a3642;
  --land: #1c2832; --band: #141c24; --accent: #62c3cb; --m: #3987e5; --t: #e0703f; --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.5; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
main.wrap { padding-block: 30px 72px; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar { font-family: var(--arabic); direction: rtl; unicode-bidi: isolate; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem .8rem; z-index: 50; font-family: var(--sans); }
.skip:focus { left: 8px; top: 8px; }

/* site header and footer */
header.site { border-bottom: 1px solid var(--rule); background: var(--surface); }
header.site .bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1.6rem; padding-block: .8rem; }
.brand { font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none; }
header.site nav { display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; font-family: var(--sans); font-size: .9rem; }
header.site nav a { text-decoration: none; font-weight: 500; color: var(--ink2); padding-block: .15rem; border-bottom: 2px solid transparent; }
header.site nav a:hover { color: var(--ink); }
header.site nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
footer.site { border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .82rem; color: var(--ink2); }
footer.site .wrap { padding-block: 1.4rem 2.2rem; display: grid; gap: .4rem; }
footer.site p { margin: 0; max-width: 60em; }

/* type */
.kicker { font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.08; margin: 0 0 .6rem; font-weight: 700; text-wrap: balance; }
.lede { font-size: 1.14rem; color: var(--ink2); max-width: 44em; margin: 0 0 1.1rem; }
.stats { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; font-family: var(--sans); font-size: .86rem; color: var(--ink2); margin: 0; padding: 0; list-style: none; }
.stats b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
section { margin-top: 2.6rem; }
h2 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .3rem; text-wrap: balance; }
.sub { color: var(--ink2); margin: 0 0 1rem; max-width: 46em; }
.prose { max-width: 42em; }
.prose p { margin: 0 0 .9rem; }
.prose h2 { margin-top: 2rem; }
.prose h3 { font-size: 1.1rem; margin: 1.3rem 0 .25rem; }
.prose dt { font-weight: 700; } .prose dd { margin: 0 0 .6rem; color: var(--ink2); }
.prose ul { padding-left: 1.2rem; }

.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-family: var(--sans); font-size: .8rem; color: var(--ink2); align-items: center; }
.sw { display: inline-block; width: .72rem; height: .72rem; border-radius: 50%; margin-right: .38rem; vertical-align: -.06rem; }
.sw.m { background: var(--m); } .sw.t { background: var(--t); }
.sw.lost { background: transparent; border: 2px solid var(--ink2); }
.sw.m.lost { border-color: var(--m); } .sw.t.lost { border-color: var(--t); }
.sw.line { width: 1.3rem; height: 0; border-radius: 0; border-top: 2px solid var(--ink2); vertical-align: .22rem; }
.sw.dash { width: 1.3rem; height: 0; border-radius: 0; border-top: 2px dashed var(--ink2); vertical-align: .22rem; }

/* century control and map */
.cents { display: flex; flex-wrap: wrap; gap: .3rem; margin: .9rem 0; align-items: center; }
.cents button { font-family: var(--sans); font-size: .82rem; font-weight: 500; padding: .34rem .62rem; border: 1px solid var(--rule); background: var(--surface); border-radius: 4px; cursor: pointer; font-variant-numeric: tabular-nums; }
.cents button:hover { border-color: var(--ink2); }
.cents button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cents button.gap { color: var(--muted); border-style: dashed; }
.cents button.gap[aria-pressed="true"] { color: var(--bg); }
.cents .play { margin-left: .5rem; border-color: var(--accent); color: var(--accent); }
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.4rem; align-items: start; }
.mapbox { position: relative; background: var(--surface); border: 1px solid var(--rule); min-width: 0; overflow-x: auto; }
.mapbox svg { display: block; width: 100%; min-width: 700px; max-width: none; height: auto; }
.land { fill: var(--land); stroke: var(--rule); stroke-width: .6; }
.sea { fill: var(--surface); }
.city { font-family: var(--sans); font-size: 11.5px; fill: var(--ink2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.dot { cursor: pointer; stroke-width: 1.8; }
.dot.m { fill: var(--m); stroke: var(--m); } .dot.t { fill: var(--t); stroke: var(--t); }
.dot.lost { fill: var(--surface); }
.dot.past { opacity: .38; }
.dot.sel { stroke: var(--ink); stroke-width: 2.6; }
.dot:focus-visible { outline: none; stroke: var(--ink); stroke-width: 3; }
.side { min-width: 0; }
.side h3 { font-size: 1.2rem; margin: 0; line-height: 1.2; }
.side .rng { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: .15rem 0 .6rem; font-variant-numeric: tabular-nums; }
.side p { margin: 0 0 .8rem; color: var(--ink2); }
.wlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.wlist li { border-bottom: 1px solid var(--rule); }
@media (min-width: 861px) { .wlist { max-height: 25.5rem; overflow-y: auto; } }
.wlist button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: .9rem minmax(0, 1fr); gap: .5rem; width: 100%; padding: .42rem 0; cursor: pointer; }
.wlist button:hover .wa, .wlist button:focus-visible .wa { text-decoration: underline; }
.wlist button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wlist .sw { margin: .42rem 0 0; }
.wa { font-weight: 700; } .wt { font-style: italic; }
.wm { display: block; font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.unplaced { font-family: var(--sans); font-size: .8rem; color: var(--ink2); margin: .7rem 0 0; }
.regbars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: .28rem .6rem; font-family: var(--sans); font-size: .82rem; align-items: center; margin: 0; }
.regbars i { display: block; height: .56rem; background: var(--ink2); border-radius: 0 2px 2px 0; min-width: 2px; }
.regbars span:last-child { font-variant-numeric: tabular-nums; color: var(--ink2); }

/* tables */
.tablewrap { overflow-x: auto; }
table.plain { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .88rem; }
table.plain th, table.plain td { text-align: left; padding: .5rem .8rem .5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.plain thead th { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--ink); }
table.plain td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.plain td.txt { font-family: var(--serif); font-size: 1rem; color: var(--ink2); min-width: 16rem; }
table.plain tr.none td { color: var(--muted); }
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem; }
.ways h3 { margin: 0 0 .2rem; font-size: 1.15rem; }
.ways p { margin: 0; color: var(--ink2); }
.ways > div { border-top: 2px solid var(--ink); padding-top: .7rem; }

/* network */
.netscroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); position: relative; }
.netscroll svg { display: block; min-width: 1040px; width: 100%; max-width: none; height: auto; }
.nettools { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; margin: .8rem 0; }
.nettools label { font-family: var(--sans); font-size: .84rem; display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; }
.lane { fill: var(--band); } .lanelab { font-family: var(--sans); font-size: 11.5px; fill: var(--ink2); }
.gapband { fill: var(--rule); opacity: .55; }
.axis { font-family: var(--sans); font-size: 10.5px; fill: var(--muted); }
.grid { stroke: var(--rule); stroke-width: 1; }
.edge { fill: none; stroke: var(--ink2); stroke-width: 1; opacity: .3; }
.edge.abr, .edge.sup { stroke-width: 1.8; }
.edge.tch, .edge.fam { stroke-dasharray: 3 3; }
.edge.dim { opacity: .06; }
.edge.hot { opacity: 1; stroke: var(--ink); stroke-width: 1.8; }
.node { cursor: pointer; stroke-width: 2; }
.node.m { fill: var(--m); stroke: var(--m); } .node.t { fill: var(--t); stroke: var(--t); }
.node.lost { fill: var(--surface); }
.node.dim { opacity: .18; }
.node.sel { stroke: var(--ink); stroke-width: 3; }
.node:focus-visible { outline: none; stroke: var(--ink); stroke-width: 3; }
.nlab { font-family: var(--serif); font-size: 12px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.hint { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); font-family: var(--sans); font-size: .78rem; line-height: 1.3; padding: .35rem .55rem; border-radius: 3px; max-width: 16rem; transform: translate(-50%, calc(-100% - 10px)); }
.tip i { font-family: var(--serif); font-size: .9rem; }

/* catalogue */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 .4rem; font-family: var(--sans); font-size: .88rem; }
.filters input, .filters select { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .42rem .55rem; min-width: 0; }
.filters input { flex: 1 1 15rem; }
.count { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: 0 0 .5rem; }
.cat { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.cat li { border-bottom: 1px solid var(--rule); }
.cat a, .cat .headrow { display: grid; grid-template-columns: 5.8rem minmax(0, 1.2fr) minmax(0, 1.3fr) 5.4rem minmax(0, .8fr) 9.2rem; gap: .2rem 1rem; padding: .5rem .2rem; align-items: baseline; color: inherit; text-decoration: none; }
.cat a:hover { background: var(--band); }
.cat a:hover .ti { text-decoration: underline; }
.cat a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cat .y { font-family: var(--sans); font-size: .84rem; color: var(--ink2); font-variant-numeric: tabular-nums; }
.cat .a { font-weight: 700; } .cat .ti { font-style: italic; }
.cat .ar { display: block; font-size: 1rem; font-weight: 400; font-style: normal; color: var(--muted); text-align: left; }
.cat .k, .cat .r, .cat .s { font-family: var(--sans); font-size: .82rem; color: var(--ink2); }
.cat .headrow span { font-family: var(--sans); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.st { display: inline-flex; align-items: center; gap: .35rem; }
.st::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; border: 2px solid var(--ink2); background: var(--ink2); flex: none; }
.st.ms::before, .st.partly::before { background: linear-gradient(90deg, var(--ink2) 50%, transparent 50%); }
.st.lost::before { background: transparent; }
.empty { font-family: var(--sans); color: var(--ink2); padding: 1rem 0; }

/* shared facts list (drawer and work page) */
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem .9rem; margin: 0 0 .9rem; padding-block: .7rem; border-block: 1px solid var(--rule); font-family: var(--sans); font-size: .86rem; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }
.doubt { font-family: var(--sans); font-size: .86rem; border: 1px dashed var(--ink2); padding: .5rem .7rem; margin: 0 0 .9rem; }
.doubt b { font-weight: 600; }
.rel { list-style: none; margin: 0; padding: 0; }
.rel li { padding: .22rem 0; }
.rel button { all: unset; cursor: pointer; color: var(--accent); }
.rel button:hover, .rel button:focus-visible { text-decoration: underline; }
.rel small { display: block; font-family: var(--sans); font-size: .78rem; color: var(--muted); }
h4.lab, .lab { font-family: var(--sans); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .3rem; font-weight: 600; }

/* drawer */
.card { position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; width: min(430px, 100%); background: var(--surface); border-left: 1px solid var(--rule); box-shadow: -12px 0 32px var(--shadow); overflow-y: auto; padding: 1.1rem 1.3rem 1.6rem; }
.card .close { position: sticky; top: 0; float: right; font-family: var(--sans); font-size: .82rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .3rem .6rem; cursor: pointer; }
.card .ck { font-family: var(--sans); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: .2rem 0 .5rem; }
.card h3 { font-size: 1.5rem; line-height: 1.15; margin: 0; font-style: italic; font-weight: 400; text-wrap: balance; }
.card .tar { font-size: 1.5rem; line-height: 1.5; margin: .1rem 0 .5rem; text-align: right; }
.card .auth { font-size: 1.1rem; font-weight: 700; margin: 0; }
.card .full { color: var(--ink2); margin: 0 0 .9rem; font-size: .98rem; }
.card .note { margin: 0 0 1rem; }
.card .more { display: inline-block; font-family: var(--sans); font-size: .88rem; font-weight: 500; margin: 0 0 .4rem; }

/* work page */
.crumbs { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin: 0 0 1.2rem; }
.crumbs a { color: var(--ink2); }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2.6rem; align-items: start; }
.work h1 { font-style: italic; font-weight: 400; font-size: clamp(1.9rem, 4.6vw, 2.7rem); margin-bottom: .1rem; }
.work .tar { font-size: 1.9rem; line-height: 1.5; margin: 0 0 .6rem; text-align: left; }
.work .auth { font-size: 1.25rem; font-weight: 700; margin: 0; }
.work .full { color: var(--ink2); margin: 0 0 1.2rem; }
.work .note { font-size: 1.12rem; max-width: 38em; margin: 0 0 1.4rem; }
.work .rel a { color: var(--accent); text-decoration: none; }
.work .rel a:hover { text-decoration: underline; }
.work aside { min-width: 0; }
.strip { display: block; width: 100%; height: auto; margin: .3rem 0 1.2rem; }
.strip .ax { stroke: var(--ink2); stroke-width: 1; } .strip .tk { stroke: var(--rule); stroke-width: 1; }
.strip text { font-family: var(--sans); font-size: 10px; fill: var(--muted); }
.strip .gapband { opacity: .7; }
.strip .mk.m { fill: var(--m); stroke: var(--m); } .strip .mk.t { fill: var(--t); stroke: var(--t); }
.strip .mk { stroke-width: 2; } .strip .mk.lost { fill: var(--surface); }
.cite { font-family: var(--sans); font-size: .86rem; color: var(--ink2); background: var(--band); padding: .7rem .9rem; margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.6rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .88rem; }
.pager a { text-decoration: none; max-width: 48%; }
.pager a:hover { text-decoration: underline; }
.pager small { display: block; color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.dl { font-family: var(--sans); font-size: .9rem; }

@media (max-width: 860px) {
  .mapgrid, .work { grid-template-columns: minmax(0, 1fr); }
  .ways { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cat a { grid-template-columns: 4.6rem minmax(0, 1fr); }
  .cat .ti { grid-column: 2; } .cat .k { grid-column: 1; grid-row: 2; } .cat .r { grid-column: 2; } .cat .s { grid-column: 2; }
  .cat li.headrowli { display: none; }
  .card { top: auto; left: 0; width: 100%; max-height: 82%; border-left: 0; border-top: 1px solid var(--rule); box-shadow: 0 -12px 32px var(--shadow); }
  .pager a { max-width: 100%; }
}
@media (min-width: 1100px) { body.cardopen { padding-right: 430px; } }
@media (prefers-reduced-motion: no-preference) { .dot, .node, .edge { transition: opacity .25s; } }
@media print { header.site nav, .card, .filters, .cents, .pager { display: none !important; } body { background: #fff; } }

.reading{max-width:850px;margin:0 auto;padding-bottom:3rem}.reading nav{display:flex;gap:1rem;flex-wrap:wrap}.bio-entry{border-top:1px solid var(--line);padding:2rem 0;margin-top:2rem;scroll-margin-top:2rem}.bio-text{font-size:1.5rem;line-height:2.1;text-align:right}.bio-entry h3{font-size:1rem;margin-top:1.5rem}.bio-entry summary{cursor:pointer;padding:1rem 0}.bio-entry details{margin-top:1rem}

.explore-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:1.25rem;margin:2rem 0}.explore-card,.source-box{display:block;padding:1.5rem;border:1px solid var(--ink2);border-radius:4px}.explore-card{text-decoration:none;color:var(--ink)}.explore-card:hover{background:var(--paper2,#ecefe9)}.explore-card h2{font-size:1.6rem}.source-box{margin:1.5rem 0}.reading h2{margin-top:2rem}.site nav{flex-wrap:wrap}
