:root {
  color-scheme: light;
  --bg: #f7f9fc; --surface: #ffffff; --surface-soft: #eef3f9;
  --text: #24354d; --text-muted: #5e6e84; --border: #dbe3ee;
  --accent: #285ea0; --accent-soft: #e8f0fb; --highlight: #dceafb;
  --focus-ring: #2563b5; --radius: 14px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 17px; line-height: 1.7; background: var(--bg); color: var(--text);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141b27; --surface: #1c2738; --surface-soft: #233147;
  --text: #edf2fa; --text-muted: #aebdd2; --border: #3a4b65;
  --accent: #a9cbf7; --accent-soft: #293f60; --highlight: #344f75;
  --focus-ring: #a4caff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: .22em; }
button, input { font: inherit; }
button, .button-link { cursor: pointer; }
button, input, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 4px; }
h1, h2, h3, p { margin-block: 0 1rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.35; font-weight: 600; letter-spacing: -.035em; text-wrap: balance; }
html[lang="ar"] h1 { letter-spacing: 0; line-height: 1.65; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; }
.container { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
main.container { flex: 1; padding-block: 38px 90px; }
main:focus { outline: none; }
.reading-width { max-width: 840px; }
.site-header { background: var(--surface); border-block-end: 1px solid var(--border); }
.header-top { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { display: inline-flex; align-items: center; text-decoration: none; font-size: 1.38rem; font-weight: 650; color: var(--text); letter-spacing: -.04em; }
.brand-domain { font-weight: 400; color: var(--text-muted); }
.brand-mark { display: block; flex-shrink: 0; margin-inline-end: 11px; width: 35px; height: 39px; object-fit: contain; }
.header-actions { display: flex; gap: 22px; align-items: center; font-size: .88rem; }
.header-actions a { padding-block: 12px; text-decoration: none; }
.theme-toggle { background: var(--surface-soft); color: var(--text); border: 1px solid var(--border); border-radius: 24px; padding: 8px 13px; min-height: 44px; display: flex; gap: 7px; align-items: center; font-size: .82rem; }
.theme-toggle > span:first-child { font-size: 1.15rem; }
.menu-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 10px; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 9px; font: inherit; white-space: nowrap; }
.site-header { position: relative; }
.navigation-panel { padding: 24px; background: var(--surface); }
.js .navigation-panel { position: absolute; z-index: 20; inset-block-start: 100%; inset-inline-end: max(16px, calc((100% - 1120px) / 2)); width: min(380px, calc(100% - 32px)); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px #00000012; }
.menu-close { display: block; margin-inline-start: auto; margin-block-end: 8px; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text); font-size: 1.5rem; }
.menu-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; padding: 10px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text); text-align: start; font-size: .94rem; font-weight: 550; }
.menu-group-toggle:hover, .menu-group-toggle:focus-visible { background: var(--accent-soft); }
.menu-chevron { width: 7px; height: 7px; flex-shrink: 0; margin-inline: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
html[dir="rtl"] .menu-chevron { transform: rotate(135deg); }
.menu-group-toggle[aria-expanded="true"] .menu-chevron { transform: rotate(45deg); }
.menu-group-links { padding-inline-start: 14px; }
.menu-divider { margin-block-start: 18px; padding-block-start: 18px; border-block-start: 1px solid var(--border); }
.navigation-panel a { display: block; padding: 10px 8px; min-height: 44px; color: var(--text); text-decoration: none; font-size: .9rem; overflow-wrap: anywhere; }
.navigation-panel a:hover, .navigation-panel a[aria-current] { color: var(--accent); background: var(--accent-soft); border-radius: 5px; }
.navigation-panel a[aria-current] { font-weight: 650; }
.breadcrumbs { display: flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--text-muted); margin-block-end: 30px; }
.breadcrumbs .breadcrumb-category { flex-shrink: 0; min-width: 0; max-inline-size: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs > [aria-hidden] { flex-shrink: 0; }
.breadcrumbs a { flex-shrink: 0; text-decoration: none; }
.breadcrumbs [aria-current] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero { padding-block: 25px 14px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.9rem); font-weight: 500; }
.eyebrow { font-size: .7rem; letter-spacing: .2em; font-weight: 650; color: var(--accent); margin-block-end: 12px; }
.intro, .description { color: var(--text-muted); max-width: 720px; }
.search-form { display: flex; max-width: 680px; padding: 7px; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-block: 14px 40px; }
.search-form input { min-width: 0; flex: 1; border: 0; color: var(--text); background: transparent; padding: 9px 12px; font-size: .94rem; }
.search-form input::placeholder { color: var(--text-muted); opacity: 1; }
.search-form button, .button-link { background: var(--accent); color: var(--surface); border: 0; border-radius: 9px; padding: 10px 20px; font-size: .88rem; text-decoration: none; }
.category-section { margin-block: 44px; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-height: 105px; padding: 22px; display: flex; justify-content: space-between; align-items: center; gap: 14px; color: var(--text); text-decoration: none; font-weight: 550; font-size: .93rem; }
.category-description { display: block; margin-block-start: 9px; font-size: .82rem; font-weight: 400; line-height: 1.7; color: var(--text-muted); }
.category-card > span:first-child { min-width: 0; }
.category-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.card-arrow { color: var(--accent); flex-shrink: 0; font-size: 1.15rem; }
html[dir="rtl"] .card-arrow { transform: scaleX(-1); }
.list-section { margin-block-start: 36px; }
.dhikr-list { padding: 0; margin: 0; list-style: none; border-block-start: 1px solid var(--border); }
.dhikr-list li { border-block-end: 1px solid var(--border); }
.dhikr-list a { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 8px; color: var(--text); font-size: .98rem; text-decoration: none; }
.dhikr-list a:hover { background: var(--accent-soft); }
.empty-state { padding-block: 30px; color: var(--text-muted); }
.reading-hint { font-size: .8rem; color: var(--text-muted); margin-block: 22px 13px; }
.reading-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented-reading, .grouped-reading { display: grid; gap: 24px; }
.dhikr-group-card { min-width: 0; }
.group-title { margin: 0; padding: 20px 24px; font-size: 1.2rem; overflow-wrap: anywhere; }
.segment-card { min-width: 0; }
.repeat-note { margin: 0; padding: 13px 24px; border-block-end: 1px solid var(--border); color: var(--text-muted); text-align: end; font-size: .85rem; font-weight: 550; cursor: default; }
.segment-card .reading-channel { padding-block: 20px; }
.reading-channel { padding: 27px 32px 30px; }
.reading-channel + .reading-channel { border-block-start: 1px solid var(--border); }
.channel-label { font-size: .72rem; letter-spacing: .06em; color: var(--text-muted); margin-block-end: 14px; font-weight: 600; }
html[lang="ar"] .channel-label { letter-spacing: 0; font-size: .85rem; }
.segment-text { line-height: 2.1; }
.channel-ar { background: var(--surface); padding-block: 28px 36px; }
.channel-ar .segment-text { font-family: "Traditional Arabic", "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, serif; font-size: clamp(1.65rem, 3.3vw, 2rem); line-height: 2.2; }
.channel-transliteration { background: var(--surface-soft); }
.channel-transliteration .segment-text { font-size: 1.02rem; color: var(--text); }
.channel-en .segment-text { font-size: 1.08rem; }
.dhikr-segment { border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 2px 3px; cursor: text; transition: background-color 100ms ease; }
.dhikr-segment.is-active { background: var(--highlight); box-shadow: inset 0 -2px var(--accent); }
.dhikr-hadiths { margin-block-start: 32px; text-align: start; }
.dhikr-hadiths > h2 { font-size: 1.3rem; font-weight: 700; }
.hadith-card { padding: clamp(20px, 4vw, 32px); margin-block-end: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere; }
.hadith-text { margin: 0; font-size: 1.1rem; line-height: 1.9; white-space: pre-wrap; }
.dhikr-hadiths[lang="ar"] .hadith-text { line-height: 2; }
.hadith-note { margin-block-start: .9rem; padding-block: .75rem; padding-inline: .9rem; border-inline-start: 3px solid var(--border); background: var(--surface-soft); font-size: .95rem; overflow-wrap: anywhere; }
.hadith-note__label { font-weight: 600; margin-block-end: .25rem; }
.hadith-note__text { margin: 0; line-height: 1.7; white-space: pre-wrap; }
.hadith-note__text + .hadith-note__text { margin-block-start: .6rem; }
.hadith-references { list-style: none; padding: 0; margin: 20px 0 0; font-size: .85rem; color: var(--text-muted); }
.hadith-references li + li { margin-block-start: 6px; }
.hadith-reference-domain { color: var(--text-muted); font-size: .92em; }
.sources { margin-block-start: 42px; }
.dhikr-links-section { margin-block-start: 32px; padding-block-start: 24px; border-block-start: 1px solid var(--border); }
.dhikr-category-chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.dhikr-category-chips a { display: block; padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; overflow-wrap: anywhere; }
.dhikr-neighbors, .dhikr-related-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.dhikr-neighbor, .dhikr-related-links a { display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; overflow-wrap: anywhere; }
.dhikr-neighbor-label { display: block; color: var(--text-muted); font-size: .8rem; margin-block-end: 6px; }
.dhikr-nav-arrow { display: inline-block; }
html[dir="rtl"] .dhikr-nav-arrow { transform: scaleX(-1); }
.dhikr-related-links { list-style: none; margin: 0; padding: 0; }
.dhikr-related-links a { height: 100%; }
.dhikr-category-chips a:hover, .dhikr-neighbor:hover, .dhikr-related-links a:hover { background: var(--accent-soft); border-color: var(--accent); }
.sources > h2 { margin-block-end: 17px; }
.source-card { padding: 22px 25px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); margin-block-end: 12px; }
.source-heading { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.source-heading h3 { margin: 0; font-weight: 600; }
.reference { font-weight: 400; color: var(--text-muted); padding-inline-start: 5px; }
.provider { font-size: .75rem; color: var(--text-muted); }
.narrator { color: var(--text-muted); font-size: .88rem; margin-block: 5px 9px; }
.source-link { font-size: .82rem; display: inline-block; padding-block: 6px; }
.source-url { display: block; overflow-wrap: anywhere; font-size: .72rem; }
details { margin-block-start: 12px; border-block-start: 1px solid var(--border); padding-block-start: 8px; }
summary { cursor: pointer; padding-block: 7px; color: var(--text-muted); font-size: .82rem; }
.source-text { white-space: pre-wrap; margin-block: 14px 0; line-height: 1.95; }
.page-content { white-space: normal; max-width: 800px; line-height: 1.85; overflow-wrap: anywhere; }
.draft-note { color: var(--text-muted); font-size: .72rem; border-inline-start: 2px solid var(--border); padding-inline-start: 10px; margin-block-end: 25px; }
.site-footer { border-block-start: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .83rem; }
.footer-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; min-height: 104px; padding-block: 24px; }
.footer-inner nav { display: flex; flex-wrap: wrap; flex: 1 1 600px; min-width: 0; gap: 4px 22px; align-items: center; }
.footer-inner a { text-decoration: none; padding-block: 10px; }
.footer-brand { display: inline-flex; align-items: center; color: var(--text); font-weight: 600; }
.year { margin-inline-start: auto; }
.skip { position: fixed; inset-block-start: -100px; inset-inline-start: 20px; padding: 10px 18px; z-index: 5; background: var(--surface); }
.skip:focus { inset-block-start: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 800px) {
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .container { width: calc(100% - 40px); }
  .header-actions { gap: 15px; }
}
@media (max-width: 600px) {
  :root { font-size: 16px; }
  .container { width: calc(100% - 32px); }
  .header-top { min-height: 80px; gap: 10px; }
  .wordmark { font-size: 1.25rem; }
  .brand-mark { width: 26px; height: 31px; margin-inline-end: 7px; }
  .header-actions { gap: 6px; }
  .menu-toggle { font-size: .8rem; padding-inline: 7px; }
  .search-link { display: none; }
  .theme-toggle { padding: 7px 12px; }
  [data-theme-label] { display: none; }
  main.container { padding-block: 24px 56px; }
  .hero { padding-block-start: 15px; }
  .hero h1 { margin-block-end: 12px; }
  .intro { max-width: 300px; }
  .category-card { padding: 17px; min-height: 110px; font-size: .9rem; }
  .category-grid { gap: 9px; }
  .search-form { padding: 5px; gap: 3px; }
  .search-form input { padding-inline: 8px; font-size: .85rem; }
  .search-form button { padding-inline: 13px; }
  .search-form button span { display: none; }
  .reading-channel { padding: 20px 18px 25px; }
  .channel-ar .segment-text { line-height: 2.25; }
  .source-card { padding: 19px; }
  .breadcrumbs { margin-block-end: 24px; }
  .reading-hint { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 440px) {
  .category-grid { grid-template-columns: minmax(0, 1fr); }
  .category-card { min-height: 78px; padding: 18px; font-size: .98rem; }
}

/* Optional analytics: nonblocking, using the site's existing colors. */
.footer-settings { border: 0; background: transparent; color: var(--accent); padding: 10px 0; font: inherit; text-align: start; }
.consent-banner { position: fixed; z-index: 30; inset-inline-end: 16px; inset-block-end: 16px; width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px #00000018; font-size: .85rem; }
.consent-banner h2 { font-size: 1rem; margin-block-end: 8px; }
.consent-banner p { margin-block-end: 12px; }
.consent-banner > a { display: inline-block; padding-block: 8px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 12px; }
.consent-actions button { flex: 1 1 130px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); background: var(--accent-soft); font: inherit; }
.consent-actions button:hover { background: var(--highlight); }
.consent-status { color: var(--text-muted); }

.brand-ar { padding-inline: 8px; letter-spacing: 0; white-space: nowrap; }
html[lang="ar"] .wordmark { flex-shrink: 0; }
@media (max-width: 600px) {
  html[lang="ar"] .header-top { flex-wrap: wrap; padding-block: 12px; }
  html[lang="ar"] .wordmark { font-size: 1.05rem; }
}
@media (max-width: 350px) {
  html[lang="ar"] .header-actions { margin-inline-start: auto; }
  html[lang="ar"].js .navigation-panel { max-height: calc(100dvh - 150px); }
}
