/* Khwaja Gharib Nawaz — mobile-first styles */

:root {
  --green: #0f3d2e;
  --green-2: #17573f;
  --green-3: #e6efe9;
  --gold: #b98a22;
  --gold-2: #e8c56a;
  --rose: #a8324a;
  --bg: #f8f3e8;
  --card: #fffdf8;
  --ink: #1c2a23;
  --muted: #687a70;
  --line: rgba(15, 61, 46, .12);
  --shadow: 0 1px 2px rgba(15, 61, 46, .06), 0 6px 20px rgba(15, 61, 46, .07);
  --radius: 18px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --arabic: 'Amiri', 'Traditional Arabic', serif;
  --urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Amiri', serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23e8c56a' stroke-opacity='.16' stroke-width='1'%3E%3Cpath d='M28 6l6.4 15.6L50 28l-15.6 6.4L28 50l-6.4-15.6L6 28l15.6-6.4z'/%3E%3Crect x='14' y='14' width='28' height='28' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='5'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme='dark'] {
  --bg: #0b1612;
  --card: #12211b;
  --ink: #ece6d6;
  --muted: #98a89f;
  --line: rgba(232, 197, 106, .14);
  --green-3: #17302580;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --gold: #e0b551;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0; }
h1, h2, h3, b, .num, blockquote { font-variant-numeric: lining-nums; }
h3 { font-size: 1.3rem; font-weight: 700; }
p { margin: 0; }
p + p { margin-top: .75em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; top: 8px; inset-inline-start: 8px; z-index: 99; background: var(--card); padding: 8px 12px; transform: translateY(-200%); }
.skip:focus { transform: none; }
html, body { overflow-x: clip; }

.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.kicker {
  font: 600 .7rem/1.3 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}
.note { font-size: .82rem; color: var(--muted); padding: 0 4px; }
.ar { font-family: var(--arabic); direction: rtl; font-size: 1.45rem; line-height: 2.1; }
.urdu { font-family: var(--urdu); direction: rtl; }

/* ---------- shell ---------- */

.shell { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; }
main { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); outline: none; }

.boot { min-height: 80vh; display: grid; place-items: center; }
.boot .urdu { font-size: 2.2rem; color: var(--gold); }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .68rem; font-weight: 500; color: var(--muted);
  position: relative;
}
.tab.on { color: var(--green); }
[data-theme='dark'] .tab.on { color: var(--gold-2); }
.tab.on::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--gold);
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: var(--green); color: #fff;
}
.topbar h1 { flex: 1; text-align: center; font-size: 1.35rem; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
}
.iconbtn:active { background: rgba(255, 255, 255, .12); }
.iconbtn-space { width: 40px; }

.pattern {
  background-color: var(--green);
  background-image: var(--pattern), radial-gradient(120% 80% at 50% 0%, var(--green-2), var(--green));
  color: #fff;
}
.pagehead { padding: 20px 20px 44px; text-align: center; }
.pagehead h2 { font-size: 1.9rem; margin-top: 4px; }
.pagehead .kicker { color: var(--gold-2); }
.pagehead .sub { color: rgba(255, 255, 255, .78); font-size: .9rem; margin-top: 6px; }
.pagehead + .stack { margin-top: -28px; }

