/*
 * Tokayah — Arabic / RTL content styles
 *
 * Loaded only on pages with Arabic posts (see includes/rtl.php).
 * Everything is scoped to `.tokayah-rtl` / `[dir="rtl"]` so the LTR site
 * chrome (header, menus, footer) is untouched.
 *
 * Font: Cairo (Google Fonts, SIL OFL 1.1), self-hosted, variable 400–900.
 */

@font-face {
    font-family: 'Tokayah Arabic';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../assets/fonts/cairo/cairo-arabic.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* Latin glyphs of the same family, so English words and digits inside
   Arabic text match the Arabic letterforms. */
@font-face {
    font-family: 'Tokayah Arabic';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../assets/fonts/cairo/cairo-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Font scope ----------
   The theme's font rules all go through these custom properties, so
   overriding them on the RTL wrapper switches every descendant. */
.tokayah-rtl {
    --font-arabic: 'Tokayah Arabic', 'Rubik', Tahoma, 'Segoe UI', sans-serif;
    --font-primary: var(--font-arabic);
    --font-display: var(--font-arabic);
    --font-body: var(--font-arabic);
    --font-heading: var(--font-arabic);
    font-family: var(--font-arabic);
}

/* Arabic is a connected script: letter-spacing breaks the joins and
   uppercase is meaningless. */
.tokayah-rtl,
.tokayah-rtl * {
    letter-spacing: 0 !important;
}

.tokayah-rtl h1,
.tokayah-rtl h2,
.tokayah-rtl h3,
.tokayah-rtl h4,
.tokayah-rtl h5,
.tokayah-rtl h6 {
    text-transform: none;
    font-weight: 800;
    line-height: 1.5;
    text-align: right;
}

/* ---------- Single post header ---------- */
.tokayah-rtl.single-post-header h1 {
    line-height: 1.6;
}

.tokayah-rtl.single-post-header .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* ---------- Article body ---------- */
.tokayah-rtl .blog-content-block {
    font-size: 1.0625rem;
    line-height: 1.95;
    color: #1f2937;
}

.tokayah-rtl .blog-content-block p,
.tokayah-rtl.single-post-content .prose p {
    line-height: 1.95;
    text-align: right;
}

.tokayah-rtl .blog-content-block h1,
.tokayah-rtl .blog-content-block h2,
.tokayah-rtl .blog-content-block h3,
.tokayah-rtl .blog-content-block h4 {
    line-height: 1.55;
}

.tokayah-rtl .blog-content-block h5,
.tokayah-rtl .blog-content-block h6 {
    text-transform: none;
}

/* Lists */
.tokayah-rtl .blog-content-block ul,
.tokayah-rtl .blog-content-block ol,
.tokayah-rtl.single-post-content .prose ul,
.tokayah-rtl.single-post-content .prose ol {
    padding-left: 0;
    padding-right: 1.5em;
}

.tokayah-rtl .blog-content-block ul > li::before {
    left: auto;
    right: -1.1em;
    top: 0.85em;
}

.tokayah-rtl .blog-content-block ol {
    list-style: arabic-indic;
}

/* Quotes & highlight boxes: accent border on the reading-start side */
.tokayah-rtl .blog-content-block blockquote,
.tokayah-rtl .blog-content-block.blog-content--highlight,
.tokayah-rtl.single-post-content .prose blockquote {
    border-left: 0;
    border-right: 4px solid #dc2626;
}

/* Alignment: the block's default "left" means "start of line", which is the
   right side for Arabic. Only an explicit centre/justify changes it. */
.tokayah-rtl .blog-content-block.blog-content--align-left,
.tokayah-rtl .blog-content-block.blog-content--align-right,
.tokayah-rtl .blog-content-block.blog-content--align-left :is(p, h1, h2, h3, h4, h5, h6),
.tokayah-rtl .blog-content-block.blog-content--align-right :is(p, h1, h2, h3, h4, h5, h6) { text-align: right; }
.tokayah-rtl .blog-content-block.blog-content--align-center,
.tokayah-rtl .blog-content-block.blog-content--align-center :is(p, h1, h2, h3, h4, h5, h6) { text-align: center; }
.tokayah-rtl .blog-content-block.blog-content--align-justify p { text-align: justify; }

/* Heading accent bar sits on the right (start) for Arabic */
.tokayah-rtl .blog-content-block h2::after { margin-left: auto; margin-right: 0; }
.tokayah-rtl .blog-content-block.blog-content--align-center h2::after { margin-left: auto; margin-right: auto; }

/* Drop caps break Arabic letter joining — disable them */
.tokayah-rtl .blog-content-block.blog-content--dropcap > p:first-of-type::first-letter {
    float: none;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
}

/* Tables */
.tokayah-rtl .blog-content-block th,
.tokayah-rtl .blog-content-block td {
    text-align: right;
}

/* Code stays LTR */
.tokayah-rtl .blog-content-block pre,
.tokayah-rtl .blog-content-block code {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

@media (max-width: 767px) {
    .tokayah-rtl .blog-content-block { font-size: 1rem; }
}
