/* ==========================================================================
   The Mantle Library — stylesheet (v2 design system)

   Family base tokens (shared with sibling apps) + Mantle identity:
   logo GREEN + antique GOLD on dark (default); illuminated manuscript
   GREEN + GOLD on paper for the light theme.

   Every colour flows through the CSS variables below — no hard-coded
   hex/rgb values appear anywhere else in this file.

   Dark theme lives on :root (default); light theme under html.light.
   ========================================================================== */

/* ---------- Font-face slots ----------------------------------------------
   Both DigitalKhatt faces ARE bundled (SIL OFL 1.1 — see fonts/README.txt):
   'DigitalKhatt IndoPak' (13-line IndoPak mushaf style) is the primary
   Arabic face; 'DigitalKhatt V2' (New Madina) is the bundled fallback.
   Amiri Quran / Noto Naskh remain optional drop-in fallbacks; until added,
   local() and the system serif keep those slots readable. Family names
   are stable.
   ------------------------------------------------------------------------- */

@font-face {
  font-family: 'DigitalKhatt IndoPak';
  src: local('DigitalKhatt IndoPak'),
       local('DigitalKhatt-IndoPak'),
       url('../fonts/DigitalKhattIndoPak.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'DigitalKhatt V2';
  src: local('DigitalKhatt New Madina'),
       local('DigitalKhattV2'),
       url('../fonts/DigitalKhattV2.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Amiri Quran';
  src: local('Amiri Quran'),
       local('AmiriQuran'),
       url('../fonts/AmiriQuran.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Noto Naskh';
  src: local('Noto Naskh'),
       local('NotoNaskh'),
       url('../fonts/NotoNaskh.ttf') format('truetype');
  font-display: swap;
}

/* Honorific ligatures (ﷺ ﷻ ﷽ ﷲ …) for Latin text: subset of Amiri (OFL 1.1).
   Amiri's em is tall, so scale it down to sit well inside Georgia/Times lines. */
@font-face {
  font-family: 'Honorifics';
  src: url('../fonts/honorifics.ttf') format('truetype');
  unicode-range: U+FDF2-FDFB, U+FDFD;
  size-adjust: 55%;
  font-display: swap;
}

/* ---------- Design tokens: dark theme (default) ---------- */

:root {
  /* Family base (dark) — Family Green (matches the app icon's deep green) */
  --bg: rgb(16, 22, 19);
  --cream: rgb(240, 235, 220);
  --fg: var(--cream);
  --card: rgb(30, 41, 34);
  --border: rgb(54, 68, 58);            /* muted, derived from --card */
  --border-hover: rgb(100, 118, 100);   /* warmed card derivative */
  --dim: rgba(240, 235, 220, 0.72);
  --faint: rgba(240, 235, 220, 0.48);

  /* Mantle identity: logo green + antique gold */
  --gold: rgb(214, 174, 94);            /* primary accent / underlines / links */
  --accent: rgb(36, 90, 62);            /* logo green: badges / buttons / active */
  --accent-strong: rgb(46, 112, 78);    /* hover & emphasis green */
  --accent-text: rgb(167, 201, 137);    /* family light green for text on dark */

  /* Utility shades */
  --selection: rgba(214, 174, 94, 0.35);
  --shadow: rgba(0, 0, 0, 0.4);
  --overlay: rgba(9, 13, 10, 0.82);
  --badge-fg: rgb(240, 235, 220);

  /* Per-channel text colours */
  --vc-ar: var(--cream);                /* Arabic: cream */
  --vc-en: rgb(214, 208, 192);          /* English: slightly softer */

  /* Per-script font scaling (70–160%, set from the Display panel) */
  --fs-ar: 1;
  --fs-en: 1;

  /* Typography */
  --serif-display: Georgia, 'Times New Roman', 'Honorifics', serif;
  --serif-body: Georgia, 'Times New Roman', 'Nimbus Roman', 'Honorifics', serif;
  --arabic-stack: 'DigitalKhatt IndoPak', 'DigitalKhatt V2', 'Amiri Quran', 'Noto Naskh', serif;

  --radius: 14px;
  --max-width: 46rem;
}

/* ---------- Design tokens: light theme ---------- */

html.light {
  /* Family base (light) — Illuminated manuscript */
  --paper: rgb(246, 240, 224);
  --ink: rgb(40, 34, 24);
  --bg: var(--paper);
  --fg: var(--ink);
  --card: rgb(255, 252, 243);           /* lifted parchment card */
  --border: rgb(214, 200, 168);         /* muted, derived from --paper */
  --border-hover: rgb(176, 158, 118);
  --dim: rgba(40, 34, 24, 0.82);
  --faint: rgba(40, 34, 24, 0.68);

  /* Mantle identity: deep green + antique gold on paper */
  --gold: rgb(146, 112, 44);
  --accent: rgb(36, 90, 62);
  --accent-strong: rgb(28, 72, 50);
  --accent-text: rgb(36, 90, 62);

  /* Utility shades */
  --selection: rgba(146, 112, 44, 0.3);
  --shadow: rgba(40, 34, 24, 0.22);
  --overlay: rgba(40, 34, 24, 0.82);
  --badge-fg: rgb(246, 240, 224);

  /* Per-channel text colours */
  --vc-ar: var(--ink);
  --vc-en: rgb(84, 74, 56);             /* softer than ink */
}

/* ---------- Reset & base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Keep the footer/audio clear of content when jumping to anchors. */
  scroll-padding-bottom: calc(185px + env(safe-area-inset-bottom));
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: url('../icons/bg-tile-dark.jpg');
  background-repeat: repeat;
  color: var(--fg);
  font-family: var(--serif-body);
  font-size: 1.05rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Light theme swaps in the light arabesque tile over the paper base. */
html.light body {
  background-color: var(--paper);
  background-image: url('../icons/bg-tile-light.jpg');
}

img, audio { max-width: 100%; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::selection { background: var(--selection); }

/* ---------- Accessibility helpers ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--badge-fg);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  font-weight: bold;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ----------
   In-column page header (the pattern used by the sibling apps, Munajaat
   Maqbool and JustQuran): no full-width app bar — the header lives inside
   the centred content column, so the site already presents like the
   planned mobile app. Round logo + large serif title with circular icon
   buttons at the right of the row, a small italic gold subtitle, and a
   thin accent rule beneath. Rendered by app.js (.view-header).
   privacy.html / support.html still use the legacy .site-nav (rules kept
   below). */

.view-header { margin: 0.25rem 0 1.75rem; }

.view-header::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 0.85rem;
  background: var(--accent);
}

.view-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-header-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--gold);   /* echoes the gold mantle in the app icon */
}

.view-header-title {
  font-size: clamp(1.3rem, 5.5vw, 1.9rem);
  margin: 0;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.view-header-sub {
  font-style: italic;
  color: var(--gold);
  font-size: 0.95rem;
  margin: 0.3rem 0 0;
}

/* Circular outline icon buttons (header actions / verse copy). */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  color: var(--gold);
  border-color: var(--gold);
}
.icon-btn svg { width: 1.1rem; height: 1.1rem; display: block; }

/* privacy.html / support.html legacy nav (static pages without the view header) */
.site-header:has(> .site-nav) {
  position: relative;
  border-bottom: none;
  padding: 1rem 1.25rem 0;
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 1.25rem;
  justify-content: flex-end;
  align-items: center;
  font-size: 0.95rem;
}

.nav-link {
  color: var(--dim);
  padding: 0.35rem 0.25rem;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--fg); text-decoration: none; border-bottom-color: var(--border-hover); }
