/* Quran for Amal — site styles */
:root {
  --bg: #ece3d0;
  --paper: #fbf7ee;
  --ink: #2b2621;
  --ink-soft: #564e44;
  --muted: #8b8070;
  --accent: #2c6659;
  --accent-soft: rgba(44, 102, 89, .09);
  --gold: #9c7735;
  --gold-line: rgba(156, 119, 53, .32);
  --gold-soft: rgba(156, 119, 53, .12);
  --panel: #f4eedf;
  --shadow: 0 1px 2px rgba(70, 50, 20, .06), 0 18px 50px -20px rgba(70, 50, 20, .28);
  --top-bg: rgba(236, 227, 208, .86);
  --img-filter: none;
  --img-opacity: .88;
  --fs: 1.2rem;
  --f-deva: 'Tiro Devanagari Hindi', 'Noto Serif Devanagari', 'Kohinoor Devanagari', 'Mangal', serif;
  --f-ar: 'Scheherazade New', 'Amiri', 'Traditional Arabic', 'Geeza Pro', serif;
  --f-display: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #0f1215;
  --paper: #161a1e;
  --ink: #e6dece;
  --ink-soft: #c4bba9;
  --muted: #8e8777;
  --accent: #8cc3b3;
  --accent-soft: rgba(140, 195, 179, .1);
  --gold: #cba86a;
  --gold-line: rgba(203, 168, 106, .3);
  --gold-soft: rgba(203, 168, 106, .1);
  --panel: #1c2126;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 50px -20px rgba(0, 0, 0, .6);
  --top-bg: rgba(15, 18, 21, .86);
  --img-filter: invert(1) sepia(.18);
  --img-opacity: .86;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-deva);
  font-size: 1.05rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: lining-nums;
  transition: background-color .35s ease, color .35s ease;
}
a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ar { font-family: var(--f-ar); font-size: 1.12em; line-height: 1; unicode-bidi: isolate; }

/* ------------------------------------------------------------ ornaments */
.medallion { position: relative; display: inline-grid; place-items: center; width: 74px; height: 74px; color: var(--gold); flex: none; }
.medallion svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.medallion-num { position: relative; font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); font-variant-numeric: lining-nums; line-height: 1; }
.medallion--sm { width: 46px; height: 46px; }
.medallion--sm .medallion-num { font-size: .98rem; }
.medallion--hero { width: 58px; height: 58px; }

.divider { display: flex; align-items: center; gap: 1rem; margin: 2.6em auto; max-width: 22rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to var(--dir, right), transparent, var(--gold-line)); }
.divider::after { --dir: left; }
.divider span {
  width: 18px; height: 18px; flex: none; background: var(--gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0l2.6 3.7L17 3l-.7 4.4L20 10l-3.7 2.6L17 17l-4.4-.7L10 20l-2.6-3.7L3 17l.7-4.4L0 10l3.7-2.6L3 3l4.4.7z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0l2.6 3.7L17 3l-.7 4.4L20 10l-3.7 2.6L17 17l-4.4-.7L10 20l-2.6-3.7L3 17l.7-4.4L0 10l3.7-2.6L3 3l4.4.7z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .8;
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: .5rem;
  height: 56px; padding: 0 max(1rem, env(safe-area-inset-left)) 0 max(1rem, env(safe-area-inset-right));
  background: var(--top-bg);
  -webkit-backdrop-filter: saturate(1.2) blur(12px); backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--gold-soft);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .25rem; flex: 1; min-width: 0; }
