/*tvfb2*//*tvfb*//* Tuhfat al-atfal — public pages. Loaded after site.css and qudoori.css; reuses their tokens and the
   .qd-* / .ap-card* / .rd-seg classes, and adds the verse layout (صدر | عجز) and the coloured tajweed examples. */

.tf { --tf-verse: 1.55rem; --tf-verse: clamp(1.25rem, 2.3vw, 1.55rem); }

/* ---------- a bayt: صدر | عجز, set like printed verse ---------- */
.tf-bayt {
  display: grid; grid-template-columns: 1fr 2.2rem 1fr; align-items: baseline;
  font-family: var(--font-ar); direction: rtl; font-size: var(--tf-verse); line-height: 2.05; margin: 0;
}
.tf-bayt .tf-sadr, .tf-bayt .tf-ajuz { text-align: center; overflow-wrap: anywhere; min-width: 0; }
.tf-bayt .tf-sep { align-self: center; justify-self: center; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); opacity: .75; }
.tf-bayt .qd-num.ar { -webkit-margin-end: .5em; margin-inline-end: .5em; }
/* phones: the two halves stacked, the عجز set off to the left */
@media (max-width: 559px) {
  .tf-bayt { grid-template-columns: 1fr; line-height: 1.95; }
  .tf-bayt .tf-sep { display: none; }
  .tf-bayt .tf-sadr { text-align: right; }
  .tf-bayt .tf-ajuz { text-align: left; -webkit-padding-start: 1.6em; padding-inline-start: 1.6em; }
}

/* intro paragraphs */
.tf-p {
  font-family: var(--font-ar); direction: rtl; text-align: justify; text-align-last: right;
  font-size: 1.35rem; font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 2.05; margin: 0; overflow-wrap: anywhere;
}
.tf-src { display: block; margin-top: .3rem; font-size: .8rem; color: var(--muted); }
.tf-src-line { margin: 0; font-size: .8rem; color: var(--muted); }
.tf-missing { color: var(--muted) !important; font-style: italic; font-size: .9rem !important; }
.tf-soon-wrap { margin: .6rem 0 0; }
.tf-toc-meta { text-align: center; color: var(--muted); font-size: .92rem; margin: -.6rem 0 1.2rem; font-variant-numeric: lining-nums; }

/* cards view */
.tf-read .rd-seg.tf-seg { font-size: 1rem; }
.tf-read .tf-seg .seg-ar.tf-bayt { line-height: 2.05; font-size: 1.7rem; font-size: clamp(1.35rem, 2.6vw, 1.7rem); max-width: 48rem; -webkit-margin-start: auto; -webkit-margin-end: auto; margin-inline: auto; }
.tf-read .tf-seg .seg-no { font-size: 1rem; }
.tf-read .ap-read-panel { padding: 6px 8px; }

/* Bok: the verse wider than the Norwegian */
@media (min-width: 860px) {
  .tf-book .qd-row.is-bayt { grid-template-columns: 1fr 1.3fr; align-items: center; }
  .tf-book .qd-row.is-bayt .qd-no { padding-top: 0; }
}
.tf-book .qd-row.is-bayt .qd-ar { text-align: initial; text-align-last: auto; }
.tf-book.only-ar .qd-row.is-bayt { max-width: 46rem; }
.tf-book.only-ar .qd-row.is-bayt + .qd-row.is-bayt { padding-top: .2rem; }
.tf-book .qd-row .qd-no.tf-missing { border-inline-start-style: dashed; }
.tf-row-ex { padding: 0 0 .9rem; }
@media (min-width: 860px) { .tf-book:not(.only-no):not(.only-ar) .tf-row-ex { -webkit-padding-start: 43.5%; padding-inline-start: 43.5%; } }
.tf-book.only-no .tf-row-ex .tf-ex-ar { font-size: 1.25rem; }

/* ---------- coloured tajweed examples ---------- */
.tj { color: var(--tl); }
.tf-chip i { background: var(--tl); }
:root[data-theme="dark"] .tj { color: var(--td); }
:root[data-theme="dark"] .tf-chip i { background: var(--td); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tj { color: var(--td); }
  :root:not([data-theme="light"]) .tf-chip i { background: var(--td); }
}

