/* Ferdaws content library: article layout, adhkar cards, tools. Built on style.css tokens. */

.content-page .frame { max-width: 1200px; }
.c-top { padding: 28px 24px 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; font-size: 13px; color: var(--faint); }
.crumbs li { display: inline-flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: "›"; color: var(--faint); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); }

.c-hero { max-width: 760px; padding: 26px 0 8px; }
.c-hero h1 { font-size: clamp(32px, 5.4vw, 52px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 550; margin: 16px 0 0; text-wrap: balance; }
.c-hero h1 .ar-inline, [lang="ar"] .c-hero h1 { font-family: var(--font-ar); letter-spacing: 0; line-height: 1.3; }
.c-lede { font-size: 18px; line-height: 1.6; color: var(--muted); margin: 14px 0 0; max-width: 62ch; }
.c-lede:empty { display: none; }
.answer { margin-top: 22px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 4px; }
.answer b { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
[lang="ar"] .answer b { letter-spacing: 0; text-transform: none; font-size: 13px; }
.answer p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--text); }
.c-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; color: var(--faint); }
.c-meta a { color: var(--accent); }

.c-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding: 28px 24px 24px; align-items: start; }
.c-toc { position: sticky; top: 84px; font-size: 13.5px; }
.c-toc summary { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); cursor: pointer; list-style: none; margin-bottom: 10px; }
[lang="ar"] .c-toc summary { letter-spacing: 0; text-transform: none; font-size: 13px; }
.c-toc summary::-webkit-details-marker { display: none; }
.c-toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; border-inline-start: 1px solid var(--line); }
.c-toc a { display: block; padding: 5px 12px; margin-inline-start: -1px; border-inline-start: 2px solid transparent; color: var(--muted); line-height: 1.4; }
.c-toc a:hover { color: var(--text); }
.c-toc a.active { color: var(--text); border-inline-start-color: var(--accent); font-weight: 500; }

