/* ------------------------------------------------------------ Quran slide ---
   Epic onfiremobile-r5nk2, bead .4. Loaded after styles.css. Rendered by
   slide-quran.js. Reverent and still: deep teal ground, a single soft gold
   glow, no motion, generous air. Sizes use clamp()/vmin only so a 1280x720 Pi
   and a 4K panel read the same.

   Arabic typography rules (DESIGN.md §7), each one load-bearing:
   - line-height >= 2.1: Uthmani harakat above and below collide, and the
     stage's overflow:hidden would clip the top marks of the first line.
   - letter-spacing normal, no text-transform, no font-synthesis: spacing
     breaks Arabic joining.
   - unicode-bidi: isolate, so an RTL block never reorders its LTR neighbours. */

.ns-quran {
    position: relative;
    background:
        radial-gradient(90% 70% at 50% -10%, rgba(15, 118, 110, 0.38) 0%, transparent 70%),
        radial-gradient(130% 120% at 50% 0%, #0b2623 0%, #061513 55%, #030a09 100%);
    color: #f6f1e4;
    justify-content: space-between;
    align-items: center;
    padding-block: clamp(20px, 4vmin, 72px) clamp(16px, 3vmin, 52px);
    gap: clamp(8px, 1.6vmin, 28px);
}
.ns-qr-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(55% 45% at 50% 48%, rgba(212, 175, 55, 0.09) 0%, transparent 72%);
}

/* --- surah info ---------------------------------------------------- */
.ns-qr-head {
    position: relative;
    z-index: 1;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.5vmin, 10px);
    text-align: center;
}
.ns-qr-surah-ar {
    font-family: 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    font-synthesis: none;
    letter-spacing: normal;
    unicode-bidi: isolate;
    font-size: clamp(20px, 4.2vmin, 90px);
    line-height: 1.9;
    color: #d4af37;
}
.ns-qr-surah-meta {
    font-size: clamp(12px, 1.8vmin, 32px);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(246, 241, 228, 0.6);
}
.ns-qr-dot { margin-inline: 0.7em; color: rgba(212, 175, 55, 0.7); }

/* --- the paged area ------------------------------------------------ */
.ns-qr-stage {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    width: 84vw;
    max-width: 84vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ns-qr-page {
    --qr-fit: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(clamp(10px, 2.6vmin, 52px) * var(--qr-fit));
    text-align: center;
}
.ns-qr-ar {
    font-family: 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    font-weight: 400;
    font-synthesis: none;
    letter-spacing: normal;
    word-spacing: 0.06em;
    unicode-bidi: isolate;
    direction: rtl;
    line-height: 2.2;
    /* Room for the marks above the first line and below the last. */
    padding-block: 0.12em;
    color: #fbf7ec;
    text-wrap: balance;
}
.ns-qr-end {
    display: inline-block;
    margin-inline-start: 0.28em;
    color: #d4af37;
    font-size: 0.82em;
    unicode-bidi: isolate;
}
.ns-qr-cont {
    display: inline-block;
    /* The page's own trailing space already separates it. */
    margin-inline-start: 0.05em;
    color: rgba(212, 175, 55, 0.85);
}
.ns-qr-tr {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-style: italic;
    line-height: 1.38;
    unicode-bidi: isolate;
    color: rgba(246, 241, 228, 0.82);
    /* A reading measure, not the stage width: at 84vw a paragraph of
       translation ran ~150 characters a line. em resolves against this
       element's own font-size, so the cap scales with --qr-fit; the 64vw
       floor keeps a shrunken paragraph from collapsing into a narrow column. */
    max-width: min(100%, max(46em, 64vw));
    text-wrap: pretty;
}
/* A pause mark stays on the line of the word before it (quranArabicHtml). */
.ns-qr-nb { white-space: nowrap; }
/* A page with the Arabic above the translation gets a hairline between them. */
.ns-qr-ar + .ns-qr-tr {
    padding-top: calc(clamp(10px, 2.2vmin, 40px) * var(--qr-fit));
    border-top: 1px solid rgba(212, 175, 55, 0.22);
}

/* font_size. The vmin term governs; --qr-fit is written by slide-quran.js. */
.ns-qr-sm .ns-qr-ar { font-size: calc(clamp(22px, 5.6vmin, 120px) * var(--qr-fit)); }
.ns-qr-md .ns-qr-ar { font-size: calc(clamp(26px, 7vmin, 150px) * var(--qr-fit)); }
.ns-qr-lg .ns-qr-ar { font-size: calc(clamp(30px, 8.6vmin, 184px) * var(--qr-fit)); }
.ns-qr-sm .ns-qr-tr { font-size: calc(clamp(15px, 2.9vmin, 62px) * var(--qr-fit)); }
.ns-qr-md .ns-qr-tr { font-size: calc(clamp(17px, 3.5vmin, 76px) * var(--qr-fit)); }
.ns-qr-lg .ns-qr-tr { font-size: calc(clamp(19px, 4.3vmin, 92px) * var(--qr-fit)); }

/* --- reference + attribution: never paged, never hidden ---------------- */
.ns-qr-foot {
    position: relative;
    z-index: 1;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(4px, 0.8vmin, 14px);
    text-align: center;
    max-width: 90vw;
}
.ns-qr-ref {
    display: flex;
    align-items: center;
    gap: 0.8em;
    font-size: clamp(13px, 2vmin, 36px);
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #d4af37;
}
.ns-qr-pages {
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(246, 241, 228, 0.55);
    font-variant-numeric: tabular-nums;
}
.ns-qr-pages:empty { display: none; }
.ns-qr-attr {
    font-size: clamp(13px, 1.75vmin, 30px);
    line-height: 1.35;
    color: rgba(246, 241, 228, 0.62);
    letter-spacing: 0.01em;
}

/* --- loading / degraded --------------------------------------------- */
.ns-qr-msg .ns-qr-stage { gap: clamp(10px, 2vmin, 32px); }
.ns-qr-star {
    position: relative;
    width: clamp(28px, 5vmin, 84px);
    height: clamp(28px, 5vmin, 84px);
    margin-bottom: clamp(4px, 1vmin, 16px);
}
.ns-qr-star span {
    position: absolute;
    inset: 14%;
    border: 1.5px solid rgba(212, 175, 55, 0.75);
}
.ns-qr-star span + span { transform: rotate(45deg); }
.ns-qr-loading .ns-qr-star { opacity: 0.55; }
.ns-qr-msg-title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: clamp(22px, 4.4vmin, 84px);
    font-weight: 600;
    color: #f6f1e4;
    text-align: center;
}
.ns-qr-msg-sub {
    font-size: clamp(13px, 2.1vmin, 36px);
    color: rgba(246, 241, 228, 0.58);
    text-align: center;
}

