/* ---------- فونت ---------- */
@font-face {
    font-family: "VazirFD";
    src: url("/styles/fonts/Vazir-FD-WOL.ttf") format("truetype");
    font-display: swap;
}

/* ---------- پالت تیره + روشن ---------- */
:root {
    --font: "VazirFD", system-ui, -apple-system, Segoe UI, Roboto,
        "Noto Sans Arabic", "Vazirmatn", sans-serif;

    --bg-0: #0a0b0e;
    --bg-1: #101218;
    --bg-2: #141823;
    --text: #e8ecf3;
    --muted: #a8b1c1;
    --brand: #9b87f5;
    --brand2: #5aa7ff;
    --border: color-mix(in oklab, white 8%, transparent);

    --radius-lg: 18px;
    --radius-sm: 12px;
    --shadow-1: 0 1px 0 color-mix(in oklab, white 4%, transparent) inset,
        0 12px 28px rgba(0, 0, 0, 0.22);

    color-scheme: dark;
}
html[data-theme="light"],
html[data-theme="auto"][data-color-mode="light"] {
    --bg-0: #ffffff;
    --bg-1: #f6f8fb;
    --bg-2: #ffffff;
    --text: #0b0c0f;
    --muted: #5f6b7b;
    --brand: #6d5de6;
    --brand2: #2563eb;
    --border: color-mix(in oklab, black 12%, transparent);
    color-scheme: light;
}
html[data-theme="dark"],
html[data-theme="auto"][data-color-mode="dark"] {
    color-scheme: dark;
}

/* ---------- پایه ---------- */
* {
    box-sizing: border-box;
}
html {
    font-family: var(--font);
}
body {
    margin: 0;
    color: var(--text);
    background: radial-gradient(
            1100px 520px at 120% -10%,
            color-mix(in oklab, var(--brand) 14%, transparent),
            transparent 50%
        ),
        radial-gradient(
            900px 480px at -10% 10%,
            color-mix(in oklab, var(--brand2) 12%, transparent),
            transparent 50%
        ),
        var(--bg-0);
    line-height: 1.75;
}
a {
    color: inherit;
    text-decoration: none;
}
a:focus,
button:focus {
    outline: 2px solid color-mix(in oklab, var(--brand) 70%, transparent);
    outline-offset: 2px;
    border-radius: 10px;
}
.container {
    max-width: 1180px;
    margin: auto;
    padding: 14px 16px;
}

/* کاهش حرکت برای کاربرانی که ترجیح می‌دهند */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- هدر ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg-0) 45%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
}
.nav-wrap {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.2px;
}
.brand img {
    display: block;
}

.nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 22px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg-2) 70%, transparent);
    border-radius: 999px;
    box-shadow: 0 1px 0 color-mix(in oklab, white 4%, transparent) inset;
}
.nav a {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.96rem;
    padding: 6px 10px;
    border-radius: 10px;
}
.nav a[aria-current="page"] {
    color: var(--text);
}
.nav a:hover {
    color: var(--text);
    background: color-mix(in oklab, var(--bg-1) 80%, transparent);
}

.nav-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* دکمه کلی */
.icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 85%, transparent),
        color-mix(in oklab, var(--bg-1) 60%, transparent)
    );
    box-shadow: var(--shadow-1);
    transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: pointer;
}
.icon-btn:hover {
    transform: translateY(-2px);
}

