/* ============================================================
   Noorie Foundation · theme layer (loads after site.css)
   White / blue / dark-blue by day, black / orange by night.
   Re-skins the existing markup; forms, live parts and the staff page keep working.
   ============================================================ */
@font-face { font-family: "Amiri"; src: url("../fonts/amiri-arabic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #FFFFFF; --surface: #FFFFFF; --tint: #F2F6FC; --green-wash: #E6EEFB;
  --ink: #0B1F3A; --ink-2: #1E3357; --ink-3: #5B6B85; --line: #DCE4F0; --line-2: #B9C7DE;
  --brand: #1A56DB; --brand-ink: #0B3DA0; --brand-soft: #3B74E8;
  --sun: #5B8DEF; --sun-wash: #E6EEFB; --sun-ink: #0B3DA0;
  --deep: #0B1F3A; --on-deep: #F3F6FC; --on-deep-2: #AFC0DB;
  --ok: #1f7a4d; --ok-wash: #E6F4EC;
  --accent-soft: rgba(26, 86, 219, .10); --glow: rgba(26, 86, 219, .26);
  --glass: rgba(255, 255, 255, .72); --glass2: rgba(255, 255, 255, .28); --glass-line: rgba(255, 255, 255, .95);
  --shadow: 0 1px 2px rgba(11, 31, 58, .05), 0 18px 50px rgba(11, 31, 58, .12);
  --radius: 14px; --radius-lg: 22px;
  --arabic: "Amiri", "Scheherazade New", serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #070605; --surface: #121009; --tint: #0F0D0B; --green-wash: #1A1309;
  --ink: #F6EFE4; --ink-2: #D9CFBF; --ink-3: #A1978A; --line: #2A241C; --line-2: #3D342A;
  --brand: #FF7A1A; --brand-ink: #FF9B4A; --brand-soft: #FF9B4A;
  --sun: #FFB347; --sun-wash: #2A1D0E; --sun-ink: #FFB347;
  --deep: #0F0D0B; --on-deep: #F6EFE4; --on-deep-2: #A1978A;
  --ok: #4CC38A; --ok-wash: #11261A;
  --accent-soft: rgba(255, 122, 26, .14); --glow: rgba(255, 122, 26, .40);
  --glass: rgba(255, 255, 255, .07); --glass2: rgba(255, 255, 255, .02); --glass-line: rgba(255, 255, 255, .14);
  --shadow: 0 20px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
html[data-site="academy"] { --brand: #0B3DA0; --brand-ink: #1A56DB; --sun: #3B74E8; }
html[data-site="academy"][data-theme="dark"] { --brand: #FFB13B; --brand-ink: #FFC46B; --sun: #FFB347; }

body { transition: background-color .5s, color .5s; }
html[data-theme="dark"] .header.is-scrolled { background: rgba(7, 6, 5, .85); }
html[data-theme="dark"] img.hero-photo { filter: brightness(.85); }
h1, h2, h3, h4 { text-wrap: balance; }
.display, .h1 { font-weight: 500; }
.eyebrow::before { width: 26px; height: 1px; border-radius: 0; background: var(--brand); }

/* ---------- Buttons ---------- */
.btn { border-radius: 999px; box-shadow: 0 10px 30px -10px var(--brand); position: relative; overflow: hidden; isolation: isolate; }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s; z-index: -1; }
.btn:hover::after { transform: translateX(120%); }
.btn:hover { transform: translateY(-2px); }
.btn-ghost, .btn-outline-light, .btn-light { box-shadow: none; }
.btn-sun { --b: var(--brand); color: #fff; }
.btn-sun:hover { --b: var(--brand-ink); }
html[data-theme="dark"] .btn, html[data-theme="dark"] .btn-sun { color: #120800; }
html[data-theme="dark"] .btn-ghost { color: var(--ink); }
.btn-outline-light { background: var(--glass); color: var(--ink); border-color: var(--line-2); backdrop-filter: blur(10px); }
.btn-outline-light:hover { border-color: var(--brand); color: var(--brand); background: var(--glass); }
.cta .btn-outline-light, .door.is-deep .btn-outline-light { color: var(--on-deep); border-color: rgba(255,255,255,.35); background: transparent; }

/* ---------- Header: logo · glossy pill · tools ---------- */
.header { background: transparent; border-bottom: 0; }
.header.is-scrolled { background: color-mix(in srgb, var(--bg) 85%, transparent); border-bottom-color: var(--line); }
.header-in { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { gap: 10px; }
.brand-logo { height: 46px; width: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .15)); transition: transform .5s var(--ease); }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.05); }
.brand-name { color: var(--brand); font-weight: 600; font-size: 1.2rem; }
.brand-sub { color: var(--ink-3); }
.brand-mark { display: none; }
.brand-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.brand-ico svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .brand-ico { color: #120800; }
.nav { justify-self: center; }
.nav ul { gap: 2px; padding: 5px; border-radius: 999px; background: linear-gradient(180deg, var(--glass), var(--glass2)); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), inset 0 -1px 0 rgba(0, 0, 0, .05), 0 10px 30px -10px rgba(0, 0, 0, .25); position: relative; }
html[data-theme="dark"] .nav ul { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 10px 40px -10px rgba(255, 122, 26, .25); }
.nav ul::before { content: ""; position: absolute; inset: 1px; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, .5), transparent 45%); pointer-events: none; mix-blend-mode: soft-light; }
.nav a { position: relative; z-index: 1; padding: 8px 16px; border-radius: 999px; font-size: .9rem; white-space: nowrap; line-height: 1.4; }
.nav a::after { display: none; }
.nav a:hover { color: var(--brand); }
.nav a[aria-current="page"] { color: var(--brand); background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .45)); box-shadow: 0 2px 10px rgba(0, 0, 0, .1), inset 0 1px 0 #fff; }
html[data-theme="dark"] .nav a[aria-current="page"] { background: linear-gradient(180deg, rgba(255, 122, 26, .3), rgba(255, 122, 26, .08)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 0 20px rgba(255, 122, 26, .35); }
[dir="rtl"] .nav a { font-size: .98rem; padding: 2px 16px; line-height: 2.1; }
.header-tools { justify-self: end; gap: 8px; }
.lang-switch, .menu-btn, .theme-btn, .header-tools .btn { border-radius: 999px; min-height: 40px; height: 40px; border: 1px solid var(--glass-line); background: linear-gradient(180deg, var(--glass), var(--glass2)); backdrop-filter: blur(14px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); color: var(--ink); }
.header-tools .btn { min-height: 40px; padding: 0 14px; font-size: .85rem; font-weight: 700; }
.header-tools .btn:hover, .lang-switch:hover, .theme-btn:hover { color: var(--brand); border-color: var(--glass-line); transform: translateY(-1px); }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; padding: 0; cursor: pointer; }
.theme-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon { display: none; }
html[data-theme="dark"] .theme-btn .i-sun { display: none; }
html[data-theme="dark"] .theme-btn .i-moon { display: block; }
.menu-btn { width: 40px; height: 40px; }
@media (max-width: 1000px) { .nav { display: none; } .header-in { grid-template-columns: auto 1fr; } .header-tools { grid-column: 2; } }
@media (max-width: 480px) { .brand-text { display: none; } .brand-logo { height: 40px; } }
.sheet nav a { font-family: var(--serif); }
[dir="rtl"] .sheet nav a { font-family: var(--urdu); line-height: 1.9; }

