/* ==========================================================================
   Qalam & Kitab design system: fixes layer (Bookstore Styling v1.2.0)
   Printed last in <head>, so it wins over the theme. Each block fixes a
   problem seen on the live site.
   ========================================================================== */

/* ---------- 1. Card and button links are never underlined ----------
   Astra underlines every link inside page content, including links that wrap a
   whole card, so card titles, descriptions and tags came out underlined. */
.entry-content a:is([class*="card"], [class*="btn"], [class*="button"], [class*="__cta"], [class*="tile"], [class*="chip"], [class*="pill"], [class*="qk-act"]),
.entry-content a:has(> div, > section, > article, > figure, > img, > picture, > h2, > h3, > h4, > span[class]),
.elementor-widget-container a:has(> div, > figure, > img, > h2, > h3, > h4, > span[class]) {
  text-decoration: none !important;
}
.entry-content a:has(> div) :is(div, span, p, h2, h3, h4),
.entry-content a[class*="card"] :is(div, span, p, h2, h3, h4) { text-decoration: none !important; }

/* Pieces left behind by broken auto-paragraphs (older cached pages). */
.pg-grid > p:empty, .pg-grid > br, .qk-reads-grid > p:empty, .qk-reads-grid > br,
.qcm-grid-cards > p:empty, .qcm-grid-cards > br { display: none !important; }
.pg-grid > a.pg-card:not(:has(.pg-card__title)) { display: none !important; }