.topbar-right { justify-content: flex-end; grid-column: 3; }
.topbar-title { font-family: var(--f-display); font-weight: 500; font-size: 1.12rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; min-width: 0; }
.topbar-title .n { color: var(--gold); margin-inline-end: .3em; }
.brand { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.tbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 40px; height: 40px; padding: 0 .55rem; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; text-decoration: none; font-size: .95rem; white-space: nowrap;
  color: var(--ink-soft);
}
.tbtn:hover { background: var(--gold-soft); color: var(--ink); }
.tbtn svg { width: 20px; height: 20px; }
.tbtn .aa { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; font-size: 1.12rem; letter-spacing: -.02em; }
.tbtn .aa small { font-size: .78em; }
.theme-btn .sun { display: none; }
[data-theme="night"] .theme-btn .sun { display: block; }
[data-theme="night"] .theme-btn .moon { display: none; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--gold); opacity: .75; transition: width .1s linear; }
.toc-btn { display: none; }
.has-toc .toc-btn { display: inline-flex; }

.toc-panel {
  position: fixed; z-index: 19; top: 64px; right: max(.75rem, calc(50vw - 26rem));
  width: min(22rem, calc(100vw - 1.5rem)); max-height: min(70vh, 34rem); overflow: auto;
  background: var(--paper); border: 1px solid var(--gold-line); border-radius: 14px; box-shadow: var(--shadow);
  padding: .9rem .6rem .7rem; opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.toc-open .toc-panel { opacity: 1; transform: none; pointer-events: auto; }
.toc-panel h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; margin: 0 .6rem .4rem; color: var(--gold); letter-spacing: .03em; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list a { display: block; padding: .5rem .7rem; border-radius: 8px; text-decoration: none; font-size: 1rem; line-height: 1.5; }
.toc-list a:hover { background: var(--gold-soft); }

/* ------------------------------------------------------------ the reading page */
.sheet {
  position: relative;
  max-width: 47rem;
  margin: 2.5rem auto 3rem;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: clamp(2.6rem, 6vw, 4.6rem) clamp(1.25rem, 7vw, 5.25rem) clamp(2.5rem, 6vw, 4rem);
  transition: background-color .35s ease;
}
.sheet::before, .sheet::after { content: ''; position: absolute; pointer-events: none; border: 1px solid var(--gold-line); border-radius: 3px; }
.sheet::before { inset: 14px; }
.sheet::after { inset: 19px; opacity: .55; }

.sh { text-align: center; margin-bottom: 1.4rem; }
.sh .medallion { margin-bottom: .6rem; }
.sh-ar { font-family: var(--f-ar); font-size: clamp(2.3rem, 7vw, 3rem); line-height: 1.5; color: var(--accent); margin: 0; font-weight: 400; }
.sh-name { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.55rem, 4.6vw, 1.9rem); letter-spacing: .03em; margin: .1rem 0 .15rem; line-height: 1.2; }
.sh-meta { margin: 0; font-family: var(--f-display); font-size: 1.05rem; color: var(--muted); letter-spacing: .04em; }
.sh-meta .dot { margin: 0 .45em; color: var(--gold); }
.sh-meta .hi { font-family: var(--f-deva); font-size: .92em; letter-spacing: 0; }
.sh-hindi { margin: .35rem 0 0; color: var(--ink-soft); font-size: 1.05rem; }

.content { font-size: var(--fs); line-height: 1.95; color: var(--ink); hyphens: manual; overflow-wrap: break-word; }
.content p { margin: 0 0 .85em; }
.content .num { color: var(--gold); font-variant-numeric: tabular-nums; margin-inline-end: .15em; }

.prose { margin: 0 0 1.4em; }

.ayah {
  font-family: var(--f-ar);
  font-size: 1.62em; line-height: 2.05;
  text-align: center; color: var(--ink);
  margin: 1.9em 0 .55em !important;
  word-spacing: .06em;
}
.ayah .ar { font-size: 1em; line-height: inherit; }
.ayah .num { font-family: var(--f-deva); font-size: .5em; }

.ayah-img { margin: 1.8em auto 1.1em; max-width: 36rem; }
.ayah-img img { display: block; width: 100%; height: auto; filter: var(--img-filter); opacity: var(--img-opacity); }
.ayah-img--photo img { filter: none; opacity: 1; border-radius: 6px; }

