/* =============================================================
   Kurdistan Foundation Library — main stylesheet
   Design tokens, base styles, public pages, PDF reader
   ============================================================= */

/* ---------- Fonts (self-hosted) ---------- */
/* English UI: Gellix */
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-Regular.ttf') format('truetype');   font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-Medium.ttf') format('truetype');    font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-SemiBold.ttf') format('truetype');  font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-Bold.ttf') format('truetype');      font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gellix'; src: url('../fonts/gellix/Gellix-Black.ttf') format('truetype');     font-weight: 900; font-style: normal; font-display: swap; }
/* Kurdish / Arabic: Rabar (038 = body, 042 = headings) — one font per word
   keeps cursive joining intact for Arabic-script text. */
@font-face { font-family: 'Rabar038'; src: url('../fonts/Rabar_038.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Rabar042'; src: url('../fonts/Rabar_042.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

/* ---------- Design tokens ---------- */
:root {
    --font-body: 'Gellix', 'Rabar038', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Gellix', 'Rabar042', system-ui, sans-serif;

    --c-bg: #f6f7fb;
    --c-surface: #ffffff;
    --c-text: #17181d;
    --c-text-2: #5b616e;
    --c-text-3: #9298a5;
    --c-border: #e6e8ef;

    --c-primary: #0095dd;
    --c-primary-dark: #006fb8;
    --c-primary-soft: #e3f3fd;
    --c-accent: #00bfff;
    --c-navy: #000044;
    --c-cyan: #00bfff;
    --c-cyan-light: #7fdcff;
    /* gold var names kept as aliases → cyan, so older references recolor automatically */
    --c-gold: #00bfff;
    --c-gold-light: #7fdcff;
    --c-gold-dark: #0095dd;
    --c-danger: #dc2626;
    --c-danger-soft: #fee2e2;
    --c-success: #059669;
    --c-success-soft: #d1fae5;

    --grad-primary: linear-gradient(135deg, #000044 0%, #0066cc 55%, #00bfff 130%);
    --grad-gold: linear-gradient(135deg, #0095dd 0%, #7fdcff 100%);

    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 28px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 68, .06), 0 2px 8px rgba(0, 0, 68, .05);
    --shadow: 0 8px 28px -8px rgba(0, 0, 68, .14);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 68, .22);
    --shadow-primary: 0 10px 30px -8px rgba(0, 149, 221, .45);

    --ease: cubic-bezier(.22, .68, .34, 1);
    --glass-bg: rgba(255, 255, 255, .72);
    --glass-border: rgba(255, 255, 255, .55);
}

/* ---------- Dark theme ---------- */
html[data-theme="dark"] {
    --c-bg: #080a1a;
    --c-surface: #101228;
    --c-text: #e9ecf6;
    --c-text-2: #a6adc4;
    --c-text-3: #737a95;
    --c-border: #22263f;
    --c-primary-soft: rgba(0, 191, 255, .16);
    --c-danger-soft: rgba(220, 38, 38, .16);
    --c-success-soft: rgba(5, 150, 105, .16);
    --glass-bg: rgba(8, 10, 26, .72);
    --glass-border: rgba(255, 255, 255, .08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 6px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .65);
    --c-primary: #33ccff;
    --c-primary-dark: #00bfff;
    color-scheme: dark;
}
html[data-theme="dark"] .badge,
html[data-theme="dark"] .hero__eyebrow,
html[data-theme="dark"] .lang-switch__menu a.is-active { color: var(--c-gold-light); }
html[data-theme="dark"] .btn--ghost:hover,
html[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, .09); }
html[data-theme="dark"] .btn--light { background: #e9ebf2; color: #17181d; }
html[data-theme="dark"] .book-card__cover { background: linear-gradient(160deg, #141733, #10122a); }
html[data-theme="dark"] .book-card__badge { background: rgba(12, 14, 38, .82); color: var(--c-text); }
html[data-theme="dark"] .alert--error { color: #fca5a5; border-color: rgba(220, 38, 38, .35); }
html[data-theme="dark"] .alert--success { color: #6ee7b7; border-color: rgba(5, 150, 105, .35); }
html[data-theme="dark"] .dropzone.has-file { border-color: #34d399; }
html[data-theme="dark"] .chip--active,
html[data-theme="dark"] .sidebar__nav a.active { color: #fff; }
html[data-theme="dark"] .bg-mesh {
    background:
        radial-gradient(600px 400px at 12% -5%, rgba(0, 102, 204, .3), transparent 60%),
        radial-gradient(700px 500px at 95% 5%, rgba(0, 191, 255, .16), transparent 60%),
        radial-gradient(600px 500px at 50% 110%, rgba(0, 0, 68, .55), transparent 60%);
}

/* Theme toggle: icon + label swap (shows the mode it switches TO) */
.icon-btn.theme-toggle {
    width: auto;
    height: auto;
    min-width: 138px;
    justify-content: space-between;   /* icon on one side, label on the other */
    padding: .5rem .8rem;
    border-radius: 12px;
    gap: .7rem;
    border: 1.5px solid var(--c-border);
    background: var(--c-surface);
    font-family: var(--font-body);
    font-size: .8rem;
    font-weight: 600;
    color: var(--c-text-2);
}
.theme-toggle:hover { border-color: var(--c-primary); color: var(--c-primary); }
.theme-toggle .icon-sun, .theme-toggle .tt-light { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon,
html[data-theme="dark"] .theme-toggle .tt-dark { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .tt-light { display: inline; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    transition: background .3s ease, color .3s ease;
}

img { max-width: 100%; display: block; }
a { color: var(--c-primary); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }

::selection { background: rgba(0, 191, 255, .28); }

/* Thin, theme-aware scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--c-text-3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--c-text-3); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

.container {
    width: min(1180px, 100% - 2.5rem);
    margin-inline: auto;
}

/* Decorative mesh gradient background */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(600px 400px at 12% -5%, rgba(0, 149, 221, .16), transparent 60%),
        radial-gradient(700px 500px at 95% 5%, rgba(0, 191, 255, .13), transparent 60%),
        radial-gradient(600px 500px at 50% 110%, rgba(0, 0, 68, .10), transparent 60%);
    pointer-events: none;
}

/* Scroll-reveal background image — fades in as you scroll down (JS sets opacity) */
.scroll-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    filter: blur(3px);
    transform: scale(1.05);   /* hides the blur bleed at the edges */
}
.scroll-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    /* theme-aware scrim keeps text readable over the photo */
    background: var(--c-bg);
    opacity: .55;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.4rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font: 600 .95rem var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease),
                background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn:active { transform: scale(.97); }

.btn--primary {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -8px rgba(0, 149, 221, .55); }

.btn--outline {
    background: var(--c-surface);
    border-color: var(--c-border);
    color: var(--c-text);
    box-shadow: var(--shadow-sm);
}
.btn--outline:hover { border-color: var(--c-primary); color: var(--c-primary); transform: translateY(-2px); }

.btn--ghost { background: transparent; color: var(--c-text-2); }
.btn--ghost:hover { background: rgba(23, 24, 29, .06); color: var(--c-text); }

.btn--light { background: #fff; color: var(--c-text); box-shadow: var(--shadow); }

.btn--danger { background: var(--c-danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; }

.btn--sm { padding: .45rem 1rem; font-size: .85rem; }
.btn--lg { padding: .85rem 1.8rem; font-size: 1rem; }
.btn--block { width: 100%; }

.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::before {
    content: '';
    width: 1em; height: 1em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--c-text-2);
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: rgba(23, 24, 29, .07); color: var(--c-text); }
.icon-btn--danger:hover { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- Badges & chips ---------- */
.badge {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: 999px;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .01em;
}

/* Category multi-select filter */
.filter-row {
    display: flex;
    justify-content: center;
    margin-bottom: 2.25rem;   /* space between the filter and the cards */
}
.cat-filter { position: relative; }
.cat-filter__trigger {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    min-width: 240px;
    padding: .8rem 1.1rem;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    color: var(--c-text);
    font: 600 .95rem var(--font-body);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.cat-filter__trigger:hover { border-color: var(--c-primary); }
.cat-filter.is-open .cat-filter__trigger,
.cat-filter.has-selection .cat-filter__trigger {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(0, 149, 221, .13);
}
.cat-filter__tag { flex-shrink: 0; color: var(--c-primary); }
.cat-filter__label { flex: 1; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-filter__chevron { flex-shrink: 0; color: var(--c-text-3); transition: transform .3s var(--ease); }
.cat-filter.is-open .cat-filter__chevron { transform: rotate(180deg); }

.cat-filter__panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0; right: 0;
    z-index: 40;
    padding: .5rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
    max-height: 320px;
    overflow-y: auto;
}
.cat-filter.is-open .cat-filter__panel {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.cat-filter__opt {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .7rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}
.cat-filter__opt:hover { background: var(--c-bg); }
.cat-filter__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.cat-filter__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    flex-shrink: 0;
    border: 1.5px solid var(--c-border);
    border-radius: 6px;
    color: #fff;
    transition: background .18s var(--ease), border-color .18s;
}
.cat-filter__check svg { opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s var(--ease); }
.cat-filter__opt input:checked ~ .cat-filter__check {
    background: var(--grad-primary);
    border-color: transparent;
}
.cat-filter__opt input:checked ~ .cat-filter__check svg { opacity: 1; transform: none; }
.cat-filter__opt input:focus-visible ~ .cat-filter__check { box-shadow: 0 0 0 3px rgba(0, 149, 221, .3); }
.cat-filter__name { flex: 1; font-size: .92rem; font-weight: 500; color: var(--c-text); }
.cat-filter__count {
    flex-shrink: 0;
    min-width: 22px;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--c-bg);
    color: var(--c-text-3);
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
}
.cat-filter__opt input:checked ~ .cat-filter__count { background: var(--c-primary-soft); color: var(--c-primary-dark); }
/* "All" pseudo-option at the top of the panel (a button, not a checkbox) */
button.cat-filter__all {
    width: 100%;
    border: none;
    background: transparent;
    font: inherit;
    text-align: start;
    margin-bottom: .3rem;
    border-bottom: 1px solid var(--c-border);
    border-radius: 10px 10px 0 0;
}
button.cat-filter__all:hover { background: var(--c-bg); }
.cat-filter__all .cat-filter__check { border-radius: 50%; }
.cat-filter__all.is-active .cat-filter__check {
    background: var(--grad-primary);
    border-color: transparent;
}
.cat-filter__all.is-active .cat-filter__check svg { opacity: 1; transform: none; }
.cat-filter__all.is-active .cat-filter__count { background: var(--c-primary-soft); color: var(--c-primary-dark); }

/* ---------- Language switcher ---------- */
.lang-switch { position: relative; }
.lang-switch__btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: var(--c-surface);
    color: var(--c-text-2);
    font: 600 .85rem var(--font-body);
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.lang-switch__btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.lang-switch__menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 160px;
    padding: .4rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
    z-index: 120;
}
.lang-switch.is-open .lang-switch__menu {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.lang-switch__menu a {
    display: block;
    padding: .5rem .8rem;
    border-radius: 8px;
    color: var(--c-text-2);
    font-size: .88rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.lang-switch__menu a:hover { background: var(--c-bg); color: var(--c-text); }
.lang-switch__menu a.is-active {
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    font-weight: 600;
}

/* ---------- Navbar (glass) ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    background: var(--glass-bg);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, box-shadow .3s;
}
.navbar.is-scrolled { border-bottom-color: var(--c-border); box-shadow: var(--shadow-sm); }

.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.navbar__brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--c-text);
    min-width: 0;
}
.navbar__logo-img {
    width: 40px; height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 4px 14px -4px rgba(0, 0, 68, .5);
}
.navbar__name {
    font: 800 1.02rem/1.05 var(--font-display);
    letter-spacing: .02em;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.navbar__menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.navbar__menu > a {
    position: relative;
    color: var(--c-text-2);
    font-weight: 500;
    font-size: .95rem;
    transition: color .2s;
}
.navbar__menu > a::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -6px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .25s var(--ease);
}
.navbar__menu > a:hover { color: var(--c-text); }
.navbar__menu > a:hover::after,
.navbar__menu > a.is-active::after { transform: scaleX(1); }
.navbar__menu > a.is-active { color: var(--c-primary); }

/* Hamburger (mobile only) */
.navbar__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px; height: 42px;
    padding: 0 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}
.navbar__burger span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--c-text);
    transition: transform .3s var(--ease), opacity .2s;
}
body.nav-open .navbar__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .navbar__burger span:nth-child(2) { opacity: 0; }
body.nav-open .navbar__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero (normal framed image + small Show button) ---------- */
.hero {
    position: relative;
    min-height: calc(100svh - 68px);
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 2rem 0 3rem;
}
.hero__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: min(1180px, 100% - 2.5rem);
    text-align: center;
}
/* Kurdish welcome line above the photo */
.hero__welcome {
    font-family: 'Rabar038', 'KurdishFont', sans-serif;
    font-size: clamp(1.15rem, 3vw, 1.7rem);
    font-weight: 500;
    line-height: 1.7;
    letter-spacing: .01em;
    max-width: 760px;
    margin: 0;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* Kurdish verse below the photo */
.hero__verse {
    font-family: 'Rabar038', 'KurdishFont', sans-serif;
    font-size: clamp(.95rem, 2.4vw, 1.25rem);
    font-weight: 400;
    line-height: 1.8;
    max-width: 640px;
    margin: 0;
    color: var(--c-text-2);
}
.text-gradient {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero__cta { gap: .4rem; }

/* Kurdish welcome lines around the hero image */
.hero__welcome,
.hero__verse {
    max-width: 640px;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.8;
    color: var(--c-text);
}
.hero__welcome {
    font-size: clamp(1.05rem, 3.2vw, 1.45rem);
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html[data-theme="dark"] .hero__welcome {
    background: linear-gradient(100deg, #7fdcff, #ffffff 50%, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
}
.hero__verse {
    font-size: clamp(.92rem, 2.6vw, 1.15rem);
    color: var(--c-text-2);
}

/* Results count + Load more */
.results-count {
    margin: -1rem 0 1.4rem;
    text-align: center;
    font-size: .92rem;
    font-weight: 600;
    color: var(--c-text-2);
}
.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 2.25rem;
}
.load-more-wrap[hidden] { display: none; }   /* only visible when more than 16 books match */

/* Brand: name with small "Digital Library" under it, aligned to the start */
.brand-stack {
    display: flex;
    flex-direction: column;
    align-items: center;        /* "Digital Library" centered under the name everywhere */
    line-height: 1.05;
    min-width: 0;
    text-align: center;
}
.brand-sub {
    margin: 2px 0 0;
    font-family: var(--font-body);
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--c-primary);
    white-space: nowrap;
}
.landing__brand-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;        /* "Digital Library" centered under the name */
}
.brand-sub--landing {
    font-size: .64rem;
    letter-spacing: .3em;
    color: #0095dd;
}
/* 4-language tagline slideshow under the landing brand */
.lang-slideshow--tag { height: 1.5rem; margin: .55rem 0 0; }
.lang-slideshow--tag .lang-slide {
    font-size: .85rem;
    font-weight: 600;
    color: #3a466b;
}

/* 4-language slideshow above the hero image (library page) */
.lang-slideshow--hero {
    height: 2.1rem;
    width: 100%;
    max-width: 640px;
    margin: 0;
}
.lang-slideshow--hero .lang-slide {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1rem, 3.1vw, 1.35rem);
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html[data-theme="dark"] .lang-slideshow--hero .lang-slide {
    background: linear-gradient(100deg, #7fdcff, #ffffff 50%, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Visits counter under the hero */
.site-visits {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .45rem;
    width: fit-content;
    margin: 0 auto 1.7rem;
    padding: .5rem 1.25rem;
    border-radius: 999px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
    font-size: .88rem;
    font-weight: 600;
    color: var(--c-text-2);
}
.site-visits svg { color: var(--c-primary); }
.site-visits strong { color: var(--c-primary); font-size: 1rem; }

/* Wooden shelf with the Quran books standing on it */
.shelf { margin: 0 auto 2.4rem; max-width: 640px; }
.shelf__books {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(1.2rem, 6vw, 3rem);
    padding: 0 1.4rem;
}
.shelf__book {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    width: min(140px, 25vw);
    transform-origin: bottom center;
    transition: transform .3s var(--ease);
}
.shelf__cover-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}
/* language label above each Quran */
.shelf__lang {
    padding: .16rem .65rem;
    border-radius: 999px;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
html[data-theme="dark"] .shelf__lang { color: var(--c-cyan-light); }
.shelf__book img {
    width: 100%;
    aspect-ratio: 3 / 4.2;      /* every book the same size on the shelf */
    object-fit: cover;
    display: block;
    border-radius: 3px 7px 7px 3px;
    /* standing-book look: spine shading + contact shadow on the plank */
    box-shadow:
        inset 8px 0 10px -8px rgba(255, 255, 255, .55),
        inset -10px 0 14px -10px rgba(0, 0, 0, .5),
        6px 10px 16px -6px rgba(0, 0, 0, .45);
}
.shelf__book:hover { transform: translateY(-9px); }
.shelf__book:active { transform: scale(.96); }
/* Kurdish Quran popup: choose Badini or Sorani */
.shelf__pop {
    position: absolute;
    bottom: calc(100% + .55rem);
    left: 50%;
    z-index: 30;
    display: flex;
    gap: .4rem;
    padding: .4rem;
    border-radius: 12px;
    background: var(--c-surface);
    border: 1.5px solid rgba(0, 102, 204, .45);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 8px) scale(.94);
    transform-origin: bottom center;
    pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.shelf__pop.is-open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.shelf__pop a {
    padding: .45rem .85rem;
    border-radius: 9px;
    font-family: var(--font-display);
    font-size: .88rem;
    font-weight: 700;
    color: var(--c-text);
    background: var(--c-bg);
    transition: background .2s, color .2s;
}
.shelf__pop a:hover { background: var(--grad-primary); color: #fff; }
/* the wooden plank */
.shelf__plank {
    position: relative;
    height: 15px;
    border-radius: 3px;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .07) 0 26px, transparent 26px 54px),
        linear-gradient(180deg, #b4713a 0%, #8f4f22 55%, #6f3a16 100%);
    box-shadow: inset 0 2px 2px rgba(255, 244, 220, .4);
}
.shelf__plank::after {
    /* front edge of the shelf, slightly inset, with the drop shadow */
    content: '';
    position: absolute;
    left: 10px; right: 10px;
    top: 100%;
    height: 9px;
    border-radius: 0 0 7px 7px;
    background: linear-gradient(180deg, #5e2f10, #46200a);
    box-shadow: 0 14px 20px -8px rgba(0, 0, 0, .5);
}

/* Book-language section tabs — segmented pill control */
.lang-tabs__title {
    margin: 0 0 .8rem;
    text-align: center;
    font-family: var(--font-display);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--c-text-3);
}
.lang-tabs__title::before,
.lang-tabs__title::after {
    content: '';
    display: inline-block;
    vertical-align: middle;
    width: 34px;
    height: 1.5px;
    margin-inline: .7rem;
    background: linear-gradient(90deg, transparent, var(--c-border));
}
.lang-tabs__title::after { background: linear-gradient(90deg, var(--c-border), transparent); }
.lang-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .25rem;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 1.6rem;
    padding: .3rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
}
.lang-tabs button {
    padding: .52rem 1.15rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    font: 600 .88rem var(--font-body);
    color: var(--c-text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: all .22s var(--ease);
}
.lang-tabs button:hover {
    background: var(--c-primary-soft);
    color: var(--c-primary);
}
.lang-tabs button.is-active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}

/* Back-to-top button (appears after scrolling) */
.to-top {
    position: fixed;
    bottom: 1.1rem;
    inset-inline-end: 1.1rem;
    z-index: 125;
    width: 46px; height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    background: var(--grad-primary);
    box-shadow: 0 10px 24px -8px rgba(0, 149, 221, .6);
    opacity: 0;
    transform: translateY(14px) scale(.9);
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:active { transform: scale(.9); }
@media (max-width: 860px) {
    /* sit above the mobile tab bar */
    .to-top { bottom: 5.1rem; width: 42px; height: 42px; }
}
#load-more { gap: .45rem; }
#load-more.is-loading svg { display: none; }
.hero__cta-icon { transition: transform .3s var(--ease); }
.hero__cta:hover .hero__cta-icon { transform: translateY(3px); }

/* framed square photo */
.hero__visual {
    display: flex;
    justify-content: center;
    perspective: 1400px;
    perspective-origin: 50% 100%;
}
.hero__frame {
    position: relative;
    width: min(720px, 92vw);
    aspect-ratio: 16 / 9;
    border-radius: 26px;
    padding: 10px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transform-origin: center bottom;
    will-change: transform, opacity;
}
.hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
}
.hero__glow {
    position: absolute;
    inset: -2px;
    border-radius: 28px;
    padding: 2px;
    background: var(--grad-primary);
    opacity: .5;
    filter: blur(14px);
    z-index: -1;
    animation: hero-glow 5s ease-in-out infinite alternate;
}
@keyframes hero-float {
    from { translate: 0 -8px; }
    to   { translate: 0 8px; }
}
@keyframes hero-glow {
    from { opacity: .35; }
    to   { opacity: .7; }
}

/* Scroll-down indicator (animated mouse) */
.hero__scroll {
    position: absolute;
    bottom: 1.6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}
.hero__mouse {
    display: block;
    width: 26px;
    height: 42px;
    border: 2px solid var(--c-text-3);
    border-radius: 999px;
    position: relative;
}
.hero__mouse span {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--c-primary);
    animation: mouse-wheel 1.6s var(--ease) infinite;
}
@keyframes mouse-wheel {
    0%   { opacity: 0; transform: translateY(0); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(14px); }
}

/* Soft animated gradient orbs (pre-blurred gradients — cheap to composite) */
.hero__orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
}
.hero__orb--1 {
    width: 560px; height: 560px;
    top: -180px;
    inset-inline-start: -140px;
    background: radial-gradient(circle, rgba(0, 149, 221, .22) 0%, transparent 65%);
    animation: orb-drift 14s ease-in-out infinite alternate;
}
.hero__orb--2 {
    width: 640px; height: 640px;
    bottom: -260px;
    inset-inline-end: -180px;
    background: radial-gradient(circle, rgba(147, 51, 234, .18) 0%, transparent 65%);
    animation: orb-drift 18s ease-in-out infinite alternate-reverse;
}
@keyframes orb-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(60px, 40px, 0) scale(1.12); }
}

/* Hero entrance (staggered, GPU-only) */
.hero-in {
    opacity: 0;
    transform: translateY(26px);
    animation: hero-in .8s var(--ease) forwards;
    animation-delay: var(--d, 0s);
}
@keyframes hero-in {
    to { opacity: 1; transform: none; }
}

/* Books section anchor lands below the sticky navbar */
.section--books { scroll-margin-top: 60px; padding-top: 2.5rem; }
.section--books .search-bar { margin-bottom: 1.75rem; }
.section--books .chip-row { margin-bottom: 2rem; }

/* ---------- Search bar ---------- */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 640px;
    margin: 0 auto;
    padding: .45rem .45rem .45rem 1.1rem;
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow);
    transition: box-shadow .25s var(--ease), border-color .25s;
}
.search-bar:focus-within {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(0, 149, 221, .15), var(--shadow);
}
.search-bar__icon { color: var(--c-text-3); flex-shrink: 0; }
.search-bar input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    padding: .6rem .8rem;
    font: 500 1rem var(--font-body);
    color: var(--c-text);
}
.search-bar input::placeholder { color: var(--c-text-3); }
.search-bar__btn { flex-shrink: 0; }

.search-bar__spinner {
    width: 18px; height: 18px;
    margin-right: .5rem;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity .2s;
}
.search-bar.is-loading .search-bar__spinner { opacity: 1; animation: spin .7s linear infinite; }

/* ---------- Sections ---------- */
.section { padding: 1.5rem 0 2.5rem; }
.section--grid { min-height: 40vh; }
.section__title {
    position: relative;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 2rem 0 1.25rem;
    padding-bottom: .55rem;
}
.section__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    width: 46px;
    height: 3px;
    border-radius: 3px;
    background: var(--grad-gold);
}

/* ---------- Book grid & cards ---------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 1.5rem;
    transition: opacity .25s var(--ease);
}
.book-grid.is-loading { opacity: .45; pointer-events: none; }

.book-card {
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(0, 149, 221, .35);
}

.book-card__cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: linear-gradient(160deg, #eceefc, #f6f0fd);
}
.book-card__cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s var(--ease);
}
.book-card:hover .book-card__cover img { transform: scale(1.05); }

.book-card__badge {
    position: absolute;
    top: .75rem;
    left: .75rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--c-text);
    font-size: .72rem;
    font-weight: 600;
}

.book-card__body {
    padding: 1rem 1.1rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.book-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 0 0 .35rem;
    line-height: 1.4;
    overflow-wrap: break-word;   /* long titles wrap fully, never clipped */
}
.book-card__line {
    margin: 0 0 .25rem;
    color: var(--c-text-2);
    font-size: .82rem;
    line-height: 1.5;
    overflow-wrap: break-word;
}
.book-card__lbl { color: var(--c-text-3); font-weight: 600; font-size: .74rem; }
.book-card__line:last-of-type { margin-bottom: .55rem; }
.book-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--c-text-3);
    font-size: .78rem;
    font-weight: 500;
    margin-top: auto;      /* pins the views row to the card bottom */
    padding-top: .4rem;
}
.book-card__views {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--c-primary);
    font-weight: 600;
}
.book-card__views svg { opacity: .85; }
.book-card__pages {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-weight: 600;
}
.book-card__pages svg { opacity: .8; }

