/* Layout concept: Kufic Bismillah ribbon, white sticky header with nav, a dark-walnut hero banner (welcome text + mihrab frame),
   then ivory sections for featured books, about, articles and contact, a three-column footer and a floating WhatsApp button.
   Light ivory/white with gold is the default; the viewer's dark theme swaps to emerald night. The hero banner stays walnut in both. */
:root {
  --bg: #faf7ef;
  --bg2: #f3eddc;
  --paper: #ffffff;
  --line: rgba(150, 108, 28, 0.36);
  --line-soft: rgba(150, 108, 28, 0.17);
  --fg: #231c12;
  --muted: #655a47;
  --gold-1: #c9a24a;
  --gold-2: #a77d22;
  --gold-3: #7d5a12;
  --gold-text: #80570b;
  --btn-1: #b78d2c;
  --btn-2: #946a19;
  --on-gold: #ffffff;
  --glow: rgba(167, 125, 34, 0.12);
  --shadow: rgba(70, 48, 10, 0.28);
  --cover-1: #0f3b2d;
  --cover-2: #16304a;
  --cover-3: #4b1c26;
  --cover-ink: #f3dd9a;
  --wa: #1fa855;
  --wa-ink: #ffffff;
  --f-kufi: 'Reem Kufi', 'Amiri', 'Noto Naskh Arabic', serif;
  --f-ur: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', 'Jameel Noori Nastaleeq', serif;
  --f-disp: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --f-en: 'Jost', 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07140f; --bg2: #0a1c15; --paper: #0e2419;
    --line: rgba(214, 176, 86, 0.32); --line-soft: rgba(214, 176, 86, 0.15);
    --fg: #f1e8d0; --muted: #b4bba8;
    --gold-1: #f6e2a3; --gold-2: #d6ab43; --gold-3: #9a6f1c; --gold-text: #e8c978;
    --btn-1: #f0d68a; --btn-2: #c99a30; --on-gold: #2a1c04;
    --glow: rgba(214, 176, 86, 0.14); --shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07140f; --bg2: #0a1c15; --paper: #0e2419;
  --line: rgba(214, 176, 86, 0.32); --line-soft: rgba(214, 176, 86, 0.15);
  --fg: #f1e8d0; --muted: #b4bba8;
  --gold-1: #f6e2a3; --gold-2: #d6ab43; --gold-3: #9a6f1c; --gold-text: #e8c978;
  --btn-1: #f0d68a; --btn-2: #c99a30; --on-gold: #2a1c04;
  --glow: rgba(214, 176, 86, 0.14); --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 14px -apple-system, BlinkMacSystemFont, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

#app { min-height: 100%; overflow-x: clip; }
#app[data-lang="ur"] { font-family: var(--f-ur); font-size: 1.02rem; line-height: 2.1; }
#app[data-lang="en"] { font-family: var(--f-en); font-size: 1rem; line-height: 1.65; }
#app[data-lang="ur"] .en, #app[data-lang="en"] .ur { display: none !important; }
.u { font-family: var(--f-ur); line-height: 2.1; }
.e { font-family: var(--f-en); line-height: 1.5; }
.gold-text {
  background: linear-gradient(100deg, var(--gold-1) 5%, var(--gold-2) 50%, var(--gold-1) 80%, var(--gold-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  padding-block: 0.12em;
}
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1120px, 100%); margin-inline: auto; padding-inline: 18px; position: relative; z-index: 1; }

/* ---------- Bismillah ribbon ---------- */
.ribbon { position: relative; text-align: center; background: var(--paper); padding: 12px 18px 6px; overflow: hidden; border-bottom: 1px solid var(--line-soft); }
.bism { font-family: var(--f-kufi); font-weight: 600; font-size: clamp(1.9rem, 5.8vw, 3.1rem); line-height: 1.8; margin: 0; position: relative; }
.deco { position: absolute; pointer-events: none; z-index: 0; }
.ribbon .deco { top: 50%; width: 210px; height: 210px; transform: translateY(-50%); opacity: 0.3; }
.ribbon .dl { left: -78px; } .ribbon .dr { right: -78px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper);
  border-bottom: 1px solid var(--line); box-shadow: 0 10px 22px -16px var(--shadow);
}
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand svg { width: 46px; height: 46px; flex: none; }
.brand-t { min-width: 0; }
.brand-en { display: block; font-family: var(--f-disp); font-weight: 700; font-size: 1.45rem; line-height: 1.1; color: var(--fg); white-space: nowrap; }
.brand-sub { display: block; font-size: .76rem; color: var(--muted); line-height: 1.8; }
.brand-sub .u { font-size: .86rem; line-height: 1.6; }
.nav { display: flex; gap: 2px; margin-inline-start: auto; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { position: relative; padding: 4px 14px; white-space: nowrap; color: var(--fg); font-weight: 500; }
.nav a::after { content: ""; position: absolute; inset-inline: 14px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--gold-2); transform: scaleX(0); transition: transform .25s; }
.nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); }
.nav a[aria-current="true"] { color: var(--gold-text); }
.tools { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; background: transparent; cursor: pointer; color: var(--gold-text); line-height: 1.7; }
.pill:hover { background: var(--glow); }
@media (max-width: 860px) {
  .tools { margin-inline-start: auto; }
  .nav { order: 3; flex: 1 0 100%; margin-inline-start: 0; }
  .nav a { padding-inline: 12px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 8px; padding: 6px 26px; border: 1px solid transparent;
  background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); color: var(--on-gold); font-weight: 600; cursor: pointer; line-height: 1.8;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px var(--shadow); }
