/* ==========================================================================
   ذِكْرَى · Dhikra Design System
   A hand-crafted Islamic-manuscript-inspired system.
   Palette rationale:
     --ink      #0F2A22  deep pine — primary text & dark surfaces (calm, grounded)
     --emerald  #1B5E4A  brand emerald — primary action, links, focus
     --emerald-soft #3F8F76  hover/secondary emerald
     --gold     #C6A15B  warm manuscript gold — accent ONLY (used sparingly)
     --ivory    #F7F4EC  warm ivory paper — light background
     --sand     #ECE4D3  slightly deeper paper — card/section separation
   Deliberately avoids the 3 "AI-generated" tells:
     - not cream+terracotta+serif
     - not black+acid-green
     - not broadsheet hairline layout
   ========================================================================== */

:root {
  /* ---- Color tokens ---- */
  --ink: #0f2a22;
  --ink-2: #17362c;
  --emerald: #1b5e4a;
  --emerald-soft: #3f8f76;
  --emerald-tint: rgba(27, 94, 74, 0.08);
  --gold: #c6a15b;
  --gold-soft: #dcc084;
  --ivory: #f7f4ec;
  --sand: #ece4d3;
  --paper: #ffffff;
  --text: #24352f;
  --text-muted: #5c6b64;
  --line: rgba(15, 42, 34, 0.10);
  --shadow-sm: 0 2px 8px rgba(15, 42, 34, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 42, 34, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 42, 34, 0.14);

  /* surface roles */
  --bg: var(--ivory);
  --surface: var(--paper);
  --surface-2: var(--sand);
  --nav-bg: rgba(15, 42, 34, 0.88);

  /* ---- Type scale (1.2 minor third) ---- */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.44rem, 1.3rem + 0.7vw, 1.8rem);
  --step-3: clamp(1.73rem, 1.5rem + 1.15vw, 2.4rem);
  --step-4: clamp(2.07rem, 1.7rem + 1.85vw, 3.2rem);

  /* ---- Spacing / radius / motion ---- */
  --sp: 8px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --container: 1180px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.5s;
}

/* Dark theme — a warm midnight, not pure black */
body.dark-mode {
  --ink: #d9e6df;
  --ink-2: #cddbd3;
  --emerald: #57c9a5;
  --emerald-soft: #7ad9ba;
  --emerald-tint: rgba(87, 201, 165, 0.12);
  --gold: #e0be7c;
  --gold-soft: #ecd39c;
  --text: #dce7e1;
  --text-muted: #9db1a8;
  --line: rgba(255, 255, 255, 0.10);
  --bg: #0c1b16;
  --surface: #12261f;
  --surface-2: #163027;
  --nav-bg: rgba(8, 18, 14, 0.9);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: 'Tajawal', 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 72px;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  overflow-x: hidden;
}
html[lang="en"] body { font-family: 'Sora', system-ui, sans-serif; }

/* Language visibility */
html[lang="ar"] .lang-en { display: none; }
html[lang="en"] .lang-ar { display: none; }

h1, h2, h3, h4 {
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1.3;
  color: var(--ink);
  font-weight: 700;
}
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] h4 {
  font-family: 'Sora', sans-serif;
  letter-spacing: -0.01em;
}