.stack { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.stack.lift { margin-top: -36px; position: relative; }
.section-title { margin: 10px 4px 0; font-size: 1.4rem; }

/* ---------- cards ---------- */

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
a.card { transition: transform .15s; }
a.card:active { transform: scale(.985); }
.card h3 + p, .card h3 + .muted { margin-top: 4px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.chev { width: 18px; height: 18px; color: var(--muted); }
.link { color: var(--gold); font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.link .ic { width: 16px; height: 16px; }
.pill { font-size: .75rem; background: var(--green-3); color: var(--green); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
[data-theme='dark'] .pill { color: var(--gold-2); }

.linkcard { display: flex; align-items: center; gap: 14px; }
.linkcard > .ic:first-child {
  width: 44px; height: 44px; padding: 10px; border-radius: 14px;
  background: var(--green-3); color: var(--green);
}
[data-theme='dark'] .linkcard > .ic:first-child { color: var(--gold-2); }
.linkcard > div { flex: 1; }
.linkcard.static { align-items: flex-start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green); color: #fff;
  border-radius: 99px; padding: 12px 20px; font-weight: 600; font-size: .92rem;
  margin-top: 14px;
}
.btn.ghost { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
[data-theme='dark'] .btn { background: var(--gold); color: #10201a; }
[data-theme='dark'] .btn.ghost { background: transparent; color: var(--gold-2); border-color: var(--gold); }
.btn .ic { width: 18px; height: 18px; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btnrow .btn { flex: 1; margin-top: 0; min-width: 140px; }

/* ---------- home ---------- */

.hero {
  padding: calc(var(--safe-t) + 14px) 20px 0;
  text-align: center;
  overflow: hidden;
  position: relative;
}
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero .date { font-size: .78rem; letter-spacing: .04em; color: var(--gold-2); }
.hero .ar.urdu { font-size: 2.3rem; color: var(--gold-2); line-height: 2; margin-top: 4px; }
.hero h1 { font-size: 2.3rem; letter-spacing: .01em; }
.hero-sub { font-size: .88rem; color: rgba(255, 255, 255, .78); margin-top: 6px; }
.dome-art { display: block; width: 100%; max-width: 420px; margin: 14px auto 0; }

.prayer-mini { display: flex; justify-content: space-between; align-items: center; }
.prayer-mini h3 { font-size: 1.7rem; }
.np-count {
  font-weight: 600; color: var(--green); background: var(--green-3);
  padding: 8px 14px; border-radius: 99px; font-size: .88rem; font-variant-numeric: tabular-nums;
}
[data-theme='dark'] .np-count { color: var(--gold-2); }

.urs { display: flex; align-items: center; gap: 16px; }
.urs > div:not(.urs-count) { flex: 1; }
.urs-count {
  width: 72px; height: 72px; border-radius: 20px; flex: none;
  display: grid; place-content: center; text-align: center;
  background: linear-gradient(150deg, var(--gold-2), var(--gold)); color: #2a1d02;
}
.urs-count b { font: 700 1.7rem/1 var(--serif); }
.urs-count span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.urs.live { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; }
.urs.live .muted { color: rgba(255, 255, 255, .75); }
.urs.live .kicker { color: var(--gold-2); }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--gold-2); flex: none; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232, 197, 106, .7); } 100% { box-shadow: 0 0 0 16px rgba(232, 197, 106, 0); } }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.q {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 4px 12px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  font-size: .72rem; font-weight: 500; line-height: 1.2;
}
.q .ic { width: 26px; height: 26px; color: var(--green); }
[data-theme='dark'] .q .ic { color: var(--gold-2); }
.q:active { transform: scale(.96); }

.saying { margin: 0; position: relative; }
.saying .q-ic { width: 30px; height: 30px; color: var(--gold); opacity: .6; }
.saying blockquote { margin: 6px 0 10px; font: 600 1.35rem/1.35 var(--serif); }
.saying figcaption { font-size: .85rem; margin-bottom: 8px; }

.mini-rhythm { list-style: none; margin: 0; padding: 0; }
.mini-rhythm li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: .9rem; }
.mini-rhythm li:first-child { border-top: 0; }
.mini-rhythm span { color: var(--muted); text-align: right; }

.intro p { margin-top: 8px; color: var(--muted); }

/* ---------- life ---------- */

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.chip b { display: block; font: 700 1.1rem/1.2 var(--serif); color: var(--green); }
[data-theme='dark'] .chip b { color: var(--gold-2); }
.chip span { font-size: .78rem; color: var(--muted); }

.timeline { list-style: none; margin: 4px 0; padding: 0 0 0 26px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--gold), var(--line)); }
.timeline li { position: relative; padding: 0 0 22px; }
.timeline .dot {
  position: absolute; left: -24px; top: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--gold);
}
.timeline h3 { margin: 2px 0 6px; }
.timeline p:not(.kicker) { color: var(--ink); opacity: .88; }