.nav-link[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent-text); }

/* ---------- Settings page ---------- */

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.settings-heading {
  font-size: 1.1rem;
  color: var(--accent-text);
  margin: 0 0 0.75rem;
}

.theme-choices {
  display: flex;
  gap: 0.6rem;
}

.theme-choice {
  flex: 1;
  padding: 0.55rem 0.9rem;
  font: inherit;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.theme-choice:hover { border-color: var(--border-hover); }
.theme-choice[aria-pressed="true"] {
  color: var(--badge-fg);
  background: var(--accent);
  border-color: var(--accent);
}

.settings-note {
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

.fs-row {
  display: grid;
  grid-template-columns: 4rem 1fr 2.9rem;
  align-items: center;
  gap: 0.6rem;
  margin: 0.45rem 0;
  font-size: 0.9rem;
  color: var(--dim);
}
.fs-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent-strong);
}
.fs-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.view { min-height: 40vh; }

/* ---------- Headings with gold underline accent ---------- */

h1, h2, h3 {
  font-family: var(--serif-display);
  font-weight: normal;
  line-height: 1.3;
}

.app-title, .page-title {
  text-align: center;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  margin: 1.25rem 0 1.75rem;
  letter-spacing: 0.01em;
}

.app-title::after, .page-title::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin: 0.7rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