/* فقط برای آیکن‌های داخل دکمه‌های تِم (ماه/خورشید) */
.icon-btn.theme-btn img {
    position: absolute;
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* آیکن فعال در تم */
.icon-btn.theme-btn[data-icon="sun"] .icon-sun {
    opacity: 1;
}
.icon-btn.theme-btn[data-icon="moon"] .icon-moon {
    opacity: 1;
}

/* فقط روی آیکن‌ها فیلتر اعمال شود، نه تصاویر محتوا */
.nav-actions img,
.footer img,
.icon-btn img {
    filter: invert(70%) sepia(5%) saturate(200%) hue-rotate(180deg);
}

html[data-theme="light"] .nav-actions img,
html[data-theme="light"] .footer img,
html[data-theme="auto"][data-color-mode="light"] .nav-actions img,
html[data-theme="auto"][data-color-mode="light"] .footer img {
    filter: invert(10%) brightness(0.4) contrast(1.4);
}

/* تصاویر داخل محتوا و کتاب‌ها فیلتر ندارند */
.book-cover img,
.book-card img,
.chapter-card img,
.book-chapters img {
    filter: none !important;
}

/* آیکن‌های ثابت (مثل GitHub) باید همیشه دیده بشن */
.icon-btn:not(.theme-btn) img {
    position: static;
    opacity: 1;
    width: 20px;
    height: 20px;
}

/* ---------- هیرو ---------- */
.hero {
    padding: 70px 16px 54px;
}
.hero-inner {
    text-align: center;
}
.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(26px, 4.5vw, 40px);
    letter-spacing: 0.2px;
}
.lead {
    color: var(--muted);
    max-width: 62ch;
    margin: 0 auto 22px;
}
.cta {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}
.btn {
    display: inline-block;
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 800;
    transition: 0.18s ease;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn.primary {
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--brand) 86%, transparent),
        color-mix(in oklab, var(--brand) 66%, transparent)
    );
    border-color: color-mix(in oklab, var(--brand) 80%, transparent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(155, 135, 245, 0.22);
}
.btn.ghost {
    background: transparent;
    color: var(--text);
}
.btn.small {
    padding: 7px 14px;
    font-size: 0.9rem;
}

/* ---------- گرید کتاب‌ها ---------- */
.books {
    padding: 36px 16px 56px;
} /* کمی کمتر برای تعادل با فوتر */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px;
    align-items: stretch;
}
.card {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 92%, transparent),
        color-mix(in oklab, var(--bg-1) 70%, transparent)
    );
    padding: 18px;
    position: relative;
    box-shadow: var(--shadow-1);
    isolation: isolate;
}
.card h3 {
    margin: 0 0 6px;
    font-size: 1.08rem;
}
.card p {
    margin: 0 0 12px;
    color: var(--muted);
}
.card-body {
    flex: 1 1 auto;
}
.card-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.card-actions .btn {
    min-width: 100px;
    text-align: center;
}
@media (min-width: 760px) {
    .card {
        grid-column: span 4;
    }
}

/* ---------- فوتر (ارتفاع کمتر طبق خواسته) ---------- */
.footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
    padding: 10px 16px; /* قبلاً 16px بود؛ کمتر شد */
    background: color-mix(in oklab, var(--bg-0) 70%, transparent);
}
.footer p {
    margin: 0;
} /* حذف فضای اضافی متن */
.footer img {
    vertical-align: middle;
    filter: invert(90%) sepia(5%) saturate(200%) hue-rotate(180deg);
}
html[data-theme="light"] .footer img,
html[data-theme="auto"][data-color-mode="light"] .footer img {
    filter: invert(10%) sepia(20%) saturate(300%) hue-rotate(180deg);
}

/* ---------- دسترسی کمکی ---------- */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
/* ///////////////////
 */

/* هدر داخلی صفحه لیست */
.page-header {
    padding: 32px 16px 12px;
    text-align: center;
}
.page-header h1 {
    margin: 0 0 8px;
    font-size: clamp(22px, 4vw, 30px);
}
.page-header p {
    margin: 0 auto;
    color: var(--muted);
    max-width: 60ch;
}

/* ظرف لیست کتاب‌ها */
.books-list {
    padding: 20px 16px 70px;
}
.books-list .grid {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px;
    align-items: stretch;
}

/* کارت کتاب‌: هم‌استایل با کارت‌های صفحه اصلی */
.book-card {
    grid-column: span 12;
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 92%, transparent),
        color-mix(in oklab, var(--bg-1) 72%, transparent)
    );
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 1px 0 color-mix(in oklab, #fff 4%, transparent) inset,
        0 12px 28px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* کاور کتاب */
/* کاور پیش‌فرض: پرکننده و مدرن */
.book-card .cover {
    position: relative;
    background: var(--bg-1);
    aspect-ratio: 4 / 3; /* می‌تونی 3/4 هم امتحان کنی */
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}
.book-card .cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* پیش‌فرض: کراپ زیبا */
    filter: none !important;
}

