/* =====================================================================
   Arabic MetaNet  —  oriental, right-to-left interface
   ===================================================================== */
@font-face { font-family: "Amiri"; src: url("fonts/Amiri-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("fonts/Amiri-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Reem Kufi"; src: url("fonts/ReemKufi.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url("fonts/NotoNaskhArabic.woff") format("woff"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #241b10;
  --muted: #6f604b;
  --paper: #fffaf0;
  --sand: #f4ead6;
  --line: #e0cfaa;
  --line-2: #cdb685;
  --gold: #b0832a;
  --gold-l: #e8cf8f;
  --gold-xl: #f6ead0;
  --lapis: #143e63;
  --lapis-d: #0b2740;
  --lapis-l: #e2ecf5;
  --terra: #a2452a;
  --terra-l: #f7e3da;
  --teal: #16706d;
  --teal-l: #dcefec;
  --plum: #6b3d6e;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 8px 26px -14px rgba(60, 38, 8, .35);
  --f-body: "Noto Naskh Arabic", "Amiri", "Segoe UI", Tahoma, sans-serif;
  --f-head: "Noto Naskh Arabic", "Amiri", Tahoma, sans-serif;
  --f-kufi: "Reem Kufi", "Noto Naskh Arabic", Tahoma, sans-serif;
  --f-lit: "Amiri", "Noto Naskh Arabic", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--sand) url("img/girih.svg") repeat;
  background-size: 120px 120px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lapis); text-decoration: none; }
