/* ==========================================================================
   Sheikh Mahmoud Khalil Al-Husary — Serene Editorial Quran Library
   Warm Parchment & Ink Design System (RTL Arabic + LTR English, Light + Dark)
   ========================================================================== */

:root {
  /* Light Theme — Warm Ivory Parchment */
  --bg: #faf7f2;
  --bg-subtle: #f3ede3;
  --surface: #ffffff;
  --surface-hover: #fbf8f3;
  --surface-active: #f1e9dc;
  --ink: #1c1916;
  --ink-secondary: #5c5449;
  --ink-muted: #6f665a;
  --border: rgba(28, 25, 22, 0.1);
  --border-strong: rgba(28, 25, 22, 0.2);
  --accent: #8f6b3a;
  --accent-soft: rgba(143, 107, 58, 0.11);
  --accent-ink: #ffffff;
  --live: #1f5c47;
  --live-soft: rgba(31, 92, 71, 0.1);
  --player-bg: rgba(250, 247, 242, 0.94);
  --shadow-sm: 0 1px 2px rgba(28, 25, 22, 0.04);
  --shadow-md: 0 10px 30px rgba(28, 25, 22, 0.07);
  --shadow-lg: 0 20px 50px rgba(28, 25, 22, 0.14);

  /* Typography */
  --font-ar-display: "Amiri", "Scheherazade New", Georgia, serif;
  --font-ar-ui: "IBM Plex Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  --font-en-display: "Cormorant Garamond", Georgia, serif;
  --font-en-ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing & Layout */
  --max-w: 1120px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --player-h: 82px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #131210;
  --bg-subtle: #1a1815;
  --surface: #201e1a;
  --surface-hover: #272420;
  --surface-active: #2e2921;
  --ink: #f2ece1;
  --ink-secondary: #b7ad9e;
  --ink-muted: #9a9083;
  --border: rgba(242, 236, 225, 0.1);
  --border-strong: rgba(242, 236, 225, 0.22);
  --accent: #caa265;
  --accent-soft: rgba(202, 162, 101, 0.14);
  --accent-ink: #161411;
  --live: #58b895;
  --live-soft: rgba(88, 184, 149, 0.14);
  --player-bg: rgba(22, 20, 17, 0.94);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ar-ui);
  font-size: 15px;
  line-height: 1.7;
  padding-bottom: calc(var(--player-h) + 40px);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
  position: relative;
}

html[lang="en"] body {
  font-family: var(--font-en-ui);
}

/* Subtle tactile paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Top Navigation
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
  background: var(--surface);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-ar-display);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[lang="en"] .brand-title {
  font-family: var(--font-en-display);
  font-size: 19px;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: 14px;
  color: var(--ink-secondary);
  transition: color 0.2s var(--ease);
  position: relative;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn,
.lang-btn {
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.icon-btn {
  width: 36px;
  color: var(--ink-secondary);
}

.lang-btn {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.icon-btn:hover,
.lang-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--ink);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero {
  padding: 64px 0 72px;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.78fr);
  gap: 56px;
  align-items: center;
}

.hero-kicker {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}

html[lang="ar"] .hero-kicker {
  letter-spacing: 0;
  text-transform: none;
  font-size: 13.5px;
}

.hero-title {
  margin: 0 0 20px;
  font-family: var(--font-ar-display);
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
  font-weight: 700;
  line-height: 1.22;
  color: var(--ink);
}

html[lang="en"] .hero-title {
  font-family: var(--font-en-display);
  font-size: clamp(2.35rem, 4.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.hero-verse-block {
  margin: 0 0 22px;
  padding-inline-start: 16px;
  border-inline-start: 2px solid var(--accent);
}

.hero-verse-ar {
  font-family: var(--font-ar-display);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.5;
}

.hero-verse-ref {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
}

.hero-subtitle {
  margin: 0 0 28px;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--ink-secondary);
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--ink) 88%, var(--accent));
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  max-width: 520px;
}

.stat-year {
  font-family: var(--font-ar-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

html[lang="en"] .stat-year {
  font-family: var(--font-en-display);
  font-size: 27px;
}

.stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Hero Artwork Frame */
.hero-artwork {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.artwork-frame {
  border-radius: calc(var(--radius-lg) - 6px);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--bg-subtle);
  position: relative;
}

