/* ==========================================================================
   Surah At-Taghābun (Ayats 1–3) — Interactive Experience
   Color Palette: Deep Cosmic Obsidian with Luminous Auroras
   ========================================================================== */

:root {
  --bg-deep: #050711;
  --bg-surface: #0a0e24;
  --bg-surface-elevated: #11173b;
  --bg-glass: rgba(13, 18, 48, 0.72);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glass-glow: rgba(99, 102, 241, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Vibrant Accent Hues */
  --accent-cyan: #22d3ee;
  --accent-cyan-glow: rgba(34, 211, 238, 0.4);
  --accent-violet: #a855f7;
  --accent-violet-glow: rgba(168, 85, 247, 0.4);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.4);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.4);
  --accent-coral: #f43f5e;
  --accent-coral-glow: rgba(244, 63, 94, 0.4);
  --accent-gold: #fbbf24;

  /* Typography */
  --font-arabic: 'Amiri Quran', 'Amiri', serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cinzel', serif;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --header-height: 64px;
}

/* Base Reset & Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  font-size: 16px;
  background-color: var(--bg-deep);
}

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-deep);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
  position: relative;
  letter-spacing: -0.01em;
}

/* Background Cosmic Canvas */
#cosmic-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.95;
}

/* ==========================================================================
   Header & Sticky Navigation
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 100;
  background: rgba(5, 7, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-en {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-ar {
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  color: var(--accent-gold);
  line-height: 1.1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-chip {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.nav-chip:hover, .nav-chip:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Scroll Progress Line */
.scroll-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.scroll-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet), var(--accent-amber));
  box-shadow: 0 0 10px var(--accent-cyan-glow);
  transition: width 0.1s linear;
}

/* ==========================================================================
   Layout Containers & Common Styles
   ========================================================================== */
main {
  position: relative;
  z-index: 1;
}

.section {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height) + 2rem) 1.25rem 4rem;
}