/* حالت نمایش کامل (contain) برای کتاب‌هایی که بنرشان افقی/عمودی عجیبه */
.book-card[data-fit="contain"] .cover {
    display: grid;
    place-items: center;
    background: radial-gradient(
            120% 120% at 50% 0%,
            color-mix(in oklab, var(--brand) 8%, transparent),
            transparent 40%
        ),
        var(--bg-1);
}
.book-card[data-fit="contain"] .cover img {
    position: static;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* بدون کراپ */
}

/* قاب زیباتر برای تصویر کامل: هاله و سایه لطیف */
.book-card[data-fit="contain"] .cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent,
        color-mix(in oklab, var(--bg-1) 30%, transparent)
    );
    pointer-events: none;
}

/* بدنه و دکمه‌ها */
.book-card .body {
    padding: 16px;
    display: flex;
    flex-direction: column;
}
.book-card h3 {
    margin: 0 0 6px;
    font-size: 1.02rem;
}
.book-card p {
    margin: 0 0 12px;
    color: var(--muted);
}
.book-card .actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.book-card .btn {
    min-width: 100px;
    text-align: center;
}
.book-card .btn.muted {
    color: var(--muted);
    border: 1px dashed var(--border);
    cursor: default;
}

/* سه ستونه روی دسکتاپ */
@media (min-width: 760px) {
    .book-card {
        grid-column: span 4;
    }
}

/* فقط برای بعضی کارت‌ها (جلدهای عمودی که زیاد بالا رفته‌اند) */
.book-card.shift-down .cover img {
    object-position: center 20%; /* عدد کمتر = پایین‌تر */
}
.book-card.shift-down .cover .two img {
    object-position: center 10%; /* عدد کمتر = پایین‌تر */
}
/* --- Hero Section --- */
.book-hero {
    position: relative;
    overflow: hidden;
    padding: 80px 20px 60px;
    text-align: center;
}
.book-hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(
            circle at 30% 20%,
            color-mix(in oklab, var(--brand) 25%, transparent),
            transparent 70%
        ),
        radial-gradient(
            circle at 70% 80%,
            color-mix(in oklab, var(--brand) 10%, transparent),
            transparent 80%
        );
    opacity: 0.4;
    z-index: 0;
}
.book-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.book-cover img {
    width: 220px;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}
.book-cover:hover img {
    transform: scale(1.05);
}

.book-info h1 {
    font-size: 1.8rem;
    margin: 8px 0;
}
.book-info .subtitle {
    color: var(--muted);
    margin-bottom: 20px;
}
.book-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Description --- */
.book-description {
    max-width: 800px;
    margin: 60px auto;
    padding: 0 20px;
    line-height: 1.8;
}
.book-description h2,
.book-description h3 {
    text-align: center;
    margin-bottom: 16px;
}
.book-description blockquote {
    border-right: 4px solid var(--brand);
    padding: 12px 16px;
    background: color-mix(in oklab, var(--bg-2) 92%, transparent);
    border-radius: 12px;
    margin: 20px 0;
    font-style: italic;
}

/* --- Chapters Section --- */
.book-chapters {
    padding: 40px 20px 80px;
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 96%, transparent),
        var(--bg-1)
    );
    border-radius: 8px;
}
.book-chapters h2 {
    text-align: center;
    margin-bottom: 20px;
}
.chapter-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.chapter-card {
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 92%, transparent),
        color-mix(in oklab, var(--bg-1) 75%, transparent)
    );
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.chapter-card.disabled {
    opacity: 0.5;
    cursor: default;
}
.chapter-card a {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.2s ease;
}
.chapter-card a:hover {
    background: color-mix(in oklab, var(--brand) 20%, transparent);
}

/* --- Thanks --- */
.book-thanks {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
/* --- بخش بالای کتاب (هدر) --- */
.book-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 60px 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.book-cover img {
    width: 260px;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    transition: transform 0.3s ease;
}
.book-cover:hover img {
    transform: scale(1.05);
}

.book-meta {
    max-width: 540px;
}
.book-meta h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}
.book-meta .subtitle {
    color: var(--muted);
    font-size: 1rem;
    margin-bottom: 20px;
}