.artwork-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s var(--ease);
}

[data-theme="dark"] .artwork-frame img {
  filter: brightness(0.84) contrast(1.06) sepia(0.16);
}

.hero-artwork:hover .artwork-frame img {
  transform: scale(1.025);
}

.artwork-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 6px 4px;
  font-size: 12px;
  color: var(--ink-muted);
}

.artwork-years {
  font-family: var(--font-en-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */

.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.section-num {
  display: block;
  font-family: var(--font-en-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.section-title {
  margin: 0;
  font-family: var(--font-ar-display);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.25;
}

html[lang="en"] .section-title {
  font-family: var(--font-en-display);
  font-size: clamp(1.85rem, 3.2vw, 2.45rem);
  letter-spacing: -0.01em;
}

.section-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Section 01 — Complete 114-Surah Library
   ========================================================================== */

.mode-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}

.mode-tab {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.mode-tab:hover {
  color: var(--ink);
}

.mode-tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.search-box {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
}

.search-box svg {
  position: absolute;
  top: 50%;
  inset-inline-start: 14px;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding-inline-start: 40px;
  padding-inline-end: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-input::placeholder {
  color: var(--ink-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.search-clear {
  position: absolute;
  top: 50%;
  inset-inline-end: 10px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  font-size: 14px;
}

.search-clear:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  gap: 6px;
}

.filter-pill {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-secondary);
  transition: all 0.2s var(--ease);
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.filter-pill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.showing-count {
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* 114 Surah Grid */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 10px;
}

.surah-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: start;
  width: 100%;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

.surah-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.surah-card.is-playing {
  border-color: var(--accent);
  background: var(--surface-active);
}

.surah-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  transition: all 0.2s var(--ease);
}

.surah-card:hover .surah-num {
  border-color: var(--accent);
  color: var(--accent);
}

.surah-card.is-playing .surah-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.surah-info {
  min-width: 0;
  flex: 1;
}

.surah-names {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.surah-name-primary {
  font-family: var(--font-ar-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[lang="en"] .surah-name-primary {
  font-family: var(--font-en-ui);
  font-size: 14.5px;
  font-weight: 600;
}

.surah-name-secondary {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

html[lang="en"] .surah-name-secondary {
  font-family: var(--font-ar-display);
  font-size: 16px;
  color: var(--ink-secondary);
}

.surah-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.eq-bars span {
  width: 2.5px;
  background: currentColor;
  border-radius: 2px;
  animation: eqPulse 0.9s ease-in-out infinite;
}

.eq-bars span:nth-child(2) {
  animation-delay: 0.2s;
}

.eq-bars span:nth-child(3) {
  animation-delay: 0.4s;
}

.is-paused .eq-bars span {
  animation: none;
  height: 4px !important;
}

@keyframes eqPulse {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
}

.empty-state button {
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ==========================================================================
   Section 02 — Archival & Historic Editions
   ========================================================================== */

.archive-intro {
  max-width: 68ch;
  color: var(--ink-secondary);
  margin: -12px 0 28px;
  font-size: 15px;
  line-height: 1.85;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.archive-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: start;
  width: 100%;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.archive-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.archive-card.is-playing {
  border-color: var(--accent);
  background: var(--surface-active);
}

.archive-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.archive-year {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.archive-tag {
  font-size: 12px;
  color: var(--ink-muted);
}

.archive-title {
  margin: 0 0 6px;
  font-family: var(--font-ar-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

html[lang="en"] .archive-title {
  font-family: var(--font-en-display);
  font-size: 21px;
}

.archive-note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.archive-play-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--ink);
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s var(--ease);
}

.archive-card:hover .archive-play-circle {
  border-color: var(--accent);
  color: var(--accent);
}

.archive-card.is-playing .archive-play-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ==========================================================================
   Live Quran Radio Strip
   ========================================================================== */

.radio-section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.radio-header {
  max-width: 62ch;
  margin-bottom: 24px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--live);
  background: var(--live-soft);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.radio-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: start;
  width: 100%;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.radio-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.radio-card.is-playing {
  border-color: var(--live);
  box-shadow: 0 0 0 1px var(--live);
}

.radio-card-title {
  font-family: var(--font-ar-display);
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 4px;
}

html[lang="en"] .radio-card-title {
  font-family: var(--font-en-display);
  font-size: 21px;
}

.radio-card-sub {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.radio-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}

.radio-card.is-playing .radio-action {
  background: var(--live);
  border-color: var(--live);
  color: #ffffff;
}

/* ==========================================================================
   Section 03 — Biography, Quote, Books & Timeline
   ========================================================================== */

.bio-lead {
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink-secondary);
  max-width: 74ch;
  margin: 0 0 24px;
}

.bio-quote {
  margin: 32px 0;
  padding: 24px 28px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border-inline-start: 3px solid var(--accent);
}

.bio-quote p {
  margin: 0 0 10px;
  font-family: var(--font-ar-display);
  font-size: 20px;
  line-height: 1.75;
  color: var(--ink);
}

html[lang="en"] .bio-quote p {
  font-family: var(--font-en-display);
  font-size: 22px;
  font-style: italic;
  line-height: 1.5;
}

.bio-quote cite {
  font-style: normal;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.bio-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s var(--ease);
}

.bio-expand-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.bio-chapters {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.bio-chapters[hidden] {
  display: none;
}

.chapter-card {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.chapter-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

.chapter-title {
  margin: 0 0 12px;
  font-family: var(--font-ar-display);
  font-size: 20px;
  font-weight: 700;
}

html[lang="en"] .chapter-title {
  font-family: var(--font-en-display);
  font-size: 23px;
}

.chapter-card p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-secondary);
}

.chapter-card p:last-child {
  margin-bottom: 0;
}

/* Scholarly Books */
.books-box {
  margin-top: 36px;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.books-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 10px 24px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.books-grid li {
  font-size: 14px;
  color: var(--ink-secondary);
  padding-inline-start: 14px;
  position: relative;
}

.books-grid li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  inset-inline-start: 0;
  top: 10px;
}

/* Timeline */
.timeline-block {
  margin-top: 48px;
}

.timeline-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 0 0 20px;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.timeline-item {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.timeline-year {
  font-family: var(--font-en-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 6px;
}

.timeline-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding: 48px 0 64px;
  text-align: center;
}

.footer-verse {
  font-family: var(--font-ar-display);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 12px;
}

.footer-note {
  font-size: 13px;
  color: var(--ink-muted);
  max-width: 60ch;
  margin: 0 auto 20px;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.footer-links a:hover {
  color: var(--accent);
}

/* ==========================================================================
   Persistent Bottom Audio Player
   ========================================================================== */

.player-bar {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 50;
  background: var(--player-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.06);
}

.player-progress-wrap {
  position: relative;
  height: 5px;
  width: 100%;
  background: var(--border);
  cursor: pointer;
}

.player-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.player-progress-input {
  position: absolute;
  inset: -6px 0;
  width: 100%;
  height: 17px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.player-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 10px 24px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.player-track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.player-meta {
  min-width: 0;
}

.player-title {
  font-family: var(--font-ar-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[lang="en"] .player-title {
  font-family: var(--font-en-ui);
  font-size: 14.5px;
  font-weight: 600;
}

.player-sub {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-secondary);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}

.ctrl-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.ctrl-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.ctrl-play {
  width: 44px;
  height: 44px;
  background: var(--ink);
  color: var(--bg);
}

.ctrl-play:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--accent));
  color: var(--bg);
}

.player-time {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 84px;
  text-align: center;
}

.player-extras {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.mini-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}

.mini-pill:hover,
.mini-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Queue Drawer & Sleep Timer Popover
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 13, 11, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.queue-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: 65;
  width: min(400px, 100vw);
  background: var(--bg);
  border-inline-start: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s var(--ease), visibility 0s linear 0.3s;
}

html .queue-drawer.open {
  transition: transform 0.3s var(--ease), visibility 0s;
}

html[dir="rtl"] .queue-drawer {
  transform: translateX(-100%);
}

html .queue-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.queue-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: start;
  transition: background-color 0.15s var(--ease);
}

.queue-item:hover {
  background: var(--bg-subtle);
}

.queue-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: center;
}

/* Sleep Popover */
.sleep-wrap {
  position: relative;
}

.sleep-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  inset-inline-end: 0;
  width: 180px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 70;
}

.sleep-menu.open {
  display: flex;
}

.sleep-opt {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: start;
  font-size: 13px;
  color: var(--ink-secondary);
}

.sleep-opt:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.sleep-opt.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: calc(var(--player-h) + 18px);
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  z-index: 80;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero-artwork {
    max-width: 360px;
    margin: 0 auto;
  }

  .archive-list,
  .radio-grid,
  .bio-chapters {
    grid-template-columns: 1fr;
  }

  .player-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .player-extras {
    grid-column: 1 / -1;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }

  :root {
    --player-h: 124px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 36px 0 48px;
  }

  .section {
    padding: 48px 0;
  }

  .hero-stats {
    gap: 10px;
  }

  .surah-grid {
    grid-template-columns: 1fr;
  }

  .player-inner {
    padding: 10px 14px;
  }

  .player-time {
    display: none;
  }

  .hide-sm {
    display: none;
  }
}

/* ==========================================================================
   Reciter Switcher Ribbon (Golden School of Egyptian Recitation)
   ========================================================================== */

.reciter-ribbon {
  position: sticky;
  top: var(--nav-h);
  z-index: 35;
  background: color-mix(in srgb, var(--bg-subtle) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.reciter-ribbon-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.reciter-ribbon-inner::-webkit-scrollbar {
  display: none;
}

.reciter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}

.reciter-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.reciter-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.reciter-pill-years {
  font-size: 11px;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

html {
  scroll-padding-top: calc(var(--nav-h) + 64px);
}

/* ==========================================================================
   Offline & Data-Saver UI (Zero-Data Playback & Storage Manager)
   ========================================================================== */

.offline-banner {
  background: var(--live-soft);
  color: var(--live);
  border-bottom: 1px solid color-mix(in srgb, var(--live) 25%, transparent);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.offline-banner[hidden] {
  display: none;
}

.surah-card-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.surah-card-wrap .surah-card {
  padding-inline-end: 46px;
}

.surah-save-btn {
  position: absolute;
  top: 50%;
  inset-inline-end: 10px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
  z-index: 2;
}

.surah-save-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--ink);
}

.surah-save-btn.is-saved {
  color: var(--live);
  background: var(--live-soft);
  border-color: color-mix(in srgb, var(--live) 25%, transparent);
}

.surah-save-btn.is-saving {
  color: var(--accent);
  animation: pulseOpacity 1s ease-in-out infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.offline-badge-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--live-soft);
  color: var(--live);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.offline-summary {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offline-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.offline-clear-btn {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.offline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 8px;
}

.offline-item-play {
  flex: 1;
  min-width: 0;
  text-align: start;
}

.offline-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.offline-item-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.offline-item-del {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.offline-item-del:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.offline-empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-muted);
}

/* ==========================================================================
   Archival Sheikh Portraits & Switcher Avatars
   ========================================================================== */

.artwork-frame {
  position: relative;
}

.artwork-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 36px rgba(28, 25, 22, 0.16);
  border-radius: inherit;
}

.sheikh-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: sepia(0.18) contrast(1.04) saturate(0.88);
  transition: transform 0.8s var(--ease), opacity 0.3s var(--ease);
}

[data-theme="dark"] .sheikh-portrait {
  filter: sepia(0.22) brightness(0.9) contrast(1.08) saturate(0.82);
}




/* ==========================================================================
   v2 refinements — accessibility, RTL media controls, medallions, polish
   ========================================================================== */

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* Keyboard focus on cards and pills */
.surah-card:focus-visible,
.archive-card:focus-visible,
.radio-card:focus-visible,
.reciter-pill:focus-visible,
.mode-tab:focus-visible,
.filter-pill:focus-visible,
.queue-item:focus-visible,
.sleep-opt:focus-visible,
.surah-save-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero: quiet geometric field behind the copy */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero-pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  -webkit-mask: 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='black' stroke-width='1'%3E%3Cpolygon points='48.0,18.0 56.8,26.8 69.2,26.8 69.2,39.2 78.0,48.0 69.2,56.8 69.2,69.2 56.8,69.2 48.0,78.0 39.2,69.2 26.8,69.2 26.8,56.8 18.0,48.0 26.8,39.2 26.8,26.8 39.2,26.8'/%3E%3Cpolygon points='0.0,-30.0 8.8,-21.2 21.2,-21.2 21.2,-8.8 30.0,0.0 21.2,8.8 21.2,21.2 8.8,21.2 0.0,30.0 -8.8,21.2 -21.2,21.2 -21.2,8.8 -30.0,0.0 -21.2,-8.8 -21.2,-21.2 -8.8,-21.2'/%3E%3Cpolygon points='96.0,-30.0 104.8,-21.2 117.2,-21.2 117.2,-8.8 126.0,0.0 117.2,8.8 117.2,21.2 104.8,21.2 96.0,30.0 87.2,21.2 74.8,21.2 74.8,8.8 66.0,0.0 74.8,-8.8 74.8,-21.2 87.2,-21.2'/%3E%3Cpolygon points='0.0,66.0 8.8,74.8 21.2,74.8 21.2,87.2 30.0,96.0 21.2,104.8 21.2,117.2 8.8,117.2 0.0,126.0 -8.8,117.2 -21.2,117.2 -21.2,104.8 -30.0,96.0 -21.2,87.2 -21.2,74.8 -8.8,74.8'/%3E%3Cpolygon points='96.0,66.0 104.8,74.8 117.2,74.8 117.2,87.2 126.0,96.0 117.2,104.8 117.2,117.2 104.8,117.2 96.0,126.0 87.2,117.2 74.8,117.2 74.8,104.8 66.0,96.0 74.8,87.2 74.8,74.8 87.2,74.8'/%3E%3Ccircle cx='48' cy='48' r='9'/%3E%3C/g%3E%3C/svg%3E") repeat center / 96px 96px;
  mask: 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='black' stroke-width='1'%3E%3Cpolygon points='48.0,18.0 56.8,26.8 69.2,26.8 69.2,39.2 78.0,48.0 69.2,56.8 69.2,69.2 56.8,69.2 48.0,78.0 39.2,69.2 26.8,69.2 26.8,56.8 18.0,48.0 26.8,39.2 26.8,26.8 39.2,26.8'/%3E%3Cpolygon points='0.0,-30.0 8.8,-21.2 21.2,-21.2 21.2,-8.8 30.0,0.0 21.2,8.8 21.2,21.2 8.8,21.2 0.0,30.0 -8.8,21.2 -21.2,21.2 -21.2,8.8 -30.0,0.0 -21.2,-8.8 -21.2,-21.2 -8.8,-21.2'/%3E%3Cpolygon points='96.0,-30.0 104.8,-21.2 117.2,-21.2 117.2,-8.8 126.0,0.0 117.2,8.8 117.2,21.2 104.8,21.2 96.0,30.0 87.2,21.2 74.8,21.2 74.8,8.8 66.0,0.0 74.8,-8.8 74.8,-21.2 87.2,-21.2'/%3E%3Cpolygon points='0.0,66.0 8.8,74.8 21.2,74.8 21.2,87.2 30.0,96.0 21.2,104.8 21.2,117.2 8.8,117.2 0.0,126.0 -8.8,117.2 -21.2,117.2 -21.2,104.8 -30.0,96.0 -21.2,87.2 -21.2,74.8 -8.8,74.8'/%3E%3Cpolygon points='96.0,66.0 104.8,74.8 117.2,74.8 117.2,87.2 126.0,96.0 117.2,104.8 117.2,117.2 104.8,117.2 96.0,126.0 87.2,117.2 74.8,117.2 74.8,104.8 66.0,96.0 74.8,87.2 74.8,74.8 87.2,74.8'/%3E%3Ccircle cx='48' cy='48' r='9'/%3E%3C/g%3E%3C/svg%3E") repeat center / 96px 96px;
  opacity: 0.07;
  -webkit-mask-composite: source-in;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 70% 80% at 50% 40%, transparent 30%, var(--bg) 78%);
  pointer-events: none;
}
.hero-copy { animation: rise 0.7s var(--ease) both; }

/* Medallion artwork */
.artwork-frame {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--bg-subtle) 70%);
}
.medallion { width: 88%; aspect-ratio: 1; animation: medallion-in 0.9s var(--ease) both; }
.medallion[hidden] { display: none; }
.medallion-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.medallion-svg .m-line { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.medallion-svg .m-faint { stroke-opacity: 0.45; stroke-width: 1; }
.medallion-svg .m-dots { fill: var(--accent); opacity: 0.7; }
.medallion-svg .m-star { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.medallion-svg .m-core { fill: var(--bg-subtle); stroke: var(--accent); stroke-width: 1.2; }
.medallion-svg text { fill: var(--ink); }
.medallion-svg .m-kicker { font-family: var(--font-ar-ui); font-size: 15px; letter-spacing: 0.5px; fill: var(--ink-secondary); }
.medallion-svg .m-name { font-family: var(--font-ar-display); font-weight: 700; }
.medallion-svg .m-years { font-family: var(--font-en-display); font-size: 17px; font-weight: 600; fill: var(--accent); letter-spacing: 0.5px; }
body.is-audio-playing .medallion-svg .m-star { animation: breathe 6s ease-in-out infinite; transform-origin: 200px 200px; }
.sheikh-portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait-credit { margin: 2px 6px 0; font-size: 11px; color: var(--ink-muted); }

/* Ribbon monograms */
.reciter-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-ar-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  flex-shrink: 0;
}
.reciter-pill.active .reciter-avatar {
  color: var(--bg);
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  border-color: color-mix(in srgb, var(--bg) 45%, transparent);
}

/* Media controls keep their universal left-to-right order in Arabic too */
.player-controls,
.player-progress-wrap { direction: ltr; }
.player-time { unicode-bidi: plaintext; }

/* Disabled states */
.mini-pill:disabled,
.ctrl-btn:disabled,
.sleep-opt:disabled,
#downloadLink.is-disabled { opacity: 0.38; pointer-events: none; cursor: default; }
#downloadLink:not([href]) { opacity: 0.38; }

/* Drawers */
body.drawer-open { overflow: hidden; }
.drawer-title { font-size: 17px; margin: 0; }
.queue-item-sub { font-size: 12px; opacity: 0.72; }
.queue-item[aria-current="true"] { font-weight: 600; }

/* Playing card gets a soft accent rule */
.surah-card.is-playing { box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm); }
html[dir="rtl"] .surah-card.is-playing { box-shadow: inset -3px 0 0 var(--accent), var(--shadow-sm); }

/* Footer links to each Sheikh page */
.footer-sheikhs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 18px;
  font-size: 13px;
}
.footer-sheikhs a { color: var(--ink-secondary); text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.footer-sheikhs a:hover { color: var(--accent); border-color: var(--accent); }
.noscript-note { text-align: center; padding: 12px; background: var(--accent-soft); margin: 0; }

/* Legal page */
.legal-page { padding-bottom: 56px; }
.legal-wrap { max-width: 780px; margin: 0 auto; padding: 48px 0 32px; }
.legal-head { margin-bottom: 24px; }
.legal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 28px; margin-bottom: 16px; }
.legal-card h2 { margin: 0 0 10px; font-family: var(--font-ar-display); font-size: 22px; }
html[lang="en"] .legal-card h2 { font-family: var(--font-en-display); font-size: 24px; }
.legal-card p, .legal-card li { color: var(--ink-secondary); font-size: 14.5px; line-height: 1.85; }
.legal-card ul { margin: 8px 0 0; padding-inline-start: 20px; }
.legal-card a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
[hidden] { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes medallion-in { from { opacity: 0; transform: scale(0.96) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { stroke-width: 1.6; } 50% { stroke-width: 2.6; } }

@media (max-width: 640px) {
  .medallion { width: 82%; }
  .legal-card { padding: 20px 18px; }
}

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

/* Player layout: track flexes, controls and extras keep their natural width */
.player-inner { grid-template-columns: minmax(0, 1fr) auto auto; }
.player-meta { min-width: 0; }
.player-title, .player-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) {
  .player-extras .hide-sm { display: none; }
}
@media (max-width: 900px) {
  .player-inner { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Keep hyphenated names (Al-Husary) on one line */
.nowrap { white-space: nowrap; }

/* Small phones: give the site name room */
@media (max-width: 420px) {
  .brand-mark { display: none; }
  .brand-sub { display: none; }
  .nav-actions { gap: 6px; }
  .nav-actions .lang-btn, .nav-actions .icon-btn { padding-inline: 10px; }
}

/* Latin names inside Arabic layout keep their own direction (An-Nisa' not 'An-Nisa) */
.surah-name-secondary, .queue-item-sub, .surah-name-primary, .offline-item-title { unicode-bidi: plaintext; }
