/* =========================================================
   إجابات — مدوّنة ميثاق العسر | واجهة الموقع
   Scholarly, modern RTL Arabic site
   ========================================================= */

:root {
  --bg:        #f5f1e8;
  --surface:   #fffdf7;
  --surface-2: #f0ebdd;
  --text:      #1d2926;
  --muted:     #5f6f69;
  --primary:   #0e5247;
  --primary-d: #0a3a32;
  --primary-l: #e3efeb;
  --accent:    #b08428;
  --accent-l:  #f3e9d0;
  --border:    #e6dfcd;
  --shadow:    0 1px 3px rgba(20,40,35,.06), 0 8px 24px rgba(20,40,35,.06);
  --shadow-lg: 0 4px 12px rgba(20,40,35,.08), 0 16px 48px rgba(20,40,35,.10);

  --font-serif: "Amiri", "Noto Naskh Arabic", Georgia, serif;
  --font-sans:  "Tajawal", "Segoe UI", system-ui, sans-serif;

  --maxw: 1180px;
  --read: 760px;
  --radius:   14px;
  --radius-sm: 9px;
  --gap: 1.5rem;
  --header-h: 70px;
  --t: .25s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:        #10171a;
  --surface:   #182125;
  --surface-2: #1f2a2e;
  --text:      #e9e7df;
  --muted:     #9baba5;
  --primary:   #45a896;
  --primary-d: #61c2af;
  --primary-l: #1a302c;
  --accent:    #d8ac56;
  --accent-l:  #2a2417;
  --border:    #2a373b;
  --shadow:    0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.35), 0 16px 48px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg); color: var(--text);
  line-height: 1.75; font-size: 17px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background var(--t), color var(--t);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--primary); color: #fff; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.25rem; }
.section-title {
  font-family: var(--font-serif); font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--text); margin-bottom: .35rem; font-weight: 700;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 1.25rem; flex-wrap: wrap; }
.section-head .more-link { color: var(--primary); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.section-sub { color: var(--muted); font-size: .95rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .65rem; }
.brand .mark {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff; border-radius: 13px; font-size: 1.5rem; font-family: var(--font-serif);
  font-weight: 700; box-shadow: var(--shadow);
}
.brand b { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 700; line-height: 1; color: var(--text); }
.brand span { display: block; font-size: .72rem; color: var(--muted); margin-top: 3px; }

.nav { display: flex; align-items: center; gap: .2rem; margin-inline-start: auto; }
.nav a {
  padding: .5rem .9rem; border-radius: 8px; color: var(--muted);
  font-weight: 500; font-size: .96rem; transition: var(--t);
}
.nav a:hover, .nav a.active { color: var(--primary); background: var(--primary-l); }
.nav .cta { background: var(--primary); color: #fff; }
.nav .cta:hover { background: var(--primary-d); color: #fff; }

.icon-btn {
  width: 42px; height: 42px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; cursor: pointer; display: grid; place-items: center; color: var(--text);
  transition: var(--t); flex: none;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn svg { width: 20px; height: 20px; }
.sun { display: none; } .moon { display: block; }
[data-theme="dark"] .sun { display: block; } [data-theme="dark"] .moon { display: none; }
.menu-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 380px at 100% -10%, var(--primary-l), transparent 60%),
    radial-gradient(900px 320px at -5% 10%, var(--accent-l), transparent 55%);
  border-bottom: 1px solid var(--border);
  padding: clamp(2.5rem, 6vw, 4.5rem) 0; text-align: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; color: var(--primary);
  background: var(--surface); border: 1px solid var(--border); padding: .35rem .9rem;
  border-radius: 999px; font-size: .85rem; font-weight: 500; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.hero h1 {
  font-family: var(--font-serif); font-weight: 700; font-size: clamp(2.3rem, 6vw, 3.8rem);
  line-height: 1.18; color: var(--text); letter-spacing: -.5px;
}
.hero .lede { max-width: 660px; margin: 1.1rem auto 0; font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--muted); font-family: var(--font-serif); }
.hero .sig { margin-top: 1.5rem; font-family: var(--font-serif); font-size: 1.15rem; color: var(--accent); font-style: italic; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.75rem; flex-wrap: wrap; }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-top: 2.25rem; flex-wrap: wrap; }
.hero-stats .stat b { display: block; font-family: var(--font-serif); font-size: 2rem; color: var(--primary); line-height: 1; }
.hero-stats .stat span { font-size: .85rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.4rem;
  border-radius: 999px; font-weight: 600; font-size: .98rem; cursor: pointer;
  border: 1px solid transparent; transition: var(--t);
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-d); color: #fff; transform: translateY(-2px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Toolbar ---------- */
.toolbar { padding: 2rem 0 .5rem; }
.search-box { position: relative; max-width: 540px; margin: 0 auto 1.5rem; }
.search-box svg { position: absolute; inset-inline-start: 1rem; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; padding: .85rem 3rem .85rem 1rem; font-family: var(--font-sans); font-size: 1rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); transition: var(--t);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-l); }

