/* Popups (all looks): one frame for every popup, matching the Learn guide (learn-guides.js, "Popup layout").
 * Covers the wuḍūʾ guide (.wudu-*), the prayer and devotional guides (.prayer-guide), the worship
 * companion (.worship-detail-*) and the Qurʾān reader (.salah-quran-*). Frame only: header, art,
 * reading column, progress bar, buttons, spacing, sizing, phones. Inner content keeps its own styles.
 * Loaded after every other stylesheet (end of <body>). Selectors start html:not(#pop) (an id-level
 * weight) so these !important frame rules win over the guides' injected <style> blocks and the Modern
 * skin's long selectors. Each look keeps its own --ink/--paper/--muted/--line. The reading column is
 * --pop-measure wide: the 68ch Learn column in each look's body font (Classic DM Sans, Modern Inter). */

/* Look tokens (same values the Learn/wuḍūʾ shell uses). */
html:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){--ink:#142f34;--paper:#fbf8f1;--muted:#607075;--line:rgba(20,47,52,.18);--pop-shadow:0 28px 90px rgba(8,24,23,.34);--pop-title-font:'DM Sans',system-ui,sans-serif;--pop-measure:46.5rem}
html.salah-editorial:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){--pop-shadow:0 24px 90px rgba(0,0,0,.42);--pop-title-font:'Arial Narrow','Roboto Condensed','Helvetica Neue',Arial,sans-serif;--pop-measure:37.8rem}
html.salah-editorial[data-theme="dark"]:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){--ink:#fff;--paper:#000;--muted:#aaa;--line:rgba(255,255,255,.16)}
html.salah-editorial[data-theme="light"]:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){--ink:#050505;--paper:#fff;--muted:#5f625f;--line:rgba(5,5,5,.18)}

/* Backdrop: centred, same tint as Learn. */
html:not(#pop) body :is(.prayer-guide-overlay,.worship-detail-overlay,.salah-quran-overlay):not([hidden]){display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr)!important;place-items:center!important;padding:18px!important;background:rgba(15,31,30,.70)!important;backdrop-filter:blur(2px)!important;-webkit-backdrop-filter:blur(2px)!important}
html.salah-editorial:not(#pop) body :is(.prayer-guide-overlay,.worship-detail-overlay,.salah-quran-overlay):not([hidden]){background:rgba(0,0,0,.72)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}

/* Shell: sized to its content, up to min(88vh,900px); width min(860px,100%). */
html:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){box-sizing:border-box;position:relative;width:min(1080px,100%)!important;max-width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:min(88vh,900px)!important;margin:0!important;background:var(--paper)!important;color:var(--ink)!important;border:0!important;border-radius:26px!important;box-shadow:var(--pop-shadow)!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-shell,html:not(#pop) body .salah-quran-card{display:flex!important;flex-direction:column!important;overflow:hidden!important}
html:not(#pop) body :is(.prayer-guide,.worship-detail-card){display:block!important;padding:0!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain}

/* Header: kicker + calm title on the left, round close on the right, one hairline under it. */
html:not(#pop) body :is(.wudu-head,.pg-head,.worship-detail-head,.salah-quran-head){position:sticky!important;top:0!important;z-index:6!important;flex:0 0 auto;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:14px!important;grid-template-columns:none!important;margin:0!important;padding:18px 22px!important;background:var(--paper)!important;border:0!important;border-bottom:1px solid var(--line)!important;box-shadow:none!important;color:var(--ink)!important}
html:not(#pop) body :is(.pg-head,.worship-detail-head,.salah-quran-head) > div{flex:1 1 auto!important;min-width:0!important;margin:0!important;padding:0!important}
html:not(#pop) body :is(.wudu-kicker,.pg-head .eyebrow,.worship-detail-head .eyebrow,.salah-quran-head .eyebrow){margin:0!important;color:var(--muted)!important;font-family:inherit!important;font-size:.72rem!important;font-weight:700!important;letter-spacing:.14em!important;line-height:1.3!important;text-transform:uppercase!important}
html:not(#pop) body :is(.pg-head h2,.worship-detail-head h2,.salah-quran-head h2){margin:2px 0 0!important;color:var(--ink)!important;font-family:var(--pop-title-font)!important;font-size:clamp(1.45rem,3vw,2.25rem)!important;font-weight:700!important;line-height:1.25!important;letter-spacing:normal!important;text-transform:none!important}
html.salah-editorial:not(#pop) body :is(.pg-head h2,.worship-detail-head h2,.salah-quran-head h2){font-weight:800!important;letter-spacing:-.035em!important;text-transform:uppercase!important}
html:not(#pop) body :is(.pg-head small,.salah-quran-subtitle){display:block!important;margin:4px 0 0!important;color:var(--muted)!important;font-size:.86rem!important;line-height:1.4!important}
html:not(#pop) body :is(.wudu-close,.pg-close,.pg-back,.worship-detail-close,.salah-quran-close){position:static!important;inset:auto!important;flex:0 0 42px!important;width:42px!important;height:42px!important;min-width:42px!important;margin:0!important;padding:0!important;display:grid!important;place-items:center!important;border:1px solid var(--line)!important;border-radius:50%!important;background:transparent!important;color:var(--ink)!important;font-family:inherit!important;font-size:1.7rem!important;font-weight:400!important;line-height:1!important;box-shadow:none!important;transform:none!important;cursor:pointer}
html:not(#pop) body .pg-back{font-size:1.25rem!important}
html:not(#pop) body :is(.wudu-close,.pg-close,.pg-back,.worship-detail-close,.salah-quran-close):hover{border-color:var(--ink)!important;background:transparent!important;color:var(--ink)!important}

/* Reading column: the Learn formula (~68ch, label, title and text on one left edge). */
html:not(#pop) body .prayer-guide > :not(.pg-head):not(.pop-bar){margin-left:max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important;margin-right:max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important;max-width:none!important;width:auto!important}
html:not(#pop) body .prayer-guide > .pg-map{margin-top:clamp(20px,3.2vw,40px)!important}
html:not(#pop) body .prayer-guide > .pg-steps{margin-bottom:clamp(20px,3.2vw,40px)!important}
html:not(#pop) body .worship-detail-body{padding:clamp(20px,3.2vw,40px) max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important;background:transparent!important}
html:not(#pop) body .worship-detail-body > *{max-width:none!important}
html:not(#pop) body .salah-quran-card > :is(.salah-quran-reading-session,.salah-quran-reading-nav,.salah-quran-toolbar,.salah-quran-status){margin-left:max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important;margin-right:max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important;padding-left:0!important;padding-right:0!important}
html:not(#pop) body .salah-quran-card > .salah-quran-reading-session{align-self:flex-start!important;margin-top:16px!important}
html:not(#pop) body .salah-quran-card > .salah-quran-toolbar{border-left:0!important;border-right:0!important}
html:not(#pop) body .salah-quran-body{flex:1 1 auto!important;min-height:0!important;padding:clamp(18px,2.6vw,32px) max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important}

/* Prayer guide steps: one column, a hairline between steps, the posture figures as a compact strip
 * under the step number (not a side column), title and text below on the same left edge. */
html:not(#pop) body .prayer-guide .pg-steps{gap:0!important}
html:not(#pop) body .prayer-guide .pg-step{grid-template-columns:28px minmax(0,1fr)!important;grid-template-areas:"num pose" "copy copy"!important;gap:14px!important;align-items:start!important;padding:clamp(20px,3vw,30px) 0!important;background:transparent!important;border:0!important;border-top:1px solid var(--line)!important;border-radius:0!important;box-shadow:none!important}
html:not(#pop) body .prayer-guide .pg-step > .pg-step-num{grid-area:num!important}
html:not(#pop) body .prayer-guide .pg-step > :is(.pg-pose,.pg-pose-sequence){grid-area:pose!important;justify-self:start!important}
html:not(#pop) body .prayer-guide .pg-step > .pg-step-copy{grid-area:copy!important;min-width:0!important}
html:not(#pop) body .prayer-guide .pg-step > :not(.pg-step-num):not(.pg-pose):not(.pg-pose-sequence):not(.pg-step-copy){grid-column:1 / -1!important}
html:not(#pop) body .prayer-guide .pg-step .pg-pose{width:clamp(84px,13vw,116px)!important;height:clamp(170px,24vh,230px)!important;flex:0 0 auto!important}
html:not(#pop) body .prayer-guide .pg-step .pg-pose-sequence{max-width:100%!important;gap:8px!important}
html:not(#pop) body .prayer-guide .pg-step-title h3{font-family:var(--pop-title-font)!important;font-size:clamp(1.35rem,2.3vw,1.85rem)!important;font-weight:700!important;line-height:1.2!important;letter-spacing:-.005em!important;color:var(--ink)!important}
html.salah-editorial:not(#pop) body .prayer-guide .pg-step-title h3{font-weight:800!important;letter-spacing:-.02em!important}

/* Wuḍūʾ guide: the Learn layout; its step figure is functional, so it stays on every step as a banner. */
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-body{display:flex!important;flex-direction:column!important;flex:1 1 auto;min-height:0;overflow:hidden;grid-template-columns:none!important;grid-template-rows:none!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-art{flex:0 0 auto;height:clamp(150px,24vh,230px)!important;min-height:0!important;padding:8px!important;border-right:0!important;border-bottom:1px solid var(--line)!important;overflow:hidden}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-art{position:relative!important;display:block!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-art img{position:absolute!important;inset:8px!important;width:calc(100% - 16px)!important;height:calc(100% - 16px)!important;max-width:none!important;max-height:none!important;object-fit:contain!important;object-position:center center}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-classic-sprite{width:100%!important;height:100%!important;object-fit:contain!important;object-position:center bottom!important;transform:scale(1.9)!important;transform-origin:50% 96%!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-copy{flex:1 1 auto;min-height:0;overflow-y:auto;padding:clamp(20px,3.2vw,40px) max(clamp(20px,4.5vw,56px),calc((100% - var(--pop-measure)) / 2))!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-copy > *{max-width:none!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-copy h3{font-size:clamp(1.35rem,2.3vw,1.85rem)!important;line-height:1.2!important;letter-spacing:-.005em;margin:.35rem 0 .6rem!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-badge{margin:4px 0 14px!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-explain{font-size:1rem!important}
html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-foot{flex:0 0 auto;position:relative}

/* Slim progress bar: top of the footer (stepped popups) or the bottom edge (scrolling popups). */
.pop-bar{display:block;left:0;right:0;height:3px;background:var(--line);pointer-events:none}
.pop-bar > i{display:block;width:0;height:100%;background:var(--ink);transition:width .25s ease}
.wudu-foot > .pop-bar{position:absolute;top:0}
html:not(#pop) body :is(.prayer-guide,.worship-detail-card) > .pop-bar{position:sticky!important;bottom:0;z-index:6;margin:0!important}
html:not(#pop) body .salah-quran-card > .pop-bar{position:relative;flex:0 0 3px}
@media (prefers-reduced-motion:reduce){.pop-bar > i{transition:none}}

/* Phones: full screen, like Learn. */
@media (max-width:760px){
  html:not(#pop) body :is(.wudu-guide,.prayer-guide-overlay,.worship-detail-overlay,.salah-quran-overlay):not([hidden]){padding:0!important}
  html:not(#pop) body :is(.wudu-shell,.prayer-guide,.worship-detail-card,.salah-quran-card){width:100%!important;height:100dvh!important;max-height:none!important;border-radius:0!important}
  html:not(#pop) body :is(.wudu-head,.pg-head,.worship-detail-head,.salah-quran-head){padding:13px 16px!important}
  html:not(#pop) body .wudu-guide:not(.learn-guide) .wudu-art{height:clamp(120px,20vh,170px)!important}
  html:not(#pop) body .prayer-guide .pg-step{grid-template-columns:24px minmax(0,1fr)!important;gap:10px!important}
  html:not(#pop) body .prayer-guide .pg-step .pg-pose{width:clamp(74px,22vw,96px)!important;height:clamp(150px,22vh,190px)!important}
}
/* Posture figures stay side by side (a compact strip) at every width. */
html:not(#pop) body .prayer-guide .pg-step .pg-pose-sequence{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;align-items:flex-end!important}
html:not(#pop) body .prayer-guide .pg-step .pg-pose-stage{flex:0 0 auto!important;width:auto!important}
