/* TGPU Iqra — Theme A Flagship Arabic Learning Experience (theme-a-v1.css)
   Approved emerald & gold palette, Amiri Quran Arabic display, Plus Jakarta Sans UI,
   mobile-first responsive architecture, zero-pill metadata restraint, WCAG AA contrast. */

:root {
  --iqra-emerald-deep: #063f35;
  --iqra-emerald: #0b5a4c;
  --iqra-emerald-soft: #eaf4ef;
  --iqra-gold: #c6a667;
  --iqra-gold-bright: #e9bd62;
  --iqra-gold-soft: #f5efe1;
  --iqra-canvas: #f8f6f0;
  --iqra-surface: #ffffff;
  --iqra-ink: #172521;
  --iqra-muted: #4a5a54;
  --iqra-border: #dce7e0;
  --font-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-arabic: "Amiri Quran", "Amiri", "Noto Naskh Arabic", "Noto Sans Arabic", serif;
}

body {
  font-family: var(--font-ui);
  background: var(--iqra-canvas);
  color: var(--iqra-ink);
}

.arabic-display,
.arabic-letter,
.quiz-letter .arabic-letter,
.letter-card .arabic-letter,
.theme-a-arabic {
  font-family: var(--font-arabic);
  font-feature-settings: "kern" 1, "liga" 1, "mark" 1, "mkmk" 1;
  letter-spacing: 0 !important;
}

/* Top Site Utility Bar (3-zone clean contract) */
.tgpu-topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(14px, 3vw, 28px);
  background: var(--iqra-emerald-deep);
  color: #ffffff;
  border-bottom: 1px solid rgba(233, 189, 98, 0.22);
}

.tgpu-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tgpu-topbar-brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.tgpu-topbar-nav {
  display: none;
  align-items: center;
  gap: 20px;
  font-size: 13.5px;
  font-weight: 600;
}

@media (min-width: 760px) {
  .tgpu-topbar-nav {
    display: flex;
  }
}

.tgpu-topbar-nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.tgpu-topbar-nav a:hover {
  color: var(--iqra-gold-bright);
  border-bottom-color: var(--iqra-gold-bright);
}

.tgpu-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tgpu-topbar-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 8px;
}

.tgpu-topbar-link:hover {
  text-decoration: underline;
}

.tgpu-topbar-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 0;
  background: var(--iqra-gold-bright);
  color: #143328;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

.tgpu-topbar-cta:hover {
  filter: brightness(1.04);
}

.tgpu-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.tgpu-install-btn[hidden] {
  display: none;
}

/* Offline Connectivity Banner */
.tgpu-offline-banner {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 85;
  padding: 10px 14px;
  border-radius: 12px;
  background: #172521;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Theme A Welcome / Flagship Homepage */
.theme-a-welcome {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  text-align: start;
}

.theme-a-hero {
  border-radius: 26px;
  padding: clamp(22px, 3.5vw, 36px);
  background: linear-gradient(145deg, #063f35 0%, #0b5a4c 62%, #0e6958 100%);
  color: #ffffff;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: center;
}

@media (min-width: 820px) {
  .theme-a-hero {
    grid-template-columns: 1.25fr 0.95fr;
    gap: 28px;
  }
}

.theme-a-hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-a-hero-brand img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #ffffff;
  object-fit: contain;
  padding: 3px;
}

.theme-a-hero-brand strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.theme-a-hero-brand span {
  display: block;
  font-size: 12.5px;
  color: #e9bd62;
  font-weight: 700;
}

.theme-a-hero h1 {
  font-size: clamp(28px, 3.8vw, 42px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  text-wrap: balance;
  margin: 10px 0 8px;
}

.theme-a-hero p {
  font-size: 15px;
  line-height: 1.58;
  color: rgba(255, 255, 255, 0.88);
  max-width: 54ch;
  margin: 0;
}

.theme-a-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.86);
  margin-top: 14px;
}

.theme-a-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.theme-a-hero-actions .btn {
  width: auto;
  min-width: 190px;
  background: var(--iqra-gold-bright);
  color: #123127;
  font-weight: 800;
  border-radius: 14px;
  min-height: 52px;
  padding: 12px 22px;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), filter 160ms ease;
}

.theme-a-hero-actions .btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.theme-a-hero-actions .btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* Interactive 3-Letter Preview Stage on Welcome */
.theme-a-preview-stage {
  border-radius: 20px;
  background: #fbfaf6;
  color: var(--iqra-ink);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(233, 189, 98, 0.35);
}

.theme-a-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.theme-a-preview-head strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
}

.theme-a-preview-head span {
  font-size: 12px;
  color: var(--iqra-muted);
}

.theme-a-demo-letters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.theme-a-demo-btn {
  min-height: 108px;
  border-radius: 16px;
  border: 1.5px solid var(--iqra-border);
  background: #ffffff;
  color: var(--iqra-emerald-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 10px 6px;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.theme-a-demo-btn:hover,
.theme-a-demo-btn.active {
  border-color: var(--iqra-emerald);
  background: var(--iqra-emerald-soft);
}

.theme-a-demo-btn .demo-glyph {
  font-family: var(--font-arabic);
  font-size: 46px;
  line-height: 1.25;
  color: var(--iqra-emerald-deep);
}

.theme-a-demo-btn small {
  font-size: 12px;
  font-weight: 700;
  color: var(--iqra-muted);
}

.theme-a-demo-status {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--iqra-muted);
  margin: 0;
  min-height: 36px;
}

.theme-a-demo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid #e7eee9;
  padding-top: 10px;
  font-size: 12px;
}

