/* Bahethat 2026 theme: WordPress-specific additions on top of site.css (loaded right after it).
   Only things the static design did not need: admin bar offset, menu states from WordPress, editor content
   (alignments, captions, galleries, tables, links), the generic page/listing layout, and an unscoped pager. */

/* ---------- Admin bar: keep the sticky masthead under it ---------- */
.admin-bar .masthead { top: 32px; }
@media (max-width: 782px) { .admin-bar .masthead { top: 46px; } }
@media (max-width: 600px) { .admin-bar .masthead { top: 0; } }

/* ---------- Main nav states coming from the WordPress menu ---------- */
.mainnav > li.current-menu-ancestor > button,
.mainnav > li.current-menu-parent > button { color: var(--wine); font-weight: 500; }
.mainnav > li.current-menu-ancestor > button::after,
.mainnav > li.current-menu-parent > button::after { transform: scaleX(1); }
.mega a[aria-current="page"] strong { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 5px; }
/* A mega panel with one column of short items (no descriptions) stays compact */
.mega:not(:has(a > span)) { width: 420px; }
.mega-soon { display: flex; flex-direction: column; padding: 10px 12px; color: var(--grey-ink); cursor: default; }
.mega-soon strong { font-weight: 500; }
.drawer details li .drawer-soon { display: flex; align-items: center; min-height: 44px; padding-inline-start: 16px; color: var(--grey-ink); }
.drawer .drawer-link[aria-current="page"], .drawer details li a[aria-current="page"] { color: var(--wine); }

/* ---------- Screen-reader text used by WordPress core output ---------- */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { position: static !important; width: auto; height: auto; margin: 0; clip: auto; background: var(--panel); color: var(--wine); padding: 8px 12px; }

/* ---------- Editor content inside .prose ---------- */
.prose a:not([class]) { color: var(--wine); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.prose a:not([class]):hover { text-decoration-color: currentColor; }
.prose img { height: auto; }
.prose figure, .prose .wp-caption { max-width: 100%; }
.prose .wp-caption-text, .prose figcaption { margin-top: 8px; font-size: .875rem; line-height: 1.7; color: var(--grey-ink); }
.prose .alignright { float: right; margin: .3em 0 1em 1.5em; max-width: 50%; }
.prose .alignleft { float: left; margin: .3em 1.5em 1em 0; max-width: 50%; }
.prose .aligncenter { display: block; margin-inline: auto; }
.prose::after { content: ""; display: table; clear: both; }
.prose ol:not([class]) { padding-inline-start: 1.4em; list-style: decimal; }
.prose ol:not([class]) li::marker { color: var(--gold-ink); font-weight: 500; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.7; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 8px 12px; text-align: start; vertical-align: top; }
.prose th { background: var(--beige-50); color: var(--wine); font-weight: 500; }
.prose hr { border: 0; height: 1px; background: var(--rule); margin: 2em 0; }
.prose iframe, .prose video, .prose embed, .prose object { max-width: 100%; }
.prose .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.prose .gallery-item { margin: 0; }
.prose .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }
@media (max-width: 760px) {
  .prose .alignright, .prose .alignleft { float: none; margin: 0 0 1em; max-width: 100%; }
}