.tf-exs {
  margin: .7rem 0 .2rem; padding: .7rem .9rem .5rem; border-radius: 12px;
  background: var(--surface); background: color-mix(in srgb, var(--gold) 6%, var(--surface)); border: 1px solid var(--border); border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--border));
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .tf-exs { background: var(--surface); border: 1px solid var(--border); } }
.tf-exs-head {
  display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 .2rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
}
.tf-exs-head .ar { font-family: var(--font-ar); font-size: 1.05rem; letter-spacing: 0; text-transform: none; }
.tf-ex { margin: 0; padding: .35rem 0; }
.tf-ex + .tf-ex { border-top: 1px dashed var(--border); }
.tf-ex-ar {
  font-family: var(--font-ar); direction: rtl; text-align: right; margin: 0; color: var(--ink);
  font-size: 1.6rem; font-size: clamp(1.3rem, 2.4vw, 1.6rem); line-height: 2; overflow-wrap: anywhere;
}
.tf-ex figcaption { display: flex; flex-wrap: wrap; grid-gap: .3rem .8rem; gap: .3rem .8rem; align-items: center; font-size: .82rem; color: var(--muted); }
.tf-ref { font-variant-numeric: lining-nums; }
.tf-note { flex-basis: 100%; color: var(--ink); font-size: .9rem; }

.tf-chip { display: inline-flex; align-items: center; grid-gap: .4rem; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tf-chip i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; flex: none; }
.tf-chip .ar { font-family: var(--font-ar); font-weight: 400; color: var(--muted); font-size: 1rem; }

.tf-legend {
  display: flex; flex-wrap: wrap; align-items: center; grid-gap: .35rem 1rem; gap: .35rem 1rem; margin: 0 0 1rem; padding: .55rem .8rem;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); position: relative;
}
.tf-legend-h { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.tf-book .tf-legend { max-width: 40rem; margin: 0 auto 1.6rem; }
.tf-read .tf-legend { margin: .6rem 0; }
.ar-present-body > .tf-legend { margin-top: 1rem; }

/* ---------- Lysbilder ---------- */
.tf-slide-bayt { font-family: var(--font-ar); direction: rtl; display: flex; flex-direction: column; grid-gap: .2rem; gap: .2rem; width: 100%; max-width: 46rem; -webkit-margin-start: auto; -webkit-margin-end: auto; margin-inline: auto; }
.tf-slide-bayt p { margin: 0; font-size: 2.5rem; font-size: clamp(1.6rem, 3.6vw, 2.5rem); line-height: 1.95; overflow-wrap: anywhere; color: var(--ink); }
.tf-slide-bayt .tf-sadr { text-align: right; -webkit-padding-end: 12%; padding-inline-end: 12%; }
.tf-slide-bayt .tf-ajuz { text-align: left; -webkit-padding-start: 12%; padding-inline-start: 12%; }
.tf-slide-bayt .qd-num.ar { font-size: .5em; }
@media (max-width: 559px) {
  .tf-slide-bayt .tf-sadr { -webkit-padding-end: 0; padding-inline-end: 0; }
  .tf-slide-bayt .tf-ajuz { -webkit-padding-start: 1.2em; padding-inline-start: 1.2em; }
}
.tf-slide-p { font-size: 1.9rem; font-size: clamp(1.35rem, 2.8vw, 1.9rem); text-align: justify; text-align-last: center; }
.tf-slide-ex { text-align: center; }
.tf-slide-kicker { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.tf-slide-ex-ar { font-family: var(--font-ar); direction: rtl; margin: 0; font-size: 3rem; font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 2; overflow-wrap: anywhere; color: var(--ink); }
.tf-slide-ref { display: flex; flex-wrap: wrap; justify-content: center; grid-gap: .4rem 1.2rem; gap: .4rem 1.2rem; margin: 0; color: var(--muted); }
.qd-view.is-slides:fullscreen .tf-slide-bayt p { font-size: 4rem; font-size: clamp(2.2rem, 4.6vw, 4rem); }
.qd-view.is-slides:fullscreen .tf-slide-ex-ar { font-size: 4.6rem; font-size: clamp(2.4rem, 5.4vw, 4.6rem); }

/* contents: the intro card */
.tf-intro-card { border-color: var(--border); border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); background: linear-gradient(135deg, var(--surface), var(--surface)); background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 8%, var(--surface)), var(--surface)); }
@supports not (color: color-mix(in srgb, red 50%, blue)) { .tf-intro-card { border-color: var(--border); background: linear-gradient(135deg, var(--surface), var(--surface)); } }
.tf-intro-card .ap-card-num { color: var(--gold); }