a { color: var(--emerald); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- Accessibility: visible keyboard focus (never for mouse clicks) ---- */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}
body.dark-mode :focus-visible { outline-color: var(--gold-soft); }
/* Skip link for keyboard/screen-reader users */
.skip-link {
  position: fixed; top: 8px; inset-inline-start: 8px; z-index: 3000;
  background: var(--emerald); color: #fff; padding: 10px 18px; border-radius: 10px;
  transform: translateY(-160%); transition: transform 0.25s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* ---- Decorative page backdrop (subtle, not particles) ---- */
.page-aura {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 85% -10%, var(--emerald-tint), transparent 60%),
    radial-gradient(50vw 50vw at -10% 110%, rgba(198,161,91,0.10), transparent 60%);
}
.page-pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%231b5e4a' stroke-opacity='0.05' stroke-width='1'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3Ccircle cx='30' cy='30' r='10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 60px 60px;
}
body.dark-mode .page-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2357c9a5' stroke-opacity='0.06' stroke-width='1'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3Ccircle cx='30' cy='30' r='10'/%3E%3C/g%3E%3C/svg%3E");
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
  position: fixed; top: 0; inset-inline: 0; z-index: 1000;
  height: 72px; padding: 0 clamp(16px, 4vw, 40px);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: background var(--dur) var(--ease-out);
}
.navbar-brand { display: flex; align-items: center; gap: 12px; }
.navbar-brand .brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
}
.navbar-brand .brand-mark svg { width: 24px; height: 24px; }
.navbar-brand .brand-mark img { width: 42px; height: 42px; object-fit: contain; display: block; }
.navbar-brand .site-name {
  font-family: 'Amiri', serif; font-size: 1.5rem; color: #fff; font-weight: 700;
  line-height: 1;
}
html[lang="en"] .navbar-brand .site-name { font-family: 'Sora', sans-serif; font-size: 1.25rem; }
.navbar-brand .site-tag {
  display: block; font-size: 0.62rem; color: var(--gold-soft); letter-spacing: 0.18em;
  font-family: 'Sora', sans-serif; text-transform: uppercase; margin-top: 2px;
}

.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-links { display: none; }
.nav-links a {
  color: rgba(255,255,255,0.82); font-size: 0.98rem; font-weight: 500;
  padding: 8px 4px; position: relative; transition: color 0.25s var(--ease-out);
}
.nav-links a::after {
  content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 2px;
  background: var(--gold); border-radius: 2px; transform: scaleX(0);
  transition: transform 0.3s var(--ease-spring);
}
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.16);
  color: #fff; border-radius: 12px; cursor: pointer; font-size: 1rem;
  transition: background 0.25s var(--ease-out), transform 0.25s var(--ease-spring);
}
.icon-btn:hover { background: rgba(255,255,255,0.2); transform: translateY(-2px); }
.lang-toggle-btn {
  min-width: 44px; height: 40px; padding: 0 12px;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.16);
  color: #fff; border-radius: 12px; cursor: pointer;
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: 0.8rem;
  transition: background 0.25s var(--ease-out);
}
.lang-toggle-btn:hover { background: rgba(255,255,255,0.2); }
.nav-toggle { display: grid; }

@media (min-width: 992px) {
  .nav-toggle { display: none; }
  .nav-links { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); margin-inline: 18px; }
}

/* Mobile menu */
.mobile-nav {
  position: fixed; top: 72px; inset-inline: 0; z-index: 999;
  background: var(--nav-bg); backdrop-filter: blur(16px);
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease-out);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mobile-nav.open { grid-template-rows: 1fr; }
.mobile-nav .inner { overflow: hidden; }
.mobile-nav a {
  display: block; color: rgba(255,255,255,0.9); font-size: 1.05rem;
  padding: 15px 24px; border-top: 1px solid rgba(255,255,255,0.06);
}
.mobile-nav a:hover, .mobile-nav a.active { background: rgba(255,255,255,0.08); color: var(--gold-soft); }

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
main { flex: 1 0 auto; }
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section-tinted { background: var(--surface-2); }
.center { text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Sora', sans-serif; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--emerald);
  background: var(--emerald-tint); padding: 7px 14px; border-radius: 999px;
  margin-bottom: 18px;
}
.eyebrow i { color: var(--gold); }
.section-title { font-size: var(--step-3); margin-bottom: 14px; }
.section-sub { color: var(--text-muted); font-size: var(--step-0); max-width: 640px; margin: 0 auto 44px; line-height: 1.9; }
.section-sub.left { margin-inline: 0; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 30px; border-radius: 999px; border: none; cursor: pointer;
  font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.btn-primary {
  background: linear-gradient(135deg, var(--emerald-soft), var(--emerald));
  color: #fff !important; box-shadow: 0 8px 24px rgba(27,94,74,0.28);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(27,94,74,0.36); }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--ink) !important; box-shadow: 0 8px 24px rgba(198,161,91,0.3); }
.btn-gold:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(198,161,91,0.4); }
.btn-ghost {
  background: var(--surface); color: var(--ink) !important; border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--emerald); color: var(--emerald) !important; }