/* --- برچسب‌ها --- */
.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.book-tags span {
    background: color-mix(in oklab, var(--brand) 25%, transparent);
    border: 1px solid color-mix(in oklab, var(--brand) 35%, var(--border));
    border-radius: 10px;
    padding: 4px 10px;
    font-size: 0.85rem;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- دکمه‌ها --- */
.book-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.book-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
}
.book-actions .btn.primary {
    background: var(--brand);
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.book-actions .btn.primary:hover {
    background: color-mix(in oklab, var(--brand) 70%, white 10%);
}
.book-actions .btn.ghost {
    border: 1px solid var(--border);
    color: var(--text);
}
.book-actions .btn.ghost:hover {
    background: color-mix(in oklab, var(--bg-2) 80%, var(--brand) 15%);
}

/* --- معرفی کتاب --- */
.book-intro {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    text-align: justify;
    line-height: 1.9;
}
.book-intro h2 {
    text-align: center;
    margin-bottom: 20px;
}
.key-points {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    font-size: 0.9rem;
}
.key-points div {
    background: color-mix(in oklab, var(--bg-2) 92%, transparent);
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
}

/* --- فهرست فصل‌ها (Accordion) --- */
.book-chapters {
    max-width: 900px;
    margin: 60px auto;
    padding: 0 20px 80px;
}
.book-chapters h2 {
    text-align: center;
    margin-bottom: 24px;
}
.book-chapters details {
    background: color-mix(in oklab, var(--bg-2) 95%, transparent);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
}
.book-chapters summary {
    cursor: pointer;
    padding: 14px 20px;
    font-weight: bold;
    position: relative;
}
.book-chapters summary::marker {
    content: "";
}
.book-chapters summary::after {
    content: "▼";
    position: absolute;
    left: 18px;
    top: 14px;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: transform 0.2s;
}
.book-chapters details[open] summary::after {
    transform: rotate(180deg);
}

.book-chapters ul {
    list-style: none;
    margin: 0;
    padding: 0 20px 14px 0;
}
.book-chapters li {
    padding: 6px 0;
}
.book-chapters li a {
    text-decoration: none;
    color: var(--brand);
    transition: color 0.2s ease;
}
.book-chapters li a:hover {
    color: color-mix(in oklab, var(--brand) 70%, white);
}

.chapter-box {
    display: inline-block;
    min-width: 26px;
    text-align: center;
    font-size: 0.85rem;
    background: color-mix(in oklab, var(--bg-2) 85%, var(--brand) 10%);
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: 8px;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: background 0.3s ease, transform 0.15s ease;
}
a:hover .chapter-box {
    background: color-mix(in oklab, var(--brand) 40%, var(--bg-2) 60%);
    transform: translateY(-2px);
}

/* ---------- محتوا ---------- */
.markdown-body {
    max-width: 950px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    line-height: 1.8;
    font-size: 1rem;
    color: var(--text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    font-weight: 700;
    margin-top: 2.2rem;
    margin-bottom: 1rem;
    color: var(--text-strong);
}

.markdown-body p {
    margin: 0.8rem 0;
    text-align: justify;
}

.markdown-body a {
    color: var(--brand);
    text-decoration: none;
    border-bottom: 1px dashed color-mix(in oklab, var(--brand) 60%, transparent);
    transition: color 0.2s ease;
}
.markdown-body a:hover {
    color: color-mix(in oklab, var(--brand) 90%, white);
}

/* ---------- بلوک‌های کد ---------- */
.hljs {
    background: #101215;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #d4d4d4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* رنگ‌های کدها (تیره) */
.hljs-keyword,
.hljs-selector-tag,
.hljs-title,
.hljs-section {
    color: #c586c0;
}
.hljs-string,
.hljs-attr,
.hljs-symbol {
    color: #ce9178;
}
.hljs-number,
.hljs-literal {
    color: #b5cea8;
}
.hljs-comment {
    color: #6a9955;
    font-style: italic;
}
.hljs-type,
.hljs-built_in {
    color: #4ec9b0;
}
.hljs-function {
    color: #dcdcaa;
}

/* ---------- نقل‌قول ---------- */
.markdown-body blockquote {
    border-right: 4px solid var(--brand);
    padding-right: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: color-mix(in oklab, var(--text) 80%, gray);
}

/* ---------- جدول‌ها ---------- */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}
.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border);
    padding: 0.7rem;
    text-align: center;
}
.markdown-body th {
    background: color-mix(in oklab, var(--bg-2) 85%, var(--brand) 8%);
}

