/* =========================================================
   Qur'an Teaching (14419) and Dawah (14431) appeal pages.
   Shared layout polish. Selectors are scoped with
   .site-main:has(.tr-qt-page) so they outrank the per-page
   WPBakery CSS and the site-wide Additional CSS.
   ========================================================= */

/* ---------- Hero banner ---------- */

/* The banner sat 168px up under the (opaque) top bar and menu, which hid
   its top 43px and covered the artwork's title. Start it below the menu,
   as the theme already does on tablet and mobile. */
.site-main:has(.tr-qt-page) .singlhead {
  margin-top: 0 !important;
}

.site-main:has(.tr-qt-page) .singlhead > img {
  display: block;
  width: 100%;
  height: auto;
}

/* The banner artwork already shows the appeal name; keep the heading for
   screen readers and search engines, without the dark bar over the art. */
.site-main:has(.tr-qt-page) .singlhead .entry-header {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Stray spacing from the page builder ---------- */

/* WordPress turns line breaks between builder blocks into <br>/<p>. */
.site-main:has(.tr-qt-page) .wpb-content-wrapper :is(.vc_row, .vc_row_inner, .vc_column-inner, .wpb_wrapper) > br {
  display: none;
}

.site-main:has(.tr-qt-page) .wpb-content-wrapper .wpb_wrapper > p:empty {
  display: none;
}

/* Rows left empty in the editor. */
.site-main:has(.tr-qt-page) .wpb-content-wrapper > .vc_row:not(:has(img, svg, video, h1, h2, h3, h4, li, a, form, iframe, input, .vc_separator, p:not(:empty))) {
  display: none;
}

/* ---------- Main intro block ---------- */

/* Same grid on both pages: the intro row uses the normal WPBakery gutter,
   so its text lines up with every full-width block below it. */
.site-main:has(.tr-qt-page) .entry-content .tr-qt-page {
  max-width: none;
  margin-right: -15px;
  margin-left: -15px;
  padding: 44px 0 8px;
}

.site-main:has(.tr-qt-page) .tr-qt-benefits {
  margin-top: 26px;
  margin-bottom: 28px;
  row-gap: 16px;
}

.site-main:has(.tr-qt-page) .tr-qt-benefit {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Same icon size on both pages (Dawah used 42px, Qur'an 62px). */
.site-main:has(.tr-qt-page) .tr-qt-benefit .tr-qt-icon {
  display: inline-flex;
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.site-main:has(.tr-qt-page) .tr-qt-benefit .tr-qt-icon img {
  width: 28px;
  height: 28px;
}

.site-main:has(.tr-qt-page) .tr-qt-benefit:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(16, 54, 83, 0.1);
}

/* Learning block: photo and copy as one card. */
.site-main:has(.tr-qt-page) .tr-qt-learning {
  margin: 0 0 8px !important;
  padding: 14px 6px;
  background: #fff;
  border: 1px solid #e5edf1;
  border-radius: 16px;
  box-shadow: 0 7px 22px rgba(16, 54, 83, 0.055);
}

.site-main:has(.tr-qt-page) .tr-qt-learning > .wpb_column > .vc_column-inner {
  padding-top: 0;
  padding-bottom: 0;
}

.site-main:has(.tr-qt-page) .tr-qt-learning > .wpb_column:last-child > .vc_column-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 14px 22px 14px 14px;
}

.site-main:has(.tr-qt-page) .entry-content .tr-qt-photo {
  min-height: 360px;
  border-radius: 12px;
  box-shadow: none;
}

.site-main:has(.tr-qt-page) .tr-qt-photo img {
  border-radius: 12px;
}

/* Donation card stays in view while reading the intro. */
@media (min-width: 992px) {
  .site-main:has(.tr-qt-page) .tr-qt-sidebar > .vc_column-inner {
    position: sticky;
    top: 110px;
  }
}

/* ---------- Lasting legacy panel ---------- */

.site-main:has(.tr-qt-page) .entry-content .tr-qt-legacy {
  max-width: none;
  margin: 32px 0 0 !important;
  padding: 30px 32px !important;
  background-size: auto 84%, auto !important;
  border-radius: 18px;
}

.site-main:has(.tr-qt-page) .tr-qt-legacy-layout {
  align-items: center;
}

.site-main:has(.tr-qt-page) .tr-qt-legacy-layout > div {
  padding: 0 290px 0 0 !important;
}

.site-main:has(.tr-qt-page) .tr-qt-legacy .tr-qt-legacy-icon {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
}

/* ---------- "Other Appeals" heading ---------- */

.site-main:has(.tr-qt-page) .wpb-content-wrapper > .vc_row:has(.vc_separator) {
  margin-top: 44px !important;
  padding: 0 16px !important;
}

.site-main:has(.tr-qt-page) .wpb-content-wrapper .vc_separator {
  width: 100% !important;
  max-width: 560px;
  margin: 0 auto 6px !important;
}

.site-main:has(.tr-qt-page) .wpb-content-wrapper .vc_separator h4 {
  padding: 0 18px;
  color: #092746 !important;
  font-family: "TR Quran Poppins", Arial, sans-serif !important;
  font-size: clamp(24px, 2.6vw, 32px) !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-main:has(.tr-qt-page) .wpb-content-wrapper .vc_separator .vc_sep_line {
  height: 0 !important;
  background: none !important;
  border: 0 !important;
  border-top: 2px solid #0ba33e !important;
}

/* ---------- Related appeals cards ---------- */

.site-main:has(.tr-qt-page) .related-singlepost {
  padding: 8px 0 48px !important;
}

/* Card edges line up with the content above (container padding + card padding). */
.site-main:has(.tr-qt-page) .related-singlepost > .container {
  max-width: 1262px !important;
  padding-right: 12px !important;
  padding-left: 12px !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .owl-stage {
  display: flex;
}

.site-main:has(.tr-qt-page) .related-singlepost .owl-item {
  display: flex;
  height: auto;
}

.site-main:has(.tr-qt-page) .related-singlepost .each-related-post {
  display: flex;
  width: 100%;
  margin: 0 !important;
  padding: 10px !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .white-bg-related-post {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto !important;
  min-height: 100%;
  padding: 10px 10px 18px !important;
  border: 1px solid #e5edf1 !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 20px rgba(16, 54, 83, 0.06) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.site-main:has(.tr-qt-page) .related-singlepost .white-bg-related-post:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(16, 54, 83, 0.11) !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .white-bg-related-post > a {
  display: block;
}

.site-main:has(.tr-qt-page) .related-singlepost .related-post-img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
  object-fit: cover !important;
  border-radius: 10px !important;
  background: #eef3f6;
}

.site-main:has(.tr-qt-page) .related-singlepost h2 {
  margin: 14px 6px 8px !important;
  line-height: 1.3 !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .related-post-title {
  font-family: "TR Quran Poppins", Arial, sans-serif;
  font-size: 17px !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .related-post-excerpt {
  display: -webkit-box !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 6px 18px !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  color: #5b6574;
  font-size: 14px;
  line-height: 1.55 !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .related-post-excerpt p {
  display: inline;
  margin: 0 !important;
}

.site-main:has(.tr-qt-page) .related-singlepost .rp-dnt-btn {
  margin: auto 6px 0 !important;
  padding: 0;
}

.site-main:has(.tr-qt-page) .related-singlepost .rp-dnt-btn :is(button, a) {
  padding: 11px 18px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
}

/* ---------- Tablet / mobile ---------- */

@media (max-width: 991px) {
  .site-main:has(.tr-qt-page) .tr-qt-legacy-layout > div {
    padding-right: 180px !important;
  }
}

@media (max-width: 767px) {
  .site-main:has(.tr-qt-page) .entry-content .tr-qt-page {
    padding-top: 28px;
  }

  .site-main:has(.tr-qt-page) .tr-qt-learning {
    padding: 12px 0;
  }

  .site-main:has(.tr-qt-page) .tr-qt-learning > .wpb_column:last-child > .vc_column-inner {
    padding: 18px 18px 8px;
  }

  .site-main:has(.tr-qt-page) .entry-content .tr-qt-photo {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .site-main:has(.tr-qt-page) .entry-content .tr-qt-legacy {
    padding: 24px 20px 120px !important;
    background-size: auto 110px, auto !important;
  }

  .site-main:has(.tr-qt-page) .tr-qt-legacy-layout {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .site-main:has(.tr-qt-page) .tr-qt-legacy-layout > div {
    padding: 0 !important;
  }

  .site-main:has(.tr-qt-page) .tr-qt-legacy .tr-qt-legacy-icon {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
  }

  .site-main:has(.tr-qt-page) .wpb-content-wrapper > .vc_row:has(.vc_separator) {
    margin-top: 32px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-main:has(.tr-qt-page) .tr-qt-benefit,
  .site-main:has(.tr-qt-page) .related-singlepost .white-bg-related-post {
    transition: none;
  }

  .site-main:has(.tr-qt-page) .tr-qt-benefit:hover,
  .site-main:has(.tr-qt-page) .related-singlepost .white-bg-related-post:hover {
    transform: none;
  }
}