/* ---------- New home hero ---------- */
.nh { position: relative; overflow: hidden; min-height: calc(100svh - var(--header-h)); display: grid; align-items: center; padding-block: clamp(32px, 6vw, 72px) clamp(48px, 8vw, 96px); }
.nh-pattern { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.nh-pattern svg { position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; color: var(--brand); opacity: .07; animation: nh-drift 50s linear infinite alternate; }
html[data-theme="dark"] .nh-pattern svg { opacity: .1; }
@keyframes nh-drift { from { transform: translate(0, 0) rotate(0); } to { transform: translate(3%, 2%) rotate(2deg); } }
.nh-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; z-index: 0; }
.nh-blob.a { width: 50vmax; height: 50vmax; background: var(--glow); top: -20%; inset-inline-end: -15%; animation: nh-float 14s ease-in-out infinite; }
.nh-blob.b { width: 34vmax; height: 34vmax; background: var(--accent-soft); bottom: -10%; inset-inline-start: -10%; animation: nh-float 18s ease-in-out infinite reverse; }
@keyframes nh-float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-4%, 5%); } }
.nh-in { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .nh-in { grid-template-columns: 1fr; } .nh { min-height: 0; } }
.nh .display { font-size: clamp(2.6rem, 6vw, 5rem); margin: 14px 0 10px; }
.nh .display em { font-style: italic; color: var(--brand); font-weight: 400; }
[dir="rtl"] .nh .display em { font-style: normal; }
.nh .display .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: .08em 0 .02em; margin: -.08em 0 -.02em; }
.nh .display .w > span { display: inline-block; transform: translateY(110%); }
html:not(.js) .nh .display .w > span, html.no-anim .nh .display .w > span { transform: none; }
[dir="rtl"] .nh .display .w { padding: .2em .05em .1em; margin: -.2em 0 -.1em; }
.nh-sub { font-family: var(--urdu); font-size: 1.35rem; color: var(--ink-2); margin: 0 0 12px; line-height: 2; }
[dir="rtl"] .nh-sub { font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.4; }
.nh .lead { margin-bottom: 26px; }
.nh-mini { display: flex; gap: 26px; margin-top: 34px; flex-wrap: wrap; }
.nh-mini div { font-size: .85rem; color: var(--ink-3); }
.nh-mini b { display: block; font-family: var(--serif); font-size: 1.4rem; color: var(--ink); font-weight: 500; }
/* medallion */
.medal { position: relative; width: min(100%, 480px); aspect-ratio: 1; margin-inline: auto; display: grid; place-items: center; }
.medal svg.medal-rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.medal .ring { transform-origin: 50% 50%; transform-box: fill-box; }
.medal .r1 { animation: medal-spin 120s linear infinite; } .medal .r2 { animation: medal-spin 80s linear infinite reverse; } .medal .r3 { animation: medal-spin 45s linear infinite; }
@keyframes medal-spin { to { transform: rotate(360deg); } }
.medal-core { position: relative; z-index: 2; width: 54%; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 16px; background: radial-gradient(circle at 35% 30%, var(--surface), var(--tint)); box-shadow: var(--shadow), inset 0 0 0 1px var(--line), 0 0 0 14px var(--accent-soft), 0 0 90px -20px var(--glow); }
.medal-core img { height: clamp(70px, 9vw, 110px); width: auto; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .18)); }
.medal-core .ico { width: 72px; height: 72px; border-radius: 22px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.medal-core .ico svg { width: 38px; height: 38px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.medal-core .motto { font-family: var(--serif); font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.2; color: var(--ink); }
[dir="rtl"] .medal-core .motto { font-family: var(--urdu); line-height: 1.8; }
.medal-core .sub { font-size: .7rem; color: var(--ink-3); letter-spacing: .14em; text-transform: uppercase; }
[dir="rtl"] .medal-core .sub { letter-spacing: 0; text-transform: none; font-size: .85rem; }
/* live panel (from the Worker) under the medallion: no clock, just what is on next */
.nh-live { position: relative; z-index: 2; margin-top: -18px; }
.nh-live .live { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px 20px; }
.live-clock { display: none !important; }
.live-label { font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); margin: 0 0 6px; }
[dir="rtl"] .live-label { letter-spacing: 0; text-transform: none; font-size: .9rem; }
.live-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.live-list li { padding: 8px 12px; border-radius: 12px; background: var(--tint); font-weight: 600; }
.live-meta { display: block; font-weight: 500; font-size: .82rem; color: var(--ink-3); }
.live-group + .live-group { margin-top: 12px; }
.live-group.is-now .live-label .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-inline-end: 6px; animation: nh-pulse 1.6s infinite; }
@keyframes nh-pulse { 0% { box-shadow: 0 0 0 0 var(--ok-wash); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Ayah band + academy CTA (book) ---------- */
.ayah-band { background: linear-gradient(160deg, #102a52, #0B1F3A); color: #f6efe4; }
html[data-theme="dark"] .ayah-band { background: linear-gradient(160deg, #1a1512, #0d0b09); }
.ayah-band .ayah, .ayah-band .ayah * { color: inherit; }
.ayah-band blockquote { font-family: var(--arabic); font-size: clamp(1.7rem, 4vw, 3rem); line-height: 2; }
.ayah-band .ayah-ur { font-family: var(--urdu); color: #dbe6f7; }
html[data-theme="dark"] .ayah-band .ayah-ur { color: #e8dcc5; }
.ayah-band cite { color: var(--sun); font-style: normal; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
.academy-cta { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin: 28px auto 0; padding: 20px 38px; border-radius: 28px; background: linear-gradient(135deg, #ffffff, #dbe6ff); color: #0B1F3A; text-decoration: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset, 0 25px 60px -15px rgba(91, 141, 239, .6); position: relative; transition: transform .5s var(--ease); max-width: 92vw; }
html[data-theme="dark"] .academy-cta { background: linear-gradient(135deg, #F2C14E, #ff8c1a); color: #1a1208; box-shadow: 0 25px 60px -15px rgba(255, 160, 40, .6); }
.academy-cta:hover { transform: translateY(-4px) scale(1.02); }
.academy-cta::before { content: ""; position: absolute; inset: -6px; border-radius: 34px; border: 1px solid rgba(255, 255, 255, .5); animation: nh-halo 2.4s ease-out infinite; }
@keyframes nh-halo { 0% { transform: scale(.95); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
.academy-cta .big { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; display: flex; align-items: center; gap: 10px; line-height: 1.3; }
[dir="rtl"] .academy-cta .big { font-family: var(--urdu); line-height: 1.9; }
.academy-cta .big svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.academy-cta .sm { font-size: .78rem; opacity: .8; font-weight: 600; }
.ayah-cta-wrap { text-align: center; }

/* ---------- Cards, doors, sections ---------- */
.door-x, .door, .card, .dept-card, .campus, .fieldset, .path-card, .story, .album { border-radius: var(--radius-lg); transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .3s; }
.door-x:hover, .door:hover, .card:hover, .dept-card:hover, .path-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.door-x.is-deep, .door.is-deep { background: linear-gradient(140deg, var(--brand), var(--brand-ink)); border-color: transparent; }
html[data-theme="dark"] .door-x.is-deep, html[data-theme="dark"] .door.is-deep { color: #120800; }
html[data-theme="dark"] .door-x.is-deep *, html[data-theme="dark"] .door.is-deep * { color: #120800 !important; }
.door-x.is-sun { background: linear-gradient(140deg, var(--deep), #163a6b); color: var(--on-deep); border-color: transparent; }
.door-x.is-sun h2, .door-x.is-sun p, .door-x.is-sun .door-go { color: var(--on-deep); }
html[data-theme="dark"] .door-x.is-sun { background: linear-gradient(140deg, #2a1d0e, #15100a); border: 1px solid var(--line); }
.cta { border-radius: 28px; background: linear-gradient(140deg, var(--deep), #163a6b); }
html[data-theme="dark"] .cta { background: linear-gradient(140deg, #2a1d0e, #15100a); border: 1px solid var(--line); }
.steps li::after { background: var(--brand); }
.tag { border-radius: 999px; }
.chip { border-radius: 999px; }
.chip[aria-pressed="true"], .chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Page heads (inner pages) ---------- */
.page-head { position: relative; }
.page-head::before { content: ""; position: absolute; inset: calc(-1 * var(--header-h)) -50vw 0; z-index: -1; background: var(--tint); }

/* ---------- Footer ---------- */
.footer { margin-top: clamp(48px, 8vw, 96px); background: var(--tint); color: var(--ink); border-top: 1px solid var(--line); }
.footer .motto, .footer a { color: var(--ink); }
.footer p, .footer-bottom { color: var(--ink-3); }
.footer h2 { color: var(--ink-3); }
.footer a:hover { color: var(--brand); }
.footer-bottom { border-top-color: var(--line); }
.footer-logo { height: 56px; width: auto; margin-bottom: 10px; }
[dir="rtl"] .footer .motto { font-family: var(--urdu); line-height: 1.8; font-size: clamp(1.5rem, 3vw, 2.2rem); }

/* ---------- WhatsApp button with counter-rotating rings ---------- */
.wa { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 70; width: 72px; height: 72px; display: grid; place-items: center; }
.wa .ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.wa .ring.r1 { inset: -2px; background: conic-gradient(from 0deg, #25D366 0 25%, transparent 25% 50%, #25D366 50% 75%, transparent 75%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: wa-spin 6s linear infinite; }
.wa .ring.r2 { inset: -10px; background: conic-gradient(from 90deg, var(--brand) 0 15%, transparent 15% 35%, var(--brand) 35% 50%, transparent 50% 70%, var(--brand) 70% 85%, transparent 85%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); animation: wa-spin 9s linear infinite reverse; opacity: .9; }
.wa .ring.r3 { inset: -18px; border: 1px dashed var(--sun); opacity: .7; animation: wa-spin 14s linear infinite; }
@keyframes wa-spin { to { transform: rotate(360deg); } }
.wa > a { position: relative; width: 58px; height: 58px; border-radius: 50%; background: #25D366; display: grid; place-items: center; box-shadow: 0 12px 30px -8px rgba(37, 211, 102, .8); transition: transform .4s var(--ease); }
.wa > a:hover { transform: scale(1.08) rotate(-6deg); }
.wa > a svg { width: 30px; height: 30px; fill: #fff; }
.wa .tip { position: absolute; inset-inline-end: 84px; top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; border-radius: 10px; font-size: .75rem; font-weight: 700; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .3s; }
.wa:hover .tip { opacity: 1; }
body.staff .wa { display: none; }

/* ---------- Loader: darkness → light (once per visit) ---------- */
#loader { position: fixed; inset: 0; z-index: 1000; background: #030303; display: grid; place-items: center; overflow: hidden; direction: ltr; }
#loader .horizon { position: absolute; left: 50%; top: 40%; width: 14vmin; height: 14vmin; border-radius: 50%; translate: -50% -50%; scale: .05; background: radial-gradient(circle, #fff8e6 0%, #ffd166 22%, #ff8c1a 45%, rgba(255, 110, 20, .25) 65%, transparent 72%); filter: blur(6px); opacity: 0; }
#loader .rays { position: absolute; left: 50%; top: 40%; width: 120vmax; height: 120vmax; transform: translate(-50%, -50%); background: conic-gradient(from 0deg, transparent 0 6%, rgba(255, 180, 80, .08) 7% 8%, transparent 9% 18%, rgba(255, 180, 80, .08) 19% 20%, transparent 21% 31%, rgba(255, 180, 80, .08) 32% 33%, transparent 34% 44%, rgba(255, 180, 80, .08) 45% 46%, transparent 47% 56%, rgba(255, 180, 80, .08) 57% 58%, transparent 59% 69%, rgba(255, 180, 80, .08) 70% 71%, transparent 72% 82%, rgba(255, 180, 80, .08) 83% 84%, transparent 85% 100%); opacity: 0; animation: wa-spin 60s linear infinite; }
#loader .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(to top, rgba(255, 140, 30, .12), transparent); opacity: 0; }
#loader .cap { position: absolute; bottom: 12%; left: 0; right: 0; text-align: center; color: #f3e3c3; opacity: 0; }
#loader .cap .ar { font-family: var(--arabic); font-size: 1.6rem; }
#loader .cap .en { font-family: var(--serif); font-style: italic; font-size: 1rem; opacity: .75; margin-top: 4px; }
#loader .skip { position: absolute; top: 22px; right: 22px; color: #c9b99a; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; border: 1px solid rgba(255, 255, 255, .15); background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; }
#loader .flash { position: absolute; inset: 0; background: #FFFFFF; opacity: 0; }
html[data-theme="dark"] #loader .flash { background: #FF7A1A; }

/* ---------- Book overlay (Ayah Academy) ---------- */
#book { position: fixed; inset: 0; z-index: 900; background: rgba(5, 4, 3, .92); backdrop-filter: blur(10px); display: grid; place-items: center; opacity: 0; visibility: hidden; transition: opacity .5s, visibility .5s; direction: ltr; }
#book.open { opacity: 1; visibility: visible; }
#book .close { position: absolute; top: 22px; right: 22px; color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .25); padding: 10px 16px; border-radius: 999px; font-size: .8rem; letter-spacing: .1em; cursor: pointer; font: inherit; }
.book-wrap { display: grid; gap: 16px; justify-items: center; width: min(92vw, 900px); }
.scene { perspective: 2200px; width: 100%; aspect-ratio: 1.55; }
@media (max-width: 640px) { .scene { aspect-ratio: .9; } }
.bk { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(14deg); }
.bk .left, .bk .leaf, .bk .cover { position: absolute; top: 0; bottom: 0; width: 50%; border-radius: 4px 16px 16px 4px; backface-visibility: hidden; }
.bk .left { left: 0; transform: translateZ(2px); border-radius: 16px 4px 4px 16px; background: linear-gradient(90deg, #f1e7d2, #fbf6ea 85%, #e8dcc2); box-shadow: inset -12px 0 20px -14px rgba(0, 0, 0, .35); }
.bk .leaf, .bk .cover { left: 50%; transform-origin: left center; transform-style: preserve-3d; }
.bk .leaf .f, .bk .leaf .b, .bk .cover .f, .bk .cover .b { position: absolute; inset: 0; border-radius: 4px 16px 16px 4px; backface-visibility: hidden; padding: clamp(14px, 3.4vw, 38px); overflow: hidden; }
.bk .leaf .f { background: linear-gradient(90deg, #e9dfc8, #fbf6ea 15%, #fbf6ea); }
.bk .leaf .b { background: linear-gradient(270deg, #e9dfc8, #fbf6ea 15%, #fbf6ea); transform: rotateY(180deg); border-radius: 16px 4px 4px 16px; }
.bk .cover .f { background: linear-gradient(135deg, #8c1b18, #5a0e0c); color: #f6d890; display: grid; place-content: center; text-align: center; border: 1px solid rgba(255, 220, 150, .25); box-shadow: 0 30px 60px rgba(0, 0, 0, .6); }
.bk .cover .f::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(246, 216, 144, .5); border-radius: 4px 12px 12px 4px; }
.bk .cover .b { background: #f0e6d0; transform: rotateY(180deg); border-radius: 16px 4px 4px 16px; }
.bk .cover .t { font-family: var(--serif); font-size: clamp(1.1rem, 3vw, 2.1rem); font-weight: 600; }
.bk .cover .u { font-family: var(--urdu); font-size: clamp(.95rem, 2.4vw, 1.4rem); margin-top: 4px; line-height: 1.9; }
.bk .cover img { width: clamp(44px, 9vw, 86px); margin: 0 auto 12px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4)); }
.pg-lines { position: absolute; inset: 32px; background: repeating-linear-gradient(to bottom, transparent 0 26px, rgba(120, 90, 40, .12) 26px 27px); opacity: .6; }
.pg-orn { font-family: var(--arabic); color: #b3471f; font-size: clamp(1rem, 2.5vw, 1.6rem); text-align: center; }
.final { color: #2a1d10; position: relative; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 8px; opacity: 0; font-family: var(--sans); }
.final .k { font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: #b3471f; font-weight: 700; }
.final h3 { font-family: var(--serif); font-size: clamp(1rem, 2.5vw, 1.8rem); line-height: 1.15; color: #2a1d10; }
.final .u { font-family: var(--urdu); font-size: clamp(.85rem, 1.8vw, 1.15rem); direction: rtl; text-align: right; line-height: 2; }
.final p { font-size: clamp(.68rem, 1.3vw, .86rem); color: #5a4a36; line-height: 1.5; margin: 0; }
.final .books { display: flex; gap: 4px; align-items: flex-end; margin-top: 4px; }
.final .books i { display: block; width: 12px; height: 36px; border-radius: 2px; background: #8c1b18; transform-origin: bottom; transform: scaleY(0); }
.final .books i:nth-child(2) { height: 44px; background: #b3471f; } .final .books i:nth-child(3) { height: 32px; background: #d9a23a; } .final .books i:nth-child(4) { height: 40px; background: #2d6a4f; } .final .books i:nth-child(5) { height: 48px; background: #1d3557; }
.left-txt { position: absolute; inset: 0; padding: clamp(14px, 3.4vw, 38px); display: flex; flex-direction: column; justify-content: center; gap: 8px; color: #2a1d10; opacity: 0; font-family: var(--sans); }
.left-txt .ar { font-family: var(--arabic); font-size: clamp(.95rem, 2.3vw, 1.5rem); direction: rtl; text-align: center; color: #8c1b18; }
.left-txt .cap { font-size: clamp(.65rem, 1.3vw, .82rem); color: #6b5a44; text-align: center; font-style: italic; font-family: var(--serif); }
.left-txt ul { list-style: none; display: grid; gap: 4px; font-size: clamp(.64rem, 1.25vw, .82rem); color: #4a3b29; line-height: 1.5; margin: 0; padding: 0; }
.left-txt li::before { content: "✦ "; color: #b3471f; }
.book-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; opacity: 0; transition: opacity .5s; }
.book-acts.on { opacity: 1; }
.book-acts .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }

/* ---------- Curriculum page ---------- */
.book-hero { display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .book-hero { grid-template-columns: 1fr; } }
.cover3d { position: relative; width: min(100%, 380px); margin-inline: auto; perspective: 1400px; }
.cover3d img { width: 100%; border-radius: 6px 14px 14px 6px; box-shadow: -10px 20px 50px rgba(11, 31, 58, .3), inset 0 0 0 1px rgba(0, 0, 0, .05); transform: rotateY(-14deg) rotateX(2deg); transition: transform .8s var(--ease); }
.cover3d:hover img { transform: rotateY(-4deg); }
.book-title { font-family: var(--arabic); font-size: clamp(2.4rem, 5vw, 4rem); color: var(--brand); direction: rtl; line-height: 1.5; margin: 8px 0 0; }
[dir="ltr"] .book-title { text-align: left; }
.book-sub { font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 2vw, 1.4rem); color: var(--ink-2); margin: 0 0 8px; }
[dir="rtl"] .book-sub { font-family: var(--urdu); font-style: normal; line-height: 2; }
.spec { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-top: 22px; }
@media (max-width: 560px) { .spec { grid-template-columns: 1fr; } }
.spec div { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.spec span { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
[dir="rtl"] .spec span { letter-spacing: 0; text-transform: none; font-size: .85rem; }
.months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .months { grid-template-columns: 1fr; } }
.month { padding: 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.month .mh { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem; margin-bottom: 14px; line-height: 1.6; }
html[data-theme="dark"] .month .mh { color: #120800; }
.month ol { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }
.month li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--tint); }
.month li i { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: .75rem; font-weight: 800; font-family: var(--sans); color: var(--brand); }
.month li b { display: block; font-size: .95rem; }
.month li small { color: var(--ink-3); font-size: .8rem; display: block; line-height: 1.5; }
.pages { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 16px 2px 26px; scrollbar-width: none; }
.pages::-webkit-scrollbar { display: none; }
.pages img { flex: 0 0 min(300px, 78vw); scroll-snap-align: start; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .5s var(--ease); background: #fff; }
.pages img:hover { transform: translateY(-6px); }
.coming { opacity: .75; }
.step-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: sc; }
@media (max-width: 900px) { .step-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .step-cards { grid-template-columns: 1fr; } }
.step-cards > div { counter-increment: sc; padding: 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); position: relative; }
.step-cards > div::before { content: counter(sc, decimal-leading-zero); font-family: var(--serif); font-size: 2.4rem; color: var(--accent-soft); position: absolute; top: 10px; inset-inline-end: 16px; line-height: 1; font-weight: 700; }
.step-cards h3 { font-size: 1.2rem; margin-bottom: 6px; padding-inline-end: 48px; }
.step-cards p { color: var(--ink-2); font-size: .95rem; margin: 0; }

/* ---------- Reveal + misc ---------- */
.rv { opacity: 0; transform: translateY(30px); }
html.no-anim .rv, html:not(.js) .rv { opacity: 1; transform: none; }
.tilt { transform-style: preserve-3d; }
[dir="rtl"] * { letter-spacing: 0 !important; }
[dir="rtl"] .btn { padding-block: 9px; line-height: 1.9; }
[dir="rtl"] .tag, [dir="rtl"] .chip { line-height: 1.9; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } .medal .ring, .wa .ring, .nh-pattern svg, .nh-blob { animation: none !important; } }

.bk .leaf.z1{z-index:1}.bk .leaf.z2{z-index:2}.bk .leaf.z3{z-index:3}.bk .leaf.z4{z-index:4}.bk .cover.z6{z-index:6}
.bk .cover .cover-tag{font-size:.7rem;letter-spacing:.2em;margin-top:12px;opacity:.7;font-family:var(--sans)}
.girih-defs{position:absolute;width:0;height:0}
.ayah-band .ayah { background: transparent; border: 0; padding-inline: 0; }
.ayah-band .ayah blockquote { color: #f6efe4; }
.ayah-band .ayah figcaption, .ayah-band .ayah .ayah-ur { color: #dbe6f7; }
html[data-theme="dark"] .ayah-band .ayah figcaption, html[data-theme="dark"] .ayah-band .ayah .ayah-ur { color: #e8dcc5; }
.ayah-band .ayah cite { color: var(--sun); }
.ayah-band { padding-bottom: clamp(48px, 7vw, 88px); }
.header-tools .btn, .lang-switch { white-space: nowrap; }
.nh-live:empty { display: none; }
.dept-icon, .door-ic, .icon-badge { background: var(--accent-soft) !important; color: var(--brand) !important; border-color: transparent !important; }
.filter-bar { background: var(--tint); border-color: var(--line); }
.captcha-slot:empty { display: none; }
.captcha-slot { margin: 14px 0 4px; }
.cf-turnstile { min-height: 65px; }

/* ---------- Mobile: no sideways drift ---------- */
html, body { overflow-x: clip; }
.nh, .ayah-band, .footer { overflow-x: clip; }
.medal svg.medal-rings { overflow: hidden; }
.academy-cta { box-sizing: border-box; }
@media (max-width: 480px) { .nh-mini { gap: 18px; } .nh .display { font-size: clamp(2.2rem, 11vw, 3rem); } }

/* ---------- Book reader (one page, swipe, flip, progress) ---------- */
.reader { max-width: 560px; margin-inline: auto; user-select: none; -webkit-user-select: none; }
.reader-stage { position: relative; perspective: 1800px; touch-action: pan-y; }
.reader-page { position: relative; aspect-ratio: 595 / 842; border-radius: 6px; background: #fbf6ea; box-shadow: 0 30px 60px -20px rgba(11, 31, 58, .45), 0 0 0 1px var(--line); overflow: visible; transform-style: preserve-3d; }
.reader-page .rp { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; background: #fff; backface-visibility: hidden; transform-origin: right center; will-change: transform; }
.reader-page .rp.next { z-index: 1; }
.reader-page .rp.cur { z-index: 2; }
.reader-page .rp.flipping { z-index: 3; box-shadow: -20px 0 40px -10px rgba(0, 0, 0, .35); }
.reader-page::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 18px; border-radius: 0 6px 6px 0; background: linear-gradient(to left, rgba(0, 0, 0, .14), transparent); pointer-events: none; z-index: 4; }
.reader-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; z-index: 5; box-shadow: var(--shadow); transition: background .3s, color .3s, opacity .3s; font: inherit; }
.reader-nav:hover { background: var(--brand); color: #fff; }
.reader-nav[disabled] { opacity: .3; pointer-events: none; }
.reader-nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reader-nav.left { left: -23px; } .reader-nav.right { right: -23px; }
@media (max-width: 640px) { .reader-nav.left { left: 6px; } .reader-nav.right { right: 6px; } .reader-nav { width: 40px; height: 40px; } }
.reader-bar { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); direction: ltr; }
.reader-num { font-family: var(--serif); font-size: 1.05rem; white-space: nowrap; }
.reader-num b { color: var(--brand); }
.reader-prog { height: 6px; border-radius: 6px; background: var(--tint); overflow: hidden; cursor: pointer; }
.reader-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--sun)); border-radius: 6px; transition: width .4s var(--ease); }
.reader-pct { font-size: .8rem; color: var(--ink-3); min-width: 3.2em; text-align: right; font-family: var(--sans); }
.reader-sound { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--tint); color: var(--ink); display: grid; place-items: center; cursor: pointer; font: inherit; }
.reader-sound svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reader-sound[aria-pressed="false"] { opacity: .45; }
.reader-hint { text-align: center; color: var(--ink-3); font-size: .82rem; margin: 10px 0 0; }
.reader-resume { text-align: center; margin: 8px 0 0; font-size: .85rem; }
.reader-resume a { color: var(--brand); font-weight: 700; }
.book-dl { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.book-dl .small { color: var(--ink-3); font-size: .82rem; }
.captcha-slot { margin: 14px 0; }
.captcha-slot:empty { display: none; }
@supports not (overflow-x: clip) { html, body { overflow-x: hidden; } }