.btn.ghost { background: transparent; color: var(--gold-text); border-color: var(--line); }
.btn.ghost:hover { background: var(--glow); box-shadow: none; }
.btn.wa { background: var(--wa); color: var(--wa-ink); }
.btn.sm { padding: 2px 16px; font-size: .92rem; width: 100%; }
.btn svg { width: 19px; height: 19px; flex: none; }

/* ---------- hero banner ---------- */
.stage { padding-block: clamp(24px, 4vw, 44px); }
.banner {
  --gold-1: #f6e2a3; --gold-2: #e0b550; --gold-3: #a8791d; --gold-text: #e8c978;
  --btn-1: #f0d68a; --btn-2: #c99a30; --on-gold: #2a1c04;
  --fg: #f6ead0; --muted: #d3c5a4; --line: rgba(232, 201, 120, 0.42); --line-soft: rgba(232, 201, 120, 0.2); --glow: rgba(232, 201, 120, 0.14);
  position: relative; overflow: hidden; isolation: isolate; border-radius: 18px; color: var(--fg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 14px, rgba(0, 0, 0, 0.1) 14px 19px, rgba(255, 255, 255, 0.02) 19px 31px, rgba(0, 0, 0, 0.08) 31px 35px),
    linear-gradient(120deg, #1d130b 0%, #33200f 55%, #4a2f17 100%);
  box-shadow: 0 30px 60px -34px var(--shadow);
}
.banner::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(232, 201, 120, 0.3); border-radius: 12px; pointer-events: none; z-index: -1; }
.banner-in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(20px, 4vw, 56px); align-items: center; padding: clamp(32px, 6vw, 72px) clamp(22px, 5vw, 64px); }
@media (max-width: 800px) { .banner-in { grid-template-columns: minmax(0, 1fr); } }
.hd { display: flex; flex-direction: column; margin: 0; }
.sh .hd { align-items: center; }
#app[data-lang="ur"] .hd .u { order: 1; font-size: clamp(1.8rem, 4.8vw, 2.7rem); line-height: 2; font-weight: 700; }
#app[data-lang="ur"] .hd .e { order: 2; font-family: var(--f-disp); font-size: 1rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); font-weight: 600; }
#app[data-lang="en"] .hd .e { order: 1; font-family: var(--f-disp); font-weight: 700; font-size: clamp(2rem, 5.2vw, 3rem); line-height: 1.12; }
#app[data-lang="en"] .hd .u { order: 2; font-size: 1.3rem; line-height: 2; font-weight: 600; }
.banner .hd { font-weight: 700; }
.banner h1.hd .e { color: var(--fg); }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 1.08rem; max-width: 46ch; }
.mufti-line { margin: 22px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; padding-top: 14px; border-top: 1px solid var(--line); width: fit-content; max-width: 100%; }
.mufti-line .u { font-size: 1.35rem; font-weight: 600; }
.mufti-line .e { font-family: var(--f-disp); font-size: 1.25rem; font-style: italic; color: var(--gold-text); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.banner .btn.ghost { color: var(--gold-text); }
.mihrab-wrap { display: grid; place-items: center; position: relative; }
.mihrab {
  width: min(310px, 100%); aspect-ratio: 3 / 4; position: relative; display: grid; place-items: center; text-align: center; overflow: hidden;
  border: 1.5px solid var(--gold-2); border-radius: 50% 50% 8px 8px / 36% 36% 8px 8px;
  background: radial-gradient(70% 55% at 50% 38%, rgba(232, 201, 120, 0.16), transparent 75%), rgba(20, 12, 6, 0.55);
  box-shadow: inset 0 0 0 7px rgba(20, 12, 6, 0.8), inset 0 0 0 8px rgba(232, 201, 120, 0.4);
  padding: 16% 10% 8%;
}
.mihrab .spin { position: absolute; width: 150%; left: 50%; top: 42%; margin: -75% 0 0 -75%; opacity: .55; animation: spin 150s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mihrab .cap { position: relative; margin-top: 52%; }
.mihrab .cap b { display: block; font-size: 1.2rem; line-height: 1.9; color: var(--fg); }
.mihrab .cap span { font-family: var(--f-disp); font-size: 1.02rem; color: var(--gold-text); letter-spacing: .05em; }

/* ---------- sections ---------- */
section.s { position: relative; overflow: hidden; padding-block: clamp(46px, 7vw, 84px); scroll-margin-top: 104px; }
section.alt { background: var(--bg2); border-block: 1px solid var(--line-soft); }
.sh { text-align: center; margin-bottom: clamp(26px, 4vw, 42px); }
.sh p { margin: 6px auto 0; max-width: 54ch; color: var(--muted); }
.orn { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto 8px; width: min(300px, 70%); }
.orn i { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--gold-2)); }
.orn i:last-child { background: linear-gradient(270deg, transparent, var(--gold-2)); }
.orn svg { width: 20px; height: 20px; flex: none; }
section .deco { top: 50%; width: 440px; height: 440px; transform: translateY(-50%); opacity: .2; }
section .dl { left: -250px; } section .dr { right: -250px; }
@media (max-width: 760px) { section .deco { display: none; } }