.tarjuma { margin: 0 0 1.1em; }
.tarjuma p:last-child { margin-bottom: 0; }

.tashreeh {
  position: relative;
  margin: 1.1em 0 2.1em;
  padding: 1.05em 1.25em .25em 1.35em;
  background: var(--panel);
  border-radius: 4px 12px 12px 4px;
  color: var(--ink);
}
.tashreeh::before { content: ''; position: absolute; left: 0; top: .7em; bottom: .7em; width: 2px; background: var(--gold-line); border-radius: 2px; }

.label {
  display: inline-block;
  font-size: .8em; line-height: 1.55;
  padding: .02em .62em .1em;
  border-radius: 999px;
  margin-inline-end: .2em;
  vertical-align: .06em;
}
.label--tr { color: var(--accent); background: var(--accent-soft); }
.label--tsh { color: var(--gold); background: var(--gold-soft); }

.doc-heading, .doc-surah {
  text-align: center; font-weight: 400; color: var(--accent);
  font-size: 1.32em; line-height: 1.6; margin: 1.5em 0 .9em;
}
.doc-surah { font-size: 1.45em; margin-top: 2em; }
.doc-section {
  display: flex; align-items: center; gap: .9em;
  font-weight: 400; font-size: .98em; line-height: 1.5; color: var(--gold);
  margin: 3.2em 0 .9em; text-align: center; scroll-margin-top: 80px; letter-spacing: .01em;
}
.doc-section::before, .doc-section::after { content: ''; flex: 1; height: 1px; background: var(--gold-line); }
.doc-para {
  display: table; margin: 1.6em auto 1.2em !important;
  padding: .15em 1.2em .2em; border: 1px solid var(--gold-line); border-radius: 999px;
  color: var(--ink-soft); font-size: .95em; text-align: center;
}

.soon { text-align: center; color: var(--ink-soft); padding: 1rem 0 .5rem; }
.soon-en { font-family: var(--f-display); font-size: 1.15rem; font-style: italic; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .72em 1.5em .78em; border-radius: 999px;
  background: var(--accent); color: var(--paper) !important; text-decoration: none;
  font-size: 1.02rem; line-height: 1.3; border: 1px solid transparent;
  box-shadow: 0 6px 18px -8px rgba(44, 102, 89, .7);
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(44, 102, 89, .8); }
.btn--ghost { background: transparent; color: var(--ink) !important; border-color: var(--gold-line); box-shadow: none; }
.btn--ghost:hover { background: var(--gold-soft); box-shadow: none; }

.pn-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 47rem; margin: 0 auto 1.5rem; padding: 0 1rem; }
.pn {
  display: flex; flex-direction: column; gap: .15rem; padding: .95rem 1.2rem; border-radius: 14px;
  text-decoration: none; border: 1px solid var(--gold-line); background: color-mix(in srgb, var(--paper) 60%, transparent);
  transition: border-color .2s, background-color .2s;
}
.pn:hover { border-color: var(--gold); background: var(--paper); }
.pn--next { grid-column: 2; text-align: right; }
.pn-dir { font-size: .9rem; color: var(--muted); }
.pn-name { font-family: var(--f-display); font-size: 1.2rem; font-weight: 500; }

.foot { text-align: center; padding: 1.5rem 1rem 2.5rem; color: var(--muted); font-size: .92rem; }
.foot a { text-decoration: none; border-bottom: 1px solid var(--gold-line); }
.foot .brandline { font-family: var(--f-display); font-size: 1.1rem; letter-spacing: .03em; }

