html { color-scheme: light; }
html[data-mode="dark"] {
    color-scheme: dark;
    --color-background: var(--color-dark-background, #111114);
    --color-foreground: var(--color-dark-foreground, #EDEDED);
    --color-surface: var(--color-dark-surface, #19191E);
    --color-muted: var(--color-dark-muted, #A1A1AA);
    --color-line: var(--color-dark-line, rgba(255, 255, 255, 0.08));
    --color-primary-soft: var(--color-dark-primary-soft, #2A1219);
    --color-inverse: var(--color-dark-inverse, #EDEDED);
}

*, *::before, *::after { box-sizing: border-box; }
html { hanging-punctuation: first allow-end last; }
body {
    margin: 0;
    overflow-x: clip;
    background: var(--color-background, #FBF7F0);
    color: var(--color-foreground, #1C1917);
    font-family: var(--font-family, "IBM Plex Sans Arabic", Inter, sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}
html[lang="en"] body { line-height: 1.55; }
img, svg { max-width: 100%; }
a { color: var(--color-primary, #9F1239); text-underline-offset: 4px; }
html[data-mode="dark"] a { color: var(--color-foreground, #EDEDED); }
button, input, textarea, select {
    font: inherit;
    color: inherit;
    background: var(--color-surface, #FFFFFF);
    border: 1px solid var(--color-line, #E7E7E7);
    border-radius: 8px;
    min-height: 44px;
    padding: 8px 16px;
}
button { cursor: pointer; }
button:hover { border-color: var(--color-primary, #9F1239); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--color-primary, #9F1239); outline-offset: 2px; }
h1, h2, h3, .display {
    font-family: var(--font-ui, "IBM Plex Sans Arabic", Inter, sans-serif);
    font-weight: 600;
    letter-spacing: 0;
    margin: 0 0 16px;
}
h1 { font-size: 32px; line-height: 1.3; }
h2 { font-size: 26px; line-height: 1.35; }
h3 { font-size: 20px; line-height: 1.4; }
.display { font-size: 40px; line-height: 1.25; font-weight: 600; }
html[lang="en"] h1 { line-height: 1.1; letter-spacing: -0.02em; }
html[lang="en"] h2 { line-height: 1.15; letter-spacing: -0.015em; }
html[lang="en"] h3 { line-height: 1.25; letter-spacing: -0.01em; }
html[lang="en"] .display { line-height: 1.05; letter-spacing: -0.03em; }
p { margin: 0 0 16px; }
.lede { font-size: 17px; line-height: 1.8; max-width: 680px; margin: 0 0 32px; }
html[lang="en"] .lede { font-size: 18px; line-height: 1.6; }
.small { font-size: 14px; line-height: 1.6; }
html[lang="en"] .small { line-height: 1.45; }
.caption, .reader__label {
    font-family: var(--font-ui, inherit);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    margin: 0;
}
html[lang="en"] .caption, html[lang="en"] .reader__label { letter-spacing: 0.01em; line-height: 1.4; }

.skip {
    position: absolute;
    inset-inline-start: 16px;
    top: -64px;
    background: var(--color-primary, #9F1239);
    color: var(--color-on-primary, #FBF7F0);
    padding: 8px 16px;
    z-index: 5;
}
.skip:focus { top: 8px; }

.mast {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 24px;
    border-bottom: 1px solid var(--color-line, #E7E7E7);
    background: color-mix(in srgb, var(--color-background, #FBF7F0) 92%, transparent);
    position: sticky;
    top: 0;
    z-index: 4;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 600; min-height: 44px; }
.brand__mark {
    width: 32px;
    height: 32px;
    display: inline-block;
    background: var(--color-primary, #9F1239);
    -webkit-mask: url("/brand/assets/mark.svg") center / contain no-repeat;
    mask: url("/brand/assets/mark.svg") center / contain no-repeat;
}
.mast__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.mast__nav a { color: inherit; min-height: 44px; display: inline-flex; align-items: center; padding-inline: 8px; text-decoration: none; }
.shell { max-width: 1200px; margin-inline: auto; padding: 64px 24px; }
.shell__grid, main, .hero, .hero__visual, .hero__visual > *, .feature, .shelf, .shelf__row, .band, .author-row, .most-read, .reader { min-width: 0; max-width: 100%; }
.shell__grid { display: block; }
.shell__grid:has(.ad-sidebar) { display: grid; gap: 24px; }
@media (min-width: 960px) {
    .shell { padding: 96px 32px; }
    h1 { font-size: 48px; }
    h2 { font-size: 36px; }
    h3 { font-size: 24px; }
    .display { font-size: 64px; }
    .shell__grid:has(.ad-sidebar) { grid-template-columns: minmax(0, 1fr) 256px; }
    .shell__side { order: 2; }
}
.hero {
    display: grid;
    gap: 32px;
    align-items: start;
    padding-block: 32px;
    animation: rise 500ms cubic-bezier(.2, .8, .2, 1) both;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__visual { display: grid; gap: 24px; min-width: 0; }
.trust { color: var(--color-muted); font-size: 14px; margin: 16px 0 0; }
.brand-rule {
    width: 64px;
    height: 4px;
    margin: 0 0 24px;
    border: 0;
    background: linear-gradient(to inline-end, var(--color-primary, #9F1239), var(--color-accent, #B45309));
}
.most-read { padding-block: 64px 0; }
@media (min-width: 960px) {
    .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; padding-block: 32px; }
    .most-read { padding-block: 96px 0; }
}
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.2;
}
.btn--primary {
    background: var(--color-primary, #9F1239);
    color: var(--color-on-primary, #FBF7F0);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--secondary {
    background: transparent;
    color: var(--color-foreground);
    border-color: var(--color-line, #E7E7E7);
}
.btn--ghost { background: transparent; color: inherit; border-color: transparent; }
.hero .btn { min-height: 52px; padding-inline: 24px; }
html[data-mode="dark"] .btn--primary,
html[data-color-scheme="dark"] .btn--primary,
html[data-mode="dark"] a.btn.btn--primary,
html[data-color-scheme="dark"] a.btn.btn--primary,
html[data-mode="dark"] button.btn.btn--primary,
html[data-color-scheme="dark"] button.btn.btn--primary {
    color: var(--color-on-accent, #1C1917);
    background: var(--color-accent, #B45309);
}
@media (prefers-color-scheme: dark) {
    html[data-color-scheme="system"] .btn--primary,
    html[data-color-scheme="system"] a.btn.btn--primary,
    html[data-color-scheme="system"] button.btn.btn--primary {
        color: var(--color-on-accent, #1C1917);
        background: var(--color-accent, #B45309);
    }
}

.colophon {
    border-top: 1px solid var(--color-line);
    padding: 24px;
    color: var(--color-muted);
    font-size: 14px;
}
.ad-slot, .ad-sidebar { margin-block: 16px; }
.ad-mobile-sticky { position: sticky; bottom: 0; background: var(--color-background); }

.shelf__row {
    display: flex;
    gap: 16px;
    max-width: 100%;
    overflow-x: auto;
    padding-block: 16px 24px;
    scroll-snap-type: inline mandatory;
}
.volume {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 128px;
    flex: none;
    scroll-snap-align: start;
    color: inherit;
    text-decoration: none;
}
.volume--stage { width: min(100%, 256px); max-width: 100%; }
.volume__title { font-weight: 600; font-size: 16px; line-height: 1.4; }
.volume__title[dir="rtl"], .volume__author[dir="rtl"], .feature__copy [dir="rtl"], .novel-hero h1[dir="rtl"], .work-synopsis[dir="rtl"], .chapter-row [dir="rtl"], .reader-kicker [dir="rtl"], [data-read-column][dir="rtl"], .toc [dir="rtl"] { unicode-bidi: isolate; }
.volume__author, .volume__meta { color: var(--color-muted); font-size: 14px; }

.book {
    --spine: 12px;
    --pages: 12px;
    position: relative;
    display: block;
    width: 100%;
    filter: drop-shadow(var(--shadow-book, 0 16px 24px rgb(28 25 23 / 0.24)));
    transition: transform 150ms cubic-bezier(.2, .8, .2, 1);
}
.book__shell { direction: ltr; display: flex; align-items: stretch; }
.book[dir="rtl"] .book__shell { flex-direction: row; }
.book[dir="ltr"] .book__shell { flex-direction: row-reverse; }
.book__front {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--color-surface);
    border-radius: 4px;
}
.book__front img, .book__front svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.book__glare {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgb(255 255 255 / 0.22), transparent 32%, transparent 64%, rgb(0 0 0 / 0.16));
    pointer-events: none;
}
.book__spine {
    flex: none;
    width: var(--spine);
    margin-block: 4px;
    background:
        linear-gradient(90deg, rgb(0 0 0 / 0.45), rgb(255 255 255 / 0.28) 36%, rgb(0 0 0 / 0.35)),
        var(--color-primary, #9F1239);
}
.book[dir="rtl"] .book__spine {
    background:
        linear-gradient(270deg, rgb(0 0 0 / 0.45), rgb(255 255 255 / 0.28) 36%, rgb(0 0 0 / 0.35)),
        var(--color-primary, #9F1239);
}
.book__pages {
    flex: none;
    width: var(--pages);
    align-self: stretch;
    margin-block: 8px;
    background:
        linear-gradient(90deg, #cbbba6, #f8f3ea 22%, #e7d9c6 55%, #f4ecdf 78%, #b7a48e);
}
.book__shadow {
    position: absolute;
    inset-inline: 12% -4px;
    bottom: -8px;
    height: 12px;
    background: radial-gradient(ellipse at center, rgb(28 25 23 / 0.28), transparent 70%);
    z-index: -1;
}
.volume:hover .book { transform: translateY(-8px); }
.feature { display: grid; gap: 24px; align-items: start; }
.shelf__row--fill > .volume { flex: 1 1 128px; width: auto; min-width: 112px; max-width: 168px; }
.shelf__row--fill > .volume--end { flex: 1 1 180px; width: auto; max-width: none; min-width: 148px; min-height: 210px; display: flex; align-items: center; justify-content: center; padding: 16px; border: 1px solid var(--color-line); border-radius: 16px; background: var(--color-surface, var(--color-card)); color: var(--color-foreground); font-weight: 700; text-align: center; text-decoration: none; }
.feature__copy h2 { margin-bottom: 8px; }
.feature__copy p:last-child { margin-bottom: 0; }
.band { padding-block: 64px 0; }
.band h3 { margin-top: 24px; }
.shelf__row--wrap { flex-wrap: wrap; }
.author-row { display: flex; flex-wrap: wrap; gap: 16px; }
.author-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 160px;
    min-width: min(180px, 100%);
    max-width: 100%;
    min-height: 44px;
    padding: 16px 24px;
    border: 1px solid var(--color-line);
    border-radius: 12px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
}
.author-card__name { font-weight: 600; font-size: 16px; line-height: 1.4; }
@media (min-width: 720px) {
    .feature { grid-template-columns: 256px minmax(0, 1fr); }
}
@media (min-width: 960px) {
    .band { padding-block: 96px 0; }
}
html[data-mode="dark"] .book__pages {
    background: linear-gradient(90deg, #2A2A30, #3A3A42 40%, #2A2A30);
}
html[data-mode="dark"] .book__front { background: var(--color-surface); }

.work-hero { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 32px; }
.reader {
    --reader-bg: var(--reader-light-background, #FFFDF9);
    --reader-fg: var(--reader-light-foreground, #1C1917);
    --reader-rule: var(--reader-light-rule, #E7E7E7);
    background: var(--reader-bg);
    color: var(--reader-fg);
    border: 1px solid var(--color-line, #E7E7E7);
    border-radius: 12px;
    padding: 24px;
    margin-block: 24px;
}
.reader[data-reader="sepia"] {
    --reader-bg: var(--reader-sepia-background, #F5ECD9);
    --reader-fg: var(--reader-sepia-foreground, #3e3226);
    --reader-rule: var(--reader-sepia-rule, #e0d0b4);
}
.reader[data-reader="night"] {
    --reader-bg: var(--reader-night-background, #121212);
    --reader-fg: var(--reader-night-foreground, #D6D6D6);
    --reader-rule: var(--reader-night-rule, #2c2c2c);
    border-color: rgba(255, 255, 255, 0.08);
}
html[data-mode="dark"] .reader--stage {
    --reader-bg: var(--reader-night-background, #121212);
    --reader-fg: var(--reader-night-foreground, #D6D6D6);
    --reader-rule: var(--reader-night-rule, #2c2c2c);
    border-color: rgba(255, 255, 255, 0.08);
}
.reader__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--reader-rule); padding-bottom: 16px; margin-bottom: 16px; }
.reader article, .reader p { max-width: 680px; }
.reader p {
    font-family: var(--read-font, var(--font-text, "Noto Naskh Arabic", "Source Serif 4", serif));
    font-size: 19px;
    line-height: 1.9;
}
html[lang="en"] .reader p { font-family: var(--read-font, "Source Serif 4", "Noto Naskh Arabic", serif); }
.reader-samples { display: grid; gap: 16px; }
.reader--sample { margin: 0; }
html[data-mode="dark"] .reader-samples .reader[data-reader="light"],
html[data-mode="dark"] .reader-samples .reader[data-reader="sepia"] { display: none; }

.card, .empty, .swatch {
    border: 1px solid var(--color-line, #E7E7E7);
    border-radius: 12px;
    background: var(--color-surface, #FFFFFF);
    padding: 24px;
    box-shadow: none;
}
.empty { display: grid; gap: 12px; justify-items: start; }
.empty .icon { color: var(--color-primary, #9F1239); }
.specimen { font-family: var(--font-text, "Noto Naskh Arabic", "Source Serif 4", serif); font-size: 20px; line-height: 1.9; max-width: 680px; }
.guide__hero { padding-block: 0 32px; }
.lockup { display: flex; align-items: center; gap: 16px; }
.lockup .brand__mark { width: 64px; height: 64px; }
.mark-row, .icon-row, .social-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: end; }
.icon { width: 24px; height: 24px; }
[dir="rtl"] .icon--dir { transform: scaleX(-1); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 16px; }
.swatch { margin: 0; }
.swatch span { display: block; height: 64px; border-radius: 8px; border: 1px solid var(--color-line); }
.swatch figcaption { font-size: 14px; margin-top: 8px; color: var(--color-muted); }
.social-row img { width: min(100%, 360px); height: auto; border-radius: 12px; border: 1px solid var(--color-line); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 999px; font-size: 14px; font-weight: 500; }

label { display: block; margin-block: 16px 8px; font-size: 14px; }
textarea { width: min(100%, 680px); min-height: 96px; }
input[type="text"], input[type="email"], input[type="password"], input[type="file"], input:not([type]), select { width: min(100%, 680px); }
.table-scroll { overflow-x: auto; max-width: 100%; }

.alert.alert--success {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--color-accent, #B45309) 45%, var(--color-line, #E7E7E7));
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-accent, #B45309) 14%, var(--color-surface, #FFFFFF));
    color: var(--color-foreground, #1C1917);
    font-size: 16px;
    line-height: 1.5;
    position: sticky;
    top: calc(var(--header-offset, 64px) + 8px);
    z-index: 3;
}
.alert .icon { width: 24px; height: 24px; flex: 0 0 auto; color: var(--color-accent, #B45309); }
.alert__text { margin: 0; font-size: 16px; line-height: 1.5; }
.empty-state {
    display: grid;
    gap: 12px;
    justify-items: start;
    max-width: 36rem;
    margin: 16px 0 24px;
    padding: 24px;
    border: 1px solid var(--color-line, #E7E7E7);
    border-radius: 12px;
    background: var(--color-surface, #FFFFFF);
}
.empty-state .icon { width: 32px; height: 32px; color: var(--color-primary, #9F1239); }
.empty-state__title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.4; }
.empty-state__message { margin: 0; font-size: 16px; line-height: 1.5; color: var(--color-muted, #57534e); }
.empty-state__action { min-height: 44px; font-size: 16px; text-decoration: none; }
.form-actions {
    position: sticky;
    bottom: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 12px 16px;
    background: var(--color-card, #FFFFFF);
    border: 1px solid var(--color-line, #E7E7E7);
    border-radius: 12px;
}

@media (max-width: 720px) {
    .work-hero { flex-direction: column; align-items: flex-start; }
    .hero__actions { flex-direction: column; align-items: stretch; }
    .hero .btn { width: 100%; }
}
@media (min-width: 800px) {
    .reader-samples { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reader p { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .hero { animation: none; }
    .book, .volume:hover .book { transition: none; transform: none; }
}

/* rc.12.7: one-tap favourite heart on cards */
.volume, .book-card { position: relative; }
.fav-heart { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(20, 18, 16, .62); color: #fff; cursor: pointer; backdrop-filter: blur(2px); -webkit-tap-highlight-color: transparent; }
.fav-heart svg { fill: none; stroke: currentColor; }
.fav-heart.is-on { color: #ff5a6e; }
.fav-heart.is-on svg { fill: currentColor; }
.fav-heart:focus-visible { outline: 3px solid var(--color-accent, #c2570c); outline-offset: 2px; }
.fav-heart.is-busy { opacity: .6; pointer-events: none; }
.fav-button.is-on { border-color: #ff5a6e; color: #ff5a6e; }