/* ---------- Generic page and listing (page.php, index.php) ---------- */
.gen-page, .gen-list { padding-bottom: var(--section); }
.gen-meta { margin: -8px 0 20px; }
.gen-figure { max-width: 44rem; margin: 0 0 28px; }
.gen-figure img { width: 100%; height: auto; box-shadow: var(--shadow-1); }
.gen-body { max-width: 44rem; }
.page-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .9375rem; }
.page-links a, .page-links > span:not(:first-child) { display: inline-grid; place-items: center; min-width: 44px; height: 44px; border: 1px solid var(--rule-2); background: var(--panel); }
.gen-items { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 3vw, 48px); border-top: 1px solid var(--wine); }
.gen-item .label { font-size: .8125rem; }
.gen-title { font-weight: 500; font-size: 1.0625rem; line-height: 1.6; }
.gen-item:hover .gen-title { color: var(--wine); }
.gen-excerpt { font-size: .9375rem; color: var(--grey-ink); line-height: 1.8; }
.gen-empty { display: grid; gap: 20px; max-width: 44rem; padding-block: 16px; }
.pagehead-aside { min-width: 0; }
@media (max-width: 760px) {
  .gen-items { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Pager (same look as the archives bundle, available on every template) ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 6px; margin-top: 36px; }
.pager ol { display: flex; gap: 6px; align-items: center; }
.pager li a { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding-inline: 6px; border: 1px solid var(--rule-2); background: var(--panel); color: var(--ink); font-weight: 500; transition: border-color .2s, color .2s; }
.pager li a:hover { border-color: var(--wine); color: var(--wine); }
.pager li a[aria-current="page"] { background: var(--wine); border-color: var(--wine); color: var(--on-wine); }
.pager .gap { color: var(--grey-ink); padding-inline: 4px; }
.pager .pg-step { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; color: var(--wine); font-weight: 500; }
.pager .pg-step[aria-disabled="true"] { color: var(--grey-ink); opacity: .6; }
.pager .pg-step .icon { width: 16px; height: 16px; }
.pager .pg-where { flex-basis: 100%; text-align: center; font-size: .875rem; color: var(--grey-ink); }
@media (max-width: 760px) {
  .pager { gap: 6px 2px; }
  .pager ol { gap: 4px; }
  .pager .far { display: none; }
}

/* ---------- Footer columns: any number of menu columns stays on one row on wide screens ---------- */
@media (min-width: 1001px) {
  .footer .cols { grid-template-columns: minmax(0, 4fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 2.6fr); }
}

/* =====================================================================
   Content-template additions (requested by the content templates)
   ===================================================================== */

/* ---------- Typographic cover in the wine hero (items without a featured image) ----------
   A portrait 9:16 "volume" in the brand language: deep wine board, the official knot-wings pattern
   painted with --ornament, an inset gold frame, the brand mark and the imprint. Optional children:
   .tc-kind (section label) and .tc-title (the item title, set in Neo Sans) between the mark and the imprint. */
.hero-cover.typo { margin: 0; }
.hero-cover.typo .thumb.typo {
  --tw: auto; height: 400px; width: auto; aspect-ratio: 9 / 16;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 36px 26px; text-align: center; overflow: hidden;
  background: linear-gradient(160deg, var(--wine-800), var(--wine-900) 70%); color: var(--gold);
  box-shadow: inset -8px 0 10px -6px rgba(0, 0, 0, .45), 0 22px 44px rgba(0, 0, 0, .45);
}
.hero-cover.typo .thumb.typo::before {
  background: color-mix(in srgb, var(--ornament) 20%, transparent);
  -webkit-mask: var(--pat-knotwings) center / 66px 54.6px repeat; mask: var(--pat-knotwings) center / 66px 54.6px repeat;
}
/* Inset gold frame, like the rule around the guide's cover plates */
.hero-cover.typo .thumb.typo::after {
  content: ""; position: absolute; inset: 12px; z-index: -1; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  box-shadow: inset 0 0 0 4px var(--wine-900), inset 0 0 0 5px color-mix(in srgb, var(--gold) 30%, transparent);
}
.hero-cover.typo .mark { width: 48px; height: 53px; color: var(--gold); }
.hero-cover.typo .tc-kind { font-size: .8125rem; font-weight: 500; color: var(--gold); display: inline-flex; align-items: center; gap: 6px; }
.hero-cover.typo .tc-kind::before { content: ""; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); }
.hero-cover.typo .tc-title {
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 400; font-size: 1.125rem; line-height: 1.65; color: #fff;
  padding-block: 12px; border-block: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
}
.hero-cover.typo .imprint { font-weight: 300; font-size: 1.5rem; line-height: 1.2; color: var(--on-wine); letter-spacing: .02em; }
@media (max-width: 1240px) { .hero-cover.typo .thumb.typo { height: 360px; } }
@media (max-width: 760px) {
  .hero-cover.typo .thumb.typo { height: 300px; padding: 26px 18px; gap: 10px; }
  .hero-cover.typo .mark { width: 38px; height: 42px; }
  .hero-cover.typo .tc-title { font-size: 1rem; -webkit-line-clamp: 5; }
}