.theme-a-inline-btn {
  border: 1px solid #c9dcd1;
  background: #ffffff;
  color: var(--iqra-emerald-deep);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  min-height: 38px;
  border-radius: 10px;
  cursor: pointer;
}

/* Pathway & Governance Overview Grid */
.theme-a-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 760px) {
  .theme-a-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.theme-a-panel {
  border-radius: 20px;
  border: 1px solid var(--iqra-border);
  background: #ffffff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-a-panel h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
  margin: 0;
}

.theme-a-panel p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--iqra-muted);
  margin: 0;
}

.theme-a-stat-line {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--iqra-emerald);
  font-variant-numeric: tabular-nums;
}

/* Dashboard Workspace Enhancements */
.theme-a-workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 760px) {
  .theme-a-workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.theme-a-tool-card {
  border-radius: 20px;
  border: 1px solid var(--iqra-border);
  background: #ffffff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-a-tool-card strong {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
}

.theme-a-tool-card p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--iqra-muted);
  margin: 0;
}

.theme-a-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.theme-a-tool-actions button,
.theme-a-tool-actions a {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid #cfe0d6;
  background: var(--iqra-emerald-soft);
  color: var(--iqra-emerald-deep);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-a-tool-actions .solid {
  background: var(--iqra-emerald);
  border-color: var(--iqra-emerald);
  color: #ffffff;
}

/* 28-Letter Mastery Matrix */
.theme-a-mastery-matrix {
  border-radius: 20px;
  border: 1px solid var(--iqra-border);
  background: #ffffff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-a-matrix-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-a-matrix-head strong {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
}

.theme-a-matrix-head span {
  font-size: 12.5px;
  color: var(--iqra-muted);
  font-variant-numeric: tabular-nums;
}

.theme-a-letter-cells {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 760px) {
  .theme-a-letter-cells {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }
}

.theme-a-letter-cell {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #e4ede8;
  background: #f9fbfa;
  color: #5b6d66;
  display: grid;
  place-items: center;
  font-family: var(--font-arabic);
  font-size: 24px;
  line-height: 1.2;
  cursor: pointer;
}

.theme-a-letter-cell.mastered {
  background: var(--iqra-emerald-soft);
  border-color: #9ac5b3;
  color: var(--iqra-emerald-deep);
  font-weight: 700;
}

.theme-a-local-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--iqra-muted);
  border-top: 1px solid #e6eee9;
  padding-top: 10px;
  margin: 0;
}

/* Listening Locked Notice */
.iqra-listening-lock {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--iqra-gold-soft);
  color: #463a20;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(198, 166, 103, 0.35);
}

/* iOS Install Modal */
.tgpu-ios-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(6, 38, 30, 0.56);
  display: grid;
  place-items: center;
  padding: 16px;
}

.tgpu-ios-card {
  width: min(100%, 400px);
  border-radius: 20px;
  background: #ffffff;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  color: var(--iqra-ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tgpu-ios-card h3 {
  margin: 0;
  font-size: 18px;
  color: var(--iqra-emerald-deep);
}

.tgpu-ios-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--iqra-muted);
}

/* SVG Mastery Progress Rings & Daily Ring */
.goal-card-ring {
  padding: 16px 18px !important;
}

.goal-ring-layout {
  display: flex;
  align-items: center;
  gap: 16px;
}

.iqra-ring-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.iqra-ring-svg {
  display: block;
}

.iqra-ring-track {
  stroke: rgba(255, 255, 255, 0.22);
}

.iqra-ring-arc {
  stroke: var(--iqra-gold-bright);
  transition: stroke-dashoffset 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.iqra-ring-value {
  position: absolute;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.goal-ring-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-ring-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
}

.goal-ring-metrics strong {
  color: var(--iqra-gold-bright);
  font-weight: 800;
}

/* Handwriting Mini Ring */
.theme-a-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mini-ring-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.mini-ring-track {
  stroke: #e4ede8;
}

.mini-ring-arc {
  stroke: var(--iqra-emerald);
  transition: stroke-dashoffset 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mini-ring-wrap span {
  position: absolute;
  font-size: 11px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
  font-variant-numeric: tabular-nums;
}

/* Daily Learning SVG Ring */
.daily-ring-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.daily-ring-track {
  stroke: #dce9e2;
}

.daily-ring-arc {
  stroke: var(--iqra-gold);
  transition: stroke-dashoffset 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

.daily-ring-arc.done {
  stroke: var(--iqra-emerald);
}

.daily-ring-label {
  position: absolute;
  font-size: 11px;
  font-weight: 800;
  color: var(--iqra-emerald-deep);
  font-variant-numeric: tabular-nums;
}

/* Offline Readiness Card */
.theme-a-offline-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5faf7 100%);
}

@media (min-width: 760px) {
  .theme-a-offline-card {
    grid-column: 1 / -1;
  }
}

.theme-a-offline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-a-offline-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.offline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.offline-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.offline-dot.offline {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.theme-a-offline-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--iqra-emerald);
  font-variant-numeric: tabular-nums;
}

/* RTL Refinements */
html[dir="rtl"] .theme-a-hero,
html[dir="rtl"] .theme-a-panel,
html[dir="rtl"] .theme-a-tool-card,
html[dir="rtl"] .goal-ring-body,
html[dir="rtl"] .hw-studio {
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .theme-a-hero-actions .btn,
  .theme-a-demo-btn,
  .tgpu-topbar-cta,
  .iqra-ring-arc,
  .mini-ring-arc,
  .daily-ring-arc {
    transition: none;
    transform: none;
  }
}