/* === بلوک‌های کد با دکمه کپی === */
pre {
    position: relative;
    background: #0e0f11;
    border: 1px solid color-mix(in oklab, #fff 5%, transparent);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-block: 1.5rem;
}

pre code {
    font-family: "Cascadia Code", monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e4e4e4;
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

/* === دکمه کپی برای بلوک‌های کد === */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
    background: color-mix(in oklab, var(--bg-2) 92%, var(--bg-1));
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease, background 0.3s ease;
    z-index: 3;
}

pre:hover .copy-btn {
    opacity: 1;
    transform: translateY(-2px);
}

/* آیکون درون دکمه */
.copy-btn img {
    width: 18px;
    height: 18px;
    transition: filter 0.3s ease, opacity 0.3s ease;
    opacity: 0.9;
    filter: invert(100%) brightness(1.1);
}

/* حالت hover */
.copy-btn:hover {
    background: color-mix(in oklab, var(--brand) 35%, var(--bg-2));
}
.copy-btn:hover img {
    opacity: 1;
}

/* آیکون در حالت “کپی شد” */
.copy-btn.copied img {
    content: url("/icone/check.svg");
}

/* تم روشن */
html[data-theme="light"] .copy-btn {
    background: #f2f3f4;
    border-color: color-mix(in oklab, var(--text) 25%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .copy-btn img {
    filter: invert(0%) brightness(0.25);
}
html[data-theme="light"] .copy-btn:hover {
    background: color-mix(in oklab, var(--brand) 20%, #fff);
}

.book-page {
    padding-inline: 5vw;
    max-width: 1100px;
    margin-inline: auto;
}

/* فقط روی صفحاتی که داخل مسیر /Book/ هستن */
body[data-page*="/Book/"] .site-main img {
    border-radius: 12px;
    max-width: 100%;
    display: block;
    margin: 1rem auto;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

/* مطمئن شو بقیه تصاویر مثل کاور کتاب‌ها دست‌نخورده بمونن */
.book-card img,
.cover img {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* منوی موبایل مخفی در دسکتاپ */
.menu-toggle {
    display: none;
}

/* --- تبلت (max-width: 900px) --- */
@media (max-width: 900px) {
    .nav-wrap {
        grid-template-columns: 1fr auto auto;
        gap: 8px;
    }
    .nav {
        gap: 14px;
    }
    .nav a {
        font-size: 0.9rem;
    }
    .nav-actions {
        gap: 6px;
    }
}

/* --- موبایل (max-width: 680px) --- */
@media (max-width: 680px) {
    .nav-wrap {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: color-mix(in oklab, var(--bg-2) 85%, var(--bg-1));
        box-shadow: var(--shadow-1);
    }
    .menu-toggle img {
        width: 20px;
        height: 20px;
        filter: invert(70%) sepia(5%) saturate(200%) hue-rotate(180deg);
    }
    html[data-theme="light"] .menu-toggle img,
    html[data-theme="auto"][data-color-mode="light"] .menu-toggle img {
        filter: invert(10%) brightness(0.4) contrast(1.4);
    }

    .nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        right: 16px;
        background: color-mix(in oklab, var(--bg-2) 95%, transparent);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 14px 22px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        z-index: 50;
        min-width: 180px; /* عرض حداقلی */
        width: max-content; /* با توجه به طول متن */
    }
    .nav.show {
        display: flex;
    }

    /* برند کوچکتر */
    .brand span {
        font-size: 1rem;
    }

    /* فوتر */
    .footer {
        padding: 14px 10px;
        font-size: 0.9rem;
        line-height: 1.6;
    }
}
.footer img {
    width: 20px;
    height: 20px;
}
/* --- خیلی کوچک (max-width: 400px) --- */
@media (max-width: 400px) {
    .brand span {
        display: none;
    }
    .footer {
        font-size: 0.8rem;
    }
}

/* حالت عادی (دسکتاپ و تبلت) */
.hero-title {
    font-size: 2.2rem;
    line-height: 1.3;
    text-align: center;
}

/* حالت موبایل */
@media (max-width: 680px) {
    .hero-title {
        font-size: 1.6rem; /* کوچیک‌تر از حالت دسکتاپ */
        line-height: 1.5;
    }

    .hero-title .title-main {
        display: block; /* خط بعد */
    }

    .hero-title .title-sub {
        display: block;
        margin-top: 0.3em;
    }
}

/* --- مترجمین --- */
.translators-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    padding: 50px 16px 100px;
}

/* کارت مترجم */
.translator-card {
    position: relative;
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--bg-2) 92%, transparent),
        color-mix(in oklab, var(--bg-1) 80%, transparent)
    );
    border-radius: 22px;
    width: 280px;
    padding: 30px 20px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
/* Hover */
.translator-card:hover {
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

/* تصویر مترجم */
.translator-photo {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 30%, transparent);
}

/* متن */
.translator-card h3 {
    margin: 8px 0 4px;
    font-size: 1.2rem;
    font-weight: 600;
}

.translator-card .role {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* شبکه‌های اجتماعی */
.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-links img {
    width: 24px;
    height: 24px;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease, filter 0.3s ease;
    filter: invert(85%) sepia(10%) saturate(80%) hue-rotate(200deg);
}

html[data-color-mode="light"] .social-links img {
    filter: invert(10%) brightness(0.5);
}

.social-links img:hover {
    opacity: 1;
    transform: scale(1.18);
    filter: brightness(1.4) saturate(150%);
}

/* --- صفحه گیتر --- */
.coming-soon {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 70vh;
    text-align: center;
    font-family: "Vazir", sans-serif;
}

.coming-soon h1 {
    font-size: 3rem;
    color: var(--brand, #00ffaa);
    letter-spacing: 2px;
    text-shadow: 0 0 10px color-mix(in oklab, var(--brand) 60%, #000),
        0 0 20px color-mix(in oklab, var(--brand) 40%, #000);
    animation: glowPulse 2.5s ease-in-out infinite;
}

/* انیمیشن نور ملایم متن */
@keyframes glowPulse {
    0% {
        text-shadow: 0 0 10px color-mix(in oklab, var(--brand) 60%, #000),
            0 0 20px color-mix(in oklab, var(--brand) 40%, #000);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 20px color-mix(in oklab, var(--brand) 80%, #fff),
            0 0 40px color-mix(in oklab, var(--brand) 70%, #fff);
        transform: scale(1.05);
    }
    100% {
        text-shadow: 0 0 10px color-mix(in oklab, var(--brand) 60%, #000),
            0 0 20px color-mix(in oklab, var(--brand) 40%, #000);
        transform: scale(1);
    }
}
/* Tooltip اختصاصی */
.owner-badge {
    position: relative;
}

/* ظاهر tooltip */
.owner-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(249, 203, 39, 0.95);
    color: #222;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* افکت ظاهر شدن */
.owner-badge:hover::after {
    opacity: 1;
    transform: translate(-50%, -4px);
}
.owner-badge img {
    width: 26px;
    height: 26px;
    filter: none !important; /* از فیلتر invert خلاص میشه */
    opacity: 0.95;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.owner-badge img {
    cursor: pointer;
    filter: drop-shadow(0 0 2px #fbce2b);
}
/* رنگ و افکت مخصوص برچسب همکار */
.owner-badge.work img {
    filter: drop-shadow(0 0 2px #fc6c32);
    cursor: pointer;
}
.owner-badge.star img {
    filter: drop-shadow(0 0 2px #fce832);
    cursor: pointer;
}
.owner-badge.star::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 245, 59, 0.95); /* رنگ تول‌تیپ */
    color: #222;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
/* رنگ و استایل تول‌تیپ مخصوص همکار */
.owner-badge.work::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 121, 59, 0.95); /* رنگ تول‌تیپ */
    color: #222;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* افکت ظاهر شدن */
.owner-badge.work:hover::after {
    opacity: 1;
    transform: translate(-50%, -4px);
}
.owner-badge.star:hover::after {
    opacity: 1;
    transform: translate(-50%, -4px);
}
.owner-badge.manager img {
    filter: drop-shadow(0 0 2px #7a01de);
    cursor: pointer;
}

/* رنگ و استایل تول‌تیپ مخصوص همکار */
.owner-badge.manager::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(129, 11, 248, 0.95); /* رنگ تول‌تیپ */
    color: #ffffff;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* افکت ظاهر شدن */
.owner-badge.manager:hover::after {
    opacity: 1;
    transform: translate(-50%, -4px);
}
/* دکمه فایل اصلی */
.donate-btn.download {
    background: linear-gradient(135deg, #13c74f, #5ee47b);
    color: #0f172a;
    font-family: "VazirFD";
}
.donate-btn.download:hover {
    box-shadow: 0 8px 20px rgba(92, 246, 110, 0.35);
}

/* دکمه فایل فارسی */
.donate-btn.downloadfa {
    background: linear-gradient(135deg, #d59603, #fade3f);
    color: #0f172a;
    font-family: "VazirFD";
}
.donate-btn.downloadfa:hover {
    box-shadow: 0 8px 20px rgba(245, 189, 23, 0.35);
}
/* ریسپانسیو برای موبایل */
@media (max-width: 600px) {
    .donate-buttons {
        flex-direction: column;
        gap: 12px;
    }
    .donate-btn {
        width: 80%;
        max-width: 300px;
    }
}
.donate-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap; /* تا در موبایل خودش بره زیر هم */
    margin: 30px auto;
    width: 100%;
    text-align: center;
} /* دکمه عمومی */
.donate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #8152ed, #54abd4);
    color: #0f172a;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s;
    font-family: "VazirFD";
    font-size: 14px;
    min-width: 140px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

/* مودال */
.donate-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}
.donate-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
}
.donate-content {
    position: relative;
    background: var(--bg-2);
    color: var(--fg);
    width: 90%;
    max-width: 600px;
    margin: 10% auto;
    padding: 32px;
    border-radius: 18px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.35s ease;
}
@keyframes scaleIn {
    from {
        transform: scale(0.85);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.donate-section {
    margin: 22px 0;
}

/* ردیف پرداخت: Grid پنج‌ستونه (آیکون | برچسب | مقدار | TON(اختیاری) | دکمه) */
/* ساختار ردیف پرداخت */
.donate-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    align-items: center; /* تراز عمودی دقیق وسط */
    gap: 10px;
    background: color-mix(in oklab, var(--bg-1) 92%, transparent);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px; /* ارتفاع کمی کمتر برای تراز ظریف‌تر */
    border-radius: 10px;
    font-size: 0.95rem;
    direction: rtl;
}

/* آیکون‌ها (کارت و کیف پول) */
.donate-row .icon {
    width: 24px;
    height: 24px;
    filter: none !important;
    flex-shrink: 0;
}
.donate-row .label {
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}
.donate-row .value {
    direction: ltr;
    text-align: left;
    color: var(--fg);
    font-family: monospace;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.donate-row .wallet {
    max-width: 260px;
} /* جا برای دکمه و TON */
/* آیکون تون */
.ton-icon {
    width: 24px; /* هم‌ارتفاع با بقیه */
    height: 24px;
    opacity: 0.9;
    filter: none !important;
    transition: transform 0.25s, opacity 0.25s;
}
.ton-icon:hover {
    transform: scale(1.08);
    opacity: 1;
}

/* اگر TON نداشتیم، فاصله را پر کند */
.donate-row .spacer {
    display: block;
}

/* دکمه کپی */
.copy-btn {
    background: linear-gradient(135deg, #8b5cf6, #7dd3fc);
    border: none;
    color: #0f172a;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.copy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* دکمه بستن */
.close-btn {
    display: block;
    margin: 30px auto 0;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: "VazirFD";
    font-size: medium;
    transition: color 0.3s;
}
.close-btn:hover {
    color: #8b5cf6;
}

/* دکمه کپی مخصوص مودال حمایت مالی */
.donate-copy {
    position: static !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    background: linear-gradient(135deg, #7f4bf7, #7d7dfc);
    border: none;
    color: #0f172a;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1; /* هم‌ترازی دقیق با آیکون */
    height: 26px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: "VazirFD";
}
.donate-copy:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}
.download-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-download {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: linear-gradient(135deg, #13c74f, #51d36d);
    color: #0f172a;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-family: "VazirFD";
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.tooltip-download.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

