/* ============================================================
   فتاوى الشيخ صادق البيضاني — الهوية الجديدة
   "مكتب العالم" — رقّ + حبر + ذهبي
   Deep emerald / brass gold / parchment. Cairo UI + Scheherazade content.
   ============================================================ */

/* ---------- Self-hosted fonts ---------- */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cairo-arabic.woff2') format('woff2');
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cairo-latin.woff2') format('woff2');
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cairo-latin-ext.woff2') format('woff2');
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/noto-naskh-arabic-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/noto-naskh-arabic-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/noto-naskh-arabic-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/noto-naskh-arabic-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Scheherazade New';
    src: url('../fonts/scheherazade-new-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Scheherazade New';
    src: url('../fonts/scheherazade-new-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Scheherazade New';
    src: url('../fonts/scheherazade-new-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
    --ink-950: #14110b;
    --emerald-900: #16382a;
    --emerald-800: #1f4d36;
    --emerald-700: #28603f;
    --emerald-500: #3f7d58;
    --emerald-100: #dde9dd;
    --emerald-50:  #eef4ec;
    --brass-600:   #8f6b1f;
    --brass-500:   #b7882f;
    --brass-400:   #d0a04a;
    --brass-200:   #ecd9a8;
    --brass-100:   #f6ecd3;

    --color-bg: #f6f1e4;
    --color-surface: #fffdf5;
    --color-surface-2: #efe9d8;
    --color-text: #2c2a20;
    --color-heading: #211d12;
    --color-muted: #6f6a58;
    --color-border: #ddd5bf;
    --color-border-strong: #cfc4a6;

    --color-primary: var(--emerald-800);
    --color-primary-dark: var(--emerald-900);
    --color-primary-light: var(--emerald-100);
    --color-btn: var(--emerald-800);
    --color-btn-dark: var(--emerald-900);
    --color-btn-light: var(--emerald-100);
    --color-btn-text: #f8f3e6;
    --on-primary: #f8f3e6;
    --color-accent: var(--brass-500);
    --color-accent-dark: var(--brass-600);
    --color-accent-light: var(--brass-200);
    --on-accent: #fffdf5;

    --font-arabic: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-content: 'Scheherazade New', 'Amiri', 'Noto Naskh Arabic', serif;
    --font-title: 'Cairo', sans-serif;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-soft: 0 2px 10px rgba(40, 33, 15, .07);
    --shadow-lift: 0 14px 34px rgba(40, 33, 15, .13);
    --shadow-tint: 0 8px 26px rgba(31, 77, 54, .22);
    --ring: 0 0 0 4px rgba(183, 136, 47, .18);
}

[data-theme="dark"] {
    --emerald-900: #0d1c14;
    --emerald-800: #14523a;
    --emerald-700: #5f9e7a;
    --emerald-500: #7fb898;
    --emerald-400: #9acbb0;
    --emerald-300: #b6dcc4;
    --emerald-100: #29483a;
    --emerald-50:  #1e2e24;
    --brass-500: #b7882f;
    --brass-600: #eac887;
    --brass-200:   #6b5525;
    --brass-100:   #4a3d1e;

    --color-bg: #16130d;
    --color-surface: #1e1a11;
    --color-surface-2: #262216;
    --color-text: #e7e0cf;
    --color-heading: #f6f0df;
    --color-muted: #a49c87;
    --color-border: #38301f;
    --color-border-strong: #4a4030;

    --color-primary: #86b79a;
    --color-primary-dark: #b6d7c1;
    --color-primary-light: var(--emerald-100);
    --color-btn: #86b79a;
    --color-btn-dark: #b6d7c1;
    --color-btn-light: var(--emerald-100);
    --color-btn-text: #14110b;
    --on-primary: #14110b;
    --color-accent: #d4a94e;
    --color-accent-dark: #eac887;
    --color-accent-light: var(--brass-200);
    --on-accent: #1c170e;

    --shadow-soft: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-lift: 0 14px 34px rgba(0, 0, 0, .5);
    --shadow-tint: 0 8px 26px rgba(0, 0, 0, .45);
    --ring: 0 0 0 4px rgba(212, 169, 78, .2);
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-arabic);
    background-color: var(--color-bg);
    background-image:
        radial-gradient(rgba(183, 136, 47, .045) 1px, transparent 1px),
        radial-gradient(rgba(31, 77, 54, .04) 1px, transparent 1px);
    background-size: 26px 26px, 38px 38px;
    background-position: 0 0, 13px 13px;
    color: var(--color-text);
    line-height: 1.8;
    transition: background-color .3s ease, color .3s ease;
}

a { color: var(--color-primary); text-decoration: none; transition: color .2s ease, border-color .2s ease; }
a:hover { color: var(--color-accent); }

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    font-weight: 800;
    font-family: var(--font-title);
    line-height: 1.5;
}

::selection { background: var(--brass-500); color: #fffdf5; }

.site-main { min-height: 58vh; }

/* ---------- Reading progress ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--brass-500), var(--emerald-500));
    z-index: 3000;
    transition: width .1s linear;
}

/* ---------- Buttons ---------- */
.btn-primary {
    --bs-btn-color: var(--color-btn-text);
    --bs-btn-bg: var(--color-btn);
    --bs-btn-border-color: var(--color-btn);
    --bs-btn-hover-color: var(--color-btn-text);
    --bs-btn-hover-bg: var(--color-primary-dark);
    --bs-btn-hover-border-color: var(--color-primary-dark);
    --bs-btn-active-color: var(--color-btn-text);
    --bs-btn-active-bg: var(--color-primary-dark);
    --bs-btn-active-border-color: var(--color-primary-dark);
    --bs-btn-disabled-color: var(--color-btn-text);
    --bs-btn-disabled-bg: var(--color-btn-light);
    --bs-btn-disabled-border-color: var(--color-btn-light);
    --bs-btn-focus-box-shadow: var(--ring);
    border-radius: 50px;
    font-weight: 800;
    padding: 10px 26px;
}
.btn-outline-primary {
    --bs-btn-color: var(--color-btn);
    --bs-btn-border-color: var(--color-btn);
    --bs-btn-hover-bg: var(--color-btn);
    --bs-btn-hover-border-color: var(--color-btn);
    --bs-btn-active-bg: var(--color-primary-dark);
    --bs-btn-active-border-color: var(--color-primary-dark);
    border-radius: 50px;
    font-weight: 700;
}

/* ---------- Topbar strip ---------- */
.topbar {
    background: linear-gradient(180deg, var(--ink-950), var(--emerald-900));
    color: #efdcb2;
    font-size: .84rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(183, 136, 47, .4);
}
.topbar a { color: #efdcb2; opacity: .92; }
.topbar a:hover { color: var(--brass-400); opacity: 1; }
.topbar-date { display: flex; align-items: center; gap: 6px; }
.topbar-date i { color: var(--brass-400); }
.topbar-social { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.topbar-social a { font-size: 1.02rem; }
.theme-toggle-btn {
    border: 0; background: transparent; color: #efdcb2;
    font-size: 1.02rem; cursor: pointer; padding: 0;
}
.theme-toggle-btn:hover { color: var(--brass-400); }

/* ---------- Navbar ---------- */
.main-navbar {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    box-shadow: 0 3px 14px rgba(40, 33, 15, .05);
    padding: 12px 0;
    min-height: 74px;
}
.navbar-brand { display: flex; align-items: center; gap: 12px; }
.navbar-brand .brand-img { max-height: 52px; width: auto; border-radius: 6px; }
.navbar-static { position: static; box-shadow: 0 3px 14px rgba(40, 33, 15, .04); }
.navbar-brand .brand-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-heading);
    line-height: 1.25;
    letter-spacing: -.2px;
}
.navbar-brand .brand-title::after {
    content: '';
    display: block;
    width: 46px;
    height: 3px;
    margin-top: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--brass-500), var(--emerald-500));
}
.navbar-brand .brand-title small {
    display: block;
    font-size: .74rem;
    font-weight: 600;
    color: var(--color-accent-dark);
    letter-spacing: 0;
    margin-top: 1px;
}
.main-navbar .navbar-nav { gap: 4px; }
.main-navbar .nav-link {
    color: var(--color-text);
    font-weight: 700;
    font-size: .95rem;
    padding: 9px 15px !important;
    border-radius: 50px;
    border: 1px solid transparent;
}
.main-navbar .nav-link:hover { color: var(--emerald-700); border-color: var(--color-border-strong); }
[data-theme="dark"] .main-navbar .nav-link:hover { color: #a7d3ae; }
.main-navbar .nav-link.active {
    color: var(--on-primary);
    background: var(--color-btn);
    border-color: var(--color-btn);
    box-shadow: 0 4px 14px rgba(31, 77, 54, .25);
}
.nav-icon-btn {
    width: 40px; height: 40px;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--emerald-700);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.02rem; cursor: pointer;
    transition: all .2s ease;
}
.nav-icon-btn:hover { background: var(--color-btn); color: var(--on-primary); border-color: var(--color-btn); }
.nav-quick-cluster { display: flex; gap: 8px; }
.dropdown-menu {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    padding: 8px;
}
.dropdown-item { border-radius: var(--radius-sm); color: var(--color-text); font-weight: 700; font-size: .92rem; }
.dropdown-item:hover { background: var(--emerald-50); color: var(--emerald-700); }
.header-announcement {
    margin-top: 12px;
    background: linear-gradient(90deg, var(--brass-100), var(--emerald-50));
    border: 1px solid var(--color-border-strong);
    border-inline-start: 4px solid var(--brass-500);
    color: var(--color-heading);
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
}