/* ---------- Empty state ---------- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--c-text-2);
    animation: card-in .4s var(--ease) both;
}
.empty-state__icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state h3 { color: var(--c-text); }
.empty-state .btn { margin-top: 1rem; }

/* ---------- Glass card / book detail ---------- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1rem;
    padding: .5rem 1rem .5rem .8rem;
    border-radius: 999px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
    color: var(--c-text);
    font-weight: 600;
    font-size: .9rem;
    transition: transform .15s var(--ease), border-color .2s, color .2s;
}
.back-btn:hover { border-color: var(--c-primary); color: var(--c-primary); transform: translateX(-2px); }
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }
[dir="rtl"] .back-btn:hover { transform: translateX(2px); }

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--c-text-3);
    font-size: .9rem;
}
.breadcrumb a { color: var(--c-text-2); font-weight: 500; }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb span:last-child {
    color: var(--c-text-3);
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-detail {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2.5rem;
    padding: 2.5rem;
}
.book-detail__cover img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transition: transform .35s var(--ease);
}
.book-detail__cover img:hover { transform: scale(1.02) rotate(-.5deg); }

.book-detail__title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin: .75rem 0 .25rem;
}
.book-detail__author { color: var(--c-text-2); font-size: 1.05rem; margin: 0 0 1.5rem; }

.book-detail__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 1.1rem 1.4rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.stat { display: flex; flex-direction: column; }
.stat__value { font: 700 1.15rem var(--font-display); color: var(--c-text); }
.stat__label { font-size: .78rem; color: var(--c-text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

.book-detail__desc h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.book-detail__desc p { color: var(--c-text-2); margin-top: 0; }

.book-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    margin-top: 1.75rem;
}

/* ---------- Alerts ---------- */
.alert {
    padding: .9rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    animation: card-in .3s var(--ease) both;
}
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert--error { background: var(--c-danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert--success { background: var(--c-success-soft); color: #065f46; border: 1px solid #a7f3d0; }

/* ---------- Forms ---------- */
.form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.form__group { margin-bottom: 1.25rem; }
.form__group label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: .45rem;
    color: var(--c-text);
}
.req { color: var(--c-danger); }

.form__group input[type="text"],
.form__group input[type="search"],
.form__group input[type="password"],
.form__group input[type="number"],
.form__group select,
.form__group textarea {
    width: 100%;
    padding: .7rem .95rem;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    font: 500 .95rem var(--font-body);
    color: var(--c-text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form__group input:focus,
.form__group select:focus,
.form__group textarea:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(0, 149, 221, .12);
}
.form__group textarea { resize: vertical; }

.form__hint { font-size: .82rem; color: var(--c-text-3); margin: .5rem 0 0; }
.form__cover-preview {
    margin-top: .5rem;
    width: 90px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.form__actions { display: flex; gap: .75rem; margin-top: .5rem; }

/* Dropzone-style file input */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: 1.6rem 1rem;
    border: 2px dashed var(--c-border);
    border-radius: var(--radius);
    background: var(--c-bg);
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--c-primary);
    background: var(--c-primary-soft);
}
.dropzone.has-file { border-style: solid; border-color: var(--c-success); background: var(--c-success-soft); }
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.dropzone__icon { font-size: 1.6rem; }
.dropzone__text { font-size: .9rem; font-weight: 600; color: var(--c-text-2); word-break: break-all; }
.dropzone__hint { font-size: .78rem; color: var(--c-text-3); }

.inline-form { display: inline; }

/* ---------- Footer ---------- */
.footer {
    margin-top: 3rem;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
}
.footer__inner { padding: 1.25rem 0 1.05rem; text-align: center; }
.footer__brand {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: .86rem;
    letter-spacing: .02em;
    color: var(--c-text);
    margin-bottom: .3rem;
}
.footer__brand img { width: 26px; height: 26px; border-radius: 50%; }
.footer__copy { color: var(--c-text-3); font-size: .72rem; margin: 0; }
.footer__visits {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0 0 .3rem;
    font-size: .76rem;
    font-weight: 600;
    color: var(--c-text-2);
}
.footer__visits strong { color: var(--c-primary); }

/* "Designed by Alan Suliman" — Cinzel Decorative, tiny gradient text */
.footer__credit {
    display: inline-block;
    margin-top: .5rem;
    font-family: var(--font-display);
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .12em;
    background: linear-gradient(90deg, #00bfff 0%, #7fdcff 25%, #e1306c 50%, #7fdcff 75%, #00bfff 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: gold-shimmer 7s linear infinite;
    transition: opacity .2s;
}
.footer__credit:hover { opacity: .8; }

/* ---------- PDF reader ---------- */
.reader-body {
    background: #23252d;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.reader-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 1rem;
    background: rgba(30, 32, 40, .85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #e7e9ee;
}
.reader-bar .icon-btn { color: #b9bdc9; }
.reader-bar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.reader-bar__left { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.reader-bar__title { min-width: 0; line-height: 1.25; }
.reader-bar__title strong {
    display: block;
    font-size: .92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reader-bar__title span { font-size: .75rem; color: #9298a5; }

.reader-bar__center { display: flex; align-items: center; gap: .25rem; }
.reader-bar__pages {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    color: #b9bdc9;
}
.reader-bar__pages input {
    width: 52px;
    padding: .3rem .4rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font: 600 .88rem var(--font-body);
    outline: none;
    -moz-appearance: textfield;
}
.reader-bar__pages input::-webkit-outer-spin-button,
.reader-bar__pages input::-webkit-inner-spin-button { -webkit-appearance: none; }
.reader-bar__pages input:focus { border-color: var(--c-primary); }

.reader-bar__right { display: flex; align-items: center; gap: .25rem; flex: 1; justify-content: flex-end; }
.reader-bar__zoom { font-size: .82rem; color: #b9bdc9; min-width: 44px; text-align: center; }

.reader-progress {
    position: sticky;
    top: 0;
    height: 3px;
    z-index: 51;
    background: transparent;
}
.reader-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--grad-primary);
    transition: width .15s linear;
}

.reader-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem 3rem;
}
/* "This file is big" notice at the top of the reader */
.reader-bignote {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem 1rem;
    background: #fef3c7;
    color: #7c5312;
    font-size: .9rem;
    font-weight: 600;
    border-bottom: 1px solid #f6d98a;
}
.reader-bignote button {
    margin-inline-start: auto;
    border: 0;
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    opacity: .7;
}
.reader-bignote button:hover { opacity: 1; }
/* Google Drive embedded reader fills the viewport, no inner padding. */
.reader-viewport--drive {
    padding: 0;
    overflow: hidden;
    display: flex;
}
.reader-drive-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.reader-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}
.reader-page {
    position: relative;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
    overflow: hidden;
}
.reader-page canvas { display: block; width: 100%; height: 100%; }
.reader-page--pending::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, #f1f2f6 30%, #fafbfe 50%, #f1f2f6 70%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.reader-page__num {
    position: absolute;
    bottom: .5rem;
    right: .6rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    background: rgba(23, 24, 29, .55);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    pointer-events: none;
}

.reader-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 5rem 1rem;
    color: #b9bdc9;
}

.spinner {
    width: 42px; height: 42px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* =============================================================
   Scroll-reveal entrances — components fade in one by one as
   they enter the viewport. JS assigns --rd (reveal delay) so
   elements arriving together cascade in a stagger.
   Default: fade + rise. .reveal--pop: fade + pop (cards).
   ============================================================= */
.reveal { opacity: 0; }
.reveal.is-visible {
    opacity: 1;
    animation: reveal-up .65s var(--ease) backwards;
    animation-delay: var(--rd, 0s);
}
@keyframes reveal-up {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
}
/* Cards: small pop with a gentle overshoot */
.reveal--pop.is-visible { animation-name: reveal-pop; }
@keyframes reveal-pop {
    0%   { opacity: 0; transform: translateY(18px) scale(.94); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.012); }
    100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- RTL (Arabic / Kurdish Badini) ---------- */
/* Drop your Kurdish font at assets/fonts/kurdish.woff2 (or .ttf) — it loads automatically. */
@font-face {
    font-family: 'KurdishFont';
    src: url('../fonts/kurdish.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}
/* FONT STRATEGY (bulletproof against broken Kurdish letters):
   Kurdish letters (ێ ۆ ڕ ڤ …) don't exist in Tajawal or the English fonts,
   and whenever ONE WORD is drawn from two different fonts the cursive joining
   breaks (Safari/phones show disconnected letters). The only safe rule is:
   Arabic-script text must always come from ONE font that covers everything.
   Nizar (KurdishFont) covers Arabic + Kurdish in a single file — so ALL RTL
   pages (Arabic, Badini, Sorani) use it for everything. */
html[dir="rtl"] {
    --font-body: 'Rabar038', 'KurdishFont', system-ui, Tahoma, sans-serif;
    --font-display: 'Rabar042', 'Rabar038', 'KurdishFont', system-ui, Tahoma, sans-serif;
}

/* English pages keep Outfit for the UI, but every spot that can hold
   Kurdish/Arabic DATA (titles, authors, category badges, filter labels,
   shelf labels, landing slides/buttons) renders in the Kurdish font. */
html[lang="en"] [dir="rtl"],
html[lang="en"] [dir="auto"],
html[lang="en"] .book-card__badge,
html[lang="en"] .badge,
html[lang="en"] .cat-filter__label,
html[lang="en"] .cat-filter__name,
html[lang="en"] .shelf__lang,
html[lang="en"] .reader-bar__title {
    font-family: 'Rabar038', 'KurdishFont', system-ui, Tahoma, sans-serif;
}

/* NEVER letter-space Arabic-script text — it disconnects the letters on Safari */
html[dir="rtl"] body { letter-spacing: 0; }
html[dir="rtl"] body { font-weight: 500; }
html[dir="rtl"] p { font-weight: 400; }
[dir="rtl"] .hero__title,
[dir="rtl"] .book-detail__title,
[dir="rtl"] .section__title { letter-spacing: 0; }
[dir="rtl"] .book-card__badge { left: auto; right: .75rem; }
[dir="rtl"] .search-bar { padding: .45rem 1.1rem .45rem .45rem; }
[dir="rtl"] .reader-page__num { right: auto; left: .6rem; }
[dir="rtl"] .stat__label { letter-spacing: 0; }
[dir="rtl"] .alert ul { padding-left: 0; padding-right: 1.2rem; }
/* Keep the PDF page controls in reading order for the document itself */
[dir="rtl"] .reader-bar__pages { direction: ltr; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .book-detail { grid-template-columns: 240px 1fr; gap: 1.75rem; padding: 1.75rem; }
}

@media (max-width: 860px) {
    /* Collapse the navbar into a hamburger + glass dropdown panel */
    .navbar__burger { display: flex; }
    .navbar__menu {
        position: fixed;
        top: 68px;
        inset-inline: 0;
        z-index: 99;
        flex-direction: column;
        align-items: stretch;
        gap: .35rem;
        margin: 0 .75rem;
        padding: .9rem;
        border-radius: var(--radius);
        background: var(--c-surface);
        backdrop-filter: blur(20px) saturate(1.6);
        -webkit-backdrop-filter: blur(20px) saturate(1.6);
        border: 1px solid var(--c-border);
        box-shadow: var(--shadow-lg);
        opacity: 0;
        transform: translateY(-12px);
        pointer-events: none;
        transition: opacity .28s var(--ease), transform .28s var(--ease);
    }
    body.nav-open .navbar__menu {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    .navbar__menu > a {
        padding: .8rem 1rem;
        border-radius: 12px;
        font-size: 1rem;
    }
    .navbar__menu > a:hover { background: var(--c-primary-soft); color: var(--c-primary); }
    .navbar__menu .lang-switch { align-self: stretch; }
    .navbar__menu .lang-switch__btn { width: 100%; justify-content: center; }
    .navbar__menu .theme-toggle { align-self: center; }

    /* natural height on mobile so the verse below the image clears the tab bar */
    .hero { min-height: auto; padding: 1.25rem 0 2rem; }
    .hero__inner { gap: 1.5rem; }
}

@media (max-width: 720px) {
    /* two cards per row on phones — text scales down and wraps, nothing clipped */
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .book-card__badge { top: .45rem; left: .45rem; font-size: .62rem; padding: .18rem .5rem; }
    [dir="rtl"] .book-card__badge { left: auto; right: .45rem; }
    .book-card__body { padding: .6rem .7rem .75rem; }
    .book-card__title { font-size: .84rem; }
    .book-card__line { font-size: .73rem; }
    .book-card__lbl { font-size: .66rem; }
    .book-card__meta { font-size: .7rem; }
    .filter-select { width: 100%; min-width: 0; }

    .book-detail { grid-template-columns: 1fr; padding: 1.4rem; }
    .book-detail__cover { max-width: 240px; margin-inline: auto; }
    .book-detail__stats { gap: 1.25rem; }
    .book-detail__actions .btn { flex: 1; }

    .form__row { grid-template-columns: 1fr; }

    .search-bar__btn { display: none; } /* live search handles it on mobile */

    .reader-bar { flex-wrap: wrap; }
    .reader-bar__left { flex-basis: 100%; order: 1; }
    .reader-bar__center { order: 2; flex: 1; }
    .reader-bar__right { order: 3; flex: 0; }
    .reader-bar__zoom { display: none; }
    .reader-viewport { padding: 1rem .5rem 2rem; }
}

/* =============================================================
   Landing / splash page
   ============================================================= */
/* Clip sideways only (the 3D cover flap sticks out) — the page must still be
   able to scroll vertically on screens shorter than the flip-book. */
html:has(.landing-body) { overflow-x: hidden; }
.landing-body {
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    position: relative;
    display: flex;
}

/* Blurred city photo background */
.landing-bg {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(9px) saturate(1.05);
    transform: scale(1.12);   /* scale (not negative inset) provides blur bleed */
    z-index: 0;
    animation: landing-zoom 26s ease-in-out infinite alternate;
}
@keyframes landing-zoom {
    from { transform: scale(1.12); }
    to   { transform: scale(1.2); }
}

/* Maroon → gold tinted veil */
.landing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(1200px 700px at 50% -10%, rgba(0, 191, 255,.18), transparent 60%),
        linear-gradient(180deg, rgba(2, 4, 40,.78) 0%, rgba(1, 2, 30,.86) 55%, rgba(1, 1, 20,.94) 100%);
}
html[data-theme="light"] .landing-overlay {
    background:
        radial-gradient(1200px 700px at 50% -10%, rgba(0, 191, 255,.22), transparent 60%),
        linear-gradient(180deg, rgba(6, 14, 66,.70) 0%, rgba(4, 10, 54,.78) 55%, rgba(2, 4, 40,.86) 100%);
}

/* Floating gold particles */
.landing-particles { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.landing-body { overflow-x: hidden; }
.landing-particles .p {
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(122, 212, 255,.9), rgba(0, 191, 255,0));
    animation: particle-rise linear infinite;
}
@keyframes particle-rise {
    0%   { transform: translateY(20vh) scale(.4); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(-90vh) scale(1); opacity: 0; }
}
.p--1  { left: 6%;  bottom: -10px; animation-duration: 15s; animation-delay: 0s;   }
.p--2  { left: 14%; bottom: -10px; animation-duration: 19s; animation-delay: 3s;   width: 5px; height: 5px; }
.p--3  { left: 23%; bottom: -10px; animation-duration: 13s; animation-delay: 1.5s; }
.p--4  { left: 31%; bottom: -10px; animation-duration: 21s; animation-delay: 5s;   width: 9px; height: 9px; }
.p--5  { left: 39%; bottom: -10px; animation-duration: 17s; animation-delay: 2s;   }
.p--6  { left: 47%; bottom: -10px; animation-duration: 23s; animation-delay: 6s;   width: 4px; height: 4px; }
.p--7  { left: 54%; bottom: -10px; animation-duration: 14s; animation-delay: 4s;   }
.p--8  { left: 62%; bottom: -10px; animation-duration: 20s; animation-delay: 1s;   width: 8px; height: 8px; }
.p--9  { left: 70%; bottom: -10px; animation-duration: 16s; animation-delay: 7s;   }
.p--10 { left: 78%; bottom: -10px; animation-duration: 22s; animation-delay: 2.5s; width: 5px; height: 5px; }
.p--11 { left: 85%; bottom: -10px; animation-duration: 18s; animation-delay: 5.5s; }
.p--12 { left: 92%; bottom: -10px; animation-duration: 15s; animation-delay: 3.5s; width: 9px; height: 9px; }
.p--13 { left: 44%; bottom: -10px; animation-duration: 24s; animation-delay: 8s;   width: 4px; height: 4px; }
.p--14 { left: 18%; bottom: -10px; animation-duration: 20s; animation-delay: 6.5s; }

.landing-theme {
    position: fixed;
    top: 1.1rem;
    inset-inline-end: 1.1rem;
    z-index: 6;
    color: #dcefff;
    border: 1px solid rgba(122, 212, 255,.3);
    background: rgba(30, 10, 10, .35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.landing-theme:hover { background: rgba(30, 10, 10, .55); color: #fff; }

/* Center flip-book */
.landing {
    position: relative;
    z-index: 3;
    margin: auto;
    width: min(540px, 100% - 2.25rem);
    padding: 1.5rem 0;
    perspective: 1900px;
    transition: opacity .45s ease;
}
.flipbook {
    position: relative;
    perspective: 1600px;
    animation: landing-in .8s var(--ease) backwards;
}
/* hardcover peeking on the left → shows it's a book with a cover that will close */
.flipbook__face {
    border-radius: 28px;
    text-align: center;
    color: #dcefff;
    overflow: hidden;
    border: 1px solid rgba(122, 212, 255,.28);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.flipbook__face--open {
    position: relative;                  /* defines the flip-book height */
    z-index: 1;
    padding: 2.5rem 2rem 2.3rem 2.7rem;
    color: #1b2547;                      /* dark text on white paper */
    /* white ruled "paper" page */
    background:
        repeating-linear-gradient(0deg, transparent 0 29px, rgba(10, 60, 140, .06) 29px 30px),
        linear-gradient(180deg, #ffffff, #eef2f9);
    /* stacked page edges peeking at the bottom-right → book thickness */
    box-shadow:
        3px 4px 0 #e4e9f3,
        6px 8px 0 #d2dae9,
        9px 12px 0 #bcc7de,
        0 34px 80px -20px rgba(0, 0, 0, .7);
}
/* left spine (the book's binding) — gutter shadow + stitched seam */
.flipbook__spine {
    position: absolute;
    inset: 0 auto 0 0;
    width: 34px;
    background: linear-gradient(90deg, rgba(0, 0, 68, .26), rgba(0, 0, 68, .07) 55%, transparent);
    pointer-events: none;
    z-index: 2;
}
.flipbook__spine::before {
    content: '';
    position: absolute;
    left: 13px; top: 9%; bottom: 9%;
    border-left: 2px dashed rgba(0, 149, 221, .5);
}
.flipbook__edge { display: none; }
/* bookmark ribbon hanging from the top */
.flipbook__ribbon {
    position: absolute;
    top: -3px;
    inset-inline-end: 42px;
    width: 26px; height: 58px;
    z-index: 4;
    background: linear-gradient(180deg, #00bfff, #0066cc);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 6px 14px -4px rgba(0, 0, 0, .55);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
/* hard cover: two sides, laid OPEN on the left at rest, swings shut on selection */
.flipbook__cover {
    position: absolute;
    inset: 0;
    z-index: 3;
    transform-origin: left center;
    transform: rotateY(-142deg);        /* open flap, visible on the left at rest */
    transform-style: preserve-3d;
    transition: transform .8s var(--ease);
    pointer-events: none;
}
.cover-side {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}
.cover-side--front {
    background: var(--grad-primary);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 30px 70px -22px rgba(0, 0, 0, .7);
}
.cover-side--back {
    transform: rotateY(180deg);
    background: linear-gradient(160deg, #071040, #02040f);
    box-shadow: inset 0 0 0 1px rgba(122, 212, 255, .18);
}
.cover-side--back::before {
    content: '';
    position: absolute;
    inset: 16px;
    border: 1.5px solid rgba(122, 212, 255, .22);
    border-radius: 12px;
}
.cover-side__spine {
    position: absolute;
    inset: 0 0 0 auto;
    width: 26px;
    background: linear-gradient(270deg, rgba(0, 0, 0, .45), transparent);
    pointer-events: none;
}
.flipbook__frame {
    position: absolute;
    inset: 16px;
    border: 1.5px solid rgba(122, 212, 255,.5);
    border-radius: 12px;
    pointer-events: none;
}
.flipbook__cover-logo-img {
    width: 92px; height: 92px;
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, .08), 0 12px 34px -8px rgba(0, 0, 0, .5);
}
.flipbook__title {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 4.5vw, 1.9rem);
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.1;
    color: #ffffff;
    max-width: 90%;
}
.flipbook__rule {
    width: 50px; height: 2px;
    border-radius: 2px;
    background: var(--c-gold-light);
    opacity: .85;
}
.flipbook__sub {
    font-size: .85rem;
    max-width: 78%;
    color: rgba(206, 228, 255,.8);
    line-height: 1.55;
}
/* selection → cover shuts over the page, then the whole landing fades out */
body.is-leaving .flipbook__cover { transform: rotateY(0deg); }
body.is-leaving .flipbook__face--open { transition: transform .5s ease; transform: scale(.98); }
body.is-leaving .landing { opacity: 0; transition: opacity .35s ease .8s; }
@keyframes landing-in {
    from { opacity: 0; transform: translateY(26px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.landing__logo-img {
    width: 84px; height: 84px;
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 0 0 6px rgba(0, 191, 255, .08), 0 10px 30px -8px rgba(0, 0, 0, .5);
    animation: logo-glow 3.5s ease-in-out infinite alternate;
}
@keyframes logo-glow {
    from { box-shadow: 0 0 0 4px rgba(0, 191, 255, .08), 0 10px 30px -8px rgba(0,0,0,.5); }
    to   { box-shadow: 0 0 0 12px rgba(0, 191, 255, .18), 0 14px 38px -8px rgba(0,0,0,.55); }
}
.landing__brand {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 5.5vw, 2.1rem);
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.12;
    margin: 0;
    background: linear-gradient(100deg, #0066cc 0%, #000044 28%, #00bfff 55%, #000044 78%, #0066cc 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gold-shimmer 6s linear infinite;
}
@keyframes gold-shimmer {
    to { background-position: 220% center; }
}
.landing__kicker {
    margin: .35rem 0 0;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .42em;
    color: rgba(206, 228, 255,.62);
}
.landing__divider {
    display: block;
    width: 60px; height: 2px;
    margin: 1.4rem auto 1.2rem;
    background: linear-gradient(90deg, transparent, #0095dd, transparent);
}
/* rotating "choose your language" slideshow */
.lang-slideshow {
    position: relative;
    height: 1.7rem;
    margin: 0 0 1.4rem;
}
.lang-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #3a466b;
    opacity: 0;
    transform: translateY(9px);
    transition: opacity .5s var(--ease), transform .5s var(--ease);
    pointer-events: none;
}
.lang-slide.is-active { opacity: 1; transform: none; }

/* language buttons — name only, centered, modern */
.lang-btns {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
.lang-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .9rem 1.2rem;
    border-radius: 14px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    color: #0d2354;
    background: #ffffff;
    border: 2px solid rgba(0, 102, 204, .55);
    box-shadow: 0 2px 8px -3px rgba(0, 0, 68, .22);
    overflow: hidden;
    transition: transform .25s var(--ease), color .25s, box-shadow .3s, border-color .25s, background .3s;
    animation: lang-in .6s var(--ease) both;
    animation-delay: calc(.35s + var(--i) * .12s);
}
@keyframes lang-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
.lang-btn:hover {
    transform: translateY(-3px);
    color: #fff;
    background: var(--grad-primary);
    border-color: transparent;
    box-shadow: 0 14px 34px -10px rgba(0, 149, 221, .55);
}

@media (max-width: 560px) {
    .landing { padding: 1rem 0; }
    .flipbook__face--open { padding: 2rem 1.3rem 1.9rem; }
    .lang-btn { font-size: 1.02rem; padding: .85rem 1rem; }
}
@media (max-height: 640px) {
    .landing__logo-img { width: 62px; height: 62px; margin-bottom: .7rem; }
    .landing__divider { margin: 1rem auto .8rem; }
    .lang-slideshow { margin-bottom: 1rem; }
    .flipbook__face--open { padding: 1.6rem 1.4rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .landing-bg, .landing-particles .p, .landing__logo-img, .landing__brand,
    .flipbook { animation: none !important; }
}

/* ---------- Page-open transition (library after the book flips) ---------- */
.page { animation: page-open .6s var(--ease) both; }
@keyframes page-open {
    from { opacity: 0; transform: translateY(10px) scale(.992); }
    to   { opacity: 1; transform: none; }
}

/* ---------- About / Contact pages ---------- */
.page-head { max-width: 680px; margin: 1.5rem auto 2.5rem; text-align: center; }
.page-head__eyebrow {
    display: inline-block;
    padding: .3rem .9rem;
    border-radius: 999px;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    margin-bottom: 1rem;
}
.page-head__title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 .6rem; }
.page-head__lead { color: var(--c-text-2); font-size: 1.1rem; margin: 0; }

/* "Share your books" invitation at the top of the About page */
.contribute-note {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    max-width: 720px;
    margin: 0 auto 2.5rem;
    padding: 1.3rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1.5px solid rgba(0, 149, 221, .3);
    background: var(--c-primary-soft);
}
.contribute-note__icon { font-size: 2rem; flex-shrink: 0; }
.contribute-note__body { flex: 1; min-width: 0; }
.contribute-note__body h2 { font-size: 1.1rem; margin: 0 0 .25rem; }
.contribute-note__body p { margin: 0; color: var(--c-text-2); font-size: .94rem; line-height: 1.6; }
.contribute-note .btn { flex-shrink: 0; }
@media (max-width: 600px) {
    .contribute-note { flex-direction: column; text-align: center; }
}

.stat-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-bottom: 2.5rem; }
.stat-pill {
    display: flex; flex-direction: column; align-items: center;
    min-width: 120px;
    padding: 1rem 1.6rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.stat-pill__num { font: 800 1.6rem var(--font-display); background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-pill__label { font-size: .82rem; color: var(--c-text-3); font-weight: 500; }

.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: start; }
.about-card { padding: 2rem; }
.about-card h2 { font-size: 1.4rem; margin-bottom: .6rem; }
.about-card p { color: var(--c-text-2); margin: 0 0 1rem; }
.about-values { display: flex; flex-direction: column; gap: 1rem; }
.value-card {
    display: flex; gap: 1rem; align-items: flex-start;
    padding: 1.25rem 1.4rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.value-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.value-card__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 12px; font-size: 1.4rem;
    background: var(--c-primary-soft);
}
.value-card h3 { font-size: 1.05rem; margin: 0 0 .2rem; }
.value-card p { color: var(--c-text-2); font-size: .9rem; margin: 0; }

.cta-band {
    margin-top: 2.5rem;
    padding: 2.25rem;
    border-radius: var(--radius-lg);
    text-align: center;
    color: #fff;
    background: var(--grad-primary);
    box-shadow: var(--shadow-primary);
}
.cta-band p { font-size: 1.1rem; margin: 0 0 1.25rem; opacity: .95; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; gap: 1.5rem; }
.contact-info { display: flex; flex-direction: column; gap: 1rem; }
.contact-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.3rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--c-text);
    transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
a.contact-card:hover { transform: translateY(-3px); border-color: var(--c-primary); box-shadow: var(--shadow); }
.contact-card__icon { grid-row: 1 / 3; font-size: 1.5rem; }
.contact-card__label { font-size: .76rem; color: var(--c-text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.contact-card__value { font-weight: 600; word-break: break-word; }
.contact-form-card { padding: 2rem; }
.contact-form-card h2 { font-size: 1.3rem; margin-bottom: 1.1rem; }

@media (max-width: 820px) {
    .about-grid, .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Navbar name on small screens ---------- */
@media (max-width: 520px) {
    .navbar__name { font-size: .8rem; letter-spacing: 0; }
    .navbar__logo-img { width: 34px; height: 34px; }
}

/* =============================================================
   2.5D app-like UI layer
   Layered depth, floating app bar, pressable controls, tab bar.
   ============================================================= */
html { -webkit-tap-highlight-color: transparent; }

:root {
    --radius-sm: 14px;
    --radius: 20px;
    --radius-lg: 28px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 68, .06), 0 1px 2px rgba(0, 0, 68, .08);
    --shadow: 0 12px 26px -10px rgba(0, 0, 68, .18), 0 2px 6px rgba(0, 0, 68, .06);
    --shadow-lg: 0 28px 56px -18px rgba(0, 0, 68, .3), 0 4px 12px rgba(0, 0, 68, .08);
}

/* Floating detached app bar */
.navbar {
    top: .65rem;
    margin: .65rem .9rem 0;
    border-radius: 22px;
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow);
}
.navbar__inner { height: 62px; padding-inline: 1.1rem; width: auto; }
.navbar.is-scrolled { box-shadow: var(--shadow-lg); }
@media (max-width: 860px) {
    .navbar__menu { top: calc(62px + 1.5rem); margin: 0 1.1rem; }
}

/* Pressable 2.5D buttons */
.btn { will-change: transform; }
.btn--primary {
    box-shadow: 0 4px 0 rgba(0, 0, 68, .3), 0 14px 26px -10px rgba(0, 149, 221, .55);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 68, .3), 0 18px 32px -10px rgba(0, 149, 221, .6);
}
.btn--primary:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0, 0, 68, .3), 0 8px 16px -8px rgba(0, 149, 221, .45);
}
.btn--outline:active, .btn--ghost:active, .icon-btn:active { transform: scale(.94); }

/* Raised cards with inner top highlight (tactile, layered) */
.book-card,
.panel, .stat-card, .value-card, .contact-card, .stat-pill,
.contact-form-card, .about-card {
    border: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .65),
        0 12px 26px -10px rgba(0, 0, 68, .16),
        0 2px 6px rgba(0, 0, 68, .07);
}
html[data-theme="dark"] .book-card,
html[data-theme="dark"] .panel, html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .value-card, html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .stat-pill, html[data-theme="dark"] .contact-form-card,
html[data-theme="dark"] .about-card {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .06),
        0 14px 30px -12px rgba(0, 0, 0, .6),
        0 2px 6px rgba(0, 0, 0, .3);
}
.book-card { border-radius: var(--radius); }
.book-card:active { transform: scale(.965); transition-duration: .1s; }
.book-card:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .65),
        0 26px 48px -16px rgba(0, 0, 68, .28),
        0 4px 10px rgba(0, 0, 68, .08);
}

/* Filled app-style inputs */
.search-bar,
.cat-filter__trigger,
.form__group input[type="text"],
.form__group input[type="search"],
.form__group input[type="password"],
.form__group input[type="email"],
.form__group input[type="number"],
.form__group select,
.form__group textarea {
    background: var(--c-bg);
    border-color: transparent;
    box-shadow: inset 0 2px 5px rgba(0, 0, 68, .07), inset 0 0 0 1px var(--c-border);
}
html[data-theme="dark"] .search-bar,
html[data-theme="dark"] .cat-filter__trigger {
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--c-border);
}

/* Footer as a rounded app sheet */
.footer {
    margin: 3rem .9rem 1rem;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* Bottom tab bar (mobile app navigation) */
.tabbar { display: none; }
@media (max-width: 860px) {
    .tabbar {
        position: fixed;
        left: .9rem; right: .9rem; bottom: .8rem;
        z-index: 130;
        display: flex;
        gap: .3rem;
        padding: .45rem .55rem;
        border-radius: 24px;
        background: var(--glass-bg);
        backdrop-filter: blur(20px) saturate(1.6);
        -webkit-backdrop-filter: blur(20px) saturate(1.6);
        border: 1px solid var(--c-border);
        box-shadow: var(--shadow-lg);
    }
    .tabbar a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: .4rem .25rem .35rem;
        border-radius: 16px;
        font-size: .64rem;
        font-weight: 700;
        letter-spacing: .02em;
        color: var(--c-text-3);
        transition: color .2s, background .2s, transform .15s var(--ease);
    }
    .tabbar a:active { transform: scale(.92); }
    .tabbar a.is-active {
        color: #fff;
        background: var(--grad-primary);
        box-shadow: 0 8px 18px -6px rgba(0, 149, 221, .55);
    }
    /* keep content clear of the tab bar */
    body:has(.tabbar) { padding-bottom: 78px; }
    body:has(.tabbar) .footer { margin-bottom: .5rem; }
}

/* ---------- Compact "You may also like" cards ---------- */
.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: .8rem;
}
.mini-card {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .6rem .75rem .6rem .6rem;
    border-radius: 16px;
    background: var(--c-surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), var(--shadow-sm);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
html[data-theme="dark"] .mini-card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-sm); }
.mini-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mini-card:active { transform: scale(.97); }
.mini-card__cover {
    width: 48px;
    height: 66px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 3px 8px -2px rgba(0, 0, 68, .3);
}
.mini-card__info { min-width: 0; }
.mini-card__title {
    margin: 0 0 .1rem;
    font-size: .84rem;
    font-weight: 700;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-card__author {
    margin: 0 0 .2rem;
    font-size: .74rem;
    color: var(--c-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-card__views {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .7rem;
    font-weight: 600;
    color: var(--c-primary);
}

/* ---------- Tab bar: slightly smaller + social flyout ---------- */
@media (max-width: 860px) {
    .tabbar { padding: .35rem .45rem; border-radius: 20px; }
    .tabbar a, .tabbar__social-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: .32rem .2rem .3rem;
        border: none;
        background: transparent;
        border-radius: 14px;
        font-family: var(--font-body);
        font-size: .58rem;
        font-weight: 700;
        letter-spacing: .02em;
        color: var(--c-text-3);
        cursor: pointer;
        transition: color .2s, background .2s, transform .15s var(--ease);
    }
    .tabbar a svg, .tabbar__social-btn svg { width: 17px; height: 17px; }
    .tabbar a:active, .tabbar__social-btn:active { transform: scale(.92); }
    .tabbar a.is-active, .tabbar__social-btn.is-active {
        color: #fff;
        background: var(--grad-primary);
        box-shadow: 0 8px 18px -6px rgba(0, 149, 221, .55);
    }
}
.tabbar__social-menu {
    position: absolute;
    bottom: calc(100% + .6rem);
    inset-inline-end: .35rem;
    display: flex;
    gap: .5rem;
    padding: .5rem .55rem;
    border-radius: 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px) scale(.92);
    transform-origin: bottom center;
    pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.tabbar__social-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.tabbar__social-menu a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 12px;
    color: #fff;
    transition: transform .2s var(--ease);
}
.tabbar__social-menu a:active { transform: scale(.9); }
.social--ig { background: linear-gradient(45deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888); }
.social--snap { background: #FFFC00; color: #1a1a1a; }
.social--tt { background: #ffffff; color: #010101; box-shadow: inset 0 0 0 1px rgba(0, 0, 68, .15); }

/* ---------- Landing: Kurdish Badini/Sorani popup ---------- */
.lang-ku { position: relative; }
.lang-ku__btn { width: 100%; }
.lang-ku__pop {
    position: absolute;
    bottom: calc(100% + .55rem);
    left: 0; right: 0;
    z-index: 20;
    display: flex;
    gap: .5rem;
    padding: .5rem;
    border-radius: 14px;
    /* darker than the white language buttons so it stands apart */
    background: linear-gradient(180deg, #12275e, #0a1a44);
    border: 2px solid rgba(0, 191, 255, .55);
    box-shadow: 0 18px 40px -14px rgba(0, 0, 68, .6);
    opacity: 0;
    transform: translateY(8px) scale(.96);
    transform-origin: bottom center;
    pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.lang-ku__pop.is-open { opacity: 1; transform: none; pointer-events: auto; }
.lang-ku__pop a {
    flex: 1;
    padding: .65rem .5rem;
    border-radius: 10px;
    text-align: center;
    font-family: var(--font-display);
    font-size: .98rem;
    font-weight: 700;
    color: #eaf7ff;
    background: rgba(255, 255, 255, .1);
    border: 1.5px solid rgba(122, 212, 255, .4);
    transition: background .2s, color .2s, transform .2s var(--ease), border-color .2s;
}

/* Navbar "change language" pill → back to the landing page */
.navbar__lang {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .9rem;
    border-radius: 999px;
    border: 1.5px solid var(--c-border);
    color: var(--c-text-2);
    font-size: .84rem;
    font-weight: 600;
    transition: border-color .2s, color .2s;
}
.navbar__lang:hover { border-color: var(--c-primary); color: var(--c-primary); }
.navbar__lang::after { display: none !important; }
.lang-ku__pop a:hover {
    color: #fff;
    background: var(--grad-primary);
    transform: translateY(-2px);
}
