/* Shared root study page styles. Extracted from the updated sad-l-w root pages. */
.root-study-page {
    --root-bg: #f7f3ea;
    --root-card: #fffaf1;
    --root-panel: #fffdf7;
    --root-section: #fffaf2;
    --root-text: #2f2a22;
    --root-muted: #6d6255;
    --root-soft: #f0e5d2;
    --root-border: rgba(148, 114, 55, 0.28);
    --root-border-soft: rgba(148, 114, 55, 0.16);
    --root-accent: #b9852f;
    --root-accent-deep: #8b6423;
    --root-accent-soft: rgba(185, 133, 47, 0.11);
    --root-shadow: 0 22px 60px rgba(65, 46, 20, 0.10);

    direction: rtl;
    text-align: right;
    max-width: 980px;
    margin: 0 auto;
    padding: 3.5rem 1.25rem;
    line-height: 2.05;
    color: var(--root-text);
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  }

  /* Dark mode follows the Forqan theme only. */
  html[data-forqan-theme="dark"] .root-study-page,
  html.forqan-theme-dark .root-study-page,
  html.forqan-root-pre-dark .root-study-page,
  body.dark-theme .root-study-page,
  .root-study-page.forqan-root-dark {
    --root-bg: #0f1a2c;
    --root-card: #121f33;
    --root-panel: #1b2a40;
    --root-section: rgba(255, 255, 255, 0.035);
    --root-text: #ece7dc;
    --root-muted: #beb6a7;
    --root-soft: rgba(255, 255, 255, 0.06);
    --root-border: rgba(214, 176, 95, 0.24);
    --root-border-soft: rgba(214, 176, 95, 0.16);
    --root-accent: #d6b05f;
    --root-accent-deep: #f0cf7a;
    --root-accent-soft: rgba(214, 176, 95, 0.12);
    --root-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  }

  html[data-forqan-theme="light"] .root-study-page,
  html.forqan-theme-light .root-study-page,
  html.forqan-root-pre-light .root-study-page,
  body.light-theme .root-study-page,
  .root-study-page.forqan-root-light {
    --root-bg: #f7f3ea;
    --root-card: #fffaf1;
    --root-panel: #fffdf7;
    --root-section: #fffaf2;
    --root-text: #2f2a22;
    --root-muted: #6d6255;
    --root-soft: #f0e5d2;
    --root-border: rgba(148, 114, 55, 0.28);
    --root-border-soft: rgba(148, 114, 55, 0.16);
    --root-accent: #b9852f;
    --root-accent-deep: #8b6423;
    --root-accent-soft: rgba(185, 133, 47, 0.11);
    --root-shadow: 0 22px 60px rgba(65, 46, 20, 0.10);
  }

  .root-study-page * {
    box-sizing: border-box;
  }

  .root-study-page,
  .root-study-page h1,
  .root-study-page h2,
  .root-study-page h3,
  .root-study-page p,
  .root-study-page li,
  .root-study-page strong {
    color: var(--root-text);
  }

  .root-study-page h1,
  .root-study-page h2,
  .root-study-page h3,
  .root-study-page p,
  .root-study-page li {
    direction: rtl;
    text-align: right;
  }

  .root-frame {
    background:
      radial-gradient(circle at top right, var(--root-accent-soft), transparent 34%),
      var(--root-card);
    border: 1px solid var(--root-border);
    border-radius: 26px;
    padding: 2.4rem;
    box-shadow: var(--root-shadow);
  }

  .root-hero {
    border-bottom: 1px solid var(--root-border-soft);
    padding-bottom: 1.65rem;
    margin-bottom: 2rem;
  }

  .root-kicker {
    color: var(--root-accent-deep);
    font-size: 0.96rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
  }

  .root-study-page h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.05rem);
    line-height: 1.4;
    letter-spacing: -0.02em;
  }

  .root-subtitle {
    color: var(--root-muted);
    max-width: 780px;
    margin: 1rem 0 0;
    font-size: 1.04rem;
  }

  .root-forms-card,
  .root-toc {
    background:
      linear-gradient(180deg, var(--root-accent-soft), transparent 82%),
      var(--root-panel);
    border: 1px solid var(--root-border);
    border-radius: 20px;
    padding: 1.35rem 1.55rem;
    margin: 1.55rem 0;
  }

  .root-forms-card h2,
  .root-toc h2 {
    margin-top: 0;
  }

  .root-forms-card ul {
    padding-right: 1.2rem;
    margin: 0.75rem 0 0;
  }

  .root-forms-card li {
    margin: 0.48rem 0;
  }

  .root-toc ol {
    list-style-position: inside;
    padding-right: 0;
    margin: 0.75rem 0 0;
    columns: 2;
    column-gap: 2rem;
  }

  .root-toc li {
    margin: 0.28rem 0;
    break-inside: avoid;
  }

  .root-section {
    background: var(--root-section);
    border: 1px solid var(--root-border-soft);
    border-radius: 18px;
    padding: 1.5rem 1.6rem;
    margin: 1.55rem 0;
  }

  .root-section h2 {
    margin: 0 0 1rem;
    color: var(--root-text);
    font-size: 1.35rem;
    line-height: 1.6;
  }

  .root-section h2::before {
    content: "";
    display: inline-block;
    width: 0.58rem;
    height: 0.58rem;
    border-radius: 999px;
    background: var(--root-accent);
    margin-left: 0.55rem;
    vertical-align: 0.08em;
  }

  .root-study-page p {
    margin: 0.85rem 0;
  }

  .root-study-page a {
    color: var(--root-accent-deep);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
  }

