/* أرشيف تراث الشيخ الدكتور محمد خلدون مكي الحسني — visual system
   Palette: deep forest green, warm ivory, charcoal ink, muted brass accent.
   All spacing uses logical properties (RTL-native). */

:root {
  --bg: #f5f0e6;
  --paper: #fbf8f2;
  --paper-2: #f1ebdf;
  --ink: #1c1e1b;
  --ink-2: #3d413b;
  --muted: #6b675c;
  --line: #e2d9c7;
  --line-2: #d3c6ad;
  --green: #123d30;
  --green-2: #1f5a46;
  --green-3: #2f7a5f;
  --green-ink: #f3efe4;
  --brass: #94702c;
  --brass-2: #b58f45;
  --brass-soft: #efe2c2;
  --mark: #f3dd9a;
  --ok: #1f6b4a;
  --warn: #8a5a12;
  --bad: #8b2f2a;
  --info: #2c5a7a;
  --shadow: 0 1px 2px rgba(28, 30, 27, .06), 0 8px 28px rgba(28, 30, 27, .06);
  --shadow-lg: 0 2px 6px rgba(28, 30, 27, .07), 0 22px 60px rgba(18, 61, 48, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --f-display: "Amiri", "Noto Naskh Arabic", serif;
  --f-read: "Noto Naskh Arabic", "Amiri", serif;
  --f-ui: "IBM Plex Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  --read-size: 1.24rem;
  --wrap: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411; --paper: #131b17; --paper-2: #18221d; --ink: #ebe5d6; --ink-2: #cfc8b7; --muted: #9a9484;
    --line: #26332c; --line-2: #33443a; --green: #0b2a21; --green-2: #7cc0a4; --green-3: #9bd3ba; --green-ink: #eae4d4;
    --brass: #c9a861; --brass-2: #d8bb7a; --brass-soft: #2b2a1f; --mark: #5d4b16;
    --ok: #79c39f; --warn: #e0b061; --bad: #e08a80; --info: #8fbbd8;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25); --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 22px 60px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1411; --paper: #131b17; --paper-2: #18221d; --ink: #ebe5d6; --ink-2: #cfc8b7; --muted: #9a9484;
  --line: #26332c; --line-2: #33443a; --green: #0b2a21; --green-2: #7cc0a4; --green-3: #9bd3ba; --green-ink: #eae4d4;
  --brass: #c9a861; --brass-2: #d8bb7a; --brass-soft: #2b2a1f; --mark: #5d4b16;
  --ok: #79c39f; --warn: #e0b061; --bad: #e08a80; --info: #8fbbd8;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25); --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 22px 60px rgba(0,0,0,.35);
  color-scheme: dark;
}

:root {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84' fill='none' stroke='%23e8d6a8' stroke-width='1'%3E%3Crect x='26' y='26' width='32' height='32'/%3E%3Crect x='26' y='26' width='32' height='32' transform='rotate%2845 42 42%29'/%3E%3Ccircle cx='42' cy='42' r='6'/%3E%3Cpath d='M42 0V19.4M42 64.6V84M0 42H19.4M64.6 42H84M0 0L26 26M84 0L58 26M0 84L26 58M84 84L58 58'/%3E%3C/svg%3E");
  --pattern-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84' fill='none' stroke='%23123d30' stroke-width='1'%3E%3Crect x='26' y='26' width='32' height='32'/%3E%3Crect x='26' y='26' width='32' height='32' transform='rotate%2845 42 42%29'/%3E%3Ccircle cx='42' cy='42' r='6'/%3E%3Cpath d='M42 0V19.4M42 64.6V84M0 42H19.4M64.6 42H84M0 0L26 26M84 0L58 26M0 84L26 58M84 84L58 58'/%3E%3C/svg%3E");
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%2394702c' stroke-width='2'%3E%3Crect x='20' y='20' width='60' height='60'/%3E%3Crect x='20' y='20' width='60' height='60' transform='rotate%2845 50 50%29'/%3E%3Ccircle cx='50' cy='50' r='14'/%3E%3C/svg%3E");
  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='22' viewBox='0 0 160 22' fill='none' stroke='%23a8843a' stroke-width='1.2'%3E%3Cpath d='M4 11H58M102 11H156'/%3E%3Crect x='73' y='4' width='14' height='14' transform='rotate%2845 80 11%29'/%3E%3Crect x='75.5' y='6.5' width='9' height='9'/%3E%3Ccircle cx='64' cy='11' r='1.6' fill='%23a8843a'/%3E%3Ccircle cx='96' cy='11' r='1.6' fill='%23a8843a'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-ui); font-size: 1rem; line-height: 1.75;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video, iframe { max-width: 100%; }
svg:not([width]) { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }
a { color: var(--green-2); text-decoration-thickness: 1px; text-underline-offset: 4px; }
:root:not([data-theme="light"]) a { }
a:hover { color: var(--brass); }
::selection { background: var(--mark); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--green); color: var(--green-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand svg { width: 38px; height: 38px; color: var(--brass); }
.brand b { font-family: var(--f-display); font-size: 1.32rem; font-weight: 700; line-height: 1.1; display: block; }
.brand small { display: block; font-size: .74rem; color: var(--muted); letter-spacing: 0; line-height: 1.2; margin-top: 2px; }
.nav { display: flex; gap: 2px; margin-inline-start: auto; align-items: center; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .93rem; padding: 7px 11px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--green-2); background: var(--paper-2); font-weight: 600; }
.tools { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
@media (max-width: 1060px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; }
  .tools { margin-inline-start: auto; }
  .nav.open {
    display: flex; flex-direction: column; align-items: stretch; position: fixed; inset: 68px 0 auto 0;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 16px 18px; box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 68px); overflow: auto;
  }
  .nav.open a { padding: 12px 14px; font-size: 1.02rem; border-bottom: 1px solid var(--line); border-radius: 0; }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .brand b { font-size: 1.12rem; }
  .brand svg { width: 32px; height: 32px; }
  .wrap { padding-inline: 16px; }
}