.cats { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; }
.cat-pill {
  padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: .9rem; font-weight: 500; color: var(--muted);
  transition: var(--t); white-space: nowrap;
}
.cat-pill:hover { border-color: var(--primary); color: var(--primary); }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cat-pill .n { opacity: .65; font-size: .8em; margin-inline-start: .25rem; }

/* ---------- Grid + Cards ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.grid.books { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-media.noimg { display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-l), var(--accent-l)); }
.card-media.noimg span { font-family: var(--font-serif); font-size: 2.4rem; color: var(--primary); opacity: .55; }
.card-body { padding: 1.3rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.badge { align-self: flex-start; font-size: .75rem; font-weight: 500; color: var(--primary); background: var(--primary-l); padding: .25rem .7rem; border-radius: 999px; }
.card h3 { font-family: var(--font-serif); font-weight: 700; font-size: 1.3rem; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card p { color: var(--muted); font-size: .95rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .more { margin-top: auto; padding-top: .6rem; color: var(--primary); font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: .35rem; }
.card .more svg { width: 16px; height: 16px; transition: transform var(--t); }
.card:hover .more svg { transform: translateX(-4px); }
.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); grid-column: 1/-1; }

/* ---------- Book cards ---------- */
.book-card { text-align: center; }
.book-cover { aspect-ratio: 3/4.2; border-radius: var(--radius-sm); overflow: hidden; background: linear-gradient(135deg, var(--primary), var(--primary-d)); box-shadow: var(--shadow); position: relative; display: grid; place-items: center; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .ph { color: #fff; opacity: .85; text-align: center; padding: 1rem; }
.book-cover .ph svg { width: 42px; height: 42px; margin: 0 auto .5rem; }
.book-card h3 { font-family: var(--font-serif); font-size: 1.1rem; margin-top: .8rem; line-height: 1.4; color: var(--text); }
.book-card .author { color: var(--muted); font-size: .85rem; margin-top: .2rem; }

/* ---------- Article page ---------- */
.article-hero { padding: 2.5rem 0 1rem; }
.breadcrumb { display: flex; gap: .4rem; flex-wrap: wrap; color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.breadcrumb a:hover { color: var(--primary); }
.article-hero h1 { font-family: var(--font-serif); font-weight: 700; font-size: clamp(1.9rem, 4.5vw, 2.9rem); line-height: 1.3; color: var(--text); }
.article-hero .meta { margin-top: 1rem; display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.article-hero .meta span { display: inline-flex; align-items: center; gap: .4rem; }
.article-hero .meta svg { width: 16px; height: 16px; }
.feat-img { max-width: var(--read); margin: 1.5rem auto 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); cursor: zoom-in; border: 1px solid var(--border); }

.article-body { max-width: var(--read); margin: 2rem auto 0; font-family: var(--font-serif); font-size: 1.3rem; line-height: 2.1; }
.article-body p { margin-bottom: 1.4rem; text-align: justify; }
.article-body h2, .article-body h3 { font-family: var(--font-serif); color: var(--primary-d); margin: 1.8rem 0 .8rem; }
.article-body blockquote { border-inline-start: 4px solid var(--accent); padding-inline-start: 1.2rem; margin: 1.5rem 0; color: var(--muted); font-style: italic; }

/* ---------- Sources box ---------- */
.sources-box { max-width: var(--read); margin: 2.5rem auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.sources-box h3 { font-family: var(--font-serif); font-size: 1.3rem; color: var(--primary); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.sources-box h3 svg { width: 22px; height: 22px; }
.sources-box ol { list-style: none; counter-reset: src; display: flex; flex-direction: column; gap: .7rem; }
.sources-box li { counter-increment: src; display: flex; gap: .75rem; align-items: flex-start; }
.sources-box li::before { content: counter(src); flex: none; width: 26px; height: 26px; display: grid; place-items: center; background: var(--primary-l); color: var(--primary); border-radius: 50%; font-size: .8rem; font-weight: 700; font-family: var(--font-sans); }
.sources-box .src-name { font-weight: 600; color: var(--primary); transition: var(--t); }
.sources-box a.src-name:hover { color: var(--accent); }
.sources-box .src-loc { color: var(--muted); font-size: .9rem; }

/* ---------- Article image gallery ---------- */
.gallery-grid { max-width: var(--read); margin: 2rem auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.gallery-grid figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); cursor: zoom-in; background: var(--surface); }
.gallery-grid img { width: 100%; height: 220px; object-fit: cover; display: block; }
.gallery-grid figcaption { padding: .6rem .8rem; font-size: .88rem; color: var(--muted); text-align: center; }

/* ---------- Figures chips ---------- */
.figures-bar { max-width: var(--read); margin: 1.75rem auto 0; }
.figures-bar .lbl { color: var(--muted); font-size: .9rem; margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem; }
.figures-bar .lbl svg { width: 17px; height: 17px; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; color: var(--accent); background: var(--accent-l); padding: .35rem .85rem; border-radius: 999px; transition: var(--t); }
.chip:hover { background: var(--accent); color: #fff; }

/* ---------- Article nav ---------- */
.article-nav { max-width: var(--read); margin: 3rem auto 0; padding-top: 2rem; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.article-nav a { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; transition: var(--t); }
.article-nav a:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.article-nav .dir { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .35rem; }
.article-nav .dir svg { width: 15px; height: 15px; }
.article-nav .t { font-family: var(--font-serif); font-weight: 700; margin-top: .35rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-nav .prev { text-align: end; } .article-nav .prev .dir { justify-content: flex-end; }

/* ---------- Page header (listing pages) ---------- */
.page-head { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 2.5rem 0; text-align: center; }
.page-head h1 { font-family: var(--font-serif); font-size: clamp(1.9rem, 4vw, 2.7rem); color: var(--text); }
.page-head p { color: var(--muted); margin-top: .5rem; max-width: 620px; margin-inline: auto; }

/* ---------- Forms ---------- */
.form-card { max-width: 640px; margin: 2.5rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 600; margin-bottom: .5rem; font-size: .95rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 1rem; transition: var(--t);
}
.field select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: left 1rem center, left .7rem center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-left: 2.2rem; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-l); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
.chk-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.chk-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; font-size: .9rem; transition: var(--t); background: var(--bg); user-select: none; }
.chk-chip input { width: auto; margin: 0; accent-color: var(--primary); }
.chk-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-l); color: var(--primary-d); font-weight: 600; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }
.field .err { color: #c0392b; font-size: .85rem; margin-top: .35rem; }
.alert { padding: 1rem 1.25rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-weight: 500; }
.alert-success { background: var(--primary-l); color: var(--primary-d); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }

/* ---------- Q&A ---------- */
.qa-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.qa-q { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 700; color: var(--text); display: flex; gap: .6rem; }
.qa-q .ic { color: var(--primary); flex: none; }
.qa-a { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); color: var(--muted); line-height: 1.9; }

/* ---------- PDF viewer ---------- */
.book-detail { display: grid; grid-template-columns: 280px 1fr; gap: 2.5rem; padding: 2.5rem 0; align-items: start; }
.book-detail .cover { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); position: sticky; top: calc(var(--header-h) + 1rem); }
.book-detail h1 { font-family: var(--font-serif); font-size: clamp(1.7rem, 3.5vw, 2.4rem); color: var(--text); }
.book-detail .author { color: var(--accent); font-size: 1.1rem; margin-top: .4rem; }
.book-meta { display: flex; gap: 1.5rem; margin: 1.25rem 0; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.book-desc { line-height: 1.9; margin: 1.25rem 0; }
.pdf-frame { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 1.5rem; box-shadow: var(--shadow); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .35rem; justify-content: center; margin: 2.5rem 0; flex-wrap: wrap; list-style: none; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 .6rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .9rem; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled span { opacity: .4; }
.infinite-status { text-align: center; color: var(--muted); font-size: .9rem; margin: 1.5rem 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); padding: 3rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { font-family: var(--font-serif); font-size: 1.2rem; color: var(--text); margin-bottom: .9rem; }
.footer-col p { color: var(--muted); font-size: .92rem; line-height: 1.8; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { color: var(--muted); font-size: .92rem; transition: var(--t); }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.5rem; text-align: center; color: var(--muted); font-size: .88rem; }
.footer-bottom .sig { font-family: var(--font-serif); color: var(--accent); font-size: 1.1rem; margin-bottom: .5rem; }

/* ---------- Lightbox + totop ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(8,14,12,.92); display: none; place-items: center; padding: 2rem; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 95%; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.totop { position: fixed; inset-block-end: 1.5rem; inset-inline-start: 1.5rem; z-index: 90; width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(10px); transition: var(--t); }
.totop.show { opacity: 1; visibility: visible; transform: translateY(0); }
.totop svg { width: 22px; height: 22px; }

.pad { padding: 1.5rem 0 4rem; }

/* ---------- CMS page content (RichEditor HTML) ---------- */
.page-content { font-size: 1.15rem; line-height: 2.05; color: var(--text); }
.page-content h2 { font-family: var(--font-serif); font-size: 1.6rem; color: var(--primary); margin: 1.8rem 0 .7rem; }
.page-content h3 { font-family: var(--font-serif); font-size: 1.3rem; color: var(--primary-d); margin: 1.4rem 0 .6rem; }
.page-content p { margin-bottom: 1.1rem; }
.page-content ul, .page-content ol { margin: 0 1.5rem 1.1rem; }
.page-content li { margin-bottom: .5rem; }
.page-content a { color: var(--primary); text-decoration: underline; }
.page-content blockquote { border-inline-start: 4px solid var(--accent); padding-inline-start: 1.1rem; color: var(--muted); font-style: italic; margin: 1.2rem 0; }
.page-content strong { color: var(--primary-d); }
.page-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 1rem 0; }

/* ---------- Reading progress bar ---------- */
.read-progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 110;
  width: 0%; background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width .1s linear;
}

/* ---------- Font size controls ---------- */
.font-controls { display: inline-flex; gap: .2rem; align-items: center; margin-inline-start: auto; }
.font-controls button {
  width: 30px; height: 28px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 7px; cursor: pointer; font-family: var(--font-serif);
  font-size: .9rem; transition: var(--t);
}
.font-controls button:hover { border-color: var(--primary); color: var(--primary); }
.article-body { font-size: calc(1.3rem * var(--font-scale, 1)); }

/* ---------- In-body auto-links ---------- */
.entity-link { color: var(--primary); border-bottom: 1px dotted color-mix(in srgb, var(--primary) 50%, transparent); }
.entity-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Tags ---------- */
.tags-row { max-width: var(--read); margin: 1.75rem auto 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.tag-pill {
  font-size: .85rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  padding: .3rem .8rem; border-radius: 999px; transition: var(--t);
}
.tag-pill:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Share bar ---------- */
.share-bar { max-width: var(--read); margin: 1.5rem auto 0; display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.share-label { color: var(--muted); font-size: .9rem; font-weight: 600; }
.share-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center; cursor: pointer; transition: var(--t);
}
.share-btn svg { width: 19px; height: 19px; }
.share-btn:hover { transform: translateY(-3px); color: #fff; }
.share-btn.wa:hover { background: #25d366; border-color: #25d366; }
.share-btn.tg:hover { background: #229ed9; border-color: #229ed9; }
.share-btn.tw:hover { background: #111; border-color: #111; }
.share-btn.fb:hover { background: #1877f2; border-color: #1877f2; }
.share-btn.copy:hover { background: var(--primary); border-color: var(--primary); }
.share-btn.copied { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Footer social ---------- */
.social-row { display: flex; gap: .5rem; margin-top: 1rem; }
.social-ic {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg);
  color: var(--muted); display: grid; place-items: center; transition: var(--t);
}
.social-ic svg { width: 18px; height: 18px; }
.social-ic:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-3px); }

/* ---------- Instant search ---------- */
.search-box .results {
  position: absolute; inset-inline: 0; top: calc(100% + .5rem); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; display: none;
}
.search-box .results.open { display: block; }
.search-box .results a {
  display: flex; flex-direction: column; gap: .15rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border);
  transition: var(--t);
}
.search-box .results a:last-child { border-bottom: none; }
.search-box .results a:hover { background: var(--primary-l); }
.search-box .results .r-title { font-family: var(--font-serif); font-weight: 700; color: var(--text); font-size: .98rem; }
.search-box .results .r-cat { font-size: .78rem; color: var(--accent); }
.search-box .results .r-empty { padding: .9rem 1rem; color: var(--muted); font-size: .9rem; }

/* ---------- Series box ---------- */
.series-box {
  max-width: var(--read); margin: 2rem auto 0; background: var(--accent-l); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius); padding: 1.3rem 1.5rem;
}
.series-box h3 { font-family: var(--font-serif); color: var(--accent); margin-bottom: .8rem; }
.series-box ol { margin: 0; padding-inline-start: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.series-box li.current { font-weight: 700; color: var(--primary); }
.series-box a:hover { color: var(--primary); }

/* ---------- Subscribe ---------- */
.amount-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.amount-row .cur { font-family: var(--font-serif); font-size: 1.8rem; color: var(--primary); font-weight: 700; }
.amount-row input { width: 130px; font-size: 1.6rem; font-weight: 700; text-align: center; padding: .5rem; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.amount-row input:focus { outline: none; border-color: var(--primary); }
.amount-row .per { color: var(--muted); }
.pay-buttons { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ---------- OKX pay page ---------- */
.okx-amount { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.okx-addr { display: flex; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.okx-addr code { flex: 1; word-break: break-all; font-size: .9rem; color: var(--text); }
.okx-copy { flex: none; font-size: .8rem; padding: .3rem .7rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); cursor: pointer; }
.okx-copy:hover { border-color: var(--primary); }
.okx-qr { display: grid; place-items: center; margin: 1.25rem 0; }
.okx-qr canvas { border: 8px solid #fff; border-radius: 10px; box-shadow: var(--shadow); }
.okx-status { margin-top: 1rem; color: var(--muted); font-size: .95rem; display: flex; align-items: center; gap: .5rem; justify-content: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: okxspin 0.8s linear infinite; }
@keyframes okxspin { to { transform: rotate(360deg); } }

/* ---------- Premium paywall ---------- */
/* Client-side meter: paywall hidden until JS marks <html> over the free-read limit. */
.paywall { display: none; }
html.metered-locked .paywall { display: block; }
html.metered-locked .article-body {
  /* ~4 lines — short pieces (a few lines) get clipped too, not just long ones. */
  max-height: 170px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

/* Featured image, gallery, and video are outside .article-body — blur them too. */
html.metered-locked .feat-img,
html.metered-locked .gallery-grid figure,
html.metered-locked .article-video .video-frame {
  position: relative;
}
html.metered-locked .feat-img img,
html.metered-locked .gallery-grid img,
html.metered-locked .article-video .video-frame > * {
  filter: blur(22px); pointer-events: none; user-select: none;
}
html.metered-locked .feat-img::after,
html.metered-locked .gallery-grid figure::after,
html.metered-locked .article-video .video-frame::after {
  content: "🔒 محتوى للمشتركين"; position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
  color: #fff; font-family: var(--font-sans); font-weight: 600; font-size: 1rem;
  background: rgba(0, 0, 0, .25); text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
/* Sources/citations list — same lock treatment as the media above. */
html.metered-locked .sources-box ol {
  filter: blur(6px); pointer-events: none; user-select: none;
  max-height: 130px; overflow: hidden;
}
html.metered-locked .sources-box::before {
  content: "🔒 المصادر والمراجع خاصّة بالمشتركين"; position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
  color: #fff; font-family: var(--font-sans); font-weight: 600; font-size: 1rem;
  background: rgba(0, 0, 0, .35); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); border-radius: inherit;
}

.paywall {
  max-width: var(--read); margin: 1.5rem auto 0; text-align: center;
  background: linear-gradient(180deg, transparent, var(--surface) 30%);
  border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  padding: 2.5rem 1.5rem; position: relative; margin-top: -3rem;
}
.paywall::before { content: ""; position: absolute; top: -3rem; inset-inline: 0; height: 3rem; background: linear-gradient(180deg, transparent, var(--surface)); }
.paywall .lock { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-l); color: var(--accent); display: grid; place-items: center; margin: 0 auto 1rem; }
.paywall .lock svg { width: 28px; height: 28px; }
.paywall h3 { font-family: var(--font-serif); font-size: 1.5rem; color: var(--text); margin-bottom: .5rem; }
.paywall p { color: var(--muted); max-width: 460px; margin: 0 auto 1.25rem; }
.premium-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--accent); background: var(--accent-l); padding: .25rem .7rem; border-radius: 999px; font-weight: 600; }

/* ---------- Watermark notice ---------- */
.wm-notice {
  max-width: var(--read); margin: 1.5rem auto 0; padding: .6rem 1rem;
  font-size: .78rem; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--border); border-radius: var(--radius-sm); text-align: center;
}

/* ---------- AI assistant ---------- */
.ai-turn { margin-bottom: 1.25rem; }
.ai-turn .who { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
.ai-turn .bubble {
  padding: 1rem 1.25rem; border-radius: var(--radius); line-height: 2;
  border: 1px solid var(--border);
}
.ai-q .bubble { background: var(--primary-l); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.ai-a .bubble { background: var(--surface); font-family: var(--font-serif); font-size: 1.1rem; }
.ai-sources { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .82rem; color: var(--muted); }
.ai-sources a { color: var(--primary); background: var(--primary-l); padding: .25rem .7rem; border-radius: 999px; }
.ai-sources a:hover { background: var(--primary); color: #fff; }
.ai-ask { display: flex; gap: .6rem; align-items: stretch; margin-top: 1rem; }
.ai-ask textarea {
  flex: 1; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: 1rem; resize: vertical;
}
.ai-ask textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-l); }
.ai-ask button { align-self: flex-end; }

/* ---------- Most read ---------- */
.most-read { list-style: none; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.most-read a { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; transition: var(--t); }
.most-read a:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.most-read .rank { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; color: var(--accent); min-width: 1.6rem; text-align: center; }
.most-read .mr-title { display: block; font-family: var(--font-serif); font-weight: 700; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.most-read .mr-meta { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ---------- Entity show enrichment ---------- */
.entity-hero { display: flex; gap: 1.5rem; align-items: center; justify-content: center; flex-wrap: wrap; text-align: start; }
.entity-hero .photo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: var(--shadow-lg); }
.entity-hero .photo-ph { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-l); color: var(--primary); }
.entity-hero .photo-ph svg { width: 48px; height: 48px; }

/* ---------- Lens pair (الحقيقي / المذهبي) ---------- */
.lens-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.lens-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem 1.5rem; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.lens-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.lens-card .entity-name { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700; color: var(--text); }
.lens-card:nth-child(odd) { border-top: 4px solid var(--primary); }
.lens-card:nth-child(even) { border-top: 4px solid var(--accent); }

/* ---------- Homepage directory (أبواب الموقع) ---------- */
.dir-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.dir-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.dir-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.dir-card .ic { font-size: 2rem; flex: none; width: 56px; height: 56px; display: grid; place-items: center; background: var(--primary-l); border-radius: 14px; }
.dir-card .t { font-family: var(--font-serif); font-weight: 700; font-size: 1.25rem; color: var(--text); }
.dir-card .c { color: var(--muted); font-size: .85rem; }

/* ---------- Entity grid (figures / sources) ---------- */
.entity-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.entity-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1rem; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.entity-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.entity-ic {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-l); color: var(--primary); margin-bottom: .3rem;
}
.entity-ic svg { width: 26px; height: 26px; }
.entity-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; color: var(--text); line-height: 1.4; }
.entity-sub { color: var(--muted); font-size: .82rem; }
.entity-count { font-size: .82rem; color: var(--accent); background: var(--accent-l); padding: .2rem .7rem; border-radius: 999px; }

/* =========================================================
   Islamic ornaments / زخارف إسلامية
   ========================================================= */
.hero, .page-head { position: relative; overflow: hidden; }
.hero::before, .page-head::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: url("/img/pattern-star.svg");
  background-size: 80px 80px; opacity: .5; pointer-events: none;
}
.hero > .wrap, .page-head > .wrap { position: relative; z-index: 1; }
[data-theme="dark"] .hero::before, [data-theme="dark"] .page-head::before { opacity: .35; }

/* Decorative band beneath the header */
.bismillah-band {
  height: 6px;
  background:
    linear-gradient(90deg, transparent, var(--accent) 20%, var(--primary) 50%, var(--accent) 80%, transparent);
  opacity: .85;
}

/* Ornamental divider with a central 8-point star (خاتم) */
.ornament-divider {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: 2.5rem auto; max-width: 520px; color: var(--accent);
}
.ornament-divider .line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent));
}
.ornament-divider .line:last-child { transform: scaleX(-1); }
.ornament-divider svg { width: 34px; height: 34px; flex: none; }

/* Faint patterned backdrop for boxed content, kept readable via an overlay */
.sources-box, .form-card {
  position: relative;
  background-image: url("/img/pattern-star.svg");
  background-size: 80px 80px;
  background-position: top left;
}
.sources-box::after, .form-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--surface); opacity: .955; z-index: 0; pointer-events: none;
}
.sources-box > *, .form-card > * { position: relative; z-index: 1; }