.section-heading {
  font-size: 1.25rem;
  color: var(--accent-text);
  margin: 0 0 0.75rem;
}

/* ---------- Menu rows (app-style home) ----------
   Two-column tiles: circular gold-ringed icon on top, bold title with
   its bracketed gloss and Arabic subtitle centred beneath. */

.menu-rows {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.menu-row-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 0.6rem;
  height: 100%;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.menu-row-link:hover {
  text-decoration: none;
  border-color: var(--gold);
  box-shadow: 0 2px 10px var(--shadow);
}
.menu-row-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  text-decoration: none;
}

.menu-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
}
.menu-row-icon svg { width: 1.05rem; height: 1.05rem; display: block; }

.menu-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  align-items: center;
  text-align: center;
}

.menu-row-title {
  font-family: var(--serif-display);
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--fg);
}

/* Bracketed English gloss always on its own line under a page/section title. */
.page-title-gloss {
  display: block;
  font-size: 0.52em;
  font-weight: normal;
  color: var(--dim);
  margin-top: 0.4rem;
  letter-spacing: 0.01em;
}

.block-gloss { display: block; }
/* Modern simplification beneath the historical (Victorian) translation. */
.translation-modern {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  font-size: 0.88em;
  color: var(--dim);
}

.translation-modern-label {
  display: block;
  font-size: 0.68rem;
  font-family: var(--sans, inherit);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

/* Explains the modern layer's status on pages that contain it. */
.modern-layer-note {
  font-size: 0.78rem;
  color: var(--dim);
  border-left: 2px solid var(--gold);
  padding-left: 0.6rem;
  margin-top: 0.6rem;
  line-height: 1.5;
}


/* English gloss (the bracketed translation) on its own line under the title. */
.menu-row-gloss {
  font-family: var(--serif-display);
  font-size: 0.78rem;
  color: var(--dim);
}

.menu-row-sub {
  font-size: 0.82rem;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-row-chevron {
  display: none;
}

/* Arabic subtitle inside a work row gets the Arabic typeface. */
.menu-row-sub[lang="ar"] {
  font-family: var(--arabic-stack);
  font-size: calc(0.9rem * var(--fs-ar));
  line-height: 1.5;
}

/* ---------- Genre groups within Historic Recordings ---------- */

.genre-group { margin-top: 1.35rem; }
.genre-group:first-of-type { margin-top: 0.9rem; }

.genre-heading {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 0.7rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

/* ---------- Reader view ---------- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.work-header { text-align: center; margin-bottom: 2rem; }

.work-title-ar {
  font-family: var(--arabic-stack);
  font-size: calc(clamp(1.7rem, 6vw, 2.3rem) * var(--fs-ar));
  line-height: 2;
  color: var(--vc-ar);
  margin: 0.5rem 0 0.25rem;
}

.work-author { color: var(--dim); margin: 0.25rem 0; }
.work-description { color: var(--dim); max-width: 36rem; margin: 0.75rem auto 0; }

.work-source {
  color: var(--faint);
  font-size: 0.85rem;
  max-width: 36rem;
  margin: 1rem auto 0;
}
.work-source summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--dim);
  display: inline-block;
  list-style-position: inside;
}
.work-source summary::before { content: "▸ "; }
details.work-source[open] summary::before { content: "▾ "; }
.work-source p { margin: 0.5rem 0 0; }

/* ---------- Reader: verse-per-card (Munajaat-style) ---------- */

.verse-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.verse-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.2rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.verse-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 10px var(--shadow);
}

.verse-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.verse-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.3rem;
  font-weight: bold;
  font-size: 0.95rem;
  color: var(--badge-fg);
  background: var(--accent);
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}

.verse-copy {
  width: 2rem;
  height: 2rem;
}
.verse-copy svg { width: 0.95rem; height: 0.95rem; }
.verse-copy.is-copied {
  color: var(--gold);
  border-color: var(--gold);
}

.arabic-text {
  font-family: var(--arabic-stack);
  font-size: calc(1.7rem * var(--fs-ar));
  line-height: 2.2;
  color: var(--vc-ar);
  margin: 0 0 1rem;
  white-space: pre-line;
}

.translation {
  margin: 0;
  color: var(--vc-en);
  font-size: calc(1rem * var(--fs-en));
  white-space: pre-line;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.section-note {
  font-size: 0.9rem;
  color: var(--faint);
  font-style: italic;
  margin: -0.4rem 0 1.1rem;
}

.translation-pending {
  font-size: 0.85rem;
  color: var(--faint);
  font-style: italic;
  margin: -0.4rem 0 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.verse-num {
  color: var(--gold);
  font-size: 0.75em;
  font-family: var(--latin-stack, serif);
}

/* ---------- Work index: section list (Munajaat-style rows) ---------- */

.section-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.section-item-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: inherit;
  transition: border-color 160ms ease;
}
.section-item-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.section-item-text { flex: 1; min-width: 0; text-align: center; }

.section-item-heading {
  display: block;
  font-size: 1.08rem;
}

.section-item-count {
  display: block;
  color: var(--dim);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.section-item-chevron {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 1.7rem;
  line-height: 1;
}

/* ---------- Section reader: previous / next bar ---------- */

.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.section-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 38%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--dim);
}
.section-nav-link:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  text-decoration: none;
}
.section-nav-link.is-disabled { visibility: hidden; }