.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass), var(--green-3)); margin-inline-start: 0; }

/* ------------------------------------------------ hero */
.hero {
  position: relative; overflow: hidden; color: var(--green-ink);
  background:
    radial-gradient(1200px 420px at 85% -10%, rgba(181, 143, 69, .22), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(47, 122, 95, .35), transparent 60%),
    linear-gradient(160deg, #0f3529 0%, #123d30 45%, #0c2c22 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .11; pointer-events: none;
  background-image: var(--pattern); background-size: 84px 84px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.6) 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.6) 60%, transparent 100%);
}
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.25fr .9fr; gap: 56px; padding-block: 76px 84px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .86rem; color: #e8d6a8; letter-spacing: 0; margin: 0 0 18px; }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; opacity: .7; }
.hero h1 {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(2.1rem, 4.2vw, 3.5rem); line-height: 1.35; margin: 0 0 6px;
  text-wrap: balance;
}
.hero h1 .honor { display: block; font-size: .52em; font-weight: 400; color: #e8d6a8; margin-bottom: 6px; }
.hero .lede { font-family: var(--f-read); font-size: 1.16rem; line-height: 2; color: #d9e3dc; max-width: 40em; margin: 14px 0 28px; }
.searchbox {
  display: flex; align-items: center; gap: 6px; background: var(--paper); color: var(--ink);
  border-radius: 14px; padding: 7px; box-shadow: 0 10px 40px rgba(0,0,0,.25); max-width: 620px;
  border: 1px solid rgba(255,255,255,.5);
}
.searchbox svg { width: 22px; height: 22px; color: var(--muted); margin-inline: 10px 2px; flex-shrink: 0; }
.searchbox input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.06rem; color: var(--ink); padding: 10px 4px;
}
.searchbox button {
  border: 0; background: var(--green); color: var(--green-ink); font: inherit; font-weight: 600; padding: 10px 22px;
  border-radius: 10px; cursor: pointer;
}
:root[data-theme="dark"] .searchbox button { background: #1f5a46; }
.searchbox button:hover { background: var(--green-2); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: .96rem;
  padding: 11px 20px; border-radius: 11px; border: 1px solid var(--line-2); color: var(--ink); background: var(--paper);
  cursor: pointer; font-family: var(--f-ui);
}
.btn:hover { border-color: var(--brass); color: var(--ink); }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn.primary:hover { background: var(--green-2); color: #fff; }
.hero .btn { background: rgba(255,255,255,.06); color: var(--green-ink); border-color: rgba(255,255,255,.28); }
.hero .btn:hover { background: rgba(255,255,255,.12); border-color: #e8d6a8; color: #fff; }
.hero .btn.gold { background: #e8d6a8; color: #13261e; border-color: #e8d6a8; }
.hero .btn.gold:hover { background: #f1e3bd; color: #0d1d16; }
.btn svg { width: 18px; height: 18px; }

/* the manuscript card in the hero */
.folio {
  position: relative; background: var(--paper); color: var(--ink); border-radius: 6px; padding: 38px 34px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 0 0 1px color-mix(in srgb, var(--brass) 45%, transparent) inset;
  transform: rotate(-1.2deg);
}
.folio::before {
  content: ""; position: absolute; inset: 12px; border: 1px solid color-mix(in srgb, var(--brass) 50%, transparent); border-radius: 3px; pointer-events: none;
}
.folio::after {
  content: ""; position: absolute; inset: 16px; border: 1px solid color-mix(in srgb, var(--brass) 22%, transparent); border-radius: 2px; pointer-events: none;
}
.folio .orn { display: block; width: 58px; height: 58px; margin: -8px auto 12px; }
.folio blockquote { margin: 0; font-family: var(--f-display); font-size: 1.32rem; line-height: 2.05; text-align: center; text-wrap: pretty; }
.folio figcaption { margin-top: 16px; text-align: center; font-size: .86rem; color: var(--muted); }
.folio figcaption a { color: var(--brass); }

/* ------------------------------------------------ sections */
.section { padding-block: 72px; }
.section.alt { background: var(--paper); border-block: 1px solid var(--line); }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.sec-head h2, .h2 { font-family: var(--f-display); font-size: clamp(1.6rem, 2.6vw, 2.15rem); margin: 0; line-height: 1.4; font-weight: 700; }
.sec-head p { margin: 4px 0 0; color: var(--muted); max-width: 46em; }
.kicker { font-size: .82rem; color: var(--brass); font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.kicker svg { width: 16px; height: 16px; }
.more { font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.more::after { content: "←"; transition: transform .2s; }
.more:hover::after { transform: translateX(-4px); }

.divider { display: flex; align-items: center; gap: 14px; color: var(--brass); margin: 0 auto; max-width: 340px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.divider svg { width: 22px; height: 22px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: -44px; position: relative; z-index: 2; }
.stat { padding: 22px 22px 20px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; }
.stat b { display: block; font-family: var(--f-display); font-size: 2.1rem; line-height: 1.1; color: var(--green-2); font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .88rem; color: var(--muted); margin-top: 6px; line-height: 1.5; }
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-inline-start: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-inline-start: 1px solid var(--line); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* series board */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .board { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px; border-radius: 12px; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); transition: transform .18s, box-shadow .18s, border-color .18s; min-height: 132px;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brass-2); color: var(--ink); }
.tile .no { font-family: var(--f-display); font-size: 2.3rem; line-height: 1; color: var(--brass); font-variant-numeric: tabular-nums; }
.tile .t { font-family: var(--f-display); font-size: 1.08rem; font-weight: 700; }
.tile .m { font-size: .8rem; color: var(--muted); margin-top: auto; display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.tile .pip { position: absolute; top: 14px; inset-inline-end: 14px; }
.tile.missing { background: transparent; border-style: dashed; color: var(--muted); }
.tile.missing .no { color: var(--line-2); }
.tile .gist { font-size: .86rem; color: var(--ink-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid; line-height: 1.6; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.full { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.pill.partial, .pill.review { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.pill.meta, .pill.external { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); background: color-mix(in srgb, var(--info) 8%, transparent); }
.pill.missing, .pill.lost { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.pill.plain { color: var(--muted); border-color: var(--line-2); }
.pill.plain::before { display: none; }
.pip { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pip.full { background: var(--ok); } .pip.partial, .pip.review { background: var(--warn); } .pip.meta, .pip.external { background: var(--info); } .pip.missing, .pip.lost { background: var(--bad); }

/* cards */
.grid { display: grid; gap: 18px; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.c3, .grid.c2, .grid.c4 { grid-template-columns: 1fr; } }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; transition: border-color .18s, transform .18s;
}
a.card:hover { border-color: var(--brass-2); transform: translateY(-2px); color: var(--ink); }
.card h3 { font-family: var(--f-display); font-size: 1.28rem; line-height: 1.55; margin: 0; font-weight: 700; }
.card p { margin: 0; color: var(--ink-2); font-size: .95rem; line-height: 1.85; }
.card .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: auto; padding-top: 8px; }
.card .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brass-soft); color: var(--brass); margin-bottom: 4px; }
.card .ic svg { width: 24px; height: 24px; }

/* sections nav cards on home */
.portal { position: relative; overflow: hidden; }
.portal::after { content: ""; position: absolute; inset-inline-end: -30px; bottom: -30px; width: 130px; height: 130px; opacity: .07; background: var(--brass); -webkit-mask: var(--star-img) center / contain no-repeat; mask: var(--star-img) center / contain no-repeat; }

/* ------------------------------------------------ page heads */
.phead { background: var(--paper); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.phead::before { content: ""; position: absolute; inset: 0; opacity: .05; background-image: var(--pattern-ink); background-size: 72px 72px; pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, #000, transparent 70%); mask-image: linear-gradient(to left, #000, transparent 70%); }
.phead .wrap { position: relative; padding-block: 44px 38px; }
.phead h1 { font-family: var(--f-display); font-size: clamp(1.8rem, 3.4vw, 2.7rem); line-height: 1.45; margin: 6px 0 8px; font-weight: 700; text-wrap: balance; }
.phead .sub { color: var(--ink-2); max-width: 52em; font-size: 1.04rem; margin: 0; font-family: var(--f-read); line-height: 2; }
.crumbs { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brass); }
.crumbs span[aria-hidden] { opacity: .6; }

/* ------------------------------------------------ library */
.lib { display: grid; grid-template-columns: 270px 1fr; gap: 34px; padding-block: 36px 70px; align-items: start; }
@media (max-width: 920px) { .lib { grid-template-columns: 1fr; } }
.facets { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 920px) { .facets { position: static; } .facets details:not([open]) { } }
.facet { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.facet summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.facet summary::-webkit-details-marker { display: none; }
.facet summary::after { content: "+"; color: var(--muted); }
.facet[open] summary::after { content: "−"; }
.facet ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.facet a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--ink-2); padding: 5px 8px; border-radius: 7px; font-size: .92rem; }
.facet a:hover { background: var(--paper-2); }
.facet a[aria-current] { background: var(--brass-soft); color: var(--ink); font-weight: 600; }
.facet a small { color: var(--muted); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); font-size: .92rem; }
.toolbar .sorts a { margin-inline-start: 10px; text-decoration: none; color: var(--muted); }
.toolbar .sorts a[aria-current] { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--brass); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; padding: 3px 11px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); text-decoration: none; border: 1px solid var(--line); }
a.chip:hover { border-color: var(--brass-2); color: var(--ink); }
.chip.x::after { content: "×"; color: var(--muted); }

.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 74px 1fr auto; gap: 18px; padding: 20px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: start; }
.row:hover { background: linear-gradient(90deg, transparent, var(--paper) 30%); color: var(--ink); }
.row .yr { font-family: var(--f-display); font-size: 1.15rem; color: var(--brass); padding-top: 2px; font-variant-numeric: tabular-nums; }
.row h3 { font-family: var(--f-display); font-size: 1.24rem; margin: 0 0 4px; line-height: 1.6; font-weight: 700; }
.row p { margin: 0; color: var(--ink-2); font-size: .94rem; line-height: 1.85; }
.row .side { display: flex; flex-direction: column; align-items: end; gap: 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row .side { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .row .yr { font-size: 1rem; }
}

/* ------------------------------------------------ work page */
.work-head .meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--muted); font-size: .9rem; margin-top: 10px; }
.work-head .meta-line > span { display: inline-flex; align-items: center; gap: 6px; }
.work-head .meta-line svg { width: 16px; height: 16px; opacity: .8; }
.series-pill { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; background: var(--brass-soft); color: var(--ink); padding: 4px 14px 4px 6px; border-radius: 99px; font-size: .86rem; font-weight: 600; }
.series-pill b { background: var(--brass); color: #fff; border-radius: 99px; min-width: 26px; height: 26px; display: inline-grid; place-items: center; font-size: .84rem; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .series-pill b { color: #1a1a14; }

.reader { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 54px; padding-block: 40px 30px; align-items: start; }
@media (max-width: 1060px) { .reader { grid-template-columns: 1fr; gap: 26px; } }
.aside { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 100px); overflow: auto; scrollbar-width: thin; padding-bottom: 6px; }
@media (max-width: 1060px) { .aside { position: static; max-height: none; order: -1; } }
.dossier { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dossier > summary { cursor: pointer; }
.dossier:not([open]) > summary { border-bottom: 0; }
.dossier > summary::after { content: "+"; margin-inline-start: auto; color: var(--muted); font-family: var(--f-ui); }
.dossier[open] > summary::after { content: "−"; }
.dossier > summary, .dossier > h2 { margin: 0; font-family: var(--f-display); font-size: 1.12rem; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--paper-2); display: flex; align-items: center; gap: 8px; cursor: default; list-style: none; }
.dossier > summary::-webkit-details-marker { display: none; }
.dossier dl { margin: 0; padding: 6px 18px 14px; display: grid; grid-template-columns: auto 1fr; gap: 0 14px; font-size: .88rem; }
.dossier dt { color: var(--muted); padding: 8px 0; border-bottom: 1px dashed var(--line); white-space: nowrap; }
.dossier dd { margin: 0; padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--ink); }
.dossier dt:last-of-type, .dossier dd:last-of-type { border-bottom: 0; }
.dossier .help { font-size: .8rem; color: var(--muted); padding: 0 18px 14px; margin: 0; line-height: 1.7; }
.readtools { display: flex; gap: 6px; flex-wrap: wrap; }
.readtools .btn { padding: 8px 12px; font-size: .86rem; }
.mini-toc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 8px; }
.mini-toc h3 { font-size: .9rem; margin: 2px 10px 8px; color: var(--muted); font-weight: 600; }
.mini-toc ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.mini-toc a { display: grid; place-items: center; height: 36px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-variant-numeric: tabular-nums; border: 1px solid var(--line); font-size: .9rem; }
.mini-toc a:hover { border-color: var(--brass); }
.mini-toc a[aria-current] { background: var(--green); color: var(--green-ink); border-color: var(--green); }

.abstract { font-family: var(--f-read); background: var(--paper); border: 1px solid var(--line); border-inline-start: 3px solid var(--brass); border-radius: var(--radius-sm); padding: 18px 22px; margin: 0 0 30px; color: var(--ink-2); line-height: 2.05; font-size: 1.04rem; }
.abstract .lbl { display: block; font-family: var(--f-ui); font-size: .78rem; color: var(--brass); font-weight: 600; margin-bottom: 4px; }

.text {
  font-family: var(--f-read); font-size: var(--read-size); line-height: 2.15; color: var(--ink);
  max-width: 44em; text-align: justify; text-justify: inter-word; hyphens: none; word-spacing: .02em;
}
.text p { margin: 0 0 1.05em; position: relative; }
.text p .pn {
  position: absolute; inset-inline-start: -3.2em; top: .45em; width: 2.4em; text-align: center; font-family: var(--f-ui); font-size: .62rem;
  color: var(--muted); text-decoration: none; opacity: 0; transition: opacity .2s; font-variant-numeric: tabular-nums; line-height: 1.6;
  border: 1px solid var(--line); border-radius: 99px;
}
.text p:hover .pn, .text p:target .pn { opacity: 1; }
.text p:target { background: color-mix(in srgb, var(--mark) 45%, transparent); border-radius: 6px; box-shadow: 0 0 0 8px color-mix(in srgb, var(--mark) 45%, transparent); }
@media (max-width: 760px) { .text p .pn { display: none; } .text { text-align: start; } }
.text .basmala { text-align: center; font-family: var(--f-display); font-size: 1.3em; color: var(--green-2); margin-bottom: .4em; }
.text .eph { text-align: center; font-family: var(--f-display); font-weight: 700; font-size: 1.15em; color: var(--brass); margin-bottom: 1.2em; }
.text .eph::before, .text .eph::after { content: "۞"; font-size: .7em; margin-inline: .6em; opacity: .6; }
.text .sign { text-align: end; font-family: var(--f-display); color: var(--ink-2); margin: 0 0 .2em; font-size: 1.04em; }
.text p:not(.sign) + .sign { margin-top: 1.8em; padding-top: 1em; border-top: 1px solid var(--line); }
.text .fnote { font-size: .84em; color: var(--ink-2); line-height: 1.95; margin-bottom: .6em; }
.text hr.orn, hr.orn { border: 0; height: 26px; margin: 1.6em auto; background: var(--brass); opacity: .8; -webkit-mask: var(--orn-img) center / contain no-repeat; mask: var(--orn-img) center / contain no-repeat; }
.text .dq { quotes: none; color: var(--green-2); }
.text .br { color: var(--green-2); }
.text .cite { font-family: var(--f-ui); font-size: .68em; color: var(--muted); white-space: nowrap; vertical-align: .1em; }
.text sup.fn { font-family: var(--f-ui); font-size: .62em; color: var(--brass); font-weight: 600; }
.text a.ext { font-family: var(--f-ui); font-size: .75em; word-break: break-all; }
.text h3.th { font-family: var(--f-display); font-size: 1.3em; color: var(--green-2); margin: 1.6em 0 .6em; }
[data-size="s"] { --read-size: 1.08rem; } [data-size="l"] { --read-size: 1.42rem; } [data-size="xl"] { --read-size: 1.62rem; }

.endmark { display: flex; justify-content: center; margin: 34px 0 12px; color: var(--brass); }
.endmark svg { width: 34px; height: 34px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 40px 0 10px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--paper); }
.pager a:hover { border-color: var(--brass); }
.pager small { color: var(--muted); font-size: .8rem; }
.pager b { font-family: var(--f-display); font-size: 1.12rem; }
.pager .next { text-align: end; grid-column: 2; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: auto; } }