.section-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 1.75rem;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s var(--ease-smooth), border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.section-header-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pill-number {
  color: var(--accent-amber);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.section-lead {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 700px;
  line-height: 1.6;
}

.accent-text-amber {
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-mini {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  margin-bottom: 0.75rem;
}

.bg-cyan-soft { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.bg-violet-soft { background: rgba(168, 85, 247, 0.15); color: var(--accent-violet); }
.bg-amber-soft { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.bg-emerald-soft { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.bg-coral-soft { background: rgba(244, 63, 94, 0.15); color: var(--accent-coral); }
.bg-gold-soft { background: rgba(251, 191, 36, 0.15); color: var(--accent-gold); }

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.25rem 2rem;
}

.hero-content {
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d8b4fe;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-arabic-title {
  font-family: var(--font-arabic);
  font-size: clamp(3.2rem, 11vw, 6.5rem);
  line-height: 1.15;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 10%, #e2e8f0 40%, var(--accent-gold) 75%, var(--accent-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 45px rgba(245, 158, 11, 0.35));
  margin: 0.25rem 0;
}

.hero-subtitle {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hero-glow-text {
  font-size: clamp(1.4rem, 4.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtext {
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  color: var(--text-muted);
}

.hero-core-quote {
  max-width: 620px;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent-violet);
  font-style: italic;
  color: #cbd5e1;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
}

/* Hold-to-Enter Interaction Button */
.hold-action-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hold-orb-btn {
  position: relative;
  width: 110px;
  height: 110px;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.orb-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 4;
}

.ring-fg {
  fill: none;
  stroke: url(#orb-grad, var(--accent-cyan));
  stroke-width: 5;
  stroke-dasharray: 339.29; /* 2 * PI * 54 */
  stroke-dashoffset: 339.29;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.05s linear;
}

.orb-inner {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a1f55, #0f122a 80%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.35), inset 0 0 15px rgba(34, 211, 238, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: #fff;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}

.hold-orb-btn:active .orb-inner,
.hold-orb-btn.is-holding .orb-inner {
  transform: scale(0.93);
  box-shadow: 0 0 35px var(--accent-cyan-glow), inset 0 0 25px rgba(34, 211, 238, 0.4);
}

.orb-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.orb-icon {
  font-size: 0.9rem;
  color: var(--accent-gold);
}

.hold-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.skip-link {
  color: var(--accent-cyan);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-cyan);
}

.hero-scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  opacity: 0.7;
}

.scroll-text {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.scroll-chevron {
  width: 14px;
  height: 14px;
  border-bottom: 2px solid var(--accent-cyan);
  border-right: 2px solid var(--accent-cyan);
  transform: rotate(45deg);
  animation: chevron-bounce 2s infinite ease-in-out;
}

@keyframes chevron-bounce {
  0%, 100% { transform: translateY(0) rotate(45deg); }
  50% { transform: translateY(6px) rotate(45deg); }
}

/* ==========================================================================
   Intro Section & Components
   ========================================================================== */
.intro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card-icon-tag {
  align-self: flex-start;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: inline-block;
}

.card-heading {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #fff;
}

.card-text {
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.quote-callout {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--accent-amber);
  color: #fde68a;
  font-style: italic;
  font-size: 0.9rem;
}

/* Value Ledger Widget */
.ledger-widget-box {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ledger-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ledger-title {
  font-size: 1.35rem;
  font-weight: 800;
}

.ledger-toggle-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-amber), #d97706);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-amber-glow);
}

.ledger-caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

.ledger-bars {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ledger-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.bar-name {
  color: #e2e8f0;
}

.bar-val-text {
  font-weight: 700;
  transition: color 0.3s ease;
}

.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s var(--ease-smooth), background 0.7s ease, box-shadow 0.7s ease;
}

/* Musabbihat Row */
.musabbihat-block {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.musabbihat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.surah-chip {
  padding: 0.9rem 0.75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  transition: all 0.25s ease;
}

.surah-chip:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
}

.surah-chip.highlight-chip {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(34, 211, 238, 0.2));
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}

.chip-num {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dim);
}

.chip-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.chip-tense {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.chip-tense-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.musabbihat-insight {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  font-size: 0.88rem;
  color: #e9d5ff;
}

.insight-spark {
  font-size: 1.1rem;
}

/* Blueprint Steps */
.blueprint-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.blueprint-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.bp-step {
  display: flex;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

.bp-step.active-step {
  background: rgba(34, 211, 238, 0.07);
  border-color: rgba(34, 211, 238, 0.4);
}

.bp-number {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.bp-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #fff;
}

.bp-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Ayah Cards & Quranic Arabic Display
   ========================================================================== */
.ayah-top-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ayah-index-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.star-icon {
  color: var(--accent-gold);
  font-size: 1.1rem;
}

/* Recitation Audio Player Button */
.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.25s ease;
}

.audio-play-btn:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(168, 85, 247, 0.25));
  box-shadow: 0 0 20px var(--accent-cyan-glow);
  transform: scale(1.02);
}

.audio-play-btn.is-playing {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  border-color: #fff;
  box-shadow: 0 0 25px var(--accent-cyan-glow);
}

.audio-waves {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.audio-waves span {
  width: 2.5px;
  height: 6px;
  background: currentColor;
  border-radius: 999px;
  transition: height 0.2s ease;
}

.audio-play-btn.is-playing .audio-waves span {
  animation: wave-bar 0.9s infinite ease-in-out;
}

.audio-play-btn.is-playing .audio-waves span:nth-child(2) { animation-delay: 0.2s; }
.audio-play-btn.is-playing .audio-waves span:nth-child(3) { animation-delay: 0.4s; }
.audio-play-btn.is-playing .audio-waves span:nth-child(4) { animation-delay: 0.15s; }

@keyframes wave-bar {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

.play-reciter {
  font-size: 0.68rem;
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

/* Ayah Card Body */
.ayah-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.arabic-block {
  text-align: center;
  padding: 1rem 0;
}

.arabic-text {
  font-family: var(--font-arabic);
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  line-height: 2.3;
  color: #fff;
  word-spacing: 0.25em;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
}

/* Interactive Arabic Word Spans */
.q-word {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
}

.q-word:hover, .q-word:focus-visible {
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.15);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.3);
  transform: translateY(-2px);
}

.q-word.highlight-key {
  color: var(--accent-gold);
}

.q-ayah-num {
  font-family: var(--font-arabic);
  color: var(--accent-gold);
  font-size: 1.5rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.translation-block {
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.english-translation {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.6;
  color: #e2e8f0;
}

.word-tap-hint {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.word-tap-hint::before {
  content: '✦';
  font-size: 0.8rem;
}

/* ==========================================================================
   Interactive Toolboxes & Widgets Per Ayah
   ========================================================================== */
.interactive-tool-box {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-color: rgba(255, 255, 255, 0.15);
}

.tool-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tool-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.tool-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 680px;
}

/* Widget 1: Tasbih Trigger Button */
.tasbih-interactive-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem 0;
}

.tasbih-btn {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 35%, #0891b2, #0e1e38 85%);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 35px rgba(6, 182, 212, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(34, 211, 238, 0.5);
  transition: transform 0.15s var(--ease-spring), box-shadow 0.15s ease;
  touch-action: manipulation;
}

.tasbih-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 50px rgba(34, 211, 238, 0.7), inset 0 0 25px rgba(255, 255, 255, 0.4);
}

.tasbih-arabic {
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.tasbih-sub {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.8;
  text-transform: uppercase;
}

.tasbih-stats {
  display: flex;
  gap: 1rem;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.4rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Widget 2: Seed of Fitrah (Kufr vs Iman) */
.seed-interactive-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.seed-stage {
  width: 260px;
  height: 150px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  background: #0d122b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
}

.soil-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #3f271a, #1f140e);
  z-index: 2;
  display: grid;
  place-items: center;
  transition: transform 0.6s var(--ease-smooth), opacity 0.5s ease;
}

.soil-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #d6b49c;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
}

.seed-core {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.seed-glow {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.8), transparent 70%);
  filter: blur(12px);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
}

.seed-leaf {
  font-size: 3rem;
  position: relative;
  z-index: 2;
  transition: transform 0.5s var(--ease-spring);
}

/* Seed States */
.seed-stage.state-sprouted .soil-layer {
  transform: translateY(105%);
  opacity: 0;
}

.seed-stage.state-sprouted {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 30px var(--accent-emerald-glow);
}

.seed-stage.state-sprouted .seed-leaf {
  transform: scale(1.2) translateY(-4px);
}

.action-pill-btn {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 20px var(--accent-emerald-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-pill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--accent-emerald-glow);
}

.seed-caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 520px;
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* Widget 3: Sacred Geometry (Ahsana Suwarakum) */
.geometry-interactive-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.rosette-wrapper {
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
}

.rosette-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.4));
  transition: transform 0.8s var(--ease-spring);
}

.rosette-outer-ring {
  fill: none;
  stroke: rgba(251, 191, 36, 0.3);
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.rosette-petal {
  fill: rgba(251, 191, 36, 0.25);
  stroke: var(--accent-gold);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  transition: all 0.6s var(--ease-spring);
}

.rosette-center-core {
  fill: var(--accent-gold);
  filter: drop-shadow(0 0 10px var(--accent-gold));
}

.geometry-caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 500px;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Linguistic Gems Grid
   ========================================================================== */
.gems-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.gems-heading {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.gems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.gem-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-radius: 20px;
}

.gem-tag {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.gem-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.gem-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.6;
}

/* ==========================================================================
   Synthesis & Outro Section
   ========================================================================== */
.synthesis-card {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  text-align: center;
  padding: clamp(2rem, 5vw, 3.5rem);
}

.synthesis-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
}

.arc-timeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

.arc-node {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.arc-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
}

.arc-node h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.arc-node p {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 220px;
  line-height: 1.5;
}

.arc-divider {
  width: 24px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.next-teaser {
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
  max-width: 640px;
}

.teaser-text {
  font-size: 0.95rem;
  color: #e9d5ff;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.return-top-btn {
  display: inline-block;
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid var(--accent-cyan);
  transition: all 0.2s ease;
}

.return-top-btn:hover {
  background: var(--accent-cyan);
  color: #050711;
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

/* ==========================================================================
   Modern Top-Layer Dialog Implementation (Using retrieved guidance)
   @starting-style, transition-behavior: allow-discrete, overlay
   ========================================================================== */
.word-modal {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  max-width: 520px;
  margin: auto auto 0 auto; /* Mobile bottom sheet */
  outline: none;

  /* Baseline discrete transition setup */
  opacity: 0;
  transform: translateY(40px);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.3s;
  transition-timing-function: var(--ease-spring);
  transition-behavior: allow-discrete;
}

@media (min-width: 768px) {
  .word-modal {
    margin: auto; /* Desktop center modal */
    transform: scale(0.94);
  }
}

.word-modal[open] {
  opacity: 1;
  transform: translateY(0);

  @starting-style {
    opacity: 0;
    transform: translateY(40px);
  }
}

@media (min-width: 768px) {
  .word-modal[open] {
    transform: scale(1);

    @starting-style {
      transform: scale(0.94);
    }
  }
}

/* Backdrop */
.word-modal::backdrop {
  background-color: rgba(5, 7, 17, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    display 0.3s allow-discrete,
    overlay 0.3s allow-discrete,
    background-color 0.3s ease-out,
    backdrop-filter 0.3s ease-out;
}

.word-modal[open]::backdrop {
  background-color: rgba(5, 7, 17, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  @starting-style {
    background-color: rgba(5, 7, 17, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

.modal-card {
  background: #0d122b;
  border: 1px solid var(--border-glass);
  border-radius: 28px 28px 0 0;
  padding: 1.75rem;
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.8);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .modal-card {
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  }
}

.modal-drag-handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 auto -0.5rem;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 0.25rem;
}

.modal-arabic {
  font-family: var(--font-arabic);
  font-size: 2.4rem;
  color: #fff;
  line-height: 1.2;
}

.modal-translit {
  font-size: 0.95rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.modal-close-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.modal-close-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.field-value {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e2e8f0;
}

.highlight-meaning {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.root-chip-box {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.4rem 1rem;
  border-radius: 12px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.root-letters {
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-violet);
}

.gem-notes {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border-left: 3px solid var(--accent-cyan);
  font-size: 0.9rem;
  color: #cbd5e1;
}

/* ==========================================================================
   Footer & Version Tag (Required by Rule 1)
   ========================================================================== */
.app-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--border-glass);
  background: rgba(5, 7, 17, 0.95);
  padding: 2.5rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
}

.footer-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.footer-credit {
  font-size: 0.8rem;
  color: var(--text-dim);
  max-width: 480px;
}

.footer-version-tag {
  display: flex;
  align-items: center;
}

.version-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--accent-cyan);
}

/* ==========================================================================
   Scroll-Driven Animations (Progressive Enhancement with Feature Detection)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes reveal-card {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .card, .interactive-tool-box, .gems-section, .ledger-widget-box, .musabbihat-block, .blueprint-card {
      animation: reveal-card 0.5s linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 25%;
    }
  }
}

/* Reduced Motion Override */
@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;
  }
}

/* Mobile Media Queries */
@media (max-width: 640px) {
  .header-controls .nav-chip {
    display: none;
  }
  .section {
    padding-top: calc(var(--header-height) + 1rem);
  }
  .ayah-card {
    padding: 1.5rem 1rem;
  }
  .tasbih-interactive-area {
    gap: 1.5rem;
  }
}

/* Focus Query State for Direct Section Presentation */
html[data-focus="intro"] #hero { display: none !important; }
html[data-focus="ayah-1"] #hero, html[data-focus="ayah-1"] #intro { display: none !important; }
html[data-focus="ayah-2"] #hero, html[data-focus="ayah-2"] #intro, html[data-focus="ayah-2"] #ayah-1 { display: none !important; }
html[data-focus="ayah-3"] #hero, html[data-focus="ayah-3"] #intro, html[data-focus="ayah-3"] #ayah-1, html[data-focus="ayah-3"] #ayah-2 { display: none !important; }