.section-nav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-nav-arrow { flex: 0 0 auto; }

.section-nav-pos {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ---------- Audio ---------- */

.audio-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.audio-block h2 {
  font-size: 1.3rem;
  text-align: center;
  margin: 0 0 1rem;
}
.audio-block h2::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin: 0.5rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

audio {
  display: block;
  width: 100%;
  height: 2.75rem;
  border-radius: var(--radius);
}

/* ---------- Recording tile grid ---------- */

.tile-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem 0.9rem;
}

@media (min-width: 34rem) {
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
}

.tile { min-width: 0; }

.tile-button {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
}

.tile-art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 2px 10px var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.tile-button:hover .tile-art,
.tile-button:focus-visible .tile-art {
  border-color: var(--gold);
  box-shadow: 0 3px 14px var(--shadow);
}

.tile-artist {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.tile-title {
  display: block;
  color: var(--dim);
  font-size: 0.8rem;
  line-height: 1.35;
  margin-top: 0.1rem;
}

/* ---------- Recording detail sheet (opened from a tile) ---------- */

.rec-dialog {
  position: relative;
  width: min(94vw, 30rem);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 12px 40px var(--shadow);
  text-align: center;
}

.rec-dialog-art {
  display: block;
  width: min(55vw, 12.5rem);
  margin: 0 auto 1.25rem;
  padding: 0;
  border: 4px solid var(--accent);
  border-radius: 50%;
  overflow: hidden;
  background: #0a0e0c;
  cursor: zoom-in;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
  transition: border-color 160ms ease, box-shadow 300ms ease;
}
.rec-dialog-art:hover { border-color: var(--gold); }
.rec-dialog-art img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
}
.rec-dialog-art.is-playing img {
  animation: vinyl-spin 4s linear infinite;
}
.rec-dialog-art.is-paused img {
  animation: vinyl-spin 4s linear infinite;
  animation-play-state: paused;
}
.rec-dialog-art.is-playing {
  border-color: var(--gold);
  box-shadow: 0 0 25px rgba(201, 166, 88, 0.35), 0 8px 24px rgba(0, 0, 0, 0.5);
}
@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.rec-dialog-artist {
  margin: 0 0 0.2rem;
  font-size: 1.3rem;
}