.btn-sm { padding: 10px 20px; font-size: 0.9rem; }

/* ==========================================================================
   Cards
   ========================================================================== */
.grid { display: grid; gap: 26px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 30px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-out), border-color 0.3s;
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--emerald), var(--gold)); opacity: 0; transition: opacity 0.3s;
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.card:hover::before { opacity: 1; }

.cat-card { display: flex; flex-direction: column; align-items: flex-start; text-align: start; height: 100%; }
.cat-icon {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  font-size: 1.5rem; color: var(--emerald); background: var(--emerald-tint);
  margin-bottom: 18px; transition: transform 0.4s var(--ease-spring);
}
.card:hover .cat-icon { transform: rotate(-6deg) scale(1.08); }
.cat-card h3 { font-size: var(--step-1); margin-bottom: 10px; }
.cat-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 20px; flex: 1; }
.cat-card .card-link {
  font-weight: 600; color: var(--emerald); display: inline-flex; align-items: center; gap: 8px;
}
.cat-card .card-link i { transition: transform 0.3s var(--ease-spring); }
html[dir="rtl"] .cat-card .card-link i { transform: scaleX(-1); }
.card:hover .card-link i { transform: translateX(4px); }
html[dir="rtl"] .card:hover .card-link i { transform: scaleX(-1) translateX(4px); }

/* ==========================================================================
   Page header (interior pages)
   ========================================================================== */
.page-head { padding: clamp(40px, 7vw, 72px) 0 clamp(24px, 4vw, 40px); text-align: center; }
.page-head h1 { font-size: var(--step-4); margin-bottom: 14px; }
.page-head p { color: var(--text-muted); font-size: var(--step-0); max-width: 620px; margin: 0 auto; line-height: 1.9; }

/* Breadcrumb */
.breadcrumb { padding: 14px 0; }
.breadcrumb .inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.88rem; }
.breadcrumb a { color: var(--emerald); font-weight: 500; }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .sep { color: var(--text-muted); font-size: 0.7rem; }
html[dir="rtl"] .breadcrumb .sep { transform: scaleX(-1); }
.breadcrumb .current { color: var(--text-muted); }

/* ==========================================================================
   Dhikr cards (interior adhkar pages) — the signature reading experience
   ========================================================================== */
.dhikr-toolbar {
  position: sticky; top: 72px; z-index: 40;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 26px; box-shadow: var(--shadow-sm);
}
.dhikr-progress { display: flex; align-items: center; gap: 14px; font-weight: 600; color: var(--ink); }
.progress-ring { --p: 0; width: 46px; height: 46px; flex: 0 0 46px; position: relative; }
.progress-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.progress-ring .track { stroke: var(--line); }
.progress-ring .bar { stroke: var(--emerald); stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease-out); }
.progress-ring .pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; color: var(--emerald); font-family: 'Sora', sans-serif;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 500;
  transition: all 0.25s var(--ease-out);
}
.tool-chip:hover { border-color: var(--emerald); color: var(--emerald); }
.tool-chip.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }

.dhikr-list { max-width: 820px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; }

.dhikr-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-out), opacity 0.4s;
  scroll-margin-top: 150px;
}
.dhikr-card:target { box-shadow: 0 0 0 2px var(--gold), var(--shadow-md); }
.dhikr-card:hover { box-shadow: var(--shadow-md); }
.dhikr-card.done { opacity: 0.55; }
.dhikr-card.done .dhikr-head { background: var(--emerald-tint); }

