/*
Theme Name: Durood e Taj
Theme URI: https://duroodetaj.com/
Author: duroodetaj.com
Description: A fast, accessible, SEO- and AI-friendly theme built for duroodetaj.com. No webfonts, no jQuery, no framework. Self-hosted or YouTube video, optional autoplay. Full RTL support for Urdu, Devanagari support for Hindi, built-in schema, meta and hreflang output.
Version: 1.2.2
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: duroodetaj
Tags: accessibility-ready, translation-ready, rtl-language-support
*/

/* ---------------------------------------------------------------
   1. Tokens
   Palette: sage-tinted paper, green-black ink, deep pine, muted
   brass. Brass appears in exactly two places on the whole site —
   the wird counts and the audio progress — and nowhere else.
   --------------------------------------------------------------- */

:root {
  --paper:      #f1f2ed;
  --paper-deep: #e7e9e2;
  --paper-lift: #f8f9f6;
  --ink:        #1c2321;
  --ink-soft:   #55605b;
  --ink-faint:  #7d8781;
  --rule:       #d3d7cd;
  --pine:       #2f5d50;
  --pine-dark:  #234539;
  --brass:      #9a7b4f;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --arabic: "Amiri Quran", "Amiri", "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", "Times New Roman", serif;
  --urdu:  "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Noto Naskh Arabic", "Geeza Pro", serif;
  --deva:  "Noto Serif Devanagari", "Noto Sans Devanagari", "Nirmala UI", "Mangal", serif;

  --measure: 66ch;
  --gutter: 1.25rem;
  --shell: 46rem;

  --s1: 0.375rem;
  --s2: 0.75rem;
  --s3: 1.25rem;
  --s4: 2rem;
  --s5: 3.25rem;
  --s6: 5rem;
}

/* ---------------------------------------------------------------
   2. Reset + base
   --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 106.25%;                 /* 17px */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.22;
  margin: 0 0 var(--s2);
  text-wrap: balance;
}

h1 { font-size: 2.25rem; letter-spacing: -0.015em; }
h2 { font-size: 1.5rem; margin-top: var(--s5); }
h3 { font-size: 1.1875rem; margin-top: var(--s4); font-weight: 700; }

p, ul, ol, blockquote, table { margin: 0 0 var(--s3); }

a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--pine-dark); }

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 3px;
  border-radius: 2px;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; }

blockquote {
  margin: var(--s4) 0;
  padding: 0 0 0 var(--s3);
  border-left: 2px solid var(--brass);
  color: var(--ink-soft);
  font-style: normal;
}

code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.dt-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--pine); color: #fff;
  padding: var(--s2) var(--s3); z-index: 100;
  font-family: var(--sans); font-size: 0.9375rem;
}
.dt-skip:focus { left: 0; }

.dt-visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------
   3. Shell
   --------------------------------------------------------------- */

.dt-shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.dt-measure { max-width: var(--measure); }

/* ---------------------------------------------------------------
   4. Masthead
   --------------------------------------------------------------- */

.dt-masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

/* Wider than the reading measure: the brand, the menu and the language
   switch all have to fit on one line before it looks composed. */
.dt-masthead .dt-shell { max-width: 62rem; }

.dt-masthead__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  padding-block: var(--s3);
}

.dt-brand {
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.005em;
}
.dt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.dt-brand__mark {
  /* Height-constrained, width free. Logos are wordmarks as often as
     they are square marks, and forcing both dimensions squashes one
     of those two cases into nonsense. */
  height: 2.5rem;
  width: auto;
  max-width: 15rem;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}
.dt-brand:hover span { color: var(--pine); text-decoration: underline; }

.dt-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  font-family: var(--sans);
  font-size: 0.875rem;
}
.dt-nav a { color: var(--ink-soft); text-decoration: none; }
.dt-nav a:hover,
.dt-nav .current-menu-item > a { color: var(--pine); text-decoration: underline; }

/* Language switch sits with the nav but reads as a separate control */
.dt-langs {
  display: flex; gap: var(--s2);
  font-family: var(--sans); font-size: 0.8125rem;
}
.dt-langs a {
  color: var(--ink-faint); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.1rem 0.6rem;
}
.dt-langs a:hover { color: var(--pine); border-color: var(--pine); }
.dt-langs a[aria-current="true"] { color: var(--ink); border-color: var(--ink-faint); }