/* ------------------------------------------------------------ landing */
.landing { min-height: 100vh; min-height: 100svh; }
.pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%239c7735' stroke-width='.8' opacity='.22'%3E%3Cpath d='M48 20l8.3 8.3H68v11.7L76 48l-8 8v11.7H56.3L48 76l-8.3-8.3H28V56l-8-8 8-8V28.3h11.7z'/%3E%3Cpath d='M48 0v20M48 76v20M0 48h20M76 48h20M28.3 28.3L14 14M67.7 28.3L82 14M28.3 67.7L14 82M67.7 67.7L82 82'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 96px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, transparent 20%, #000 95%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, transparent 20%, #000 95%);
}
[data-theme="night"] .pattern { opacity: .55; }
.hero { max-width: 44rem; margin: 0 auto; padding: clamp(2.5rem, 8vh, 5rem) 1.25rem 1rem; text-align: center; }
.bismillah { font-family: var(--f-ar); font-size: clamp(1.7rem, 5.5vw, 2.3rem); color: var(--accent); margin: 0 0 1.4rem; line-height: 1.8; }
.hero h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(3rem, 11vw, 5.1rem); line-height: 1; letter-spacing: .01em; margin: .9rem 0 .7rem; }
.hero h1 em { font-style: italic; font-weight: 400; color: var(--gold); }
.hero .sub { margin: 0; font-size: clamp(1.2rem, 3.6vw, 1.45rem); color: var(--ink-soft); }
.hero .sub-en { margin: .2rem 0 0; font-family: var(--f-display); font-style: italic; font-size: clamp(1.08rem, 3vw, 1.22rem); color: var(--muted); }

.letter {
  position: relative; max-width: 40rem; margin: clamp(2rem, 6vh, 3.2rem) auto 0;
  background: var(--paper); border-radius: 6px; box-shadow: var(--shadow);
  padding: clamp(2.2rem, 6vw, 3.4rem) clamp(1.5rem, 6vw, 3.6rem) clamp(2rem, 5vw, 2.8rem);
  text-align: left; font-size: 1.12rem; line-height: 1.9;
}
.letter::before { content: ''; position: absolute; inset: 12px; border: 1px solid var(--gold-line); border-radius: 3px; pointer-events: none; }
.letter p { margin: 0 0 1em; }
.letter .salutation { font-family: var(--f-display); font-size: 1.35rem; font-style: italic; color: var(--accent); margin-bottom: .6em; }
.letter .sign { margin: 1.6em 0 0; text-align: right; }
.letter .sign .name { display: block; font-family: var(--f-display); font-size: 1.4rem; font-weight: 500; font-style: italic; }
.letter .sign .rel { display: block; font-size: .95rem; color: var(--muted); }
.letter .draft-note { font-family: system-ui, sans-serif; font-size: .78rem; letter-spacing: .02em; color: var(--muted); border: 1px dashed var(--gold-line); border-radius: 8px; padding: .4em .8em; margin: 0 0 1.4em; text-align: center; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin: 2.2rem 0 0; }
.resume { margin: 1rem 0 0; font-size: .98rem; color: var(--muted); }
.resume a { color: var(--accent); }

