*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
/* custom scrollbar (kept for reference):
* { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
*::-webkit-scrollbar { width: 3px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 0; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink); } */
:root {
  --bg: #faf9f7; --ink: #1a1a1a; --muted: #888; --accent: #b5935a;
  --border: #e8e4de; --max: 680px;
}
html { font-size: 16px; }
body { background: var(--bg); color: var(--ink); font-family: 'Inter', sans-serif; min-height: 100vh; }
header { border-bottom: 1px solid var(--border); padding: 0; position: sticky; top: 3rem; background: var(--bg); z-index: 100; box-shadow: 0 -8px 0 8px var(--bg); opacity: 0; transform: translateY(-0.5rem); pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; overflow: hidden; }
.progress-bar { position: absolute; bottom: 0; left: 0; height: 2px; width: 0%; background: var(--accent); }
header.nav-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.header-link { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.85rem 1.25rem; text-decoration: none; width: 100%; }
.header-num, .header-name, .header-dot { font-weight: 700; color: var(--accent); }
.header-dot { display: none; }
.header-num { font-size: 1.15rem; }
.header-name, .header-dot { font-size: 0.8rem; }
@media (min-width: 640px) { .header-name, .header-dot { font-size: 1rem; } .header-num { font-size: 1.65rem; } .header-emoji { font-size: 1.3rem; } }
.header-name { text-transform: uppercase; letter-spacing: 0.06em; }
.header-link:hover .header-num, .header-link:hover .header-name, .header-link:hover .header-dot { color: var(--ink); }
main { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.shalim-nav { font-family: system-ui,-apple-system,sans-serif; font-size: .875rem; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(0,0,0,.1); position: sticky; top: 0; background: rgba(240, 236, 231, 0.7); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); z-index: 9999; }
.shalim-nav a { color: #555; text-decoration: none; }
.shalim-nav a:hover { color: #111; }
.shalim-nav-title { color: #555; text-decoration: none; }
.reader-header { display: block; text-decoration: none; color: inherit; padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--border); position: relative; }
.reader-header:hover h2 { color: var(--accent); }
.reader-header::after { content: attr(data-num); position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-family: 'Cormorant', serif; font-size: 8rem; font-weight: 700; line-height: 1; color: var(--ink); opacity: 0.06; pointer-events: none; user-select: none; font-variant-numeric: lining-nums; }
.surah-num { display: none; }
h2 { font-family: 'Lora', serif; font-size: 2.5rem; font-weight: 400; line-height: 1.2; }
.surah-sub { font-size: 1.1rem; color: var(--muted); margin-top: 0.4rem; }
.surah-summary { font-family: 'Spectral', serif; font-size: 1rem; line-height: 1.75; color: var(--muted); padding: 1.5rem 0; border-bottom: 1px solid var(--border); font-style: italic; text-align: center; }
.surah-summary b { font-weight: 700; }
@media (min-width: 480px) { .surah-summary { font-size: 1.1rem; } }
.verse-ref { color: var(--accent); text-decoration: none; }
.verse-ref:hover { text-decoration: underline; }
.bismillah { text-align: center; font-family: 'Scheherazade New', 'KFGQPC Uthman Taha Naskh', 'Geeza Pro', serif; font-size: 2.2rem; line-height: 1.6; padding: 1.5rem 0; color: var(--accent); direction: rtl; border-bottom: 1px solid var(--border); }
.verses { padding: 1.5rem 0; }
.verse { display: flex; gap: 1rem; padding: 0.7rem 0; align-items: flex-start; scroll-margin-top: 7rem; }
.verse-num { font-family: 'Cormorant', serif; font-size: 2.5rem; color: #8a7050; font-weight: 700; width: 2.8rem; flex-shrink: 0; text-align: right; line-height: 1; font-variant-numeric: lining-nums; }
.verse-text { font-family: 'Lora', serif; font-size: 1.05rem; line-height: 1.8; }
.surah-nav { display: flex; justify-content: center; padding: 1.5rem 0; border-top: 1px solid var(--border); margin-top: 1rem; }
.surah-nav a { font-size: 0.8rem; color: var(--muted); text-decoration: none; text-transform: uppercase; letter-spacing: 0.06em; }
.surah-nav a:hover { color: var(--ink); }
.header-surah { font-size: 0.72rem; font-weight: 700; color: var(--accent); letter-spacing: 0.07em; text-transform: uppercase; }
.openmoji { filter: grayscale(1) sepia(1) saturate(2) brightness(0.9); }
@view-transition { navigation: auto; }
@keyframes nav-slide-from-right { from { transform: translateX(100%); } }
@keyframes nav-slide-to-left    { to   { transform: translateX(-25%); } }
@keyframes nav-slide-from-left  { from { transform: translateX(-25%); } }
@keyframes nav-slide-to-right   { to   { transform: translateX(100%); } }
html[data-nav-dir="forward"]::view-transition-new(root) { animation: nav-slide-from-right 0.3s ease; }
html[data-nav-dir="forward"]::view-transition-old(root) { animation: nav-slide-to-left    0.3s ease; }
html[data-nav-dir="back"]::view-transition-new(root)    { animation: nav-slide-from-left  0.3s ease; }
html[data-nav-dir="back"]::view-transition-old(root)    { animation: nav-slide-to-right   0.3s ease; }
@media (display-mode: standalone) { .shalim-nav { display: none; } header { top: 0; box-shadow: none; } }
/* ── Footnotes pending banner ── */
.fn-banner { font-family: system-ui, sans-serif; font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.55rem 0.9rem; margin: 1rem 0 0;
  text-align: center; letter-spacing: 0.01em; }

/* ── Footnote markers ── */
sup.fn { color: var(--accent); font-size: 0.6em; line-height: 0; cursor: pointer;
  font-family: system-ui, sans-serif; font-style: normal;
  vertical-align: super; margin-left: 1px; user-select: none; -webkit-user-select: none; }
sup.fn:active { opacity: 0.5; }

/* ── Footnote panel ── */
.fn-panel { position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: rgba(250, 249, 247, 0.7); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.10);
  padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  max-height: 45vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.22s ease; }
.fn-panel.open { transform: translateY(0); }
.fn-close { position: absolute; top: 0.5rem; right: 0.75rem;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 4px 8px; }
.fn-close:hover { color: var(--ink); }
.fn-label { font-family: system-ui, sans-serif; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 0.5rem; }
.fn-text { font-family: 'Lora', serif; font-size: 0.95rem; line-height: 1.7; color: var(--ink); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714; --ink: #edeae2; --muted: #6e6b65; --accent: #c9a870; --border: #2d2925;
  }
  .shalim-nav { background: rgba(20, 18, 16, 0.7); border-bottom-color: rgba(255,255,255,.08); }
  .shalim-nav a, .shalim-nav-title { color: #6e6b65; }
  .shalim-nav a:hover { color: var(--ink); }
  .fn-panel { background: rgba(26, 23, 20, 0.7); box-shadow: 0 -4px 24px rgba(0,0,0,0.4); }
}
.page-title { padding: 3rem 0 2.5rem; border-bottom: 1px solid var(--border); }
.page-title h1 { font-family: 'Lora', serif; font-size: 3.5rem; font-weight: 400; line-height: 1.15; color: var(--accent); }
.page-title-sub { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 0.6rem; }
@media (min-width: 640px) { .page-title h1 { font-size: 5rem; } }
#chapter-list { padding-top: 0.5rem; padding-bottom: 3rem; }
.chapter-row { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.chapter-row:hover .chapter-en { color: var(--accent); }
.chapter-num { font-family: 'Cormorant', serif; font-size: 3.5rem; font-weight: 700; color: #8a7050; width: 3.5rem; flex-shrink: 0; text-align: right; line-height: 1; font-variant-numeric: lining-nums; }
.chapter-num.three-digit { font-size: 2.8rem; }
.chapter-name { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.chapter-en { font-family: 'Lora', serif; font-size: 1rem; font-weight: 400; color: var(--ink); transition: color 0.15s; }
.chapter-ar { font-size: 0.78rem; color: var(--muted); }
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 10000; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--bg); border: 1px solid var(--border); max-width: 480px; width: 100%; padding: 1.4rem; position: relative; }
.modal-label { font-size: 0.68rem; color: var(--accent); letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 0.7rem; }
.modal p { font-family: 'Lora', serif; font-size: 0.82rem; line-height: 1.7; color: var(--ink); margin-bottom: 0.6rem; }
.modal p:last-of-type { margin-bottom: 0; }
.modal-close { margin-top: 1.1rem; display: block; width: 100%; padding: 0.5rem; background: var(--accent); color: #fff; border: none; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.modal-close:hover { opacity: 0.85; }
.margin-back {
  display: none;
  position: fixed;
  z-index: 50;
  top: 50%;
  left: calc((100vw - min(var(--max), 100vw - 2.5rem)) / 4);
  transform: translate(-50%, -50%);
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.margin-back:hover { color: var(--ink); border-color: var(--accent); }
@media (min-width: 960px) { .margin-back { display: flex; } }