/* home: the Tajwid block */
.tf-home .qd-feature { margin-top: .4rem; }

.tf-row, .tf-seg { scroll-margin-top: 90px; }
@media print { .tf-legend { break-inside: avoid; } .tf-exs { break-inside: avoid; } }
.tf .qd-toc { align-items: start; }

/* reviewed sharh under each bayt (0411): level switch + «Enkel forklaring» */
.tf-sh { margin-top: .7rem; display: grid; grid-gap: .5rem; gap: .5rem; }
.tf-sh-d { border: 1px solid var(--line, rgba(127,127,127,.28)); border-radius: 12px; }
.tf-sh-d > summary { display: flex; justify-content: space-between; align-items: center; grid-gap: .8rem; gap: .8rem; cursor: pointer; padding: .6rem .9rem; font-weight: 600; font-size: .95rem; color: var(--ink); list-style: none; min-height: 44px; }
.tf-sh-d > summary::-webkit-details-marker { display: none; }
.tf-sh-d > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.tf-sh-d[open] > summary::after { content: "\2212"; }
.tf-sh-d > summary .ar { font-family: var(--font-ar); font-weight: 600; -webkit-margin-start: auto; margin-inline-start: auto; }
.tf-sh-sw { display: flex; width: fit-content; max-width: calc(100% - 1.4rem); margin: 0 .7rem .6rem; }
.tf-sh-sw button { flex: 1 1 auto; font-family: var(--font-ar); font-size: 1rem; min-height: 40px; }
.tf-sh-body { padding: 0 .9rem .9rem; }
.tf-sh-ar { font-family: var(--font-ar); font-size: 1.15rem; line-height: 2; text-align: right; }
.tf-sh-sec + .tf-sh-sec { margin-top: .8rem; }
.tf-sh-sec h4 { margin: 0 0 .3rem; font-size: .95rem; color: var(--accent); }
.tf-sh-ar .tf-sh-sec h4 { font-size: 1.1rem; }
.tf-sh-p p { margin: 0 0 .35rem; }
.tf-sh-no .tf-sh-p p { line-height: 1.65; }
.tf-sh-src { margin: 0 0 .5rem; }
.tf-sh-src summary { cursor: pointer; font-size: .78rem; color: var(--muted); font-family: var(--font-body, inherit); }
.tf-sh-src span { display: block; font-size: .8rem; line-height: 1.6; color: var(--muted); font-family: var(--font-body, inherit); direction: rtl; text-align: right; }
.tf-sh-no .tf-sh-src span { direction: ltr; text-align: left; }
@media (min-width: 700px) { .tf-sh { max-width: 48rem; -webkit-margin-start: auto; -webkit-margin-end: auto; margin-inline: auto; } }
@media print { .tf-sh-d:not([open]) { display: none; } }

/* Hikam: the hikma text opens its sharh on tap */
.tf-seg:has(.tf-sh-d) .hk-h, .tf-row:has(.tf-sh-d) .hk-h { cursor: pointer; }

/* tvfb: flex gap fallback (html.no-flexgap set by compat.js) */
.no-flexgap .tf-ex figcaption > * + * { -webkit-margin-start: .8rem; }
.no-flexgap .tf-ex figcaption > * { margin-bottom: .3rem; }
.no-flexgap .tf-chip > * + * { -webkit-margin-start: .4rem; }
.no-flexgap .tf-legend > * + * { -webkit-margin-start: 1rem; }
.no-flexgap .tf-legend > * { margin-bottom: .35rem; }
.no-flexgap /* ---------- Lysbilder ---------- */
.tf-slide-bayt > * + * { margin-top: .2rem; }
.no-flexgap .tf-slide-ref > * + * { -webkit-margin-start: 1.2rem; }
.no-flexgap .tf-slide-ref > * { margin-bottom: .4rem; }
.no-flexgap .tf-sh-d > summary > * + * { -webkit-margin-start: .8rem; }