/* ------------------------------------------------ calligraphy display style ---
   settings.display_style 'calligraphy' (DESIGN §11). The same verbatim verse on
   an illuminated parchment page: Amiri Quran Colored (OFL, self-hosted in
   fonts/, licence fonts/OFL-Amiri.txt), an Aref Ruqaa cartouche, and original
   ornaments. Everything is scoped under .ns-qr-art, so the standard style is
   untouched. Still no motion. Arabic rules from the header still hold:
   line-height >= 2.1, normal letter-spacing, no synthesis, isolate. */

@font-face {
    font-family: 'Amiri Quran Colored';
    src: url('fonts/AmiriQuranColored.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
/* A calmer ink for the coloured marks. Recolours glyph layers only; the text
   is untouched. Browsers without font-palette keep the font's own colours. */
@font-palette-values --qr-ink {
    font-family: 'Amiri Quran Colored';
    override-colors: 0 #9a2b22, 1 #0f766e, 2 #a8741a, 3 #1f4e79;
}

.ns-quran.ns-qr-art {
    padding: clamp(10px, 2.4vmin, 44px);
    gap: 0;
    justify-content: center;
    align-items: stretch;
}
.ns-qr-art-page {
    --qr-rule: clamp(2px, 0.45vmin, 8px);
    --qr-ring: clamp(4px, 1.1vmin, 20px);
    --qr-corner: clamp(22px, 4.8vmin, 88px);
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: clamp(6px, 1.2vmin, 22px);
    padding: clamp(18px, 4.4vmin, 84px) clamp(26px, 6vmin, 110px) clamp(14px, 3.2vmin, 58px);
    background: radial-gradient(120% 95% at 50% 45%, #fbf5e6 0%, #f4ead3 58%, #e9d9b5 100%);
    color: #231a10;
    border: var(--qr-rule) solid #b8892e;
    border-radius: clamp(2px, 0.5vmin, 8px);
    box-shadow:
        inset 0 0 0 var(--qr-ring) rgba(244, 234, 211, 0),
        inset 0 0 0 calc(var(--qr-ring) + clamp(1px, 0.2vmin, 3px)) #0f766e,
        0 0 0 1px rgba(212, 175, 55, 0.35),
        0 clamp(6px, 1.4vmin, 24px) clamp(20px, 4vmin, 70px) rgba(0, 0, 0, 0.45);
}
/* The teal line is the outer edge of an inset ring; this paints the ring's
   inside back to parchment so only a hairline shows. */
.ns-qr-art-page::before {
    content: '';
    position: absolute;
    inset: calc(var(--qr-ring) + clamp(1px, 0.2vmin, 3px));
    background: radial-gradient(120% 95% at 50% 45%, #fbf5e6 0%, #f4ead3 58%, #ecdebd 100%);
    border-radius: 1px;
    pointer-events: none;
}
.ns-qr-art-page > * { position: relative; z-index: 1; }
.ns-qr-art-page > .ns-qr-art-frame { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.ns-qr-art-corner {
    position: absolute;
    width: var(--qr-corner);
    height: var(--qr-corner);
    color: #b8892e;
}
.ns-qr-art-tl { top: 0; left: 0; transform: translate(calc(-50% - var(--qr-rule) / 2), calc(-50% - var(--qr-rule) / 2)); }
.ns-qr-art-tr { top: 0; right: 0; transform: translate(calc(50% + var(--qr-rule) / 2), calc(-50% - var(--qr-rule) / 2)); }
.ns-qr-art-bl { bottom: 0; left: 0; transform: translate(calc(-50% - var(--qr-rule) / 2), calc(50% + var(--qr-rule) / 2)); }
.ns-qr-art-br { bottom: 0; right: 0; transform: translate(calc(50% + var(--qr-rule) / 2), calc(50% + var(--qr-rule) / 2)); }
.ns-qr-art-mid {
    position: absolute;
    width: calc(var(--qr-corner) * 0.3);
    height: calc(var(--qr-corner) * 0.3);
    background: #b8892e;
    box-shadow: 0 0 0 clamp(1px, 0.25vmin, 4px) #f4ead3;
}
.ns-qr-art-ml { top: 50%; left: 0; transform: translate(calc(-50% - var(--qr-rule) / 2), -50%) rotate(45deg); }
.ns-qr-art-mr { top: 50%; right: 0; transform: translate(calc(50% + var(--qr-rule) / 2), -50%) rotate(45deg); }
.ns-qr-art-mb { bottom: 0; left: 50%; transform: translate(-50%, calc(50% + var(--qr-rule) / 2)) rotate(45deg); }

/* --- surah cartouche ------------------------------------------------ */
.ns-qr-art-head { gap: clamp(2px, 0.6vmin, 12px); }
.ns-qr-art-cartouche {
    display: inline-flex;
    align-items: center;
    gap: clamp(8px, 1.6vmin, 28px);
    max-width: 70vw;
    padding: clamp(1px, 0.2vmin, 4px) clamp(8px, 1.6vmin, 30px);
    border: clamp(1.5px, 0.3vmin, 5px) solid #b8892e;
    border-radius: 999px;
    background: linear-gradient(180deg, #f9f2e1 0%, #eee0c0 100%);
    box-shadow:
        inset 0 0 0 clamp(2px, 0.45vmin, 8px) #f7efdc,
        inset 0 0 0 calc(clamp(2px, 0.45vmin, 8px) + 1px) rgba(184, 137, 46, 0.85);
    color: #b8892e;
}
.ns-qr-art-star { flex: none; width: clamp(14px, 2.6vmin, 46px); height: clamp(14px, 2.6vmin, 46px); }
.ns-qr-art-surah {
    font-family: 'Aref Ruqaa', 'Amiri Quran', 'Noto Naskh Arabic', serif;
    font-weight: 400;
    font-synthesis: none;
    letter-spacing: normal;
    unicode-bidi: isolate;
    font-size: clamp(20px, 4.4vmin, 92px);
    line-height: 1.75;
    white-space: nowrap;
    color: #7a5418;
}
.ns-qr-art .ns-qr-surah-meta { color: #0f766e; }
.ns-qr-art .ns-qr-dot { color: #b8892e; }

/* --- verse ------------------------------------------------------------ */
.ns-qr-art .ns-qr-stage { width: 76vw; max-width: 76vw; }
.ns-qr-art .ns-qr-ar {
    font-family: 'Amiri Quran Colored', 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    font-palette: --qr-ink;
    line-height: 2.3;
    color: #231a10;
}
.ns-qr-art .ns-qr-tr { color: #4a3a28; }
.ns-qr-art .ns-qr-cont { color: #a8741a; }
.ns-qr-art-end {
    display: inline-grid;
    place-items: center;
    width: 1.3em;
    height: 1.3em;
    margin-inline-start: 0.22em;
    vertical-align: -0.28em;
    color: #b8892e;
    unicode-bidi: isolate;
}
.ns-qr-art-end > * { grid-area: 1 / 1; }
.ns-qr-art-end svg { width: 100%; height: 100%; display: block; }
.ns-qr-art-num {
    font-family: 'Amiri Quran', 'Amiri Quran Colored', serif;
    font-size: 0.46em;
    line-height: 1;
    color: #7a5418;
    transform: translateY(0.06em);
}
.ns-qr-art-num[data-digits="2"] { font-size: 0.38em; }
.ns-qr-art-num[data-digits="3"] { font-size: 0.3em; }
.ns-qr-art-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.95em;
    font-size: calc(clamp(8px, 1.3vmin, 22px) * var(--qr-fit));
}
.ns-qr-art-sep i { display: block; width: 0.6em; height: 0.6em; background: #b8892e; transform: rotate(45deg); }
.ns-qr-art-sep i:nth-child(2) { width: 0.95em; height: 0.95em; background: #0f766e; box-shadow: 0 0 0 0.18em #f4ead3, 0 0 0 0.3em #b8892e; }

/* --- foot, inside the page ------------------------------------------------ */
.ns-qr-art .ns-qr-foot { max-width: 80vw; }
.ns-qr-art .ns-qr-ref { color: #0f766e; }
.ns-qr-art .ns-qr-pages { color: rgba(35, 26, 16, 0.55); }
.ns-qr-art .ns-qr-attr { color: #5b4a36; }