.rec-dialog-title {
  margin: 0 0 0.45rem;
  color: var(--dim);
}

.rec-dialog-meta {
  margin: 0 0 0.9rem;
  color: var(--faint);
  font-size: 0.88rem;
}

.rec-dialog-desc {
  margin: 0 0 1rem;
  color: var(--vc-en);
  font-size: 0.95rem;
  text-align: left;
}

.rec-dialog-note {
  margin: -0.35rem 0 1rem;
  color: var(--faint);
  font-size: 0.82rem;
  font-style: italic;
  text-align: left;
}

.rec-dialog-credit {
  margin: 0.75rem 0 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-style: italic;
}

/* Identified text & translation inside the recording sheet */
.rec-text {
  margin: 1rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.rec-text-summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--vc-en);
  user-select: none;
}

.rec-text-summary:hover { color: var(--fg); }

.rec-text[open] .rec-text-summary { border-bottom: 1px solid var(--border); }

.rec-text-body {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.rec-text-source {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
}

.rec-text-heading {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  color: var(--fg);
}

.rec-text-credit {
  margin: 0.25rem 0 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-style: italic;
}

.rec-dialog-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 2.25rem;
  height: 2.25rem;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--badge-fg);
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 50%;
  cursor: pointer;
}
.rec-dialog-close:hover { background: var(--accent-strong); }

/* Full-size label viewer overlay (opened from the thumbnail). */
.art-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--overlay);
}

.art-overlay-img {
  max-width: min(92vw, 40rem);
  max-height: 82vh;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow);
}

.art-overlay-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--badge-fg);
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 50%;
  cursor: pointer;
}
.art-overlay-close:hover { background: var(--accent-strong); }

/* ---------- Notices / states ---------- */

.notice, .loading, .error-box {
  text-align: center;
  color: var(--dim);
  padding: 2rem 1rem;
}

.error-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.error-box strong { color: var(--accent-text); }

/* ---------- About page ---------- */

.prose p { margin: 0 0 1.1rem; }
.prose ul { padding-left: 1.4rem; margin: 0 0 1.1rem; }

/* ---------- Support page (support.html) ---------- */

.support-hero {
  text-align: center;
  margin: 1rem 0 2rem;
}
.support-hero-icon {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 24%;
  box-shadow: 0 3px 14px var(--shadow);
}
.support-hero-title {
  font-family: var(--serif-display);
  font-size: 1.6rem;
  margin: 0.9rem 0 0.25rem;
}
.support-hero-tag {
  font-family: var(--arabic-stack);
  font-size: calc(1.1rem * var(--fs-ar));
  color: var(--dim);
  margin: 0 0 0.6rem;
}
.support-badges {
  color: var(--accent-text);
  font-size: 0.9rem;
  margin: 0;
}

.licence-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.1rem;
  font-size: 0.92rem;
}
.licence-table th,
.licence-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.6rem 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.licence-table th {
  width: 32%;
  font-family: var(--serif-display);
  color: var(--fg);
}
.licence-table td { color: var(--dim); }

.kofi-btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--badge-fg);
  border-radius: 999px;
  font-weight: bold;
  text-decoration: none;
  transition: background 160ms ease;
}
.kofi-btn:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.support-footer-credit {
  margin-top: 2rem;
  color: var(--faint);
  font-size: 0.88rem;
  text-align: center;
}
.prose li { margin-bottom: 0.4rem; }

.credit-line {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem 1.25rem;
  font-style: italic;
  color: var(--dim);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--faint);
}
.site-footer p { margin: 0.25rem 0; }

/* ---------- Reduced motion ---------- */

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

/* ---------- App logo ---------- */
.app-logo {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 0.75rem;
  border-radius: 22%;
}

/* ---------- Home: historic recordings listed under the works ---------- */
.home-media { margin-top: 2.25rem; }
.home-media h2 { margin-bottom: 0.25rem; }
.home-media .media-sub {
  text-align: center;
  color: var(--faint);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}