/* ---------- books ---------- */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 28px; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 2px 18px; cursor: pointer; color: var(--muted); line-height: 1.9; }
.chip:hover { color: var(--gold-text); }
.chip[aria-pressed="true"] { background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); color: var(--on-gold); border-color: transparent; font-weight: 600; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 22px; }
.book { display: flex; flex-direction: column; gap: 12px; min-width: 0; background: var(--paper); border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px; box-shadow: 0 14px 28px -24px var(--shadow); transition: border-color .25s, transform .25s; }
.book:hover { border-color: var(--line); transform: translateY(-3px); }
.cover {
  position: relative; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 3px 8px 8px 3px; overflow: hidden; display: grid; place-items: center; text-align: center;
  padding: 16% 12%; color: var(--cover-ink); background: var(--cv, var(--cover-1));
  box-shadow: 0 16px 26px -16px rgba(0, 0, 0, .7), inset 6px 0 8px -4px rgba(0, 0, 0, .45);
}
.cover::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(243, 221, 154, .7); outline: 1px solid rgba(243, 221, 154, .3); outline-offset: 3px; border-radius: 2px; }
.cover svg { position: absolute; width: 130%; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: .2; pointer-events: none; }
.cover b { position: relative; display: block; font-family: var(--f-ur); font-size: 1.1rem; line-height: 2.15; font-weight: 700; }
.cover small { position: relative; display: block; font-family: var(--f-disp); font-size: .86rem; line-height: 1.25; margin-top: 8px; letter-spacing: .04em; opacity: .9; }
.cv1 { --cv: var(--cover-1); } .cv2 { --cv: var(--cover-2); } .cv3 { --cv: var(--cover-3); }
.book .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price { font-family: var(--f-en); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold-text); font-size: 1.08rem; }
.cat { font-size: .82rem; color: var(--muted); line-height: 1.7; }
.note { text-align: center; color: var(--muted); font-size: .9rem; margin: 28px 0 0; }