.prose ul, .prose ol { padding-left: 1.2em; margin: 10px 0 0; }
.prose h3 + p { margin-top: 8px; }
.prose p + h3 { margin-top: 16px; }
.ticks { list-style: none; padding: 0 !important; margin: 10px 0 0; }
.ticks li { position: relative; padding: 6px 0 6px 26px; border-top: 1px dashed var(--line); }
.ticks li:first-child { border-top: 0; }
.ticks li::before {
  content: ''; position: absolute; left: 4px; top: 14px; width: 9px; height: 9px;
  background: var(--gold); transform: rotate(45deg); border-radius: 2px;
}
.steps li { padding: 4px 0; }

.chain { list-style: none; margin: 0; padding: 0; position: relative; }
.chain::before { content: ''; position: absolute; left: 13px; top: 16px; bottom: 16px; width: 2px; background: var(--gold); opacity: .4; }
.chain li { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; position: relative; }
.chain .bead { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--card); border: 2px solid var(--gold); margin-top: 2px; }
.chain li > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; flex: 1; }
.chain b { font: 700 1.08rem/1.25 var(--serif); display: block; }
.chain span { font-size: .8rem; color: var(--muted); }
.chain li.me .bead { background: var(--gold); box-shadow: 0 0 0 5px rgba(232, 197, 106, .3); }
.chain li.me > div { background: var(--green); color: #fff; border-color: var(--green); }
.chain li.me span { color: var(--gold-2); }

/* ---------- dargah ---------- */

.places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.places details { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.places summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.places summary::-webkit-details-marker { display: none; }
.places .num {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--green); color: var(--gold-2); font: 700 1.05rem var(--serif);
}
.places .pt { flex: 1; display: flex; flex-direction: column; }
.places .pt b { font: 700 1.15rem/1.2 var(--serif); }
.places .pt small { color: var(--muted); font-size: .78rem; }
.places details[open] .chev { transform: rotate(90deg); }
.places .chev { transition: transform .2s; }
.places details p { padding: 0 16px 16px 60px; color: var(--ink); opacity: .9; }

.rhythm { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rhythm h3 { margin: 2px 0 4px; }

/* ---------- visit ---------- */

.tbl { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; padding: 8px 10px 8px 0; white-space: nowrap; vertical-align: top; }
.tbl td { padding: 8px 0; color: var(--muted); }
.tbl tr + tr { border-top: 1px dashed var(--line); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist label { display: flex; gap: 12px; align-items: center; padding: 9px 0; cursor: pointer; border-top: 1px dashed var(--line); }
.checklist li:first-child label { border-top: 0; }
.checklist input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }

.warn { border-left: 4px solid var(--gold); }

/* ---------- prayer ---------- */

.seg { display: flex; background: var(--green-3); border-radius: 99px; padding: 4px; }
.seg button { flex: 1; padding: 9px 10px; border-radius: 99px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--green); box-shadow: var(--shadow); }
[data-theme='dark'] .seg button.on { color: var(--gold-2); }
.seg.small button { font-size: .8rem; padding: 7px; }

.prayer-head { text-align: center; background: linear-gradient(150deg, var(--green), var(--green-2)); color: #fff; border: 0; }
.prayer-head .kicker { color: var(--gold-2); }
.prayer-head h3 { font-size: 1.9rem; margin-top: 6px; }
.prayer-head .muted { color: rgba(255, 255, 255, .7); font-size: .82rem; }
.big { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.times { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.times li { display: flex; justify-content: space-between; padding: 15px 18px; font-size: 1.02rem; }
.times li + li { border-top: 1px solid var(--line); }
.times li b { font-variant-numeric: tabular-nums; }
.times li.dim { color: var(--muted); font-size: .92rem; }
.times li.on { background: var(--green-3); color: var(--green); font-weight: 700; position: relative; }
.times li.on::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
[data-theme='dark'] .times li.on { color: var(--gold-2); }

/* ---------- tasbih ---------- */

.tasbih { align-items: center; text-align: center; }
.presets { display: flex; gap: 8px; overflow-x: auto; width: calc(100% + 32px); padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets button { white-space: nowrap; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: .82rem; font-weight: 500; }
.presets button.on { background: var(--green); color: #fff; border-color: var(--green); }
.big-ar { font-size: 2.2rem; color: var(--green); margin: 8px 0 0; }
[data-theme='dark'] .big-ar { color: var(--gold-2); }
.counter {
  width: min(78vw, 300px); aspect-ratio: 1; border-radius: 50%; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, var(--green-2), var(--green));
  background-image: var(--pattern), radial-gradient(circle at 50% 35%, var(--green-2), var(--green));
  color: #fff; box-shadow: 0 18px 40px rgba(15, 61, 46, .35), inset 0 0 0 10px rgba(255, 255, 255, .04);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform .08s;
}
.counter:active { transform: scale(.97); }
.counter svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.counter circle { fill: none; stroke-width: 5; }
.counter .track { stroke: rgba(255, 255, 255, .1); }
.counter .prog { stroke: var(--gold-2); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .2s; }
.counter .n { font: 700 4.4rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.counter .of { font-size: .85rem; color: rgba(255, 255, 255, .7); margin-top: 4px; }

/* ---------- duas ---------- */

.dua .ar { margin: 14px 0 6px; color: var(--green); font-size: 1.55rem; line-height: 2.2; }
[data-theme='dark'] .dua .ar { color: var(--gold-2); }
.dua details { border-top: 1px dashed var(--line); padding: 10px 0 0; margin-top: 10px; }
.dua summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--gold); }
.dua details p { margin-top: 8px; }
.tr { font-style: italic; }

/* ---------- qibla ---------- */

.compass { width: min(80vw, 300px); aspect-ratio: 1; margin: 10px auto 6px; }
.dial {
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow), inset 0 0 0 12px var(--green-3);
  transition: transform .25s ease-out;
}
.dial > span { position: absolute; font: 700 1rem var(--serif); color: var(--muted); }
.dial .n { top: 18px; left: 50%; transform: translateX(-50%); color: var(--rose); }
.dial .s { bottom: 18px; left: 50%; transform: translateX(-50%); }
.dial .e { right: 22px; top: 50%; transform: translateY(-50%); }
.dial .w { left: 22px; top: 50%; transform: translateY(-50%); }
.needle { position: absolute; inset: 0; }
.needle::before {
  content: ''; position: absolute; left: 50%; top: 14%; bottom: 50%; width: 4px; margin-left: -2px;
  background: linear-gradient(var(--gold), var(--green)); border-radius: 4px;
}
.needle::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--green); border: 3px solid var(--gold); }
.kaaba { position: absolute; left: 50%; top: 8%; width: 22px; height: 22px; margin-left: -11px; background: #111; border-top: 4px solid var(--gold); border-radius: 3px; }

/* ---------- more ---------- */

.menu { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.menu a + a { border-top: 1px solid var(--line); }
.menu a > span { flex: 1; font-weight: 500; }
.menu a > .ic:first-child { color: var(--green); }
[data-theme='dark'] .menu a > .ic:first-child { color: var(--gold-2); }
.menu a:active { background: var(--green-3); }

.settings h3 { margin-bottom: 6px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); }
.setting span { display: flex; flex-direction: column; font-weight: 500; }
.setting small { color: var(--muted); font-weight: 400; font-size: .76rem; }
.setting select {
  font: inherit; font-size: .88rem; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); max-width: 55%;
}

/* ---------- countdown ---------- */

.countdown { text-align: center; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.cd div { background: var(--green); color: #fff; border-radius: 14px; padding: 12px 4px; }
.cd b { display: block; font: 700 1.9rem/1 var(--serif); font-variant-numeric: tabular-nums; color: var(--gold-2); }
.cd span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.urs-link > .ic:first-child, .urs-link { display: flex; align-items: center; gap: 14px; }
.urs-link > .ic:first-child { width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: linear-gradient(150deg, var(--gold-2), var(--gold)); color: #2a1d02; }
.urs-link > div { flex: 1; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-size: .88rem; transition: .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- larger screens ---------- */

@media (min-width: 900px) {
  .shell { max-width: 1080px; display: grid; grid-template-columns: 220px 1fr; gap: 0 32px; padding: 0 24px; }
  .tabbar {
    position: sticky; top: 24px; left: auto; transform: none; align-self: start;
    grid-row: 1; grid-column: 1;
    display: flex; flex-direction: column; gap: 4px; height: auto; max-width: none;
    padding: 12px; margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); box-shadow: var(--shadow);
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
  .tab.on { background: var(--green-3); }
  .tab.on::before { display: none; }
  main { grid-column: 2; padding: 24px 0 48px; max-width: 720px; }
  .hero, .pagehead, .topbar { border-radius: var(--radius); }
  .topbar { position: static; margin-bottom: 0; }
  .topbar:has(+ .pagehead) { border-radius: var(--radius) var(--radius) 0 0; }
  .topbar + .pagehead { border-radius: 0 0 var(--radius) var(--radius); }
  .quick { grid-template-columns: repeat(8, 1fr); }
  .chips { grid-template-columns: repeat(4, 1fr); }
  .toast { bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- languages ---------- */

/* Script fonts are loaded on demand by app.js; headings use the same family. */
html[lang='hi'] { --sans: 'Noto Sans Devanagari', var(--sans-base); --serif: 'Noto Sans Devanagari', var(--sans-base); }
html[lang='bn'] { --sans: 'Noto Sans Bengali', var(--sans-base); --serif: 'Noto Sans Bengali', var(--sans-base); }
html[lang='gu'] { --sans: 'Noto Sans Gujarati', var(--sans-base); --serif: 'Noto Sans Gujarati', var(--sans-base); }
html[lang='ur'] { --sans: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', var(--sans-base); --serif: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', var(--sans-base); }
:root { --sans-base: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

html:not([lang='en']) .kicker { letter-spacing: 0; text-transform: none; font-size: .78rem; }
html:not([lang='en']) h1, html:not([lang='en']) h2, html:not([lang='en']) h3,
html:not([lang='en']) .saying blockquote, html:not([lang='en']) .chip b,
html:not([lang='en']) .places .pt b, html:not([lang='en']) .chain b { font-weight: 600; line-height: 1.4; }
html:not([lang='en']) .saying blockquote { font-size: 1.15rem; }
html:not([lang='en']) .hero h1 { font-size: 2rem; }

/* Nastaliq is tall: give it room. */
html[lang='ur'] body { line-height: 2.1; font-size: 15px; }
html[lang='ur'] h1, html[lang='ur'] h2, html[lang='ur'] h3, html[lang='ur'] .saying blockquote,
html[lang='ur'] .chip b, html[lang='ur'] .places .pt b, html[lang='ur'] .chain b { line-height: 1.9; font-weight: 600; }
html[lang='ur'] .tab { font-size: .64rem; line-height: 1.6; }
html[lang='ur'] .q { line-height: 1.7; font-size: .68rem; }
html[lang='ur'] .kicker { font-size: .74rem; line-height: 1.9; }
html[lang='ur'] .pagehead h2 { font-size: 1.6rem; }
html[lang='ur'] .tr { text-align: left; }

/* Right-to-left mirroring */
[dir='rtl'] .flip { transform: scaleX(-1); }
[dir='rtl'] .places details[open] .chev { transform: scaleX(-1) rotate(90deg); }
[dir='rtl'] .timeline { padding: 0 26px 0 0; }
[dir='rtl'] .timeline::before { left: auto; right: 8px; }
[dir='rtl'] .timeline .dot { left: auto; right: -24px; }
[dir='rtl'] .ticks li { padding: 6px 26px 6px 0; }
[dir='rtl'] .ticks li::before { left: auto; right: 4px; }
[dir='rtl'] .prose ul, [dir='rtl'] .prose ol { padding-left: 0; padding-right: 1.2em; }
[dir='rtl'] .chain::before { left: auto; right: 13px; }
[dir='rtl'] .places details p { padding: 0 60px 16px 16px; }
[dir='rtl'] .tbl th { text-align: right; padding: 8px 0 8px 10px; }
[dir='rtl'] .mini-rhythm span { text-align: left; }
[dir='rtl'] .warn { border-left: 1px solid var(--line); border-right: 4px solid var(--gold); }
[dir='rtl'] .times li.on::before { left: auto; right: 0; }
[dir='rtl'] .tab.on::before { border-radius: 0 0 3px 3px; }

/* Language button & sheet */
.hero-actions { display: flex; align-items: center; gap: 4px; }
.langbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 99px; border: 1px solid rgba(232, 197, 106, .45); color: var(--gold-2);
  font-size: .8rem; font-weight: 600; background: rgba(0, 0, 0, .12);
}
.langbtn .ic { width: 16px; height: 16px; }
.langcard { width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.langcard .cur { color: var(--green); font-weight: 700; }
[data-theme='dark'] .langcard .cur { color: var(--gold-2); }

.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 20, 14, .55); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 520px;
  transform: translate(-50%, 100%); transition: transform .22s ease-out;
  background: var(--card); color: var(--ink); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: translate(-50%, 0); }
.grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
.sheet-panel h2 { font: 600 1.05rem/1.6 var(--sans-base); text-align: center; margin-bottom: 10px; }
.langs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.langs button {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
  font-size: 1.15rem; font-weight: 600;
}
.langs button[lang='en'] { font-family: var(--sans-base); }
.langs button[lang='ur'] { font-family: 'Noto Nastaliq Urdu', serif; line-height: 2; padding: 6px 18px; }
.langs button[lang='hi'] { font-family: 'Noto Sans Devanagari', sans-serif; }
.langs button[lang='bn'] { font-family: 'Noto Sans Bengali', sans-serif; }
.langs button[lang='gu'] { font-family: 'Noto Sans Gujarati', sans-serif; }
.langs button.on { border-color: var(--green); background: var(--green-3); color: var(--green); }
[data-theme='dark'] .langs button.on { border-color: var(--gold); color: var(--gold-2); }
.langs .ic { width: 20px; height: 20px; }

@media (min-width: 900px) {
  .sheet-panel { top: 50%; bottom: auto; border-radius: 24px; transform: translate(-50%, -40%); opacity: 0; transition: .2s; }
  .sheet.open .sheet-panel { transform: translate(-50%, -50%); opacity: 1; }
}
/* ---------- khadims ---------- */

.khadim-card > .kicker + .row-head { margin: 2px 0 0; }
.khadim-card > .row-head + .muted { margin-top: 2px; }
.khadim { display: flex; align-items: center; gap: 14px; }
.khadim-card > .muted + .khadim { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.khadim-ic {
  width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-3); color: var(--green);
}
[data-theme='dark'] .khadim-ic { color: var(--gold-2); }
.khadim > div { flex: 1; min-width: 0; }
.khadim b { display: block; font: 700 1.2rem/1.25 var(--serif); }
.khadim .muted { font-size: .85rem; }
.khadim .phone {
  font-variant-numeric: tabular-nums; font-family: var(--sans-base); font-weight: 600; letter-spacing: .02em;
  color: var(--green); text-align: start; unicode-bidi: isolate;
}
[data-theme='dark'] .khadim .phone { color: var(--gold-2); }
[dir='rtl'] .khadim .phone { text-align: right; }
.khadim + .btnrow { margin-top: 14px; }
.btn.wa { background: #1f8f55; color: #fff; }
[data-theme='dark'] .btn.wa { background: #25a463; color: #06170e; }
html[lang='ur'] .khadim b { line-height: 1.9; font-weight: 600; }

/* ---------- posts ---------- */

.posts-home[hidden], .khadim-card[hidden] { display: none; }
.posts-home .row-head { margin: 10px 0 10px; }
.posts-home .section-title { margin: 0 4px; }
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-meta .ic { width: 15px; height: 15px; }
.post-meta .muted { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.post h3 { margin-top: 4px; }
.post-body { margin-top: 6px; color: var(--muted); white-space: pre-line; }
.post audio { display: block; width: 100%; margin-top: 12px; }
.post-thumb { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-top: 12px; }
.post .link { margin-top: 10px; }
.media-frame {
  display: block; position: relative; width: 100%; aspect-ratio: 16 / 9; margin-top: 12px;
  border-radius: 12px; overflow: hidden; background: #000; padding: 0;
}
video.media-frame { object-fit: contain; }
.media-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(15, 61, 46, .85); color: var(--gold-2); box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: transform .15s;
}
.yt-play .ic { width: 28px; height: 28px; fill: currentColor; margin-left: 3px; }
.yt:hover .yt-play, .yt:focus-visible .yt-play { transform: scale(1.08); }
.skeleton { min-height: 120px; background: linear-gradient(90deg, var(--card), var(--green-3), var(--card)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