/* ---------- Hero tools: text buttons (listen, download) next to the icon buttons ---------- */
.page-hero .tools { flex-wrap: wrap; align-items: center; }
.page-hero .tools .btn.on-wine { min-height: 44px; padding: 0 16px; gap: 8px; font-size: .9375rem; color: var(--on-wine); border-color: color-mix(in srgb, var(--beige) 40%, transparent); }
.page-hero .tools .btn.on-wine .icon { width: 18px; height: 18px; color: var(--gold); }
.page-hero .tools .btn.on-wine:hover { background: color-mix(in srgb, var(--on-wine) 10%, transparent); border-color: var(--on-wine); }

/* ---------- Conclusion (the item's `conclusion` field, after the body) ---------- */
.prose .conclusion {
  position: relative; margin-block: 1.6em 1.2em; padding: 20px 22px 6px;
  background: var(--panel); border: 1px solid var(--rule); border-inline-start: 3px solid var(--gold);
  font-size: .97em; line-height: 1.95;
}
.prose .conclusion::before {
  content: "الخلاصة"; content: "الخلاصة" / ""; /* decorative: the section already has aria-label */
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  font-size: 1.0625rem; font-weight: 500; color: var(--wine);
}
.prose .conclusion > * { margin: 0 0 .9em; }
.prose .conclusion strong { color: var(--wine); }

/* ---------- Long unbroken strings (URLs in notes, sources, bios) never widen the page ---------- */
.prose, .endnotes, .sn, .sn-body, .fn-pop, .author-box, .ab-bio, .bookdata, .src-note, .rel-card, .pn-card { overflow-wrap: anywhere; }
.prose a, .endnotes a, .sn-body a, .fn-pop a, .author-box a { word-break: break-word; }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }

/* ---------- Extra notes block (div.notes-extra, appended by the footnote renderer) ----------
   Reference lists and «المصدر» lines kept from the legacy content: set like the sidenotes (small grey type
   under a gold rule with a diamond), each paragraph takes its own direction so Latin references read LTR. */
.notes-extra {
  position: relative; max-width: 44rem; margin-top: 2.2em !important; padding-top: 16px;
  border-top: 2px solid var(--gold); font-size: .9375rem; line-height: 1.9; color: var(--grey-ink); overflow-wrap: anywhere;
}
.notes-extra::before { content: ""; position: absolute; top: -7px; inset-inline-start: 0; width: 12px; height: 12px; background: var(--gold); transform: rotate(45deg); }
.notes-extra > *, .notes-extra li { unicode-bidi: plaintext; text-align: start; }
.notes-extra > * { margin: 0 0 .7em; }
.notes-extra > :last-child { margin-bottom: 0; }
.notes-extra ol, .notes-extra ul { padding-inline-start: 1.4em; }
.notes-extra ol { list-style: decimal; }
.notes-extra li + li { margin-top: .35em; }
.notes-extra strong, .notes-extra b { font-weight: 500; color: var(--ink); }
.notes-extra h2, .notes-extra h3, .notes-extra h4 { display: block; margin: 0 0 .5em; font-size: 1rem; font-weight: 500; color: var(--wine); }
.notes-extra h2::before { display: none; }
.notes-extra a { color: var(--wine); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; word-break: break-word; }
.notes-extra img { max-width: 100%; height: auto; }

/* ---------- Quranic verses (span.quran, wrapped by the footnote renderer) ----------
   The one exception to «Neo Sans only»: Neo Sans Arabic has no Quranic annotation marks (U+06D6-06ED,
   U+08D3-08FF), so verse text uses the self-hosted Noto Naskh Arabic ("BH Quran", fonts.css). It is not
   preloaded: browsers fetch it only on pages that contain a .quran element. */
.prose .quran, .sn-body .quran, .endnotes .quran, .conclusion .quran, .fn-pop .quran, .notes-extra .quran {
  font-family: "BH Quran", "Neo Sans Arabic", serif; font-weight: 400; font-size: 1.05em; line-height: 2;
  direction: rtl; unicode-bidi: isolate;
}