/* ---------- about ---------- */
.about-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: clamp(22px, 4vw, 44px); position: relative; }
.about-card::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line-soft); border-radius: 11px; pointer-events: none; }
.about-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 16px; margin: 0 0 8px; }
.about-name .u { font-size: 1.7rem; font-weight: 700; }
.about-name .e { font-family: var(--f-disp); font-size: 1.6rem; font-weight: 600; font-style: italic; color: var(--gold-text); }
.about-card p { margin: 0 0 12px; max-width: 74ch; }
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
@media (max-width: 760px) { .pillars { grid-template-columns: minmax(0, 1fr); } }
.pillars svg { width: 18px; height: 18px; }
.pillars b { display: block; color: var(--gold-text); font-weight: 700; margin: 2px 0; }
.pillars span { color: var(--muted); }

/* ---------- articles ---------- */
.arts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 760px) { .arts { grid-template-columns: minmax(0, 1fr); } }
.art { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 14px; padding: 22px 24px; min-width: 0; transition: border-color .25s; box-shadow: 0 14px 28px -26px var(--shadow); }
.art:hover { border-color: var(--line); }
.art .tagrow { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .84rem; color: var(--muted); }
.art .tag { color: var(--gold-text); font-weight: 600; }
.art h3 { margin: 4px 0; font-size: 1.28rem; line-height: 1.95; }
#app[data-lang="en"] .art h3 { font-family: var(--f-disp); font-size: 1.55rem; line-height: 1.2; margin: 8px 0; }
.art p { margin: 0; color: var(--muted); }
.art details { margin-top: 8px; }
.art summary { cursor: pointer; color: var(--gold-text); font-weight: 600; list-style: none; width: fit-content; }
.art summary::-webkit-details-marker { display: none; }
.art summary::after { content: " ↓"; }
.art details[open] summary::after { content: " ↑"; }
.art details p { margin-top: 6px; color: var(--fg); }

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); align-items: start; }
@media (max-width: 800px) { .contact { grid-template-columns: minmax(0, 1fr); } }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: clamp(20px, 3vw, 32px); background: var(--paper); position: relative; }
.panel::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line-soft); border-radius: 11px; pointer-events: none; }
.panel h3 { margin: 0 0 6px; font-size: 1.4rem; line-height: 1.9; }
#app[data-lang="en"] .panel h3 { font-family: var(--f-disp); font-size: 1.75rem; line-height: 1.2; }
.panel p { margin: 0 0 14px; color: var(--muted); }
.num { font-family: var(--f-en); font-variant-numeric: tabular-nums; font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 500; letter-spacing: .04em; direction: ltr; unicode-bidi: isolate; margin: 4px 0 16px; user-select: all; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
label.f { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.f input, .f textarea { width: 100%; margin-top: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; color: var(--fg); line-height: 1.8; }
.f textarea { min-height: 110px; resize: vertical; }
.f input:focus-visible, .f textarea:focus-visible { outline-offset: 1px; }

/* ---------- footer ---------- */
footer { background: var(--paper); border-top: 1px solid var(--line); padding-block: 40px 22px; padding-bottom: calc(22px + 56px); }
.fgrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .fgrid { grid-template-columns: minmax(0, 1fr); } }
.fgrid h4 { margin: 0 0 8px; font-size: 1rem; color: var(--gold-text); font-weight: 700; }
.fgrid p, .fgrid li { margin: 0; color: var(--muted); font-size: .95rem; }
.fgrid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fgrid a:hover { color: var(--gold-text); }
.fbrand { font-family: var(--f-disp); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.fbrand + .u { color: var(--gold-text); font-weight: 600; }
.copy { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; color: var(--muted); font-size: .88rem; }

/* ---------- floating WhatsApp ---------- */
.fab {
  position: fixed; z-index: 30; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 9px; background: var(--wa); color: var(--wa-ink); border-radius: 999px; padding: 8px 20px 8px 14px;
  font-weight: 600; box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .55); line-height: 1.6;
}
.fab svg { width: 24px; height: 24px; flex: none; }
.fab:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .mihrab .spin { animation: none; }
  .btn, .book, .nav a::after { transition: none; }
}