.dhikr-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; background: var(--emerald-tint); border-bottom: 1px solid var(--line);
}
.dhikr-title { font-size: var(--step-1); color: var(--emerald); margin: 0; }
.dhikr-count-badge {
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 0.85rem;
  background: var(--emerald); color: #fff; padding: 5px 13px; border-radius: 999px; white-space: nowrap;
}
.dhikr-body { padding: 24px 22px; }
.dhikr-text-ar {
  font-family: 'Amiri', serif; font-size: clamp(1.3rem, 1rem + 1.4vw, 1.85rem);
  line-height: 2.1; color: var(--ink); text-align: justify;
}
.dhikr-translit { color: var(--text-muted); font-style: italic; margin-top: 12px; font-size: 0.95rem; }

.dhikr-foot { padding: 16px 22px; background: var(--surface-2); border-top: 1px solid var(--line); }
.dhikr-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.dhikr-meta span { color: var(--text-muted); font-size: 0.88rem; display: flex; gap: 9px; align-items: flex-start; }
.dhikr-meta i { color: var(--gold); margin-top: 4px; flex: 0 0 auto; }
.dhikr-meta b { color: var(--text); }

.dhikr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tap-counter {
  flex: 1; min-width: 140px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px; border-radius: 999px; cursor: pointer; user-select: none;
  background: linear-gradient(135deg, var(--emerald-soft), var(--emerald)); color: #fff;
  font-family: inherit; font-weight: 600; font-size: 0.95rem; border: none;
  transition: transform 0.15s var(--ease-spring), box-shadow 0.3s;
  box-shadow: 0 6px 18px rgba(27,94,74,0.25);
}
.tap-counter:active { transform: scale(0.96); }
.tap-counter .tap-num { font-family: 'Sora', sans-serif; font-size: 1.05rem; }
.tap-counter.complete { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--ink); }
.act-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-muted);
  cursor: pointer; font-size: 0.95rem; transition: all 0.25s var(--ease-out);
}
.act-btn:hover { color: var(--emerald); border-color: var(--emerald); transform: translateY(-2px); }
.act-btn.active { color: #e0575e; }
.act-btn.active .fa-heart { font-weight: 900; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  /* Fixed deep-pine surface so the footer stays dark in BOTH themes
     (do NOT use var(--ink): it flips to a light tint in dark mode). */
  background: #0f2a22; color: rgba(255,255,255,0.8); margin-top: 40px;
  padding: 56px 0 28px; position: relative;
}
body.dark-mode .site-footer {
  background: #081410; /* even deeper for night, blends with --bg */
  border-top: 1px solid rgba(255,255,255,0.06);
}
.site-footer { --text-muted: rgba(255,255,255,0.6); }
.footer-grid { display: grid; gap: 34px; grid-template-columns: 1fr; margin-bottom: 36px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand .site-name { font-family: 'Amiri', serif; font-size: 1.6rem; color: #fff; margin-bottom: 12px; }
html[lang="en"] .footer-brand .site-name { font-family: 'Sora', sans-serif; }
.footer-brand p { color: rgba(255,255,255,0.65); max-width: 320px; font-size: 0.95rem; }
.footer-col h4 { color: #fff; font-size: 1.05rem; margin-bottom: 16px; }
.footer-col a { display: block; color: rgba(255,255,255,0.7); padding: 5px 0; font-size: 0.95rem; transition: color 0.2s; }
.footer-col a:hover { color: var(--gold-soft); }
.footer-social { display: flex; gap: 12px; margin-top: 16px; }
.footer-social a {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  background: rgba(255,255,255,0.08); color: #fff; transition: all 0.25s var(--ease-out);
}
.footer-social a:hover { background: var(--emerald); transform: translateY(-3px); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); padding-top: 22px; text-align: center;
  color: rgba(255,255,255,0.55); font-size: 0.85rem; line-height: 1.9;
}

/* ==========================================================================
   Scroll reveal + motion utilities
   ========================================================================== */
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: 0.08s; }
[data-reveal][data-delay="2"] { transition-delay: 0.16s; }
[data-reveal][data-delay="3"] { transition-delay: 0.24s; }
[data-reveal][data-delay="4"] { transition-delay: 0.32s; }

/* Reading progress bar (top) */
.read-progress { position: fixed; top: 0; inset-inline-start: 0; height: 3px; width: 0; z-index: 1200;
  background: linear-gradient(90deg, var(--emerald), var(--gold)); transition: width 0.1s linear; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw;
  background: var(--ink); color: #fff; padding: 13px 24px; border-radius: 999px; z-index: 2000;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-spring); font-size: 0.92rem;
}
.toast.show { opacity: 1; transform: none; }
.toast i { color: var(--gold-soft); margin-inline-end: 8px; }

/* Back to top — stacked ABOVE the assistant FAB so they never overlap */
.to-top {
  position: fixed; bottom: 90px; inset-inline-end: 24px; z-index: 900;
  width: 46px; height: 46px; border-radius: 14px; border: none; cursor: pointer;
  background: var(--emerald); color: #fff; font-size: 1rem; box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(16px) scale(0.9); pointer-events: none;
  transition: all 0.35s var(--ease-spring);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--emerald-soft); transform: translateY(-3px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ===== Assistant (client-side smart search) ===== */
.asst-fab{position:fixed;inset-inline-end:20px;bottom:20px;z-index:950;width:58px;height:58px;border:none;border-radius:50%;
  background:linear-gradient(135deg,var(--emerald),var(--emerald-soft));color:#fff;font-size:1.3rem;cursor:pointer;
  box-shadow:0 12px 30px -8px rgba(15,42,34,.55),0 0 0 1px rgba(198,161,91,.4);
  display:grid;place-items:center;transition:transform .3s var(--ease-spring),box-shadow .3s}
.asst-fab:hover{transform:scale(1.06)}
.asst-fab.active{transform:rotate(90deg) scale(1.02)}
.asst-fab::after{content:'';position:absolute;inset:-4px;border-radius:50%;border:2px solid var(--gold);opacity:.55;animation:asstPulse 2.6s var(--ease-out) infinite}
@keyframes asstPulse{0%{transform:scale(1);opacity:.5}70%{transform:scale(1.35);opacity:0}100%{opacity:0}}
.asst-panel{position:fixed;inset-inline-end:20px;bottom:88px;z-index:960;width:min(94vw,380px);max-height:min(74vh,560px);
  display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:22px;overflow:hidden;
  box-shadow:0 30px 70px -20px rgba(15,42,34,.6);opacity:0;visibility:hidden;transform:translateY(16px) scale(.98);
  transition:opacity .28s var(--ease-out),transform .28s var(--ease-out),visibility .28s}
.asst-panel.open{opacity:1;visibility:visible;transform:translateY(0) scale(1)}
.asst-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:16px 18px;
  background:linear-gradient(135deg,var(--emerald),var(--emerald-soft));color:#fff}
.asst-name{font-family:'Amiri',serif;font-size:1.15rem;display:block}
.asst-sub{font-size:.78rem;opacity:.9;display:block;margin-top:2px;line-height:1.5}
.asst-close{background:rgba(255,255,255,.16);border:none;color:#fff;width:32px;height:32px;border-radius:9px;cursor:pointer;flex-shrink:0}
.asst-close:hover{background:rgba(255,255,255,.28)}
.asst-search{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line)}
.asst-search i{color:var(--text-muted)}
.asst-search input{flex:1;border:none;background:transparent;font-family:inherit;font-size:1rem;color:var(--ink);outline:none}
body.dark-mode .asst-search input{color:var(--ivory)}
.asst-chips{display:flex;gap:7px;flex-wrap:wrap;padding:12px 16px 4px}
.asst-chip{border:1px solid var(--line);background:transparent;color:var(--text-muted);border-radius:999px;
  padding:5px 12px;font-size:.82rem;cursor:pointer;font-family:inherit;transition:.2s}
.asst-chip:hover{border-color:var(--emerald-soft);color:var(--emerald)}
.asst-results{flex:1;overflow-y:auto;padding:6px 10px 10px}
.asst-item{display:block;padding:12px 12px;border-radius:14px;text-decoration:none;transition:background .2s}
.asst-item:hover{background:var(--surface-2)}
.asst-title{font-family:'Amiri',serif;font-size:1.05rem;color:var(--emerald);margin-bottom:3px}
body.dark-mode .asst-title{color:var(--emerald-soft)}
.asst-snip{font-size:.86rem;color:var(--text);line-height:1.7;max-height:3.4em;overflow:hidden}
.asst-page{font-size:.74rem;color:var(--text-muted);margin-top:5px}
.asst-empty{padding:22px 16px;text-align:center;color:var(--text-muted);font-size:.9rem;line-height:1.8}
.asst-foot{padding:10px 16px;border-top:1px solid var(--line);font-size:.72rem;color:var(--text-muted);display:flex;align-items:center;gap:7px}
@media (prefers-reduced-motion:reduce){.asst-fab::after{animation:none}.asst-fab:hover,.asst-fab.active{transform:none}}
html[lang="en"] .asst-name{font-family:'Sora',sans-serif}
/* When the assistant panel is open, tuck the back-to-top button away so the
   two never fight for the same corner. */
body.asst-open .to-top{opacity:0;pointer-events:none;transform:translateY(16px) scale(.9)}
/* On short/mobile screens keep both controls clear of each other */
@media (max-width:600px){
  .asst-fab{width:52px;height:52px;bottom:16px;inset-inline-end:16px}
  .to-top{bottom:80px;inset-inline-end:19px;width:42px;height:42px}
}

/* ==========================================================================
   ذِكْرَى — Modern web-platform layer (2024/2025)
   Progressive enhancement only: every feature is guarded by @supports or is
   inert on browsers that don't understand it. Nothing here is load-bearing.
   ========================================================================== */

/* ---- View Transitions API: smooth cross-document page navigation ---- */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .32s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
/* Give the brand + hero a stable identity across transitions */
.navbar-brand { view-transition-name: dhikra-brand; }

/* ---- @property: typed custom property for a truly animatable gold sweep ---- */
@property --dhikra-sweep {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* ---- text-wrap: balance / pretty — tighter, more elegant headings ---- */
h1, h2, .section-title, .page-title, .dua-ar, .name-ar {
  text-wrap: balance;
}
p, .dua-en, .page-sub { text-wrap: pretty; }

/* ---- :has() — parent-aware styling without extra JS/classes ---- */
/* Dim the whole card grid subtly while a search box has a value */
.duas-search:has(input:not(:placeholder-shown)) + .duas-count { color: var(--emerald); font-weight: 600; }
/* Highlight a dua card that is being hovered within a focused list */
.duas-list:has(.dua-card:hover) .dua-card:not(:hover) { opacity: .72; transition: opacity .25s ease; }
.asma-grid:has(.name-card:hover) .name-card:not(:hover) { opacity: .78; transition: opacity .25s ease; }

/* ---- Container queries — cards adapt to their container, not the viewport ---- */
.duas-list, .asma-grid { container-type: inline-size; }
@container (max-width: 420px) {
  .dua-ar { font-size: var(--step-0); }
  .dua-top { gap: .4rem; }
}

/* ---- Modern focus ring (::focus-visible + accent-color) ---- */
:root { accent-color: var(--emerald); }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---- Scroll-driven reveal (native, no IntersectionObserver) where supported ---- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    [data-reveal]:not(.in) {
      opacity: 0;
      animation: dhikra-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}
@keyframes dhikra-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- color-mix() — derive tints from tokens instead of hand-picking ---- */
@supports (background: color-mix(in srgb, red, blue)) {
  .dua-tag, .dua-num { background: color-mix(in srgb, var(--emerald) 12%, transparent); }
}

/* ==========================================================================
   Developer credit (rendered by assets/js/credit.js — single source of truth)
   ========================================================================== */
.dev-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.dev-credit .dev-credit-line a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--gold) 55%, transparent);
  transition: color .2s ease, border-color .2s ease;
}
.dev-credit .dev-credit-line a:hover { color: var(--gold-soft); border-color: var(--gold-soft); }
.dev-credit-links { display: inline-flex; gap: .55rem; align-items: center; }
.dev-credit-links a {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--emerald) 8%, transparent);
  border: 1px solid var(--line);
  transition: color .2s ease, background .2s ease, transform .2s ease, border-color .2s ease;
  font-size: .85rem;
}
.dev-credit-links a:hover {
  color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 16%, transparent);
  border-color: var(--emerald-soft);
  transform: translateY(-2px);
}
body.dark-mode .dev-credit-links a:hover { color: var(--emerald-soft); }