/* ------------------------------------------------------------ surah index */
.index-head { max-width: 72rem; margin: 0 auto; padding: 2.6rem 1.25rem .6rem; text-align: center; }
.index-head h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(2.2rem, 7vw, 3.1rem); line-height: 1.1; margin: .2rem 0 .3rem; }
.index-head .hi { font-size: 1.25rem; color: var(--gold); margin: 0; }
.index-head .count { color: var(--muted); margin: .4rem 0 0; font-size: 1rem; }
.controls { max-width: 72rem; margin: 1.4rem auto .4rem; padding: 0 1.25rem; display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; align-items: center; }
.search { position: relative; flex: 1 1 18rem; max-width: 28rem; }
.search input {
  width: 100%; height: 48px; border-radius: 999px; border: 1px solid var(--gold-line);
  background: var(--paper); color: var(--ink); padding: 0 1.1rem 0 2.8rem; font: inherit; font-size: 1.02rem;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search svg { position: absolute; left: 1rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.chips { display: inline-flex; padding: 4px; border-radius: 999px; border: 1px solid var(--gold-line); background: var(--paper); }
.chip { border: 0; background: transparent; border-radius: 999px; padding: .45rem 1rem; cursor: pointer; font-size: .95rem; color: var(--ink-soft); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--paper); }

.cards { list-style: none; margin: 1.2rem auto 2rem; padding: 0 1.25rem; max-width: 72rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.card a {
  display: flex; align-items: center; gap: .9rem; height: 100%;
  padding: .8rem 1rem .8rem .8rem; border-radius: 14px; text-decoration: none;
  background: var(--paper); border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(70, 50, 20, .05);
  transition: border-color .2s, transform .15s ease, box-shadow .2s;
}
.card a:hover { border-color: var(--gold-line); transform: translateY(-1px); box-shadow: var(--shadow); }
.card-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-name { font-family: var(--f-display); font-weight: 600; font-size: 1.22rem; line-height: 1.2; letter-spacing: .01em; }
.card-meta { font-size: .9rem; line-height: 1.45; color: var(--muted); }
.card-ar { font-family: var(--f-ar); font-size: 1.55rem; line-height: 1.2; color: var(--accent); white-space: nowrap; }
.card-badge { font-size: .78rem; padding: .1em .65em .15em; border-radius: 999px; background: var(--accent-soft); color: var(--accent); flex: none; }
.card-badge--soon { background: transparent; color: var(--muted); border: 1px solid var(--gold-soft); }
.card--soon a { background: color-mix(in srgb, var(--paper) 45%, transparent); box-shadow: none; }
.card--soon .card-name, .card--soon .card-ar, .card--soon .medallion { opacity: .6; }
.card--ready .card-name::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: .45em; border-radius: 50%; background: var(--accent); vertical-align: .2em; }
.card[hidden] { display: none; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 640px) {
  .sheet { margin: 0; border-radius: 0; box-shadow: none; padding: 2.2rem 1.15rem 2.2rem; }
  .sheet::before { inset: 7px; }
  .sheet::after { display: none; }
  .tashreeh { margin-left: -.35em; margin-right: -.35em; padding: .95em .95em .2em 1.1em; }
  .pn-nav { grid-template-columns: 1fr; gap: .6rem; padding: 1rem; margin: 0; }
  .pn--next { grid-column: 1; }
  .tbtn .lbl { display: none; }
  .topbar-title { font-size: 1.02rem; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar-left, .topbar-right { flex: none; }
  .letter { font-size: 1.06rem; }
  .card-ar { font-size: 1.35rem; }
  .card-badge { display: none; }
  .cards { gap: .5rem; }
}
@media (max-width: 380px) {
  .topbar { gap: .2rem; padding: 0 .5rem; }
  .tbtn { min-width: 36px; padding: 0 .4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .pn-nav, .foot, .toc-panel, .progress { display: none !important; }
  body { background: #fff; }
  .sheet { box-shadow: none; margin: 0; max-width: none; }
}

/* ------------------------------------------------------------ WordPress */
.admin-bar .topbar { top: 32px; }
.admin-bar .toc-panel { top: 96px; }
@media (max-width: 782px) { .admin-bar .topbar { top: 46px; } .admin-bar .toc-panel { top: 110px; } }
@media (max-width: 600px) { .admin-bar .topbar { top: 0; } }
.page-content { font-size: 1.12rem; line-height: 1.9; }
.page-content > *:first-child { margin-top: 0; }
.page-content h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(2rem, 6vw, 2.6rem); line-height: 1.15; text-align: center; margin: 0 0 1.2rem; }
.page-content h2, .page-content h3 { color: var(--accent); font-weight: 400; line-height: 1.4; margin: 1.6em 0 .6em; }
.page-content a { color: var(--accent); }
.page-content img { height: auto; border-radius: 6px; }
.page-content blockquote { margin: 1.4em 0; padding: .6em 1.2em; border-inline-start: 2px solid var(--gold-line); background: var(--panel); border-radius: 4px 10px 10px 4px; }
.letter .wp-block-paragraph, .letter p { margin: 0 0 1em; }
.letter > *:last-child { margin-bottom: 0; }