/* Mobile drawer */
.main-drawer { width: 300px !important; background: var(--color-surface); }
.main-drawer-header {
    background: linear-gradient(135deg, var(--ink-950), var(--emerald-900));
    color: #efdcb2;
}
.main-drawer-title { color: #f6f0df !important; }
.main-drawer-nav .nav-link { color: var(--color-text); font-weight: 700; padding: 11px 16px; border-radius: var(--radius-sm); }
.main-drawer-nav .nav-link:hover,
.main-drawer-nav .nav-link.active { background: var(--color-btn); color: var(--on-primary); }
.main-drawer-header .btn-close { filter: invert(1); }

/* ---------- Hero banner ---------- */
.hero-section {
    background:
        radial-gradient(circle at 85% 15%, rgba(212, 169, 78, .22) 0, transparent 34%),
        radial-gradient(circle at 12% 88%, rgba(134, 183, 154, .16) 0, transparent 40%),
        linear-gradient(135deg, var(--ink-950) 0%, var(--emerald-900) 55%, var(--emerald-700) 100%);
    color: #f6f0df;
    border-radius: var(--radius-lg);
    padding: 48px 30px 42px;
    position: relative;
    overflow: hidden;
    margin-top: 26px;
    border: 1px solid rgba(183, 136, 47, .35);
    box-shadow: var(--shadow-tint);
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(183, 136, 47, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(183, 136, 47, .09) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: .5;
    mask-image: radial-gradient(circle at 70% 30%, #000 0, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 70% 30%, #000 0, transparent 70%);
}
.hero-section h1 { color: #f6f0df; font-size: 2.05rem; font-weight: 800; margin-bottom: 8px; position: relative; z-index: 1; }
.hero-section h1::after {
    content: '';
    display: block;
    width: 72px;
    height: 3px;
    margin-top: 14px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--brass-400), transparent);
}
.hero-intro { max-width: 720px; color: rgba(246, 240, 223, .9); margin-bottom: 22px; position: relative; z-index: 1; font-size: 1.05rem; }
.hero-section .input-group { position: relative; z-index: 1; }
.hero-section .form-control {
    border: 0;
    padding: 12px 20px;
    font-size: 1rem;
    background: rgba(255, 253, 245, .96);
    color: var(--color-text);
}
.hero-section .form-control:focus { box-shadow: 0 0 0 3px rgba(212, 169, 78, .4); }
.hero-section .btn.btn-light {
    border-radius: 50px !important;
    background: var(--brass-500);
    color: #fffdf5;
    border: 0;
    padding-inline: 26px;
}
.hero-section .btn.btn-light:hover { background: var(--brass-400); }

/* Search group: the rounded ends face outwards while the seam between the input
   and the button stays square. Logical corners, because the previous physical
   `border-radius` shorthand was written for LTR and came out swapped on this RTL
   site — the button was rounded where it met the input and square on the edge. */
.hero-section .input-group .form-control {
    border-start-start-radius: 50px;
    border-end-start-radius: 50px;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
.hero-section .input-group .btn.btn-light {
    border-start-end-radius: 50px !important;
    border-end-end-radius: 50px !important;
    border-start-start-radius: 0 !important;
    border-end-start-radius: 0 !important;
}

.hero-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hero-cell {
    background: linear-gradient(180deg, rgba(255, 253, 245, .12), rgba(255, 253, 245, .06));
    border: 1px solid rgba(183, 136, 47, .35);
    border-radius: var(--radius);
    padding: 14px 12px;
    color: #f6f0df;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.hero-cell:hover { transform: translateY(-3px); background: rgba(255, 253, 245, .14); border-color: var(--brass-400); }
.hero-cell i { font-size: 1.35rem; color: var(--brass-400); margin-bottom: 5px; display: block; }
.hero-cell .hc-label { font-weight: 800; font-size: 1rem; color: #f6f0df; }
.hero-cell .hc-sub { font-size: .8rem; color: rgba(246, 240, 223, .82); }
.hero-cell.text-white { color: #f6f0df; }

/* Hero action buttons (managed from admin) */
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}
.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    border-radius: 50px;
    font-weight: 800;
    font-size: .98rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.hero-btn:hover { text-decoration: none; transform: translateY(-2px); }
.hero-btn.hb-primary {
    background: linear-gradient(90deg, var(--brass-500), #d4a94e);
    color: #fffdf5;
    box-shadow: 0 6px 18px rgba(183, 136, 47, .35);
}
.hero-btn.hb-primary:hover { background: var(--brass-500); color: #fff; }
.hero-btn.hb-light {
    background: #fffdf5;
    color: var(--emerald-900);
    border-color: #e3d9c0;
}
.hero-btn.hb-light:hover { background: #f7f0dd; color: var(--emerald-900); }
.hero-btn.hb-outline {
    background: transparent;
    color: #f6f0df;
    border-color: rgba(246, 240, 223, .55);
}
.hero-btn.hb-outline:hover { background: rgba(255, 253, 245, .1); color: #fff; border-color: var(--brass-400); }

.hero-banner {
    --hb-bg: #1f3a2c;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 620px;
    width: 100%;
    margin-bottom: 22px;
    padding: 10px 16px;
    border-radius: 14px;
    background: var(--hb-bg);
    border: 1px solid rgba(212, 169, 78, .45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
    color: #f6f0df;
    text-decoration: none;
    position: relative;
    z-index: 1;
    text-align: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
}
.hero-banner:hover { text-decoration: none; transform: translateY(-2px); color: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .25); }
.hero-banner .hb-tag {
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 800;
    background: rgba(255, 248, 224, .16);
    border: 1px solid rgba(212, 169, 78, .6);
    color: #f3e6c4;
    border-radius: 30px;
    padding: 3px 10px;
}
.hero-banner .hb-img { max-height: 56px; width: auto; border-radius: 8px; }
.hero-banner .hb-title { font-size: 1rem; color: #fff; }
.hero-banner .hb-text { font-size: .92rem; font-weight: 700; line-height: 1.5; }
.hero-banner .hb-cta { flex-shrink: 0; font-size: 1rem; color: var(--brass-400); }

/* ---------- Section headers ---------- */
.section-header h2 {
    border: 0;
    padding: 0;
    font-size: 1.42rem;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.section-header h2::before {
    content: '';
    display: inline-block;
    width: 26px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--brass-500), var(--emerald-500));
    margin-inline-end: 2px;
}
.section-header h2 i { color: var(--brass-500); }
.section-header .see-all {
    font-size: .85rem;
    font-weight: 800;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 6px 16px;
}
.section-header .see-all:hover { color: var(--on-primary); background: var(--color-btn); border-color: var(--color-btn); }
.section-header p { color: var(--color-muted); }

/* ---------- Fatwa cards ---------- */
.fatwa-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--brass-500);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 20px 20px 16px;
    display: flex;
    flex-direction: column;
    color: var(--color-text);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    position: relative;
    overflow: hidden;
}
/* Equal-height cards only inside a Bootstrap grid. A bare height:100% would
   resolve against an auto-height column and blow the card up to the height
   of the whole list, so it is scoped to grid rows here. */
.row.g-3 > [class*="col-"] > .fatwa-card { height: 100%; }
.fatwa-card::after {
    content: '';
    position: absolute;
    top: -28px;
    inset-inline-start: -28px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(183, 136, 47, .14), transparent 70%);
    pointer-events: none;
}
.fatwa-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lift);
    border-top-color: var(--emerald-500);
    text-decoration: none;
}
.fatwa-card .fc-cat {
    align-self: flex-start;
    background: var(--emerald-50);
    color: var(--emerald-800);
    border: 1px solid var(--color-border-strong);
    border-radius: 50px;
    padding: 3px 14px;
    font-size: .76rem;
    font-weight: 800;
    margin-bottom: 12px;
}
[data-theme="dark"] .fatwa-card .fc-cat { color: #a7d3ae; background: #1e2e24; }
.fatwa-card h3 { font-size: 1.08rem; font-weight: 800; margin-bottom: 8px; line-height: 1.65; }
.fatwa-card h3 a { color: var(--color-heading); }
.fatwa-card h3 a:hover { color: var(--emerald-700); }
.fatwa-card .fc-question {
    font-size: .9rem;
    color: var(--color-muted);
    line-height: 1.85;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fatwa-card .fc-answer-preview {
    margin-top: 8px;
    background: var(--emerald-50);
    border-inline-start: 3px solid var(--emerald-500);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: .84rem;
    color: var(--color-text);
}
.fatwa-card .fc-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--color-muted);
}
.btn-read-more {
    background: var(--brass-500);
    color: var(--on-accent);
    padding: 4px 16px;
    border-radius: 50px;
    font-size: .8rem;
    font-weight: 800;
    transition: all .2s ease;
}
.btn-read-more:hover { background: var(--emerald-700); color: #f6f0df; }

/* ---------- Single post / fatwa ---------- */
.single-post {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 36px 38px 30px;
    position: relative;
}
.single-post::before,
.single-post::after {
    content: '';
    position: absolute;
    width: 26px; height: 26px;
    border: 2px solid var(--brass-500);
    pointer-events: none;
}
.single-post::before { top: 10px; inset-inline-start: 10px; border-inline-end: 0; border-bottom: 0; border-radius: var(--radius-sm) 0 0 0; }
.single-post::after { bottom: 10px; inset-inline-end: 10px; border-inline-start: 0; border-top: 0; border-radius: 0 0 var(--radius-sm) 0; }
.single-post-header {
    border-bottom: 2px solid var(--color-border-strong);
    padding-bottom: 20px;
    margin-bottom: 24px;
}
.single-post-header h1 { color: var(--color-heading); font-size: 1.85rem; margin-top: 14px; line-height: 1.55; }
.post-cat {
    background: var(--emerald-50);
    color: var(--emerald-800);
    border: 1px solid var(--color-border-strong);
    border-radius: 50px;
    padding: 5px 16px;
    font-size: .8rem;
    font-weight: 800;
}
[data-theme="dark"] .post-cat { color: #a7d3ae; background: #1e2e24; }
[data-theme="dark"] .search-result-item .badge { background: #1e2e24 !important; color: #a7d3ae !important; }
.single-post-meta { color: var(--color-muted); font-size: .85rem; display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }

/* font controls */
.post-font-controls {
    background: var(--emerald-50);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: sticky;
    top: calc(var(--ftb-top, 96px) + var(--ftb-height, 0px) + 6px);
    z-index: 20;
    box-shadow: var(--shadow-soft);
}
.post-font-controls .fc-group-label { font-size: .8rem; color: var(--color-muted); margin-inline-end: 4px; font-weight: 700; }
.font-btn {
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-sm);
    width: 34px; height: 34px;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
}
.font-btn:hover, .font-btn.active { background: var(--color-btn); border-color: var(--color-btn); color: var(--on-primary); }
.font-btn:disabled, .font-btn:disabled:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-muted);
    opacity: .45;
    cursor: not-allowed;
}
.font-style-btn { width: auto; padding: 0 12px; font-size: .8rem; }
.font-size-now {
    font-size: .75rem;
    font-weight: 700;
    color: var(--color-btn);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 9px;
    min-width: 46px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ---------- Hadith takhrij + sources ---------- */
.fatwa-citations {
    margin-top: 24px;
    padding: 18px 22px;
    border: 1px solid var(--color-border);
    border-inline-start: 4px solid var(--brass-500);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.fatwa-citations h5 {
    color: var(--brass-600);
    font-size: 1rem;
    margin-bottom: 12px;
}
[data-theme="dark"] .fatwa-citations h5 { color: var(--brass-400); }
.fatwa-citations ul { list-style: none; margin: 0; padding: 0; }
.fatwa-citations li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: 0.98rem;
    line-height: 1.9;
}
.fatwa-citations li:last-child { border-bottom: 0; padding-bottom: 0; }
.cite-main { font-weight: 600; }
.cite-meta { color: var(--color-text-muted); font-size: 0.9rem; margin-inline-start: 6px; }
.cite-grade {
    display: inline-block;
    margin-inline-start: 8px;
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid currentColor;
}
.cite-grade-sahih { color: #1f7a4d; background: rgba(31, 122, 77, .1); }
.cite-grade-hasan { color: #8a6d1f; background: rgba(138, 109, 31, .1); }
.cite-grade-daif { color: #9b2c2c; background: rgba(155, 44, 44, .1); }
[data-theme="dark"] .cite-grade-sahih { color: #58c48d; }
[data-theme="dark"] .cite-grade-hasan { color: #d9b45c; }
[data-theme="dark"] .cite-grade-daif { color: #e08585; }
.fatwa-citations blockquote {
    margin: 8px 0 0;
    padding: 10px 14px;
    border-inline-start: 3px solid var(--brass-400);
    background: var(--color-bg-subtle, rgba(0, 0, 0, .03));
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.94rem;
    color: var(--color-text);
}
.fatwa-citations a { color: var(--brass-700); }
[data-theme="dark"] .fatwa-citations a { color: var(--brass-400); }
.references-text { margin: 10px 0 0; font-size: 0.95rem; }

/* ---------- Save-for-offline button state ---------- */
.m-share-btn.offline-saved { background: var(--brass-100); border-radius: 50%; }
.m-share-btn.offline-saved i { color: var(--emerald-600) !important; }

/* Q / A blocks */
.fatwa-question {
    background: linear-gradient(180deg, var(--brass-100), var(--color-surface));
    border: 1px solid var(--color-border-strong);
    border-inline-start: 4px solid var(--brass-500);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 24px;
}
.fatwa-question h5 { color: var(--brass-600); font-size: 1rem; margin-bottom: 8px; }
[data-theme="dark"] .fatwa-question h5 { color: var(--brass-400); }
.fatwa-question p { margin: 0; font-size: 1.05rem; line-height: 2.05; text-align: justify; }
.single-post-content.fatwa-answer {
    background:
        linear-gradient(180deg, rgba(255, 253, 245, .0), rgba(238, 244, 236, .55));
    border: 1px solid var(--color-border);
    border-inline-start: 4px solid var(--emerald-500);
    border-radius: var(--radius);
    padding: 24px 26px;
    font-family: var(--font-content);
    font-size: 1.22rem;
    line-height: 2.1;
    color: var(--color-text);
    text-align: justify;
}
[data-theme="dark"] .single-post-content.fatwa-answer { background: transparent; border-color: var(--color-border); }
.single-post-content.fatwa-answer h2, .single-post-content.fatwa-answer h3, .single-post-content.fatwa-answer h4 { font-family: var(--font-title); font-size: 1.35rem; margin-top: 1.3em; color: var(--emerald-800); }
[data-theme="dark"] .single-post-content.fatwa-answer h2,
[data-theme="dark"] .single-post-content.fatwa-answer h3,
[data-theme="dark"] .single-post-content.fatwa-answer h4 { color: #a7d3ae; }
.single-post-content.fatwa-answer p { margin-bottom: 1.05em; }
.single-post-content.fatwa-answer h1 {
    font-family: var(--font-title);
    font-size: 1.6rem;
    line-height: 1.5;
    margin: 1.3em 0 .6em;
    color: var(--emerald-800);
}
[data-theme="dark"] .single-post-content.fatwa-answer h1 { color: #a7d3ae; }
.single-post-content.fatwa-answer table { width: 100%; border-collapse: collapse; margin: 1.1em 0; }
.single-post-content.fatwa-answer table td, .single-post-content.fatwa-answer table th { border: 1px solid var(--color-border); padding: 8px 12px; }
.single-post-content.fatwa-answer hr { border: 0; border-top: 1px solid var(--color-border); margin: 1.4em 0; }
/* Label that mirrors `.fatwa-question h5`. It carries its own font-size because the
   reader controls set an inline font-size on `.single-post-content`, and a child
   declaration beats that inheritance — so the label never scales with the text. */
.single-post-content.fatwa-answer h5.fatwa-answer-label {
    font-family: var(--font-title);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 12px;
    color: var(--emerald-800);
}
[data-theme="dark"] .single-post-content.fatwa-answer h5.fatwa-answer-label { color: #a7d3ae; }
.single-post-content.fatwa-answer blockquote {
    background: var(--brass-100);
    border-inline-start: 4px solid var(--brass-500);
    border-radius: var(--radius-sm);
    margin: 1.1em 0;
    padding: 14px 20px;
    font-style: italic;
}
[data-theme="dark"] .single-post-content.fatwa-answer blockquote { background: var(--surface-2); }
.single-post-content.fatwa-answer ul, .single-post-content.fatwa-answer ol { padding-inline-start: 26px; }
.audio-player audio { width: 100%; border-radius: var(--radius); }

/* prev/next */
.prevnext-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 22px;
    font-size: .88rem;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-soft);
}
.prevnext-card a { font-weight: 800; color: var(--emerald-700); }
.prevnext-card a:hover { color: var(--brass-600); }
.prevnext-card small { color: var(--color-muted) !important; font-weight: 600; }

/* ---------- Share ---------- */
.share-box { margin-top: 28px; }
.share-box h5 { font-size: 1rem; margin-bottom: 12px; }
.share-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: .86rem;
    font-weight: 800;
    color: #fffdf5 !important;
    transition: transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}
.share-btn:hover { transform: translateY(-2px); opacity: .93; box-shadow: var(--shadow-soft); }
.share-whatsapp { background: #25a366; }
.share-telegram { background: #1e7fc4; }
.share-facebook { background: #33539e; }
.share-twitter { background: #101418; }
.share-copy { background: var(--emerald-700); cursor: pointer; border: 0; }

/* ---------- Sidebar widget ---------- */
.sidebar-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    margin-bottom: 22px;
}
.sidebar-title {
    font-size: 1.02rem;
    font-weight: 800;
    border-inline-start: 4px solid var(--brass-500);
    padding-inline-start: 12px;
    margin-bottom: 16px;
}
.sidebar-title i { color: var(--brass-500); margin-inline-end: 8px; }
.sidebar-links li { margin-bottom: 4px; }
.sidebar-links a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-weight: 700;
    font-size: .9rem;
    border: 1px solid transparent;
}
.sidebar-links a:hover { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--color-border-strong); }
.sidebar-links a .n {
    background: var(--brass-500);
    color: var(--on-accent);
    border-radius: 50px;
    padding: 0 9px;
    font-size: .74rem;
    font-weight: 800;
}

/* ---------- Related fatwas (article sidebar) ---------- */
.related-fatwas-list li { margin-bottom: 4px; }
.related-fatwas-list a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    border-inline-start: 3px solid transparent;
    transition: background .15s ease, border-color .15s ease;
}
.related-fatwas-list a:hover {
    background: var(--emerald-50);
    border-color: var(--color-border-strong);
    border-inline-start-color: var(--brass-500);
}
.related-fatwas-list .rf-title {
    display: block;
    color: var(--color-text);
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.6;
}
.related-fatwas-list a:hover .rf-title { color: var(--emerald-700); }

/* ---------- Search results ---------- */
.results-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 18px; color: var(--color-heading); }
.results-title i { color: var(--brass-500); margin-inline-end: 8px; }
.results-title b { color: var(--emerald-700); }
.search-result-item {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
    color: var(--color-text);
    transition: all .2s ease;
    border-inline-start: 3px solid transparent;
}
.search-result-item:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-inline-start-color: var(--brass-500); text-decoration: none; }
.search-result-item h3 { font-size: 1.05rem; margin-bottom: 4px; color: var(--color-heading); }
.search-result-item:hover h3 { color: var(--emerald-700); }
.search-result-item .sr-q { color: var(--color-muted); font-size: .9rem; margin-bottom: 8px; }
.search-result-item .badge { background: var(--emerald-50) !important; color: var(--emerald-800) !important; border: 1px solid var(--color-border-strong); }

/* Segmented order control */
.seg { display: inline-flex; gap: 6px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 50px; padding: 5px; }
.seg button {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font-weight: 700;
    font-size: .82rem;
    padding: 6px 16px;
    border-radius: 50px;
    cursor: pointer;
    transition: all .2s ease;
}
.seg button:hover { color: var(--emerald-700); }
.seg button.active { background: var(--color-btn); color: var(--on-primary); }

/* Live suggestions inside the modal */
.search-results { max-height: 420px; overflow-y: auto; }
.suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-weight: 700;
    font-size: .92rem;
    border: 1px solid transparent;
}
.suggest-item:hover { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--color-border-strong); text-decoration: none; }
.suggest-item i { color: var(--brass-500); }
.suggest-item span { color: var(--emerald-700); font-weight: 800; }

/* ---------- Ask form ---------- */
.ask-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 34px;
    position: relative;
}
.ask-card label { font-weight: 800; color: var(--color-heading); }
.ask-card .form-control, .ask-card .form-select {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg);
    color: var(--color-text);
}
.ask-card .form-control:focus, .ask-card .form-select:focus {
    border-color: var(--emerald-500);
    box-shadow: var(--ring);
    background: var(--color-bg);
    color: var(--color-text);
}
.ask-hint { font-size: .84rem; color: var(--color-muted); }

/* ---------- Pagination ---------- */
.page-link {
    border-radius: 50% !important;
    margin: 0 2px;
    color: var(--color-text);
    font-weight: 700;
    font-size: .9rem;
    width: 36px; height: 36px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.page-link:hover { color: var(--on-primary); background: var(--emerald-700); border-color: var(--emerald-700); }
.page-item.active .page-link {
    background: var(--brass-500);
    border-color: var(--brass-500);
    color: var(--on-accent);
}
.pagination { gap: 4px; flex-wrap: wrap; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb { font-size: .88rem; }
.breadcrumb-item a { color: var(--color-muted); font-weight: 600; }
.breadcrumb-item.active { color: var(--emerald-700); font-weight: 800; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--brass-500); }

/* ---------- Footer ---------- */
.site-footer {
    background: linear-gradient(180deg, var(--emerald-900), var(--ink-950));
    color: rgba(246, 240, 223, .86);
    margin-top: 60px;
    padding: 50px 0 0;
    font-size: .92rem;
    position: relative;
    border-top: 3px solid var(--brass-500);
}
.site-footer h5 { color: #f6f0df; font-weight: 800; font-size: 1.05rem; margin-bottom: 16px; position: relative; padding-bottom: 8px; }
.site-footer h5::after { content: ''; position: absolute; bottom: 0; inset-inline-start: 0; width: 34px; height: 2px; background: var(--brass-500); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(246, 240, 223, .82); }
.footer-links a:hover { color: var(--brass-400); }
.footer-links i { margin-inline-end: 6px; font-size: .75rem; color: var(--brass-400); }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255, 253, 245, .08);
    border: 1px solid rgba(183, 136, 47, .35);
    color: #f6f0df;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.02rem;
    transition: all .2s ease;
}
.footer-social a:hover { background: var(--brass-500); border-color: var(--brass-500); transform: translateY(-3px); color: #14110b; }
.footer-extra-html { margin-top: 22px; border-top: 1px solid rgba(183, 136, 47, .25); padding-top: 22px; }
.footer-bottom {
    background: rgba(8, 6, 3, .5);
    margin-top: 34px;
    padding: 14px 0;
    text-align: center;
    font-size: .82rem;
    color: rgba(246, 240, 223, .72);
}
.footer-bottom p { margin: 0; }

/* ---------- Floating widgets ---------- */

/* Empty states */
.empty-state { text-align: center; padding: 44px 20px; color: var(--color-muted); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: 12px; opacity: .55; color: var(--brass-500); }

/* ---------- Honeypot anti-spam ---------- */
/* Clipped in place instead of pushed off-canvas: `left/top: -9999px` on an
   absolutely positioned box stretches the document's scrollable area to ~10000px,
   which shows up on a phone as a huge empty band beside the page. */
.hp-field {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%);
    white-space: nowrap !important;
}

/* Form elements on parchment (global) */
.form-control, .form-select {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text);
    border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
    border-color: var(--emerald-500);
    box-shadow: var(--ring);
    background: var(--color-surface);
    color: var(--color-text);
}
.form-label { font-weight: 700; color: var(--color-heading); }

/* Modal */
.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
}
.modal-header { border-bottom: 2px solid var(--color-border-strong); }
.modal-title i { color: var(--brass-500); margin-inline-end: 8px; }

/* Alerts */
.alert-success {
    background: var(--emerald-50);
    border: 1px solid var(--color-border-strong);
    color: var(--emerald-800);
    border-radius: var(--radius-sm);
}
[data-theme="dark"] .alert-success { color: #a7d3ae; background: #1e2e24; }
.text-danger { color: #c04a3a !important; }

/* ---------- Dark mode: Bootstrap text & surface utilities ---------- */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary { color: var(--color-muted) !important; }
[data-theme="dark"] .text-dark { color: var(--color-heading) !important; }
[data-theme="dark"] .text-success { color: #a7d3ae !important; }
[data-theme="dark"] .text-info { color: #9ed3e6 !important; }
[data-theme="dark"] .text-warning { color: var(--brass-400) !important; }
[data-theme="dark"] .text-danger { color: #f3bfae !important; }
[data-theme="dark"] .bg-white { background: var(--color-surface) !important; color: var(--color-text); }
[data-theme="dark"] .bg-light { background: var(--color-surface-2) !important; color: var(--color-text); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--color-bg);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--color-bg);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(134, 183, 154, .18);
    color: var(--color-text);
}
[data-theme="dark"] .form-control::placeholder { color: var(--color-muted); }
[data-theme="dark"] .card,
[data-theme="dark"] .list-group-item {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
[data-theme="dark"] .list-group-item a { color: var(--color-primary); }
[data-theme="dark"] .badge.bg-secondary,
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .badge.bg-info,
[data-theme="dark"] .badge.bg-danger,
[data-theme="dark"] .badge.bg-success,
[data-theme="dark"] .badge.bg-warning {
    background: var(--color-surface-2) !important;
    color: var(--color-muted);
}
[data-theme="dark"] .btn-outline-success { color: #a7d3ae; border-color: var(--emerald-500); }
[data-theme="dark"] .btn-outline-success:hover { background: var(--emerald-500); border-color: var(--emerald-500); color: #f6f0df; }
[data-theme="dark"] .btn-outline-danger { color: #f3bfae; border-color: #b06548; }
[data-theme="dark"] .btn-outline-danger:hover { background: #b06548; border-color: #b06548; color: #f6f0df; }
[data-theme="dark"] .btn-outline-primary { color: var(--color-primary); border-color: var(--color-primary); }
[data-theme="dark"] .btn-outline-primary:hover { background: var(--color-primary); border-color: var(--color-primary); color: var(--on-primary); }
[data-theme="dark"] .btn-outline-secondary { color: var(--color-muted); border-color: var(--color-border-strong); }
[data-theme="dark"] .btn-outline-secondary:hover { background: var(--color-border-strong); border-color: var(--color-border-strong); color: var(--color-heading); }

/* ---------- Quote share (selection toolbar) ---------- */
.quote-share {
    position: absolute;
    z-index: 4000;
    display: none;
    gap: 6px;
    padding: 5px;
    background: var(--ink-950);
    border: 1px solid rgba(183, 136, 47, .55);
    border-radius: 50px;
    box-shadow: var(--shadow-lift);
}
.quote-share button {
    border: 0;
    background: transparent;
    color: #f6f0df;
    font-weight: 700;
    font-size: .8rem;
    font-family: var(--font-arabic);
    padding: 5px 13px;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s ease, color .15s ease;
}
.quote-share button:hover { background: var(--brass-500); color: var(--on-accent); }

/* ============================================================
   Mobile UX — شريط تنقل سفلي، مناطق آمنة، أهداف لمس، مشاركة سريعة
   ============================================================ */
.mobile-bottom-nav {
    position: fixed;
    inset-inline: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 1060;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    transition: transform .32s ease;
}
.mobile-bottom-nav .mobile-bottom-row { display: flex; flex: 1; }
.mobile-bottom-nav .mnav-item {
    flex: 1;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    font-size: .7rem;
    font-weight: 700;
    color: var(--color-muted);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav .mnav-item i { font-size: 1.2rem; }
.mobile-bottom-nav .mnav-item.active { color: var(--color-primary); }
.mobile-bottom-nav .mnav-item:active { background: var(--color-btn-light); color: var(--color-btn-text); }
[data-theme="dark"] .mobile-bottom-nav .mnav-item:active { background: var(--emerald-700); color: #14110b; }
.mobile-bottom-nav.navhide { transform: translateY(115%); }

/* Fatwa contextual controls inside the bottom nav (font icon reveals a panel) */
.mnav-item.mnav-btn {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav .mnav-item.mnav-btn.active { color: var(--color-primary); }

/* Fatwa bottom-dock font panel */
.fatwa-mtools { display: none; }
.fatwa-mtools.open { display: flex; flex-direction: column; }
.fatwa-mtools .mt-font-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-2);
    overflow-x: auto;
}
/* Last row of the panel: no trailing rule, so the dock keeps one clean edge */
.fatwa-mtools .mt-color-btns { border-bottom: 0; }
.fatwa-mtools .mt-color-btn { gap: 6px; font-size: .74rem; }
.mt-swatch {
    width: 15px;
    height: 15px;
    border-radius: 5px;
    border: 1px solid var(--color-border-strong);
    flex: none;
}
.mt-swatch-default { background: linear-gradient(135deg, #ffffff 0 50%, #1c2a20 50% 100%); }
.mt-swatch-sepia { background: #f6eddb; }
.mt-swatch-gray { background: #f1f2f3; }
.mt-swatch-night { background: #141d18; border-color: #3d4f43; }
.fatwa-mtools .mt-color-btn.active .mt-swatch { box-shadow: 0 0 0 2px var(--color-btn); }
.fatwa-mtools .mt-label { color: var(--color-muted); font-size: .85rem; padding-inline-end: 2px; }
.fatwa-mtools .mt-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: .8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
}
.fatwa-mtools .mt-btn.active { background: var(--color-btn); color: var(--color-btn-text); border-color: var(--color-btn); }
.fatwa-mtools .mt-btn:active { transform: scale(.95); }
.fatwa-mtools .mt-btn:disabled,
.fatwa-mtools .mt-btn:disabled:active { background: var(--color-surface); color: var(--color-muted); border-color: var(--color-border); opacity: .45; transform: none; }
.fatwa-mtools .font-size-now { font-size: .72rem; padding: 2px 8px; min-width: 44px; }
.fatwa-mtools .mt-sep { width: 1px; height: 22px; background: var(--color-border); margin: 0 2px; }

/* ---------- Comfortable reading colours (mobile dock only) ---------- */
@media (max-width: 991px) {
    /* Palettes live on the reader block; the attribute is absent for "default"
       so the site theme is left completely untouched. */
    .fatwa-reader[data-read-theme="sepia"] {
        --rd-bg: #f6eddb;
        --rd-fg: #43301b;
        --rd-head: #7a5a24;
        --rd-line: #e0cfa9;
        --rd-accent: #b08a3e;
        --rd-link: #8a5a1a;
        --rd-quote: #efe2c6;
        --rd-verse-fg: #6d5320;
        --rd-verse-bg: rgba(176, 138, 62, .18);
    }
    .fatwa-reader[data-read-theme="gray"] {
        --rd-bg: #f1f2f3;
        --rd-fg: #25292d;
        --rd-head: #3f4750;
        --rd-line: #dbdfe3;
        --rd-accent: #6b7680;
        --rd-link: #35597f;
        --rd-quote: #e5e8ea;
        --rd-verse-fg: #3f4750;
        --rd-verse-bg: rgba(107, 118, 128, .18);
    }
    .fatwa-reader[data-read-theme="night"] {
        --rd-bg: #141d18;
        --rd-fg: #d5ded6;
        --rd-head: #9fc9a8;
        --rd-line: #26332b;
        --rd-accent: #5f9c6f;
        --rd-link: #8fc0d8;
        --rd-quote: #1c2820;
        --rd-verse-fg: #b7d8bf;
        --rd-verse-bg: rgba(143, 192, 216, .18);
    }

    .fatwa-reader[data-read-theme] .fatwa-question,
    .fatwa-reader[data-read-theme] .fatwa-question p { background: var(--rd-bg); border-color: var(--rd-line); color: var(--rd-fg); }
    .fatwa-reader[data-read-theme] .fatwa-question { border-inline-start-color: var(--rd-accent); }
    .fatwa-reader[data-read-theme] .fatwa-question h5 { color: var(--rd-head); }
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer {
        background: var(--rd-bg);
        border-color: var(--rd-line);
        border-inline-start-color: var(--rd-accent);
        color: var(--rd-fg);
    }
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer h2,
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer h3,
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer h4,
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer h5.fatwa-answer-label { color: var(--rd-head); }
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer a { color: var(--rd-link); }
    .fatwa-reader[data-read-theme] .single-post-content.fatwa-answer blockquote { background: var(--rd-quote); border-inline-start-color: var(--rd-accent); }
    .fatwa-reader[data-read-theme] .fatwa-tashkeel { color: var(--rd-fg); }
    .fatwa-reader[data-read-theme] .quran-verse {
        color: var(--rd-verse-fg);
        background: linear-gradient(180deg, transparent 0, transparent 18%, var(--rd-verse-bg) 18%, var(--rd-verse-bg) calc(100% - 12%), transparent calc(100% - 12%));
    }
}

/* Bottom categories sheet (fatwa pages, replaces the sidebar categories on mobile) */
.fatwa-cats-sheet {
    position: fixed;
    inset-inline: 10px;
    bottom: calc(118px + env(safe-area-inset-bottom));
    z-index: 1055;
    display: flex;
    flex-direction: column;
    max-height: 62dvh;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .28);
    transform: translateY(calc(100% + 130px));
    visibility: hidden;
    transition: transform .3s ease, visibility .3s ease;
}
.fatwa-cats-sheet.open { transform: translateY(0); visibility: visible; }
.fatwa-cats-sheet .fcs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px 11px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 800;
    color: var(--color-primary);
    font-size: .95rem;
}
.fatwa-cats-sheet .fcs-close {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1rem;
}
.fatwa-cats-sheet .fcs-body { overflow-y: auto; padding: 6px 10px 12px; }
.fatwa-cats-sheet .fcs-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--color-text);
    font-weight: 700;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.fatwa-cats-sheet .fcs-item:active { background: var(--color-btn-light); }
.fatwa-cats-sheet .fcs-item + .fcs-item { border-top: 1px solid var(--color-border); }
.fatwa-cats-sheet .fcs-n {
    font-size: .72rem;
    color: var(--color-muted);
    background: var(--color-border);
    border-radius: 50px;
    padding: 2px 9px;
    font-variant-numeric: tabular-nums;
}

/* Share sheet (mobile) — icon-only grid */
.m-share-sheet .fcs-body {
    padding: 12px 10px 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.m-share-sheet .m-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.m-share-sheet .m-share-btn:active { background: var(--color-btn-light); transform: scale(.96); }
.m-share-sheet .m-share-btn i { width: auto; font-size: 1.4rem; text-align: center; }

/* Native quick-share button */
.share-btn.share-native { background: var(--color-btn); color: var(--color-btn-text); border-color: var(--color-btn); }
.share-btn.share-native:hover { background: var(--color-btn-dark); }

/* Auto-hide top navbar with the bottom nav */
.main-navbar { transition: transform .32s ease; }
.main-navbar.navhide { transform: translateY(-115%); }

@media (max-width: 991px) {
    /* Clean single-bar header like the magazine: hide the topbar strip */
    .topbar { display: none; }
    .main-navbar { padding: 9px 0; min-height: 62px; }

    /* One row on mobile: brand on the right, then theme, search and menu.
       The bar used to wrap to two lines because the brand carries `me-auto`
       and an oversized logo could claim the whole width, so the row is locked
       to nowrap and the logo is capped to whatever space is left over.
       The breathing room comes from `gap` because the brand's Bootstrap
       `me-auto` is `!important` and would win over a plain margin. */
    .main-navbar > .container { flex-wrap: nowrap; align-items: center; gap: 10px; }
    .main-navbar .navbar-brand {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }
    .main-navbar .brand-img {
        max-height: 38px;
        max-width: 100%;
        width: auto;
        object-fit: contain;
    }
    /* Compact quick actions: theme, search and menu share the logo's row, so
       they need only a small tap target instead of the desktop-sized one.
       `.nav-icon-btn` is only ever rendered inside the `d-lg-none` cluster. */
    .main-navbar .nav-quick-cluster {
        order: 2;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 6px;
    }
    .main-navbar .nav-icon-btn { width: 34px; height: 34px; font-size: .9rem; }

    main.site-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

    /* Categories move into the bottom sheet on mobile: hide the sidebar widget */
    .sidebar-widget-cats { display: none; }

    /* Magazine-style fatwa page on mobile: no footer, header auto-hides with the dock */
    body.fatwa-article .site-footer,
    body.fatwa-article .whatsapp-float { display: none; }
    body.fatwa-article .fatwa-page { padding-top: 14px; }

    /* Question, answer and related fatwas only */
    .fatwa-page .breadcrumb-nav,
    .fatwa-page .single-post-header,
    .fatwa-page .tashkeel-bar,
    .fatwa-page .fatwa-post .prevnext-card,
    .fatwa-page .col-lg-8 > .prevnext-card,
    .fatwa-page .audio-player,
    .fatwa-page .tts-transcript { display: none; }

    /* With the header gone the card holds only the Q&A, so drop its frame too */
    .fatwa-page .single-post { padding: 0; background: none; border: none; box-shadow: none; }
    .fatwa-page .single-post::before, .fatwa-page .single-post::after { display: none; }

    /* The related widget becomes a full-width closing section instead of a sidebar card */
    .fatwa-page .fatwa-related { margin-top: 20px; }
    .fatwa-page .fatwa-related .sidebar-widget { box-shadow: none; margin-bottom: 0; }
    .fatwa-page .related-fatwas-list a { padding: 11px 12px; }
}

@media (max-width: 575px) {
    /* Search becomes a full-screen mobile sheet */
    #searchModal .modal-dialog { margin: 0; max-width: 100%; height: 100dvh; }
    #searchModal .modal-content { border: 0; border-radius: 0; height: 100%; }
    #searchModal .modal-body { display: flex; flex-direction: column; }
    #searchModal .search-results { flex: 1; overflow-y: auto; }

    /* Keep the mini topbar uncluttered: hide social icons, keep search + theme */
    .topbar-social a[href*="facebook"], .topbar-social a[href*="youtube"],
    .topbar-social a[href*="telegram"], .topbar-social a[href*="x"] { display: none; }
    .topbar { padding: 7px 0; }

    /* Generous touch targets */
    .share-btn { min-height: 44px; padding: 11px 15px; font-size: .82rem; }
    #search_input, .input-group .btn-primary { min-height: 48px; }

    /* Comfortable reading spacing */
    .single-post { padding: 20px 14px; }
    .single-post-content, .fatwa-question p { line-height: 2.05; }
    .hero-section h1 { font-size: 1.4rem; }
}
@media (min-width: 576px) and (max-width: 991px) and (pointer: coarse) {
    .share-btn { min-height: 44px; padding: 11px 15px; }
    main.site-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* Print */
.print-footer { display: none; }
@media print {
    .topbar, .main-navbar, .mobile-bottom-nav, .fatwa-cats-sheet, .post-font-controls, .sidebar-widget, .site-footer, .breadcrumb, .share-box, .reading-progress, .prevnext-card, .audio-player, .post-actions-bar, .fatwa-card-modal, .save-fatwa-btn, .card-share-btn, .single-post-header, .tashkeel-bar, .fatwa-tashkeel, .tts-transcript, .section-header, .fatwa-card, .preview-strip { display: none !important; }
    body { background: #fff !important; }
    .container, .row, .col-lg-8 { max-width: 100% !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .single-post { box-shadow: none !important; border: none !important; margin: 0 !important; }
    .fatwa-question, .single-post-content { font-size: 1.05rem !important; line-height: 2.1 !important; }
    .fatwa-question { border-bottom: 2px solid #1f4d36 !important; padding-bottom: 14px !important; margin-bottom: 18px !important; }
    .fatwa-question h5 { color: #1f4d36 !important; }
    .single-post-content.fatwa-answer h5.fatwa-answer-label { color: #1f4d36 !important; }
    .print-footer {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-top: 28px;
        padding-top: 14px;
        border-top: 2px solid #1f4d36;
    }
    .print-footer .brand-logo { font-size: 26px; }
    .print-footer b { font-size: 1.1rem; color: #1f4d36; }
    .print-footer .brand-img { max-height: 44px; max-width: 220px; }
    .print-footer-link { display: block !important; width: 100%; text-align: center; color: #666 !important; font-size: .9rem; margin-top: 4px; direction: ltr; }
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .topbar-social { justify-content: flex-start; padding-top: 4px; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
    .hero-section { padding: 34px 20px 30px; }
    .hero-section h1 { font-size: 1.55rem; }
    .single-post { padding: 24px 18px; }
    .post-font-controls { top: 66px; }
    .navbar-brand .brand-title { font-size: 1.05rem; }
    .navbar-brand .brand-title small { font-size: .66rem; }
}

@media (max-width: 575px) {
    .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .hero-cell { padding: 10px 8px; }
    .prevnext-card { flex-direction: column; }
}

/* ===== آيات القرآن في نصوص الفتوى ===== */
.quran-verse {
    display: inline;
    color: var(--color-primary);
    background: linear-gradient(to bottom, transparent 0, transparent 18%, rgba(183, 136, 47, .10) 18%, rgba(183, 136, 47, .10) calc(100% - 12%), transparent calc(100% - 12%));
    font-family: var(--font-quran, 'Amiri', 'Scheherazade New', serif);
    font-size: 1.08em;
    line-height: 1.9;
    padding: 0 2px;
    border-radius: 4px;
}

/* ===== شريط إجراءات الفتوى (حفظ + بطاقة) ===== */
.post-actions-bar {
    margin-top: 12px;
    gap: 8px;
    flex-wrap: wrap;
}
.post-actions-bar .save-fatwa-btn,
.post-actions-bar .card-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 50px;
    font-size: .8rem;
    font-weight: 700;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.post-actions-bar .save-fatwa-btn:hover,
.post-actions-bar .card-share-btn:hover { border-color: var(--color-primary); background: var(--color-btn-light); }
.post-actions-bar .save-fatwa-btn.saved { background: var(--color-btn); color: var(--color-btn-text); border-color: var(--color-btn); }

/* ===== بطاقة الصورة ===== */
.fatwa-card-canvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--color-border); }
.fatwa-card-modal .modal-body { background: var(--color-bg); }

/* ===== زر جرس الإشعارات ===== */
.push-bell-btn {
    background: transparent;
    border: 0;
    padding: 0 6px;
    color: var(--color-primary);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.push-bell-btn .fa-bell { color: var(--color-primary); }
.push-bell-btn:hover .fa-bell { opacity: .75; }
.push-notify-dot { color: #e11d48; font-size: .5rem; display: none; }
.push-notify-dot.show { display: inline; }
.push-bell-btn.is-on .fa-bell { color: var(--gold, #b7882f); }

/* ===== رابط محفوظاتي في التوببار ===== */
.bookmark-top {
    color: var(--color-primary);
    padding: 0 6px;
    font-size: 1.05rem;
}
.bookmark-top:hover { opacity: .75; }

/* ===== شريط معاينة الفتوى قبل النشر ===== */
.preview-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #b45309;
    color: #fffbeb;
    font-weight: 700;
    padding: 10px 18px;
    font-size: .9rem;
}
.preview-strip a.btn-light { color: #92400e; }

/* ===== اقتراح فتاوى مشابهة أثناء كتابة السؤال ===== */
.ask-suggestions {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e0d0);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .08);
}
.ask-suggest-hint {
    font-size: .82rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}
.ask-suggest-list { list-style: none; margin: 0; padding: 0; }
.ask-suggest-list li { border-bottom: 1px dashed var(--color-border, #e5e0d0); }
.ask-suggest-list li:last-child { border-bottom: 0; }
.ask-suggest-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 2px;
    color: var(--color-text);
    font-size: .9rem;
}
.ask-suggest-list a:hover { color: var(--color-primary); }
.ask-suggest-cat {
    font-size: .72rem;
    color: var(--color-muted);
    white-space: nowrap;
    border: 1px solid var(--color-border, #e5e0d0);
    border-radius: 20px;
    padding: 1px 10px;
}
.ask-suggest-dismiss { text-align: left; }
.ask-suggest-dismiss .btn-link { font-size: .78rem; color: var(--color-muted); }

/* ===== بطاقة أرشيف النشرة ===== */
.newsletter-issue-card { border-radius: 14px; overflow: hidden; }
.newsletter-issue-card .card-body { padding: 18px; }
.newsletter-issue-card ul li { border-bottom: 1px dashed var(--color-border, #e5e0d0); padding-bottom: 6px; }
.newsletter-issue-card ul li:last-child { border-bottom: 0; }
/* ---- TTS karaoke reader ---- */
.tts-karaoke{background:#f8fbf4;border:1px solid #e0e8d4;border-radius:10px;padding:12px 14px;}
.tts-head{display:flex;align-items:center;gap:12px;}
.tts-play-btn{flex:0 0 auto;width:46px;height:46px;border-radius:50%;border:none;background:var(--color-primary,#70a436);color:#fff;font-size:1.05rem;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .15s ease,background .15s ease;}
.tts-play-btn:hover{transform:scale(1.06);}
.tts-play-btn.tts-playing{background:#d9534f;}
.tts-status{flex:1 1 auto;min-width:0;}
.tts-title{font-size:.85rem;color:#4a5a38;margin-bottom:6px;}
.tts-counter{font-size:.8rem;color:#7c8a68;}
.tts-transcript{margin-top:10px;border-radius:8px;overflow:hidden;border:1px solid #e5ead9;}
.tts-transcript-head{background:#eef4e4;color:#3c5a1e;font-size:.8rem;padding:6px 10px;font-weight:600;}
.tts-transcript-body{background:#fbfdf8;padding:10px 12px;max-height:220px;overflow-y:auto;line-height:1.9;}
.tts-seg{color:#2f3b26;cursor:pointer;border-radius:4px;padding:1px 3px;}
.tts-seg:hover{background:#f0f5e6;}
.tts-seg-active{background:#ffe9a8;color:#6b4f00;font-weight:600;}

/* ===== قائمة شروط كلمة المرور (التسجيل) ===== */
.pw-checklist {
    display: none;
    background: var(--color-surface, #fff);
    border: 1px dashed var(--color-border, #e5e0d0);
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 8px;
}
.pw-checklist.show { display: block; }
.pw-checklist ul { list-style: none; margin: 0; padding: 0; }
.pw-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .84rem;
    color: var(--color-muted, #777);
    padding: 3px 0;
}
.pw-checklist li i { width: 16px; text-align: center; color: var(--color-muted, #bbb); }
.pw-checklist li.pw-ok { color: #198754; }
.pw-checklist li.pw-ok i { color: #198754; }

/* ===== زر المتابعة عبر Google ===== */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border, #e5e0d0);
    border-radius: 8px;
    background: var(--color-surface, #fff);
    color: var(--color-text);
    font-weight: 600;
    font-size: .92rem;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.google-btn:hover { background: var(--color-bg, #f8f6f0); border-color: #ccc; text-decoration: none; }
.google-btn .g-svg { width: 18px; height: 18px; }
.auth-or-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-muted, #999);
    font-size: .8rem;
    margin: 14px 0;
}
.auth-or-divider::before,
.auth-or-divider::after { content: ""; flex: 1 1 auto; border-top: 1px solid var(--color-border, #e5e0d0); }