/* ==========================================================================
   Focus Mode — guided full-screen dhikr session
   ========================================================================== */
.focus-start { /* toolbar chip variant that stands out a touch */
  background: linear-gradient(135deg, var(--emerald), var(--emerald-soft)) !important;
  color: #fff !important; border: none !important;
}
body.focus-open { overflow: hidden; }
.focus-overlay {
  position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column;
  background: var(--bg);
  padding: max(16px, env(safe-area-inset-top)) 18px 22px;
  animation: focus-in .28s ease;
}
.focus-overlay[hidden] { display: none !important; }
@keyframes focus-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.focus-bar { display: flex; align-items: center; gap: 14px; max-width: 820px; margin: 0 auto; width: 100%; }
.focus-step { font-size: .9rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.focus-track { flex: 1; height: 6px; border-radius: 999px; background: var(--emerald-tint, color-mix(in srgb, var(--emerald) 14%, transparent)); overflow: hidden; }
.focus-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .35s ease; }
.focus-x { border: none; background: transparent; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; padding: 6px; border-radius: 10px; }
.focus-x:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
body.dark-mode .focus-x:hover { color: var(--ivory); }
.focus-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 22px; max-width: 820px; margin: 0 auto; width: 100%; overflow-y: auto; padding: 20px 0;
}
.focus-title { font-size: var(--step-2); color: var(--gold); font-weight: 700; }
.focus-text {
  font-family: "Amiri", serif; font-size: clamp(1.5rem, 1rem + 2.4vw, 2.6rem); line-height: 2;
  color: var(--ink); text-wrap: pretty; max-width: 20ch;
}
body.dark-mode .focus-text { color: var(--ivory); }
.focus-count { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); }
.focus-count.complete { color: var(--emerald); }
.focus-tap {
  width: 120px; height: 120px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-soft)); color: #fff;
  font-weight: 700; font-size: .95rem; box-shadow: 0 12px 30px color-mix(in srgb, var(--emerald) 40%, transparent);
  transition: transform .12s ease, box-shadow .2s ease;
}
.focus-tap:active { transform: scale(.94); }
.focus-listen {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text-muted);
  padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.focus-listen:hover { color: var(--emerald); border-color: var(--emerald); }
.focus-listen[aria-pressed="true"] { color: #fff; background: var(--emerald); border-color: var(--emerald); }
body.dark-mode .focus-listen:hover, body.dark-mode .focus-listen[aria-pressed="true"] { color: var(--ivory); }
.focus-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.focus-nav { display: flex; gap: 12px; justify-content: center; max-width: 820px; margin: 0 auto; width: 100%; }
.focus-nav .btn { flex: 1; max-width: 200px; justify-content: center; }
.focus-nav .btn:disabled { opacity: .4; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .focus-overlay { animation: none; } .focus-fill { transition: none; } }

/* --- Adhkar Reminder (tools.html) --- */
.reminder-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 14px 0 6px; }
.reminder-time { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--text-muted); font-size: .88rem; }
.reminder-time input[type="time"] {
  font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); min-width: 130px;
}
body.dark-mode .reminder-time input[type="time"] { color: var(--ivory); background: var(--surface-2); }
#rem-toggle.is-on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