/* ---------------------------------------------------------------
   5. Hero — the recitation is the hero, not a headline
   --------------------------------------------------------------- */

.dt-hero { padding-block: var(--s5) var(--s4); }

.dt-hero h1 {
  font-size: clamp(2.5rem, 9vw, 3.75rem);
  margin-bottom: var(--s1);
}

.dt-hero__ar {
  font-family: var(--arabic);
  text-align: start;
  unicode-bidi: isolate;
  font-size: 1.375rem;
  color: var(--ink-faint);
  margin: 0 0 var(--s4);
  line-height: 1.9;
}

.dt-hero__lede {
  max-width: var(--measure);
  font-size: 1.125rem;
  color: var(--ink-soft);
  margin-bottom: 0;
}

/* ---------------------------------------------------------------
   6. Audio player
   --------------------------------------------------------------- */

.dt-player {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--s3);
  margin-block: var(--s4);
}

.dt-player__top {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.dt-player__btn {
  flex: 0 0 auto;
  width: 3.5rem; height: 3.5rem;
  border-radius: 50%;
  border: 0;
  background: var(--pine);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 120ms linear;
}
.dt-player__btn:hover { background: var(--pine-dark); }
.dt-player__btn svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.dt-player__btn .dt-icon-pause { display: none; }
.dt-player.is-playing .dt-icon-play { display: none; }
.dt-player.is-playing .dt-icon-pause { display: block; }

.dt-player__label {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink);
}
.dt-player__label span {
  display: block;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.dt-player__track {
  margin-top: var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.dt-player__seek {
  flex: 1 1 auto;
  height: 1.5rem;
  position: relative;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  display: block;
}
.dt-player__seek::before {
  content: "";
  position: absolute; inset-inline: 0; top: 50%;
  height: 3px; margin-top: -1.5px;
  background: var(--paper-deep);
  border-radius: 2px;
}
.dt-player__fill {
  position: absolute; inset-inline-start: 0; top: 50%;
  height: 3px; margin-top: -1.5px;
  width: 0;
  background: var(--brass);
  border-radius: 2px;
}

.dt-player__note {
  margin: var(--s2) 0 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-faint);
}
.dt-player__note a { color: var(--pine); }

/* ---------------------------------------------------------------
   7. Video facade — nothing loads from YouTube until clicked
   --------------------------------------------------------------- */

.dt-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper-deep) center/cover no-repeat;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  padding: 0;
  display: block;
}
.dt-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.dt-video__play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
.dt-video__play span {
  width: 4.5rem; height: 4.5rem;
  border-radius: 50%;
  background: rgba(28, 35, 33, 0.82);
  display: grid; place-items: center;
}
.dt-video__play svg { width: 1.5rem; height: 1.5rem; fill: #fff; margin-inline-start: 3px; }
.dt-video:hover .dt-video__play span { background: var(--pine); }

.dt-videowrap { margin-block: var(--s4); }

.dt-video-native {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: block;
}

.dt-caption a { color: var(--pine); }

.dt-caption {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-top: var(--s2);
}

/* ---------------------------------------------------------------
   8. The wird — 7 / 3 / 3. The one place the design raises its
   voice. The numerals are the content, not decoration.
   --------------------------------------------------------------- */

.dt-wird { margin-block: var(--s5); }

.dt-wird__list { list-style: none; margin: var(--s3) 0 0; padding: 0; }

.dt-wird__row {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: baseline;
  gap: var(--s3);
  padding-block: var(--s3);
  border-top: 1px solid var(--rule);
}
.dt-wird__row:last-child { border-bottom: 1px solid var(--rule); }

.dt-wird__count {
  font-family: var(--serif);
  font-size: 2.75rem;
  line-height: 1;
  color: var(--brass);
  font-variant-numeric: lining-nums;
}

.dt-wird__when { font-size: 1.0625rem; margin: 0; }
.dt-wird__when small {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-top: 0.15rem;
}

.dt-wird__foot {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  margin-top: var(--s3);
  max-width: var(--measure);
}

/* ---------------------------------------------------------------
   9. Prose (page content)
   --------------------------------------------------------------- */

.dt-prose { max-width: var(--measure); }
.dt-prose > *:first-child { margin-top: 0; }
.dt-prose ul, .dt-prose ol { padding-inline-start: 1.35rem; }
.dt-prose li { margin-bottom: var(--s1); }
.dt-prose li::marker { color: var(--ink-faint); }

.dt-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.dt-prose th, .dt-prose td {
  text-align: start;
  padding: var(--s2) var(--s2) var(--s2) 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.dt-prose th { font-weight: 700; }

/* Sourced or attributed passage — used for reported virtues */
.dt-source {
  border-inline-start: 2px solid var(--rule);
  padding-inline-start: var(--s3);
  margin-block: var(--s4);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.dt-source cite { font-style: normal; color: var(--ink-faint); }

/* Slot for the Arabic text, ready for when it is added */
.dt-arabic {
  font-family: var(--arabic);
  direction: rtl;
  text-align: right;
  font-size: 1.625rem;
  line-height: 2.25;
  margin-block: var(--s4);
}

/* ---------------------------------------------------------------
   10. Page header, links, buttons
   --------------------------------------------------------------- */

.dt-page-head { padding-block: var(--s5) var(--s4); }
.dt-page-head h1 { font-size: clamp(2rem, 6.5vw, 2.75rem); }
.dt-page-head p {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 1.0625rem;
  margin-bottom: 0;
}

.dt-crumbs {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-bottom: var(--s3);
}
.dt-crumbs a { color: var(--ink-faint); }

.dt-links { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.dt-links li { border-top: 1px solid var(--rule); }
.dt-links li:last-child { border-bottom: 1px solid var(--rule); }
.dt-links a {
  display: block;
  padding-block: var(--s3);
  text-decoration: none;
  color: var(--ink);
}
.dt-links a:hover { color: var(--pine); }
.dt-links strong { font-weight: 400; font-size: 1.125rem; display: block; }
.dt-links span {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin-top: 0.15rem;
}

.dt-btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9375rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--pine);
  border-radius: 3px;
  color: var(--pine);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}
.dt-btn:hover { background: var(--pine); color: #fff; }
.dt-btn--solid { background: var(--pine); color: #fff; }
.dt-btn--solid:hover { background: var(--pine-dark); border-color: var(--pine-dark); }

.dt-btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-block: var(--s3); }

/* ---------------------------------------------------------------
   11. Questions
   --------------------------------------------------------------- */

.dt-faq { margin-block: var(--s5); }

.dt-faq details {
  border-top: 1px solid var(--rule);
}
.dt-faq details:last-of-type { border-bottom: 1px solid var(--rule); }

.dt-faq summary {
  cursor: pointer;
  padding-block: var(--s3);
  font-size: 1.0625rem;
  list-style: none;
  display: flex;
  gap: var(--s3);
  align-items: baseline;
  justify-content: space-between;
}
.dt-faq summary::-webkit-details-marker { display: none; }
.dt-faq summary::after {
  content: "+";
  font-family: var(--sans);
  color: var(--ink-faint);
  flex: 0 0 auto;
  line-height: 1;
}
.dt-faq details[open] summary::after { content: "\2212"; }
.dt-faq summary:hover { color: var(--pine); }

.dt-faq__a {
  padding-bottom: var(--s3);
  max-width: var(--measure);
  color: var(--ink-soft);
}
.dt-faq__a p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------
   12. Footer
   --------------------------------------------------------------- */

.dt-footer {
  margin-top: var(--s6);
  border-top: 1px solid var(--rule);
  padding-block: var(--s4) var(--s5);
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-faint);
}
.dt-footer p { margin-bottom: var(--s2); max-width: var(--measure); }
.dt-footer a { color: var(--ink-soft); }
.dt-footer ul {
  list-style: none; margin: 0 0 var(--s3); padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--s3);
}

.dt-share { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.dt-share a {
  font-size: 0.8125rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  text-decoration: none;
  color: var(--ink-soft);
}
.dt-share a:hover { border-color: var(--pine); color: var(--pine); }

/* ---------------------------------------------------------------
   13. Script directions
   --------------------------------------------------------------- */

html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .dt-prose ul,
html[dir="rtl"] .dt-prose ol { padding-inline-start: 1.35rem; }

.dt-lang-ur,
.dt-lang-ur .dt-prose,
.dt-lang-ur .dt-page-head {
  font-family: var(--urdu);
  line-height: 2.35;
}
.dt-lang-ur h1 { font-size: clamp(2rem, 7vw, 2.75rem); line-height: 1.7; }
.dt-lang-ur h2 { line-height: 1.8; }
.dt-lang-ur .dt-faq summary { line-height: 2; }

.dt-lang-hi,
.dt-lang-hi .dt-prose,
.dt-lang-hi .dt-page-head {
  font-family: var(--deva);
  line-height: 1.85;
}

/* ---------------------------------------------------------------
   14. Responsive + preferences
   --------------------------------------------------------------- */

@media (min-width: 40rem) {
  html { font-size: 112.5%; }             /* 18px */
  .dt-wird__row { grid-template-columns: 5rem 1fr; }
  .dt-wird__count { font-size: 3.5rem; }
}

@media (max-width: 32rem) {
  .dt-masthead__inner { flex-direction: column; align-items: flex-start; gap: var(--s2); }
  .dt-player__btn { width: 3rem; height: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .dt-masthead, .dt-footer, .dt-player, .dt-video, .dt-share, .dt-links { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .dt-faq details { display: block; }
  .dt-faq summary::after { content: ""; }
}

/* ---------------------------------------------------------------
   15. Minimal core-block styles.
   The theme dequeues wp-block-library for speed, so the handful
   of block classes that actually appear in this content are
   styled here instead.
   --------------------------------------------------------------- */

.wp-block-image { margin: 0 0 var(--s3); }
.wp-block-image figcaption {
  font-family: var(--sans); font-size: 0.8125rem;
  color: var(--ink-faint); margin-top: var(--s1);
}
.wp-block-separator { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; }
.wp-block-table { overflow-x: auto; }
.aligncenter { margin-inline: auto; }
.alignleft { float: left; margin-inline-end: var(--s3); }
.alignright { float: right; margin-inline-start: var(--s3); }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
}

/* ---------------------------------------------------------------
   16. Free downloads
   --------------------------------------------------------------- */

.dt-downloads { margin-block: var(--s5); }

.dt-downloads__grid {
  display: grid;
  gap: var(--s3);
  align-items: start;
  margin-top: var(--s3);
}

.dt-downloads__preview {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-lift);
  max-width: 20rem;
}
.dt-downloads__preview img { width: 100%; height: auto; display: block; }
.dt-downloads__preview a { display: block; }

.dt-downloads__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
}
.dt-downloads__note {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin: var(--s1) 0 0;
  max-width: 34ch;
}

@media (min-width: 40rem) {
  .dt-downloads__grid { grid-template-columns: 20rem 1fr; gap: var(--s4); }
}

/* ---------------------------------------------------------------
   17. Add to home screen

   Sits at the bottom of the viewport on phones, above nothing and
   in the way of nothing. Dismissible, and it stays dismissed.
   --------------------------------------------------------------- */

.dt-install {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  background: var(--paper-lift);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -6px 28px rgba(28, 35, 33, 0.10);
  padding-block: var(--s3);
  padding-bottom: max(var(--s3), env(safe-area-inset-bottom));
}
.dt-install[hidden] { display: none; }

.dt-install__inner {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.dt-install__text strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 400;
}
.dt-install__text span {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.dt-install__actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.dt-install__later {
  background: none;
  border: 0;
  padding: 0.4rem 0;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-faint);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.dt-install__later:hover { color: var(--ink); }

.dt-install__ios {
  border-top: 1px solid var(--rule);
  margin-top: var(--s3);
  padding-top: var(--s3);
}
.dt-install__ios[hidden] { display: none; }
.dt-install__ios p {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin-bottom: var(--s2);
}

/* Keep the bar from covering the last line of the page. */
body:has(.dt-install:not([hidden])) .dt-footer { padding-bottom: 9rem; }

@media (min-width: 40rem) {
  .dt-install__inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
