:root {
    --brand-primary: #0066FF;
    --brand-secondary: #6366F1;
    --brand-accent: #F59E0B;
    --brand-success: #10B981;
    
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #1c1c1e;
    --text-primary: #FFFFFF;
    --text-secondary: #B3B3B3;
    --card-border-color: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(0, 102, 255, 0.2);
}

[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #f7f9fc;
    --bg-tertiary: #edf2f7;
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --card-border-color: rgba(229, 231, 235, 1);
    --card-hover-border: rgba(0, 102, 255, 0.4);
}

html { 
    scroll-behavior: smooth; 
    overflow-x: clip; 
    width: 100%; 
    max-width: 100vw; 
}

#backToTop {
    display: none !important;
}

body,
#hero-sticky-wrapper,
#article-body,
#share-modal,
#auth-modal,
button,
input,
textarea,
select,
a,
h1,
h2,
h3,
h4,
h5,
h6,
p,
span {
    font-family: 'Vazirmatn', sans-serif !important;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: clip; 
    width: 100%; 
    max-width: 100vw; 
    position: relative;
    -webkit-font-smoothing: antialiased; 
    margin: 0; 
    padding: 0;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.tabular-num { font-variant-numeric: tabular-nums; }

::selection {
    background-color: rgba(0, 102, 255, 0.2) !important;
    color: var(--brand-primary) !important;
}



.editorial-content p {
    font-size: 1.15rem; 
    line-height: 2.2;
    margin-bottom: 2rem;
    color: var(--text-primary);
    opacity: 0.95;
    font-weight: 400;
}
.editorial-content h2 {
    font-size: 1.85rem;
    font-weight: 800;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    scroll-margin-top: 100px;
}
.editorial-content h3 {
    font-size: 1.45rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    scroll-margin-top: 100px;
}

@media (max-width: 768px) {
    .editorial-content p {
        font-size: 0.98rem !important; 
        line-height: 2.05 !important;
        margin-bottom: 1.5rem !important;
    }
    .editorial-content h2 {
        font-size: 1.4rem !important;
        margin-top: 2.5rem !important;
        margin-bottom: 1rem !important;
    }
    .editorial-content h3 {
        font-size: 1.2rem !important;
        margin-top: 2rem !important;
        margin-bottom: 0.75rem !important;
    }
    .editorial-content ul:not(.no-style) li {
        font-size: 0.95rem !important; 
        line-height: 1.85 !important;
    }
}

.editorial-content a.ref-link {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--card-border-color);
    transition: all 0.3s ease;
    position: relative;
}
.editorial-content a.ref-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    width: 0;
    height: 1px;
    background-color: var(--brand-primary);
    transition: width 0.3s ease;
    margin: auto;
}
.editorial-content a.ref-link:hover {
    color: var(--brand-primary);
    border-bottom-color: transparent;
}
.editorial-content a.ref-link:hover::after {
    width: 100%;
}

.editorial-content a:not(.no-style):not(.ref-link) {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(0, 102, 255, 0.3);
    transition: all 0.2s ease;
}
.editorial-content a:not(.no-style):not(.ref-link):hover {
    text-decoration-color: var(--brand-primary);
    background-color: rgba(0, 102, 255, 0.05);
}

.editorial-content ul:not(.no-style) {
    list-style-type: none; 
    padding-right: 0.5rem; 
    margin-bottom: 2rem;
}
.editorial-content ul:not(.no-style) li {
    position: relative; 
    padding-right: 1.5rem; 
    margin-bottom: 1rem; 
    line-height: 1.9; 
    font-size: 1.1rem; 
    opacity: 0.95;
}
.editorial-content ul:not(.no-style) li::before {
    content: ""; 
    position: absolute; 
    right: 0; 
    top: 0.65rem; 
    width: 6px; 
    height: 6px; 
    border-radius: 50%;
    background-color: var(--brand-primary);
}

.code-block-wrapper,
.code-block-wrapper pre,
.code-block-wrapper code,
.inline-code {
    direction: ltr !important; 
    text-align: left !important; 
    font-family: 'JetBrains Mono', monospace !important;
}

.inline-code {
    background-color: rgba(0, 102, 255, 0.1); 
    border: 1px solid rgba(0, 102, 255, 0.25);
    padding: 0.15rem 0.5rem; 
    border-radius: 0.375rem; 
    font-size: 0.88em; 
    color: #38bdf8;
}

#reading-progress {
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 3px; 
    background-color: var(--brand-primary); 
    z-index: 1000; 
    width: 0%; 
    transition: width 0.1s ease-out;
}

.toc-link {
    transition: all 0.2s ease;
    position: relative;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    display: block;
    width: 100%;
    text-align: right;
    direction: rtl;
    color: var(--text-secondary);
}
.toc-link:hover {
    color: var(--text-primary);
}
.toc-link.active {
    color: var(--brand-primary) !important;
    font-weight: 700 !important;
    opacity: 1 !important;
    background-color: rgba(0, 102, 255, 0.08);
}

#mobile-toc-placeholder a,
#mobile-toc-placeholder a:hover,
#mobile-toc-placeholder a:focus,
#mobile-toc-placeholder a:active {
    text-decoration: none !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
}
#mobile-toc-placeholder a:hover {
    color: var(--brand-primary) !important;
}
#mobile-toc-placeholder ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
#mobile-toc-placeholder li {
    margin-bottom: 0.15rem !important;
    padding: 0 !important;
    line-height: 1.5 !important;
}
#mobile-toc-placeholder li::before {
    display: none !important;
}

.custom-scrollbar::-webkit-scrollbar { height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: var(--bg-primary); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--card-border-color); border-radius: 4px; }

.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }

.mobile-swipe-carousel {
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-y pinch-zoom;
}
.draggable-carousel {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.draggable-carousel.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}
.draggable-carousel a, .draggable-carousel img {
    user-select: none;
    -webkit-user-drag: none;
}

[google-add-preferred-source-btn] {
    display: inline-block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.pb-safe { padding-bottom: env(safe-area-inset-bottom); }