.block-title { font-family: var(--f-display); font-size: 1.5rem; margin: 54px 0 6px; display: flex; align-items: center; gap: 10px; }
.block-title svg { width: 22px; height: 22px; color: var(--brass); }
.block-sub { color: var(--muted); margin: 0 0 18px; font-size: .94rem; }

.reply { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 14px; overflow: hidden; }
.reply > summary { padding: 14px 18px; cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; flex-wrap: wrap; }
.reply > summary::-webkit-details-marker { display: none; }
.reply > summary::before { content: "‹"; transform: rotate(-90deg); transition: transform .2s; color: var(--brass); font-size: 1.3rem; line-height: 1; }
.reply[open] > summary::before { transform: rotate(90deg); }
.reply > summary b { font-weight: 600; }
.reply > summary small { color: var(--muted); }
.reply .ctx { margin: 0 18px 14px; padding: 12px 16px; border-inline-start: 3px solid var(--line-2); background: var(--paper-2); border-radius: 8px; font-size: .9rem; color: var(--ink-2); line-height: 1.9; }
.reply .ctx b { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.reply .text { padding: 0 22px 10px; font-size: calc(var(--read-size) * .92); max-width: none; }
.reply .text p .pn { display: none; }

.sources { display: flex; flex-direction: column; gap: 12px; }
.src { display: grid; grid-template-columns: 46px 1fr; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); align-items: start; }
.src .badge { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--paper-2); color: var(--green-2); font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; border: 1px solid var(--line); }
.src.canonical .badge, .src.original .badge { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.src h4 { margin: 0; font-size: 1rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.src .m { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.src .links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: .86rem; }
.src .note { font-size: .86rem; color: var(--ink-2); margin: 6px 0 0; }
.sim { font-variant-numeric: tabular-nums; }

.citebox { background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: 16px 18px; font-family: var(--f-read); font-size: .98rem; line-height: 2; position: relative; }
.citebox button { position: absolute; top: 10px; inset-inline-end: 10px; }

/* ------------------------------------------------ series page */
.series-hero { display: grid; grid-template-columns: 1fr 360px; gap: 40px; align-items: start; }
@media (max-width: 900px) { .series-hero { grid-template-columns: 1fr; } }
.meter { height: 10px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.meter span { display: block; height: 100%; }
.meter .full { background: var(--ok); } .meter .partial { background: var(--warn); } .meter .missing { background: transparent; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.ep-list { counter-reset: ep; display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.ep { display: grid; grid-template-columns: 64px 1fr auto; gap: 18px; padding: 20px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: start; }
.ep:hover { background: var(--paper); color: var(--ink); }
.ep .no { font-family: var(--f-display); font-size: 2rem; line-height: 1; color: var(--brass); text-align: center; font-variant-numeric: tabular-nums; }
.ep h3 { margin: 0 0 4px; font-family: var(--f-display); font-size: 1.2rem; }
.ep p { margin: 0; color: var(--ink-2); font-size: .94rem; line-height: 1.85; }
.ep .side { text-align: end; font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: end; white-space: nowrap; }
@media (max-width: 640px) { .ep { grid-template-columns: 44px 1fr; } .ep .side { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; } .ep .no { font-size: 1.6rem; } }

/* ------------------------------------------------ biography / claims */
.bio { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 50px; padding-block: 40px 70px; align-items: start; }
@media (max-width: 920px) { .bio { grid-template-columns: 1fr; gap: 20px; } .bio .toc { position: static !important; } }
.bio .toc { position: sticky; top: 90px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--line); }
.toc li a { display: block; padding: 7px 14px; text-decoration: none; color: var(--ink-2); font-size: .93rem; margin-inline-start: -2px; border-inline-start: 2px solid transparent; }
.toc li a:hover, .toc li a.on { color: var(--ink); border-inline-start-color: var(--brass); }
.bio-sec { margin-bottom: 46px; }
.bio-sec h2 { font-family: var(--f-display); font-size: 1.7rem; margin: 0 0 14px; display: flex; gap: 12px; align-items: center; }
.bio-sec h2::before { content: ""; width: 12px; height: 12px; background: var(--brass); transform: rotate(45deg); flex-shrink: 0; }
.prose { font-family: var(--f-read); font-size: 1.12rem; line-height: 2.1; max-width: 46em; }
.prose p { margin: 0 0 1em; }
.claims { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.claim { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.claim .st { float: inline-end; margin-inline-start: 10px; }
.claim p { margin: 0; font-family: var(--f-read); font-size: 1.06rem; line-height: 2; }
.claim .refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: .8rem; }
.claim .refs a { text-decoration: none; background: var(--paper-2); border: 1px solid var(--line); padding: 1px 9px; border-radius: 99px; color: var(--ink-2); }
.claim .refs a:hover { border-color: var(--brass); }
.claim .why { font-size: .84rem; color: var(--muted); margin-top: 6px; line-height: 1.8; }
.pill.ok, .pill.ok2 { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.rep { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.pill.dis, .pill.unv { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.lineage { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; font-family: var(--f-display); font-size: 1.08rem; line-height: 2; }
.lineage span { background: var(--paper); border: 1px solid var(--line); padding: 2px 12px; border-radius: 8px; }
.lineage i { color: var(--brass); font-style: normal; font-size: .9rem; }
.note-box { background: var(--brass-soft); border-radius: 12px; padding: 14px 18px; font-size: .94rem; line-height: 1.9; color: var(--ink); }
.note-box b { color: var(--brass); }

/* ------------------------------------------------ timeline */
.tl { position: relative; padding-block: 30px 60px; }
.tl::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 50%; width: 2px; background: linear-gradient(var(--line-2), var(--line-2)) ; transform: translateX(50%); }
.ev { position: relative; width: 50%; padding-inline-end: 44px; margin-bottom: 28px; }
.ev:nth-child(even) { margin-inline-start: 50%; padding-inline-end: 0; padding-inline-start: 44px; }
.ev::before { content: ""; position: absolute; top: 18px; inset-inline-end: -7px; width: 14px; height: 14px; background: var(--paper); border: 2px solid var(--brass); transform: rotate(45deg); z-index: 1; }
.ev:nth-child(even)::before { inset-inline-end: auto; inset-inline-start: -7px; }
.ev.major::before { background: var(--brass); }
.ev .card { gap: 4px; }
.ev .d { font-family: var(--f-display); color: var(--brass); font-size: 1.1rem; font-weight: 700; }
.ev h3 { font-size: 1.14rem; }
.ev .tag { font-size: .76rem; color: var(--muted); }
@media (max-width: 760px) {
  .tl::before { inset-inline-start: 8px; transform: none; }
  .ev, .ev:nth-child(even) { width: auto; margin-inline-start: 0; padding-inline: 34px 0; }
  .ev::before, .ev:nth-child(even)::before { inset-inline-start: 2px; inset-inline-end: auto; }
}
.tl-filter { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding-top: 26px; }
.tl-filter button { font: inherit; font-size: .88rem; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink-2); border-radius: 99px; padding: 5px 14px; cursor: pointer; }
.tl-filter button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }

/* ------------------------------------------------ search */
.search-page .searchbox { max-width: none; box-shadow: var(--shadow); border-color: var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.filters select { font: inherit; font-size: .9rem; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); }
.hits { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.hit { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; text-decoration: none; color: var(--ink); display: block; }
.hit:hover { border-color: var(--brass-2); color: var(--ink); }
.hit h3 { margin: 0 0 4px; font-family: var(--f-display); font-size: 1.16rem; }
.hit p { margin: 0; font-family: var(--f-read); font-size: 1.02rem; line-height: 2; color: var(--ink-2); }
.hit .m { font-size: .8rem; color: var(--muted); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 3px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; color: var(--line-2); }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

/* ------------------------------------------------ media */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #0b1611; border: 1px solid var(--line); }
.video iframe, .video img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.video button { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.video button span { width: 72px; height: 72px; border-radius: 50%; background: rgba(15,53,41,.85); display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.video button svg { width: 30px; height: 30px; color: #fff; margin-inline-start: 4px; transform: scaleX(-1); }

/* books */
.book { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: start; }
.cover { aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; background: linear-gradient(135deg, var(--green), #0a241c); color: #e8d6a8; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px 12px; font-family: var(--f-display); font-size: 1.02rem; line-height: 1.7; box-shadow: var(--shadow-lg), inset 6px 0 0 rgba(0,0,0,.18); position: relative; overflow: hidden; }
.cover::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(232,214,168,.4); border-radius: 2px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.ms { background: repeating-linear-gradient(0deg, var(--paper-2), var(--paper-2) 26px, var(--line) 27px); color: var(--muted); border: 1px dashed var(--line-2); box-shadow: none; }
.cover.ms::before { border-color: var(--line-2); border-style: dashed; }
@media (max-width: 560px) { .book { grid-template-columns: 100px 1fr; gap: 16px; } .cover { font-size: .82rem; } }

/* people */
.person-card .nm { font-family: var(--f-display); font-size: 1.2rem; font-weight: 700; }
.rel { font-size: .8rem; color: var(--brass); font-weight: 600; }

/* forms */
.form { display: grid; gap: 16px; max-width: 720px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .94rem; }
.form input, .form textarea, .form select { font: inherit; font-weight: 400; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); }
.form textarea { min-height: 170px; resize: vertical; line-height: 1.9; }
.form .hp { position: absolute; inset-inline-start: -9999px; }
.ok-box { background: color-mix(in srgb, var(--ok) 10%, var(--paper)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); padding: 14px 18px; border-radius: 12px; }

/* ------------------------------------------------ footer */
.foot { background: #0d241c; color: #cfd9d2; margin-top: 40px; position: relative; overflow: hidden; }
:root[data-theme="dark"] .foot { background: #0a1310; }
.foot::before { content: ""; position: absolute; inset: 0; opacity: .06; background-image: var(--pattern); background-size: 84px 84px; pointer-events: none; }
.foot .wrap { position: relative; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-block: 54px 30px; }
@media (max-width: 820px) { .foot .wrap { grid-template-columns: 1fr; gap: 26px; } }
.foot h4 { font-family: var(--f-display); color: #e8d6a8; font-size: 1.14rem; margin: 0 0 12px; }
.foot p { margin: 0 0 10px; font-size: .92rem; line-height: 1.95; color: #b9c6bd; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.foot a { color: #dfe7e1; text-decoration: none; font-size: .92rem; }
.foot a:hover { color: #e8d6a8; }
.foot .base { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; font-size: .82rem; color: #93a399; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dua { font-family: var(--f-display); font-size: 1.12rem; color: #e8d6a8; }

/* ------------------------------------------------ hero responsive */
@media (max-width: 980px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-block: 52px 76px; }
  .folio { transform: none; max-width: 560px; width: 100%; }
}
@media (max-width: 520px) {
  .searchbox { flex-wrap: nowrap; }
  .searchbox button { padding: 10px 14px; }
  .folio { padding: 30px 22px 24px; }
  .folio blockquote { font-size: 1.14rem; }
  .section { padding-block: 52px; }
}

/* reveal */
@media (prefers-reduced-motion: no-preference) {
  .rv { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
  .rv.in { opacity: 1; transform: none; }
}

/* print */
@media print {
  .top, .foot, .aside, .pager, .readtools, .progress, .no-print, .reply > summary::before { display: none !important; }
  body { background: #fff; color: #000; }
  .reader { display: block; padding: 0; }
  .text { max-width: none; font-size: 12.5pt; line-height: 1.9; }
  .text p .pn { display: none; }
  .phead { border: 0; background: #fff; }
  .phead::before { display: none; }
  a { color: #000; text-decoration: none; }
  .reply { break-inside: avoid; border: 0; }
  .reply[open] .text, .reply .text { display: block; }
}

@media (max-width: 1060px) { .aside .mini-toc, .aside > a.btn { display: none; } }

/* facsimile + covers + gallery */
.facs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .facs { grid-template-columns: 1fr; } }
.facs figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: var(--shadow); }
.facs img { display: block; width: 100%; height: auto; border-radius: 4px; }
:root[data-theme="dark"] .facs img { filter: invert(.88) hue-rotate(180deg); }
.facs figcaption { text-align: center; font-size: .82rem; color: var(--muted); padding-top: 6px; }
.cover-img { display: block; width: 62%; max-width: 220px; height: auto; margin: 0 auto 4px; border-radius: 4px 10px 10px 4px; box-shadow: var(--shadow-lg); }
.gallery { columns: 3 260px; column-gap: 16px; }
.gallery figure { break-inside: avoid; margin: 0 0 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption { padding: 10px 14px 12px; font-size: .88rem; line-height: 1.8; color: var(--ink-2); }
.gallery figcaption small { display: block; color: var(--muted); font-size: .76rem; margin-top: 4px; }
.gallery figcaption small a { color: var(--muted); }
.portrait { float: inline-end; width: 230px; margin: 0 0 18px 0; margin-inline-start: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: var(--shadow); }
.portrait img { display: block; width: 100%; height: auto; border-radius: 8px; filter: saturate(.85); }
.portrait figcaption { font-size: .78rem; color: var(--muted); padding: 6px 4px 2px; line-height: 1.6; }
@media (max-width: 640px) { .portrait { float: none; width: 70%; margin: 0 auto 20px; } }

.tscript { list-style: none; margin: 0; padding: 0 18px 16px; max-height: 460px; overflow: auto; font-family: var(--f-read); font-size: 1rem; line-height: 2; }
.tscript li { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; }
.tscript li:target { background: color-mix(in srgb, var(--mark) 45%, transparent); border-radius: 6px; }
.ts { font: inherit; font-family: var(--f-ui); font-size: .76rem; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-2); border-radius: 6px; padding: 0 7px; cursor: pointer; flex-shrink: 0; direction: ltr; }
.ts:hover { border-color: var(--brass); color: var(--ink); }

.hero .wrap > *, .reader > *, .lib > *, .bio > *, .series-hero > * { min-width: 0; }
.filters-box > summary { cursor: pointer; font-size: .9rem; color: var(--muted); margin-top: 12px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.filters-box > summary::-webkit-details-marker { display: none; }
.filters-box > summary::after { content: "▾"; }
@media (min-width: 761px) { .filters-box > summary { display: none; } }

/* generated emblem icons: alpha masks painted with the theme's brass */
.gicon { display: block; width: 76px; height: 76px; background: var(--brass); flex-shrink: 0;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; margin-bottom: 6px; }
.gicon.head { width: 64px; height: 64px; margin: 14px 0 0; }
.portal .gicon { transition: transform .35s ease; }
a.portal:hover .gicon { transform: rotate(-8deg) scale(1.04); }
@media (max-width: 640px) { .gicon { width: 64px; height: 64px; } }
.gicon.brand-mark { width: 40px; height: 40px; margin: 0; }
@media (max-width: 520px) { .gicon.brand-mark { width: 34px; height: 34px; } }

.gicon.orn-mark { width: 30px; height: 30px; margin: 0; }
.divider .gicon.orn-mark { width: 34px; height: 34px; }
.endmark .gicon.orn-mark { width: 46px; height: 46px; }
.folio .gicon.orn-mark.orn { width: 58px; height: 58px; margin: -8px auto 12px; }

/* hero portrait + name */
.hero-id { display: flex; align-items: center; gap: 26px; }
.hero-portrait { margin: 0; flex-shrink: 0; width: 150px; aspect-ratio: 1; border-radius: 50%; padding: 5px;
  background: conic-gradient(from 0deg, #e8d6a8, #b58f45, #e8d6a8, #b58f45, #e8d6a8);
  box-shadow: 0 14px 40px rgba(0,0,0,.35); }
.hero-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: 50%;
  border: 3px solid #123d30; filter: saturate(.9); }
.hero h1 .rahimahu { display: block; font-size: max(.42em, 1.1rem); font-weight: 400; color: #e8d6a8; margin-top: 8px; }
@media (max-width: 640px) {
  .hero-id { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-portrait { width: 116px; }
}
.brand-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  padding: 2px; background: linear-gradient(135deg, #e8d6a8, #b58f45); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
@media (max-width: 520px) { .brand-photo { width: 38px; height: 38px; } }