.root-study-page a:hover {
    color: var(--root-accent);
  }

  .quran-quote-link {
    color: inherit;
    border-bottom: 1px dotted currentColor;
  }

  .arabic-quote {
    direction: rtl;
    text-align: center;
    font-family: "Amiri Quran Colored", "Amiri Quran", Amiri, "Scheherazade New", serif;
    font-size: 1.48rem;
    line-height: 2.5;
    margin: 1.4rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--root-border);
    border-radius: 18px;
    background:
      linear-gradient(180deg, var(--root-accent-soft), transparent),
      var(--root-panel);
    color: var(--root-text);
  }

  .root-note {
    border-right: 3px solid var(--root-accent);
    padding: 0.9rem 1rem;
    background: var(--root-accent-soft);
    border-radius: 14px;
    color: var(--root-muted);
  }

  .root-note strong,
  .root-subtitle strong {
    color: var(--root-text);
  }

  .root-forms-list {
    margin: 0.75rem 0 0;
  }

  .translation,
  .transliteration-note {
    color: var(--root-muted);
    font-size: 0.96rem;
    line-height: 1.85;
  }

  .root-study-page.forqan-page-ltr,
  .root-study-page.forqan-page-ltr h1,
  .root-study-page.forqan-page-ltr h2,
  .root-study-page.forqan-page-ltr h3,
  .root-study-page.forqan-page-ltr p,
  .root-study-page.forqan-page-ltr li {
    direction: ltr;
    text-align: left;
  }

  .root-study-page.forqan-page-ltr .root-forms-card ul {
    padding-right: 0;
    padding-left: 1.2rem;
  }

  .root-study-page.forqan-page-ltr .root-toc ol {
    padding-left: 0;
  }

  .root-study-page.forqan-page-ltr .root-section h2::before {
    margin-left: 0;
    margin-right: 0.55rem;
  }

  .root-study-page.forqan-page-ltr .root-note {
    border-right: 0;
    border-left: 3px solid var(--root-accent);
  }


  .root-morphology-intro {
    color: var(--root-muted);
    margin-top: 0;
  }

  .morphology-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 1.1rem;
  }

  .morph-card {
    background: var(--root-panel);
    border: 1px solid var(--root-border-soft);
    border-radius: 16px;
    padding: 1rem 1.05rem;
  }

  .morph-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.65rem;
  }

  .morph-type {
    font-weight: 800;
    color: var(--root-accent-deep);
  }

  .morph-used {
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 800;
    border: 1px solid var(--root-border);
    border-radius: 999px;
    padding: 0.12rem 0.65rem;
    color: var(--root-accent-deep);
    background: var(--root-accent-soft);
  }

  .morph-form {
    direction: rtl;
    text-align: right;
    font-size: 1.24rem;
    line-height: 1.9;
    font-weight: 800;
    color: var(--root-text);
    margin: 0.2rem 0 0.55rem;
  }

  .root-study-page.forqan-page-ltr .morph-form {
    direction: rtl;
    text-align: left;
  }

  .morph-translit {
    direction: ltr;
    text-align: inherit;
    font-size: 0.95rem;
    line-height: 1.45;
    font-weight: 700;
    color: var(--root-muted);
    margin: -0.2rem 0 0.6rem;
  }

  .morph-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--root-accent-deep);
    margin-bottom: 0.15rem;
  }

  .morph-note {
    color: var(--root-muted);
    font-size: 0.95rem;
    line-height: 1.95;
    margin: 0;
  }

  .morph-note a {
    color: var(--root-accent-deep);
  }

  .morph-card.morph-no .morph-used {
    color: var(--root-muted);
    background: var(--root-soft);
    border-color: var(--root-border-soft);
  }

  .root-translit-inline {
    color: var(--root-muted);
    direction: ltr;
    display: inline;
    font-size: 0.96em;
    font-weight: 650;
    unicode-bidi: isolate;
    white-space: nowrap;
  }

  .quran-translit-line {
    color: var(--root-muted);
    direction: ltr;
    display: block;
    font-size: 0.98rem;
    font-style: italic;
    font-weight: 650;
    line-height: 1.65;
    margin: -0.4rem 0 1rem;
    text-align: inherit;
    unicode-bidi: isolate;
  }


  @media (max-width: 760px) {
    .root-study-page {
      padding: 1.25rem 0.45rem;
    }

    .root-frame {
      padding: 0.85rem;
      border-radius: 19px;
    }

    .root-section,
    .root-forms-card,
    .root-toc {
      padding: 0.85rem;
    }

    .root-toc ol {
      columns: 1;
    }

    .morphology-grid {
      grid-template-columns: 1fr;
      gap: 0.75rem;
    }

    .morph-card {
      padding: 0.9rem 0.85rem;
      border-radius: 15px;
    }

    .morph-card-header {
      display: block;
      margin-bottom: 0.5rem;
    }

    .morph-used {
      display: inline-block;
      margin-top: 0.35rem;
    }
  }