/* Section titles get a small star accent */
.section-title::before {
  content: "۞"; color: var(--accent); margin-inline-end: .5rem; font-size: .9em; opacity: .85;
}

/* Card top accent line on hover */
.card { border-top: 3px solid transparent; }
.card:hover { border-top-color: var(--accent); }

/* Hero mark gets an ornamental ring */
.brand .mark { position: relative; }
.hero .eyebrow::before, .hero .eyebrow::after { content: "۞"; opacity: .7; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .book-detail { grid-template-columns: 1fr; }
  .book-detail .cover { position: static; max-width: 240px; margin-inline: auto; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 720px) {
  .menu-toggle { display: grid; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: .25rem;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .75rem 1.25rem;
    box-shadow: var(--shadow-lg); transform: translateY(-130%); transition: transform var(--t); margin: 0;
  }
  .nav.open { transform: translateY(0); }
  .nav a { padding: .8rem 1rem; }
  .article-nav { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.5rem; }
  body { font-size: 16px; }
  .article-body { font-size: 1.18rem; line-height: 2; }
}

/* Brand logo (replaces the letter mark) */
.brand{gap:.7rem}
.brand .brand-logo{height:60px;width:auto;display:block;flex:0 0 auto}
@media (max-width:640px){ .brand .brand-logo{height:50px} }
[data-theme="dark"] .brand .brand-logo{filter:brightness(0) invert(1)}

/* ---------- Comments ---------- */
.comments-box{max-width:820px;margin:2.5rem auto 0}
.comments-box .c-count{color:var(--muted);font-weight:400;font-size:.9em}
.hp{position:absolute!important;left:-9999px!important;width:1px;height:1px;opacity:0}
.comment-form{background:var(--card,#fff);border:1px solid var(--border);border-radius:var(--radius,14px);padding:1rem;margin-bottom:1.5rem}
.comment-form textarea{width:100%;border:1px solid var(--border);border-radius:var(--radius-sm,10px);background:var(--bg);color:var(--text);
    font-family:var(--font-sans);padding:.8rem 1rem;line-height:1.9;resize:vertical;min-height:88px}
.comment-form .err{color:#c0392b;font-size:.85rem;margin-top:.4rem}
.comment-form .cf-actions{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-top:.75rem;flex-wrap:wrap}
.comment-form .cf-as{color:var(--muted);font-size:.85rem}
.comment-cta{background:var(--accent-l,#f3f7f5);border:1px solid var(--border);border-radius:var(--radius,14px);
    padding:1.1rem 1.2rem;margin-bottom:1.5rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.comment-cta p{margin:0;color:var(--text)}
.comment-list{display:flex;flex-direction:column;gap:1rem}
.comment{border:1px solid var(--border);border-radius:var(--radius,14px);padding:1rem 1.1rem;background:var(--card,#fff)}
.comment .c-head{display:flex;align-items:center;gap:.7rem;margin-bottom:.5rem}
.comment .c-avatar{flex:0 0 auto;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;
    background:var(--primary);color:#fff;font-weight:700;font-family:var(--font-serif,serif)}
.comment .c-meta{display:flex;flex-direction:column;line-height:1.3}
.comment .c-name{color:var(--primary);font-size:.98rem}
.comment .c-date{color:var(--muted);font-size:.78rem}
.comment .c-del{margin-inline-start:auto}
.comment .c-del button{background:none;border:none;color:var(--muted);font-size:.8rem;cursor:pointer;font-family:var(--font-sans)}
.comment .c-del button:hover{color:#c0392b}
.comment .c-body{margin:0;line-height:1.95;color:var(--text);white-space:pre-wrap;word-break:break-word}
.c-empty{color:var(--muted);text-align:center;padding:1.5rem 0}

/* ---------- Admin reply under a comment ---------- */
.c-reply{margin-top:.9rem;margin-inline-start:1.2rem;padding:.9rem 1rem;background:var(--accent-l,#f3f7f5);
    border:1px solid var(--border);border-inline-start:3px solid var(--primary);border-radius:var(--radius-sm,10px)}
.c-reply-head{display:flex;align-items:center;gap:.4rem;color:var(--primary);font-size:.85rem;margin-bottom:.5rem}
.c-reply-head svg{width:16px;height:16px}
.c-reply .c-body{font-size:.96rem}
.c-reply-img{display:block;max-width:100%;max-height:340px;border-radius:var(--radius-sm,10px);margin-top:.6rem}
.c-reply-video{position:relative;width:100%;max-width:480px;aspect-ratio:16/9;background:#000;
    border-radius:var(--radius-sm,10px);overflow:hidden;margin-top:.6rem}
.c-reply-video iframe,.c-reply-video video{position:absolute;inset:0;width:100%;height:100%;border:0}

/* ---------- Subscribe: primary card option ---------- */
.pay-primary-form{margin-top:.4rem}
.btn-lg{font-size:1.06rem;padding:.95rem 1.2rem}
.pay-badge{display:inline-block;font-size:.7rem;font-weight:600;background:rgba(255,255,255,.22);color:#fff;
    padding:.14rem .55rem;border-radius:999px;margin-inline-start:.45rem;vertical-align:middle}
.pay-note-cards{margin:.7rem 0 0;background:var(--accent-l,#eef5f1);
    border:1px solid color-mix(in srgb,var(--primary) 22%,transparent);border-inline-start:4px solid var(--primary);
    border-radius:var(--radius-sm,10px);padding:.72rem .9rem;color:var(--text);font-size:.86rem;line-height:1.85}
.pay-or{display:flex;align-items:center;gap:.8rem;color:var(--muted);font-size:.84rem;margin:1.15rem 0 .65rem}
.pay-or::before,.pay-or::after{content:"";flex:1;height:1px;background:var(--border)}

/* ---------- Article video embed ---------- */
.article-video{margin:1.6rem auto 0;max-width:820px}
.video-frame{position:relative;width:100%;aspect-ratio:16/9;background:#000;
    border-radius:var(--radius,14px);overflow:hidden;box-shadow:0 6px 24px rgba(0,0,0,.12)}
.video-frame iframe,.video-frame video{position:absolute;inset:0;width:100%;height:100%;border:0}
.article-video figcaption{color:var(--muted);font-size:.86rem;margin-top:.55rem;text-align:center}

/* ---------- Screenshot shield ---------- */
.shield-toast{position:fixed;left:50%;bottom:26px;transform:translate(-50%,18px);
    background:var(--primary);color:#fff;padding:.78rem 1.2rem;border-radius:999px;
    font-size:.9rem;font-family:var(--font-sans);box-shadow:0 10px 34px rgba(0,0,0,.22);
    opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:99999;max-width:92vw;text-align:center}
.shield-toast.show{opacity:1;transform:translate(-50%,0)}
body.shield-hidden .article-body,body.shield-hidden .pdf-frame{filter:blur(16px);transition:filter .12s}

/* ---------- Visible subscriber watermark (leak deterrent) ---------- */
.article-body.wm-on{position:relative}
.wm-overlay{position:absolute;inset:0;pointer-events:none;background-repeat:repeat;z-index:3;opacity:.11}
[data-theme="dark"] .wm-overlay{opacity:.16}
@media print{.wm-overlay{opacity:.28}}

/* ---------- Footer: visitors by country ---------- */
.footer-countries{margin:1.6rem 0 .4rem;padding-top:1.4rem;border-top:1px solid rgba(255,255,255,.12)}
.footer-countries>h4{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:0 0 .9rem;font-size:1rem}
.footer-countries .fc-total{font-weight:400;font-size:.82rem;opacity:.7}
.fc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:.55rem}
.fc-item{display:flex;align-items:center;gap:.5rem;padding:.5rem .7rem;border-radius:var(--radius-sm,10px);
    background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08)}
.fc-item .fc-flag{font-size:1.25rem;line-height:1}
.fc-item .fc-name{flex:1;font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.9}
.fc-item .fc-count{font-weight:700;font-size:.85rem;opacity:.95}

/* ---------- Anonymous comment ---------- */
.comment-form .anon-toggle{display:inline-flex;align-items:center;gap:.4rem;font-size:.85rem;color:var(--muted);cursor:pointer}
.comment-form .anon-toggle input{width:16px;height:16px;accent-color:var(--primary)}
.c-anon-tag{display:inline-block;font-size:.66rem;font-weight:600;background:var(--accent-l,#eef3f0);
    color:var(--accent,#5a7);padding:.06rem .45rem;border-radius:999px;margin-inline-start:.35rem;vertical-align:middle}
.c-avatar-anon{background:#8a8f98 !important}

/* ---------- Profile / renewal controls ---------- */
.radio-row{display:flex;align-items:center;gap:.55rem;padding:.45rem 0;cursor:pointer;font-size:.95rem;line-height:1.5}
.radio-row input{width:18px;height:18px;flex:0 0 auto;accent-color:var(--primary)}
.radio-row small{color:var(--muted)}
.switch-row{display:inline-flex;align-items:center;gap:.6rem;cursor:pointer}
.switch-row input{width:20px;height:20px;accent-color:var(--primary)}

/* ---------- Ads (non-subscribers only) ---------- */
.ad-slot{max-width:var(--read);margin:1.5rem auto;text-align:center}
.ad-slot-label{display:block;font-size:.68rem;color:var(--muted);letter-spacing:.05em;margin-bottom:.35rem;opacity:.7}

#ad-gate{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;
    background:var(--bg,#101915);padding:1.5rem;transition:opacity .35s ease}
#ad-gate.ad-gate-done{opacity:0;pointer-events:none}
.ad-gate-box{max-width:420px;width:100%;background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius);padding:1.75rem 1.5rem;text-align:center;box-shadow:var(--shadow-lg,0 10px 40px rgba(0,0,0,.25))}
.ad-gate-msg{font-family:var(--font-serif);font-size:1.15rem;color:var(--text);margin-bottom:1rem}
.ad-gate-msg #ad-gate-count{font-weight:700;color:var(--primary);font-size:1.35rem}
.ad-gate-hint{margin-top:1rem;font-size:.85rem;color:var(--muted)}
.ad-gate-hint a{color:var(--primary);font-weight:600}