/* ---------- 2. Playgroup page: section cards ---------- */
.pg-grid {
  max-width: 1040px !important;
  gap: clamp(14px, 2.2vw, 22px) !important;
  padding: 4px;
}
a.pg-card {
  position: relative;
  padding: clamp(22px, 3vw, 30px) clamp(20px, 2.6vw, 26px) !important;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 20px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .07);
  transition: transform .22s var(--qbs-ease, ease), box-shadow .22s var(--qbs-ease, ease) !important;
  -webkit-tap-highlight-color: transparent;
}
a.pg-card::after {
  content: "→";
  position: absolute;
  inset-inline-end: 22px;
  inset-block-start: 22px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  color: currentColor;
  font-size: 18px;
  font-weight: 700;
  transition: transform .2s var(--qbs-ease, ease), background .2s;
}
a.pg-card:hover::after { transform: translateX(4px); background: #fff; }
a.pg-card:focus-visible { outline: 3px solid var(--qk2-pri-d,#3B6648); outline-offset: 3px; }
a.pg-card:active { transform: scale(.985) !important; }
.pg-card__icon { font-size: clamp(44px, 6vw, 56px) !important; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .12)); }
.pg-card__title { font-size: clamp(20px, 2.4vw, 23px) !important; font-weight: 800 !important; letter-spacing: -.01em; }
.pg-card__desc { font-size: 15px !important; line-height: 1.6 !important; opacity: 1 !important; color: inherit; }
.pg-card--books .pg-card__desc { color: #1f4a3d; }
.pg-card--interactive .pg-card__desc { color: #1d3c6e; }
.pg-card--explore .pg-card__desc { color: #4a2a72; }
.pg-card__tag {
  margin-top: 8px !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: .06em !important;
  background: rgba(255, 255, 255, .72) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
a.pg-featured__card { text-decoration: none !important; }
a.pg-featured__card:focus-visible { outline: 3px solid var(--qk2-pri-d,#3B6648); outline-offset: 3px; }
.pg-featured__cta { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 580px) {
  /* Phones: icon and title side by side, text and tag full width below. */
  .pg-grid { gap: 14px !important; }
  .pg-grid > :is(a, span).pg-card {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 14px !important;
    padding: 18px 18px 20px !important;
  }
  .pg-grid .pg-card__icon { font-size: 40px !important; grid-row: 1; }
  .pg-grid .pg-card__title { grid-row: 1; padding-inline-end: 44px; }
  .pg-grid .pg-card__desc { grid-column: 1 / -1; }
  .pg-grid .pg-card__tag { grid-column: 1 / -1; justify-self: start; }
  a.pg-card::after { inset-block-start: 22px; inset-inline-end: 16px; width: 34px; height: 34px; }
}

/* Playgroup hero: the bright mint gradient gave white text about 2.4:1. Same hue, deeper. */
.entry-content .qk-hero.qk-hero--kids,
body .qk-hero.qk-hero--kids { background: linear-gradient(135deg, #0f6e50 0%, #16835f 55%, #1d9e75 100%) !important; }

/* ---------- 3. Content sections (.qk-section) on small screens ---------- */
@media (max-width: 600px) {
  .elementor-widget-text-editor .qk-section:has(> h2 + p):not(:has(ul, ol, .qk-faq-grid)),
  .qk-section.qk-keep-exploring { margin: 16px 0 !important; padding: 22px 18px !important; border-radius: 16px !important; }
  .qk-keep-exploring ul:not([class]) { grid-template-columns: 1fr !important; }
}

/* ---------- 4. FAQ accordions ----------
   The theme draws each FAQ group as a white card in a two-column grid. A page
   with one group got a half-width card; questions were 14.5px with a small tap area. */
.qk-faq-grid:has(> .qk-faq-group:only-child) { grid-template-columns: 1fr !important; max-width: 900px; margin-inline: auto; }
@media (max-width: 760px) { .qk-faq-grid { grid-template-columns: 1fr !important; } }
.qk-faq-group { border-radius: 18px !important; padding: clamp(16px, 2.6vw, 26px) !important; box-shadow: var(--qbs-sh-1, 0 2px 8px rgba(15, 23, 42,.06)); }
.qk-faq-group__title { font-size: clamp(17px, 2vw, 19px) !important; }
.qk-faq-item { border-bottom-color: var(--qbs-line, var(--qk2-line,#E2E8F0)) !important; }
.qk-faq-item > .qk-faq-q {
  display: block;
  min-height: 48px;
  padding: 14px 44px 14px 0 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.45;
  transition: color .15s;
}
.qk-faq-item > .qk-faq-q:hover { color: var(--qbs-green, var(--qk2-pri,#4A7C59)); }
.qk-faq-item > .qk-faq-q::after {
  content: "+" !important;
  right: 0 !important;
  left: auto !important;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--qbs-mint, var(--qk2-pri-l,#E7F0E9));
  color: var(--qbs-green, var(--qk2-pri,#4A7C59));
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
[dir="rtl"] .qk-faq-item > .qk-faq-q, .qk-ur-page .qk-faq-item > .qk-faq-q { padding: 14px 0 14px 44px !important; }
[dir="rtl"] .qk-faq-item > .qk-faq-q::after, .qk-ur-page .qk-faq-item > .qk-faq-q::after { right: auto !important; left: 0 !important; }
.qk-faq-item[open] > .qk-faq-q { color: var(--qbs-green-d, var(--qk2-pri-d,#3B6648)); }
.qk-faq-item[open] > .qk-faq-q::after { content: "−" !important; transform: translateY(-50%) !important; background: var(--qbs-green, var(--qk2-pri,#4A7C59)); color: #fff; }
.qk-faq-a { font-size: 15.5px !important; color: var(--qbs-body, var(--qk2-body,#334155)) !important; padding: 0 0 16px !important; }

/* ---------- 5. Links the site guard turned off ----------
   A link to a draft or missing page is shown as plain text to visitors.
   Editors see it marked so it can be fixed. */
.qbs-dead-link { cursor: default; text-decoration: none !important; }
span.qbs-dead-link:is([class*="card"], [class*="btn"], [class*="button"]) { opacity: .55; filter: grayscale(.35); pointer-events: none; }
a.qbs-broken {
  text-decoration: underline dashed #b42318 !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 4px;
  outline: 2px dashed rgba(180, 35, 24, .45);
  outline-offset: 2px;
}

/* ---------- 6. Headings never inherit pale builder colours ---------- */
.elementor-widget-heading .elementor-heading-title:not([style*="color"]) { color: var(--qbs-ink, var(--qk2-ink,#1E293B)); }
.elementor-widget-text-editor { color: var(--qbs-body, var(--qk2-body,#334155)); }

/* ---------- 7. Large screens: comfortable reading width for plain text pages ---------- */
@media (min-width: 1200px) {
  .ast-separate-container .entry-content > p:not([class]),
  .ast-separate-container .entry-content > ul:not([class]),
  .ast-separate-container .entry-content > ol:not([class]) { max-width: 78ch; }
}

/* ---------- 8. No Urdu switch outside Urdu books (v1.2.1) ----------
   The old header English/اردو switch and the "اردو میں پڑھیں" links are retired.
   Urdu books use Qalam Content Manager's own toggle (.qcm-lang-toggle). */
.qk-lang-switch, .qk-lang-link, [data-qk-old-lang] { display: none !important; }

/* ---------- 9. Print ---------- */
@media print {
  /* v1.3.1: the bottom nav's class is .qk-bottomnav (no hyphen), so it was printing on paper,
     along with the floating WhatsApp button and the Print Studio total bar. */
  .site-header, .site-footer, .qk-bottom-nav, .qk-bottomnav, .qps-sticky-wa, .qps-summary, #wpadminbar { display: none !important; }
  a.pg-card, .qk-faq-item { box-shadow: none !important; }
  .entry-content a:not([class])::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
}