a:hover { color: var(--terra); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
button { font-family: inherit; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--lapis); color: #fff; padding: .4rem .8rem; z-index: 99; }
.skip:focus { inset-inline-start: 1rem; }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, var(--lapis) 0%, var(--lapis-d) 100%);
  color: #fff;
  box-shadow: 0 6px 22px -12px rgba(5, 20, 35, .7);
}
.top-in { max-width: 1240px; margin: auto; padding: .55rem 1.2rem; display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-star { width: 46px; height: 46px; color: var(--gold-l); --star-in: var(--lapis); --star-core: var(--gold-l); filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); transition: transform .8s ease; }
.brand:hover .brand-star { transform: rotate(45deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-t { font-family: var(--f-kufi); font-size: 1.55rem; font-weight: 700; letter-spacing: .5px; }
.brand-s { font-size: .78rem; color: var(--gold-l); opacity: .95; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-inline-start: auto; }
.nav a { color: #e9eef4; padding: .3rem .75rem; border-radius: 999px; font-size: .95rem; transition: background .2s; }
.nav a:hover, .nav a.on { background: rgba(232, 207, 143, .16); color: var(--gold-l); }
.tools { display: flex; align-items: center; gap: .6rem; }
.seg { display: inline-flex; background: rgba(255,255,255,.08); border: 1px solid rgba(232,207,143,.35); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; color: #dfe7ef; padding: .18rem .8rem; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.seg button.on { background: var(--gold-l); color: var(--lapis-d); font-weight: 700; }
.btn-editor { border: 1px solid var(--gold-l); background: transparent; color: var(--gold-l); border-radius: 999px; padding: .22rem .9rem; cursor: pointer; font-size: .88rem; }
.btn-editor.on { background: var(--gold-l); color: var(--lapis-d); font-weight: 700; }
.band { height: 12px; background: var(--lapis-d) url("img/band.svg") repeat-x center; background-size: 28px 12px; border-top: 1px solid rgba(232,207,143,.45); border-bottom: 1px solid rgba(232,207,143,.45); }
.hsearch { background: rgba(11, 39, 64, .96); padding: .5rem 1.2rem .65rem; }
.hsearch .sbox { max-width: 760px; margin: auto; }
body.is-home .hsearch { display: none; }

/* ------------------------------------------------------------ search box */
.sbox { position: relative; display: flex; align-items: center; background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 999px; padding: .15rem .3rem .15rem .9rem; box-shadow: 0 6px 18px -12px rgba(0,0,0,.6); }
.sbox:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(176,131,42,.18); }
.sbox-i { width: 20px; height: 20px; color: var(--gold); margin-inline: .5rem .2rem; flex: none; }
.sbox input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 1rem; padding: .45rem .3rem; color: var(--ink); min-width: 0; }
.sbox input:focus { outline: none; }
.sbox button { border: 0; background: var(--lapis); color: #fff; border-radius: 999px; padding: .38rem 1.2rem; cursor: pointer; font-size: .95rem; }
.sbox button:hover { background: var(--terra); }
.sbox.big { padding: .35rem .45rem .35rem 1.1rem; }
.sbox.big input { font-size: 1.18rem; padding: .7rem .4rem; }
.sbox.big button { padding: .6rem 1.6rem; font-size: 1.05rem; }
.sugg { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; list-style: none; margin: 0; padding: .3rem; z-index: 50; box-shadow: 0 16px 34px -18px rgba(40, 25, 5, .55); max-height: 60vh; overflow: auto; text-align: start; }
.sugg li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .4rem .7rem; border-radius: 8px; cursor: pointer; color: var(--ink); }
.sugg li.on, .sugg li:hover { background: var(--gold-xl); }
.sugg .k { font-size: .75rem; padding: 0 .5rem; border-radius: 999px; background: var(--lapis-l); color: var(--lapis); white-space: nowrap; }
.sugg .k.f { background: var(--teal-l); color: var(--teal); }
.sugg .k.fn { background: var(--terra-l); color: var(--terra); }

/* ------------------------------------------------------------ layout */
main { max-width: 1240px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; min-height: 60vh; outline: none; }
main:focus, main:focus-visible { outline: none; }
.crumbs { font-size: .88rem; color: var(--muted); margin: .2rem 0 1rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--terra); }
.crumbs .sep { margin: 0 .35rem; color: var(--gold); }

.card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
}
.card::before {
  content: ""; position: absolute; inset: 5px; border: 1px solid var(--gold-xl); border-radius: calc(var(--radius) - 5px); pointer-events: none;
}
.card.orn::after {
  content: ""; position: absolute; top: -9px; inset-inline-start: 50%; width: 18px; height: 18px; transform: translateX(50%);
  background: url("img/star.svg") center / contain no-repeat;
}
.sec-h { display: flex; align-items: center; gap: .55rem; font-family: var(--f-head); font-weight: 700; font-size: 1.2rem; color: var(--lapis); margin: 0 0 .8rem; }
.sec-h svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.sec-h .n { font-family: var(--f-body); font-size: .8rem; font-weight: 400; color: var(--muted); background: var(--gold-xl); border-radius: 999px; padding: 0 .55rem; }
.sec-h .tail { margin-inline-start: auto; display: flex; gap: .4rem; }
.sec-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line)); order: 5; }
.sec-h .tail { order: 6; }
.empty { color: var(--muted); font-size: .92rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.1rem; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 980px) { .cols, .grid2 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; padding: .05rem .7rem; border-radius: 999px; background: var(--gold-xl); color: #7a5a17; border: 1px solid #ecd9ad; white-space: nowrap; }
.chip.lapis { background: var(--lapis-l); color: var(--lapis); border-color: #c9dae9; }
.chip.teal { background: var(--teal-l); color: var(--teal); border-color: #bfe0db; }
.chip.terra { background: var(--terra-l); color: var(--terra); border-color: #efc9ba; }
.chip.ghost { background: transparent; border-style: dashed; color: var(--muted); }
a.chip:hover { filter: brightness(.96); color: inherit; }

.spin { display: grid; place-items: center; padding: 4rem 0; color: var(--gold); }
.spin svg { width: 54px; height: 54px; animation: rot 2.4s linear infinite; --star-in: var(--paper); --star-core: var(--gold); }
@keyframes rot { to { transform: rotate(360deg); } }
.err-box { background: var(--terra-l); border: 1px solid #e9b8a6; color: #6d2a16; border-radius: 12px; padding: 1rem 1.2rem; }

/* ------------------------------------------------------------ home */
.hero { display: grid; place-items: center; margin: .6rem 0 1.4rem; }
.arch {
  width: min(980px, 100%);
  background: radial-gradient(120% 90% at 50% 0%, #1d527f 0%, var(--lapis) 45%, var(--lapis-d) 100%);
  color: #fff;
  border-radius: 520px 520px 22px 22px / 300px 300px 22px 22px;
  padding: 3.2rem 2.2rem 2.2rem;
  border: 2px solid var(--gold-l);
  outline: 1px solid var(--gold);
  outline-offset: 6px;
  position: relative;
  overflow: hidden;
  text-align: center;
  box-shadow: 0 30px 60px -36px rgba(8, 25, 45, .9);
}
.arch::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background: url("img/girih.svg") repeat; background-size: 96px 96px; filter: invert(1) sepia(1) saturate(2) hue-rotate(5deg); mix-blend-mode: soft-light;
}
.arch > * { position: relative; }
.arch .hero-star { width: 74px; height: 74px; color: var(--gold-l); --star-in: var(--lapis); --star-core: var(--gold-l); margin-bottom: .3rem; }
.arch h1 { font-family: var(--f-kufi); font-size: clamp(2.1rem, 5vw, 3.3rem); margin: .1rem 0 .2rem; color: var(--gold-l); letter-spacing: 1px; }
.arch .lead { font-family: var(--f-lit); font-size: 1.22rem; max-width: 720px; margin: .3rem auto 1.4rem; color: #eef3f8; line-height: 1.9; }
.arch .sbox { max-width: 720px; margin: 0 auto; }
.arch .hint { margin-top: .9rem; font-size: .92rem; color: #cfdbe8; }
.arch .hint a { color: var(--gold-l); border-bottom: 1px dotted var(--gold-l); margin: 0 .25rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.3rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.medal { text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: .9rem .5rem .7rem; box-shadow: var(--shadow); position: relative; }
.medal b { display: block; font-family: var(--f-kufi); font-size: 1.7rem; color: var(--lapis); line-height: 1.2; }
.medal span { font-size: .85rem; color: var(--muted); }
.medal::before { content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 12px; height: 12px; background: url("img/star.svg") center / contain no-repeat; opacity: .7; }
.featured .m-title { font-size: 1.75rem; }
.featured blockquote { margin: .6rem 0 0; }
.how ol { margin: .2rem 0 0; padding-inline-start: 1.3rem; }
.how li { margin-bottom: .35rem; }
.formula { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 .9rem; }
.formula .box { padding: .35rem .9rem; border-radius: 10px; font-family: var(--f-lit); font-size: 1.15rem; }
.formula .t { background: var(--lapis-l); color: var(--lapis); border: 1px solid #c9dae9; }
.formula .s { background: var(--terra-l); color: var(--terra); border: 1px solid #efc9ba; }
.formula .c { color: var(--gold); font-family: var(--f-lit); font-size: 1.3rem; }

.letters { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.letters a, .letters span { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 10px; font-family: var(--f-lit); font-size: 1.25rem; background: var(--paper); border: 1px solid var(--line); color: var(--lapis); position: relative; }
.letters a:hover { background: var(--lapis); color: var(--gold-l); border-color: var(--lapis); }
.letters a.on { background: var(--lapis); color: var(--gold-l); border-color: var(--lapis); }
.letters span { color: #cbbd9f; background: transparent; }
.letters a.all { width: auto; padding: 0 .8rem; font-family: var(--f-body); font-size: .9rem; }

/* ------------------------------------------------------------ metaphor page */
.m-head { text-align: center; padding-top: 1.6rem; }
.kicker { font-family: var(--f-head); font-size: .92rem; color: var(--gold); }
.m-title { font-family: var(--f-lit); font-weight: 700; font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.6; margin: .2rem 0 .6rem; }
.m-title .t { color: var(--lapis); }
.m-title .c { color: var(--gold); font-weight: 400; margin: 0 .25rem; }
.m-title .s { color: var(--terra); }
.m-head .chips { justify-content: center; }

.bridge { display: grid; grid-template-columns: 1fr 120px 1fr; align-items: stretch; gap: 0; margin-bottom: 1.1rem; }
.dom { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.dom::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; }
.dom.t::after { background: var(--lapis); }
.dom.s::after { background: var(--terra); }
.dom .lab { font-family: var(--f-head); font-size: .85rem; color: var(--muted); }
.dom .val { font-family: var(--f-lit); font-size: 1.5rem; font-weight: 700; line-height: 1.5; margin: .15rem 0 .4rem; }
.dom.t .val { color: var(--lapis); }
.dom.s .val { color: var(--terra); }
.dom .fr { font-size: .9rem; }
.dom .fr a { border-bottom: 1px dotted currentColor; }
.bridge .mid { display: grid; place-items: center; position: relative; }
.bridge .mid svg { width: 100%; height: 80px; overflow: visible; }
.bridge .mid .cop { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -62%); font-family: var(--f-lit); font-size: 1.3rem; color: var(--gold); background: var(--sand); padding: 0 .4rem; border-radius: 8px; }
@media (max-width: 760px) {
  .bridge { grid-template-columns: 1fr; }
  .bridge .mid { height: 46px; }
  .bridge .mid svg { transform: rotate(90deg); height: 46px; width: 46px; }
}

.maps { display: grid; grid-template-columns: minmax(0,1fr) 70px minmax(0,1fr); row-gap: .45rem; align-items: center; }
.maps .h { font-family: var(--f-head); font-size: .85rem; color: var(--muted); text-align: center; padding-bottom: .2rem; }
.role { padding: .3rem .8rem; border-radius: 10px; font-size: .95rem; line-height: 1.6; }
.role.t { background: var(--lapis-l); color: var(--lapis-d); border: 1px solid #c9dae9; }
.role.s { background: var(--terra-l); color: #6d2a16; border: 1px solid #efc9ba; }
.link { height: 2px; background: linear-gradient(90deg, var(--terra), var(--gold), var(--lapis)); position: relative; }
.link::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; background: var(--gold); transform: translate(-50%, -50%) rotate(45deg); border: 2px solid var(--paper); }

.ex-list { counter-reset: ex; display: grid; gap: .6rem; }
.ex { position: relative; margin: 0; padding: .7rem 1rem .7rem 1rem; padding-inline-start: 2.9rem; background: linear-gradient(90deg, transparent, var(--gold-xl)); border-radius: 12px; border: 1px solid #efe1c0; font-family: var(--f-lit); font-size: 1.18rem; line-height: 1.9; }
.ex::before { counter-increment: ex; content: counter(ex, arabic-indic); position: absolute; inset-inline-start: .7rem; top: .75rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; font-family: var(--f-body); font-size: .8rem; background: var(--lapis); color: var(--gold-l); border-radius: 50%; }
.ex .q { color: var(--gold); font-size: 1.3rem; }
blockquote.ex { quotes: "«" "»"; }

.ent { display: grid; grid-template-columns: 7.5rem 1fr; gap: .2rem .8rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; background: #fffdf8; }
.ent .k { font-family: var(--f-head); font-size: .82rem; color: var(--muted); padding-top: .2rem; }
.ent .v.t { color: var(--lapis-d); }
.ent .v.s { color: #6d2a16; }
.ent .meta { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; padding-top: .2rem; }

.prose { font-size: 1.02rem; }
.prose p { margin: .2rem 0 .6rem; }
.prose .lbl { font-family: var(--f-head); color: var(--gold); font-size: .9rem; display: block; }

.rel-group { margin-bottom: .75rem; }
.rel-group h4 { margin: 0 0 .3rem; font-size: .92rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.rel-group h4 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rel-group ul { list-style: none; margin: 0; padding: 0; }
.rel-group li { padding: .15rem 0; }
.rel-group li a { font-family: var(--f-lit); font-size: 1.05rem; }
.rel-group li .ref { font-size: .75rem; color: var(--muted); margin-inline-start: .3rem; }

.net { width: 100%; height: auto; display: block; }
.net text { font-family: var(--f-body); font-size: 14px; fill: var(--ink); }
.net .ctr text { font-family: var(--f-lit); font-size: 17px; font-weight: 700; fill: #fff; }
.net-card .legend { justify-content: center; margin-top: .3rem; }
@media (max-width: 700px) { .net-card { display: none; } }
.net a:hover text { fill: var(--terra); }
.net a:hover circle { stroke: var(--terra); stroke-width: 3; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .8rem; color: var(--muted); }
.legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; margin-inline-end: .3rem; vertical-align: middle; }

/* family colours */
.fam-sub { --fam: var(--teal); }
.fam-ent { --fam: var(--gold); }
.fam-use { --fam: var(--lapis); }
.fam-rel { --fam: var(--plum); }

/* ------------------------------------------------------------ frames */
.f-head { text-align: center; }
.f-title { font-family: var(--f-lit); font-weight: 700; font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin: .2rem 0 .5rem; color: var(--lapis); }
.f-head .chips { justify-content: center; }
.pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { padding: .15rem .75rem; border-radius: 999px; background: #fffdf8; border: 1px solid var(--line); font-size: .95rem; }
.pill.core { border-color: var(--lapis); background: var(--lapis-l); }
.pill.peri { border-color: #d6c49b; }
.pill.extra { border-style: dashed; }
.lu-groups { display: grid; gap: .7rem; }
.lu-groups h4 { margin: 0 0 .3rem; font-size: .88rem; color: var(--muted); font-weight: 400; }
.mlist { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 1.4rem; }
.mlist li { break-inside: avoid; padding: .18rem 0; }
.mlist li a { font-family: var(--f-lit); font-size: 1.05rem; }
.align { display: flex; flex-wrap: wrap; gap: .6rem; }
.align a { display: flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-radius: 12px; background: var(--teal-l); color: var(--teal); border: 1px solid #bfe0db; }
.align a:hover { background: var(--teal); color: #fff; }
.align svg { width: 18px; height: 18px; flex: none; color: var(--gold); --star-in: var(--teal-l); --star-core: var(--gold); }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th { text-align: start; font-family: var(--f-head); font-weight: 500; color: var(--muted); border-bottom: 2px solid var(--line); padding: .35rem .5rem; }
.tbl td { border-bottom: 1px solid #efe4cc; padding: .4rem .5rem; vertical-align: top; }
.tbl tr:hover td { background: #fffbf1; }

/* ------------------------------------------------------------ browse & search */
.page-h { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin: .3rem 0 1rem; }
.page-h h1 { font-family: var(--f-lit); font-weight: 700; color: var(--lapis); margin: 0; font-size: 1.9rem; }
.page-h .sub { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; margin-bottom: .8rem; }
.filters .fl { font-size: .85rem; color: var(--muted); }
.filters .chip { cursor: pointer; }
.filters .chip.on { background: var(--lapis); color: var(--gold-l); border-color: var(--lapis); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .7rem; }
.mcard { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .95rem; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; }
.mcard:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(60, 38, 8, .6); border-color: var(--gold); color: var(--ink); }
.mcard .nm { font-family: var(--f-lit); font-size: 1.15rem; font-weight: 700; line-height: 1.6; }
.mcard .nm .t { color: var(--lapis); }
.mcard .nm .s { color: var(--terra); }
.mcard .nm .c { color: var(--gold); font-weight: 400; }
.mcard .chips { margin-top: .3rem; }
.mcard.ref { opacity: .8; border-style: dashed; }
.pager { display: flex; justify-content: center; gap: .4rem; margin-top: 1.2rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 2.3rem; text-align: center; padding: .2rem .6rem; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.pager span.on { background: var(--lapis); color: var(--gold-l); border-color: var(--lapis); }
.res-group { margin-bottom: 1rem; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .25rem 1.2rem; }
.res-list li { padding: .2rem 0; border-bottom: 1px dotted #eadcbc; }
.res-list .w { font-family: var(--f-lit); font-weight: 700; color: var(--terra); }
.res-list .arrow { color: var(--gold); margin: 0 .3rem; }
.res-ex { list-style: none; margin: 0; padding: 0; }
.res-ex li { padding: .45rem 0; border-bottom: 1px dotted #eadcbc; }
.res-ex .txt { font-family: var(--f-lit); font-size: 1.08rem; display: block; }
.res-ex .src { font-size: .85rem; }
mark { background: #f9e5a6; color: inherit; border-radius: 3px; padding: 0 .1rem; }

/* ------------------------------------------------------------ editing */
.ef { position: relative; }
.ef.is-ed { background: linear-gradient(transparent 62%, rgba(232, 207, 143, .55) 62%); }
.ed-tools { display: inline-flex; gap: .15rem; vertical-align: middle; margin-inline-start: .3rem; }
.ed-btn { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: #fffdf6; color: var(--gold); cursor: pointer; padding: 0; vertical-align: middle; }
.ed-btn:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.ed-btn svg { width: 15px; height: 15px; }
.ed-flag { font-size: .7rem; background: var(--gold-l); color: #5c420b; border-radius: 999px; padding: 0 .45rem; margin-inline-start: .3rem; vertical-align: middle; font-family: var(--f-body); font-weight: 400; }
.editing { display: block; background: #fffdf6; border: 1.5px solid var(--gold); border-radius: 12px; padding: .6rem; margin: .3rem 0; font-family: var(--f-body); font-size: 1rem; font-weight: 400; text-align: start; }
.editing textarea, .editing input[type=text], .modal textarea, .modal input[type=text], .modal input[type=password] { width: 100%; font: inherit; font-size: 1.05rem; line-height: 1.8; padding: .5rem .7rem; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); direction: rtl; resize: vertical; }
.editing textarea:focus, .modal textarea:focus, .modal input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,131,42,.18); }
.editing .row, .modal .row { display: flex; gap: .5rem; margin-top: .55rem; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--lapis); background: var(--lapis); color: #fff; border-radius: 10px; padding: .32rem 1rem; cursor: pointer; font-size: .95rem; display: inline-flex; align-items: center; gap: .35rem; }
.btn:hover { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.ghost { background: transparent; color: var(--lapis); }
.btn.ghost:hover { background: var(--lapis-l); color: var(--lapis); }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.note { font-size: .82rem; color: var(--muted); }
.banner { display: flex; gap: .7rem; align-items: center; background: var(--gold-xl); border: 1px solid #ecd9ad; border-radius: 12px; padding: .55rem .9rem; margin-bottom: 1rem; font-size: .92rem; }
.banner.lapis { background: var(--lapis-l); border-color: #c9dae9; }
.banner svg { width: 20px; height: 20px; color: var(--gold); flex: none; }

.modal { position: fixed; inset: 0; background: rgba(11, 25, 40, .55); display: grid; place-items: center; z-index: 80; padding: 1rem; backdrop-filter: blur(2px); }
.modal[hidden] { display: none; }
.modal .dlg { width: min(560px, 100%); max-height: 88vh; overflow: auto; background: var(--paper); border-radius: 18px; border: 2px solid var(--gold-l); padding: 1.3rem 1.5rem; box-shadow: 0 30px 70px -30px rgba(0,0,0,.6); }
.modal .dlg.wide { width: min(880px, 100%); }
.modal h3 { font-family: var(--f-head); color: var(--lapis); margin: 0 0 .7rem; }
.modal label { display: block; margin: .5rem 0 .2rem; font-size: .9rem; color: var(--muted); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { border-bottom: 1px dotted var(--line); padding: .5rem 0; font-size: .92rem; }
.hist .old { color: #8a3b22; text-decoration: line-through; text-decoration-color: rgba(138,59,34,.45); }
.hist .new { color: #135c3a; }
.hist .when { color: var(--muted); font-size: .8rem; }
.toast { position: fixed; bottom: 1.2rem; inset-inline-start: 50%; transform: translateX(50%) translateY(150%); opacity: 0; visibility: hidden; background: var(--lapis-d); color: #fff; padding: .55rem 1.2rem; border-radius: 999px; border: 1px solid var(--gold-l); transition: transform .3s, opacity .3s; z-index: 90; font-size: .95rem; }
.toast.show { transform: translateX(50%) translateY(0); opacity: 1; visibility: visible; }
.toast.err { background: var(--terra); }

/* ------------------------------------------------------------ footer */
.foot { background: var(--lapis-d); color: #d8e1ea; margin-top: 2rem; }
.foot-in { max-width: 1240px; margin: auto; padding: 1.2rem; font-size: .92rem; text-align: center; }
.foot-in p { margin: .3rem 0; }
.foot a { color: var(--gold-l); }
.foot-star { width: 16px; height: 16px; color: var(--gold-l); vertical-align: -2px; margin-inline-end: .3rem; }

@media (max-width: 860px) {
  body { font-size: 16px; }
  .top-in { gap: .6rem; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: center; }
  .tools { margin-inline-start: auto; }
  .arch { padding: 2.4rem 1.1rem 1.6rem; border-radius: 300px 300px 18px 18px / 160px 160px 18px 18px; }
  .ent { grid-template-columns: 1fr; }
  .maps { grid-template-columns: minmax(0,1fr) 34px minmax(0,1fr); }
}
@media print {
  .top, .foot, .ed-tools, .hsearch, .seg, .btn-editor { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

.subh { margin: .9rem 0 .35rem; font-size: .88rem; color: var(--muted); font-weight: 400; }

@media (max-width: 860px) {
  .top { position: static; }
  .bridge .mid svg { display: none; }
  .bridge .mid .cop { position: static; transform: none; }
}

/* ------------------------------------------------------------ Arabic attestations (Quran, poetry) */
.att-card { border-color: var(--gold-l); background: linear-gradient(180deg, #fffdf6, var(--paper)); }
.att-split, .att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: .8rem; align-items: start; }
.att { position: relative; border: 1px solid #ecdcb6; border-radius: 14px; padding: .9rem 1.1rem .7rem; background: #fffefa; margin-bottom: .8rem; border-inline-start: 5px solid var(--teal); }
.att-split .att, .att-grid .att { margin-bottom: 0; }
.att.poetry { border-inline-start-color: var(--terra); }
.aya { font-family: var(--f-lit); font-size: 1.42rem; line-height: 2.25; color: #173b2f; text-align: center; }
.aya .br { color: var(--gold); font-size: 1.5rem; margin: 0 .25rem; }
.bayt { font-family: var(--f-lit); font-size: 1.3rem; line-height: 2.1; display: flex; flex-wrap: wrap; justify-content: space-around; align-items: center; gap: .2rem 1.2rem; color: #4a2315; text-align: center; }
.bayt i.sep { width: 14px; height: 14px; background: url("img/star.svg") center / contain no-repeat; flex: none; opacity: .85; }
mark.focus { background: linear-gradient(transparent 58%, rgba(232, 207, 143, .85) 58%); color: inherit; font-weight: 700; padding: 0; border-radius: 0; }
.att.poetry mark.focus { background: linear-gradient(transparent 58%, rgba(226, 160, 136, .6) 58%); }
.att-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .45rem; }
.att-ref { font-size: .85rem; font-weight: 700; color: var(--teal); }
.att-ref.poetry { color: var(--terra); }
.att-note { margin: .4rem 0 0; font-size: .95rem; color: #4d4233; }
.att-tools { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed var(--line); font-size: .9rem; }
.featured .att { margin-top: .6rem; }
.chip.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.pill.qr { border-color: var(--teal); background: var(--teal-l); color: #0e4b49; }

.aya .dots { color: var(--gold); font-family: var(--f-body); }
.aya-btn { display: block; margin: .1rem auto 0; border: 0; background: none; color: var(--teal); font: inherit; font-family: var(--f-body); font-size: .8rem; cursor: pointer; text-decoration: underline dotted; }
.aya-btn:hover { color: var(--terra); }
.aya [hidden] { display: none; }