.c-body { max-width: 760px; min-width: 0; }
.c-sec { scroll-margin-top: 84px; padding-bottom: 12px; }
.c-sec + .c-sec { margin-top: 28px; }
.c-body h2 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.02em; font-weight: 600; line-height: 1.2; margin: 0 0 14px; text-wrap: balance; }
.c-body h3 { font-size: 18px; font-weight: 600; margin: 22px 0 8px; letter-spacing: -0.01em; }
.c-body p, .c-body li { font-size: 16.5px; line-height: 1.75; color: var(--text); }
.c-body p { margin: 0 0 14px; max-width: 70ch; }
.c-body ul, .c-body ol { margin: 0 0 16px; padding-inline-start: 22px; display: grid; gap: 6px; }
.c-body a:not(.btn):not(.mini-card) { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.c-body b, .c-body strong { font-weight: 600; }
[lang="ar"] .c-body p, [lang="ar"] .c-body li { font-family: var(--font-ar); font-size: 18px; line-height: 1.95; }
[lang="ar"] .c-body h2, [lang="ar"] .c-body h3 { font-family: var(--font-ar); letter-spacing: 0; }
[lang="ar"] body, html[lang="ar"] .content-page { font-family: var(--font-ar); }

.callout { margin: 18px 0; padding: 14px 16px; border-radius: var(--r-sm); background: var(--sunken); border-inline-start: 3px solid var(--line-2); font-size: 15.5px; line-height: 1.65; color: var(--text); }
.callout.tip { background: var(--accent-soft); border-inline-start-color: var(--accent); }
.steps { counter-reset: s; list-style: none; padding: 0 !important; gap: 10px !important; }
.steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 52px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
[dir="rtl"] .steps li { padding: 12px 52px 12px 14px; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 14px; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; display: grid; place-items: center; }

.verse, .hadith { margin: 20px 0; padding: 18px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.verse-ar { font-family: var(--font-ar); font-size: 24px; line-height: 2; text-align: center; margin: 0 !important; max-width: none !important; }
.verse-en { text-align: center; color: var(--muted) !important; margin: 8px auto 0 !important; font-size: 15.5px !important; }
.verse figcaption, .hadith figcaption { text-align: center; font-size: 13px; color: var(--faint); margin-top: 8px; }
.hadith p { margin: 0 !important; font-size: 17px !important; line-height: 1.7 !important; }
.hadith figcaption { text-align: start; }
.grade { color: var(--accent); }

.tbl-scroll { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ctable { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.ctable th, .ctable td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.55; }
.ctable th { font-weight: 600; font-size: 13px; color: var(--muted); background: var(--surface-2); }
.ctable tr:last-child td { border-bottom: 0; }

/* adhkar cards */
.dk-list { display: grid; gap: 12px; margin: 16px 0; }
.dk-progress { position: sticky; top: 64px; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.dk-progress .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.dk-progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.dk-progress b { color: var(--text); font-weight: 600; }
.dk { scroll-margin-top: 120px; padding: 18px 20px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s, opacity .2s; }
.dk.is-done { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 0 0 3px var(--accent-soft); }
.dk-h { display: flex; align-items: center; gap: 10px; }
.dk-h h3 { margin: 0 !important; font-size: 15.5px !important; flex: 1; }
.dk-n { width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.dk.is-done .dk-n { background: var(--accent); color: #fff; box-shadow: none; }
.dk-count { font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.dk-ar { font-family: var(--font-ar); font-size: clamp(22px, 3.2vw, 27px); line-height: 2.05; margin: 14px 0 8px !important; max-width: none !important; color: var(--text); text-align: right; }
.dk-tr { font-size: 15px !important; line-height: 1.65 !important; color: var(--muted) !important; font-style: italic; margin: 0 0 8px !important; }
.dk-en { font-size: 16px !important; margin: 0 0 8px !important; }
.dk-virtue, .dk-note { font-size: 14.5px !important; line-height: 1.6 !important; color: var(--muted) !important; margin: 0 0 8px !important; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.dk-virtue b { color: var(--text); }
.dk-f { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dk-src { font-size: 12.5px; color: var(--faint); }
.dk-src b { color: var(--muted); font-weight: 500; }
.dk-actions { display: inline-flex; gap: 6px; }
.dk-btn { height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); display: inline-flex; align-items: center; gap: 6px; transition: background .15s; -webkit-tap-highlight-color: transparent; }
.dk-btn:hover { background: var(--sunken); }
.dk-tap { min-width: 128px; justify-content: center; }
.dk-tap b { font-variant-numeric: tabular-nums; color: var(--accent); }
.dk.is-done .dk-tap { background: var(--accent); color: #fff; box-shadow: none; }
.dk.is-done .dk-tap b { color: #fff; }
[lang="ar"] .dk-ar { font-size: clamp(23px, 3.4vw, 28px); }

.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.mini-card { display: grid; gap: 4px; padding: 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.mini-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.mini-card b { font-size: 15px; font-weight: 600; }
.mini-card span { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.faq-list { display: grid; gap: 8px; }
.faq-list details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 16px; }
.faq-list summary { cursor: pointer; list-style: none; padding: 14px 0; font-weight: 500; display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--faint); font-size: 18px; line-height: 1; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details > div { padding: 0 0 14px; color: var(--muted); font-size: 15.5px; line-height: 1.7; }

.c-cta { margin: 36px 0 24px; padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; position: relative; overflow: hidden; }
.c-cta::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 120% at 100% 0%, var(--accent-soft), transparent 60%); pointer-events: none; }
.c-cta > * { position: relative; }
.c-cta h2 { margin: 0 0 4px !important; font-size: 20px !important; }
.c-cta p { margin: 0 !important; color: var(--muted) !important; font-size: 15px !important; max-width: 52ch; }
.c-sources h2 { font-size: 15px !important; margin: 0 0 8px !important; }
.c-sources ul { font-size: 14px; color: var(--muted); gap: 2px !important; }
.c-sources li { font-size: 14px !important; color: var(--muted) !important; line-height: 1.6 !important; }
.c-disclaimer { font-size: 13px !important; color: var(--faint) !important; line-height: 1.6 !important; margin-top: 18px !important; padding-top: 14px; border-top: 1px solid var(--line); }

.c-related { padding: 24px 24px 56px; border-top: 1px solid var(--line); }
.c-related h2 { font-size: 20px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.01em; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rel-card { display: grid; align-content: start; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s, box-shadow .15s; }
.rel-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.rel-card b { font-size: 16px; font-weight: 600; line-height: 1.35; }
.rel-card span:last-child { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.rel-tag { font-size: 11.5px !important; color: var(--accent) !important; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* tools */
.tool { margin: 18px 0 22px; padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.counter { display: grid; justify-items: center; gap: 16px; text-align: center; }
.counter-ar { font-family: var(--font-ar); font-size: clamp(26px, 4vw, 34px); line-height: 1.8; margin: 0 !important; max-width: none !important; }
.counter-tr { margin: 0 !important; color: var(--muted) !important; font-size: 15px !important; }
.counter-btn { position: relative; width: min(280px, 78vw); aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; gap: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; transition: transform .08s; }
.counter-btn:active { transform: scale(.97); }
.counter-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--sunken); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray .2s; }
.counter-num { position: relative; font-size: clamp(56px, 12vw, 76px); font-weight: 550; letter-spacing: -0.04em; line-height: 1; }
.counter-of { position: relative; font-size: 14px; color: var(--muted); }
.counter-hint { position: relative; font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.counter-bar { display: grid; gap: 12px; justify-items: center; width: 100%; }
.counter-stats { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.counter-stats b { color: var(--text); font-weight: 600; }
.counter-opt { font-size: 13px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.counter.hit .counter-btn { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft); }

.ram-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.ram-head b { font-size: 22px; color: var(--text); font-weight: 600; }
.ram-bar { flex: 1; min-width: 160px; height: 8px; border-radius: 8px; background: var(--sunken); overflow: hidden; }
.ram-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.ram-grid { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
.ram-grid th, .ram-grid td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.ram-grid thead th { font-weight: 600; color: var(--muted); font-size: 12px; position: sticky; top: 0; background: var(--surface); }
.ram-grid tbody th { color: var(--muted); font-weight: 500; }
.ram-grid input, .juz input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.ram-grid tr.full th { color: var(--accent); }

.khatm-plan { display: grid; gap: 12px; }
.khatm-plan .seg { flex-wrap: wrap; }
.khatm-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.khatm-out div { padding: 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 2px; text-align: center; }
.khatm-out b { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.khatm-out span { font-size: 13px; color: var(--muted); }
.juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 6px 0 12px; }
.juz { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
.juz input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; }
.juz:has(input:checked) { background: var(--accent); color: #fff; border-color: transparent; }
.juz:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* library hub */
.lib-hero { text-align: center; padding: 56px 24px 24px; max-width: 820px; margin: 0 auto; }
.lib-hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 550; margin: 18px 0 0; text-wrap: balance; }
.lib-hero h1 span { color: var(--faint); display: block; }
.lib-hero .c-lede { margin: 14px auto 0; }
.lib-search { display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 26px auto 0; padding: 0 16px; height: 50px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.lib-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.lib-search svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.lib-search input { flex: 1; border: 0; outline: none; background: none; font-size: 15.5px; height: 100%; min-width: 0; }
.lib-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.lib-jump a { font-size: 13.5px; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); color: var(--muted); }
.lib-jump a:hover { color: var(--text); }
.lib-group { padding: 32px 24px 8px; scroll-margin-top: 72px; }
.lib-gh { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 14px; }
.lib-gh h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.lib-gh p { margin: 0; color: var(--muted); font-size: 15px; }
.lib-empty { text-align: center; color: var(--muted); padding: 24px; }
.library .foot { margin-top: 40px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--tip-bg); color: var(--tip-text); padding: 10px 14px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .c-layout { grid-template-columns: 1fr; gap: 8px; }
  .c-toc { position: static; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 12px 14px; }
  .c-toc details:not([open]) summary { margin-bottom: 0; }
  .c-toc summary { margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .c-top { padding: 18px 16px 0; }
  .c-layout { padding: 18px 16px 16px; }
  .c-related { padding: 20px 16px 40px; }
  .lib-hero { padding: 40px 16px 16px; }
  .lib-group { padding: 26px 16px 4px; }
  .dk { padding: 16px 14px 12px; }
  .dk-f { flex-direction: column; align-items: stretch; }
  .dk-actions { justify-content: stretch; }
  .dk-actions .dk-btn { flex: 1; justify-content: center; }
  .khatm-out b { font-size: 22px; }
  .juz-grid { grid-template-columns: repeat(6, 1fr); }
  .tool { padding: 16px 12px; }
  .c-cta { padding: 18px; }
}
@media print {
  .nav, .c-toc, .c-cta, .c-related, .foot, .dk-actions, .dk-progress, .toast { display: none !important; }
  .c-layout { display: block; padding: 0; }
  .dk { break-inside: avoid; box-shadow: none; }
}

.ayah { font-family: var(--font-ar); color: var(--accent); font-size: .8em; white-space: nowrap; margin-inline: .15em; }
