@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Naskh+Arabic:wght@400..700&family=Rubik:ital,wght@0,300..900;1,300..900&family=Zain:ital,wght@0,200;0,300;0,400;0,700;0,800;0,900;1,300;1,400&display=swap');

:root {
    --bg: #f5f5f5;
    --surface: #fafafa;
    --border: #eaeaea;
    --border-hover: #d0d0d0;
    --text-main: #171717;
    --text-muted: #666666;
    --accent: #000000;
    --link: #0070f3;
    --code-bg: #f5f5f5;
    
    --container-width: 800px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;

    --text-xs: 0.78rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.2rem;
    --text-xl: 1.45rem;

    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

body {
    direction: rtl;
    margin: 0;
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', 'Noto Naskh Arabic', -apple-system, sans-serif;
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    display: flex;
    flex-direction: column;
    max-width: var(--container-width);
    min-height: 100vh;
    margin: 5rem auto 0;
    /* text-align: justify; */
}

.topbar {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 900px;
    padding: var(--space-4) var(--space-5);
}

.topbar-brand {
    color: var(--accent);
    font-size: var(--text-lg);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.content {
    flex: 1;
    padding: var(--space-7) var(--space-5);
}

.article-title {
    margin: 0 0 var(--space-4);
    color: var(--accent);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -1px;
}

.article-subtitle {
    margin-bottom: var(--space-6);
    color: var(--text-muted);
    font-size: var(--text-lg);
}

h2, h3 {
    color: var(--accent);
    color: var(--accent);
}

h2 {
    margin: var(--space-7) 0 var(--space-4);
    font-size: var(--text-xl);
    font-weight: 700;
}

h3 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: var(--text-lg);
    font-weight: 600;
}

p {
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
    text-indent: 1rem;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: opacity var(--transition);
}

a:hover {
    text-decoration: underline;
}

.gh-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.gh-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--accent);
    color: var(--bg);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: opacity var(--transition);
}

.gh-link:hover {
    opacity: 0.8;
}

.breadcrumb {
    display: none;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.breadcrumb a {
    color: inherit;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.divider {
    margin: var(--space-7) 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.code-block {
    direction: ltr;
    margin: var(--space-5) 0;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: #f0f0f0;
    color: var(--text-muted);
    font-family: 'Inter', monospace;
    font-size: var(--text-xs);
    border-bottom: 1px solid var(--border);
}

.copy-btn {
    padding: var(--space-1) var(--space-2);
    background: var(--bg);
    color: var(--text-main);
    font-size: var(--text-xs);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.copy-btn:hover {
    background: var(--surface);
    border-color: var(--border-hover);
}

pre {
    margin: 0;
    padding: var(--space-4);
    color: #333;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: var(--text-sm);
    overflow-x: auto;
}

table {
    width: 100%;
    margin: var(--space-6) 0;
    font-size: var(--text-sm);
    border-collapse: collapse;
}

th, td {
    padding: var(--space-3);
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom-width: 2px;
}

tr:hover td {
    background: var(--surface);
}

ul {
    padding-right: var(--space-5);
}

li {
    margin-bottom: var(--space-2);
}

.footer {
    padding: var(--space-7) var(--space-5);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border);
}

.gh-loading-bar {
    position: relative;
    width: 100px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.gh-loading-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 600px) {
    :root {
        --space-7: 32px;
        --space-5: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .content {
        padding: var(--space-6) var(--space-4);
    }

    .article-title {
        font-size: 1.8rem;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        display: none;
    }

    tr {
        margin-bottom: 15px;
        border: 1px solid #ccc;
    }

    td {
        position: relative;
        padding-left: 50%;
        text-align: right;
        border-bottom: 1px solid #eee;
    }

    td::before {
        content: attr(data-label);
        position: absolute;
        right: 10px;
        font-weight: bold;
    }
}