/* ==========================================================
   استایل پایه (Reset + Typography + Utilities)
   ========================================================== */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    min-height: 100vh;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

ul,
ol {
    list-style: none;
}

/* ---------- تایپوگرافی ---------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-primary);
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-extrabold);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    line-height: var(--line-height-base);
    color: var(--color-text);
}

strong, b {
    font-weight: var(--font-weight-bold);
}

small {
    font-size: var(--font-size-sm);
}

mark {
    background-color: var(--color-accent);
    color: var(--color-primary-dark);
    padding: 0.1em 0.3em;
    border-radius: var(--radius-sm);
}

/* ---------- لینک‌های مقالات ---------- */
.entry-content a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

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

/* ---------- عنوان‌های مقالات ---------- */
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.entry-content p {
    margin-bottom: var(--space-4);
}

.entry-content ul,
.entry-content ol {
    margin-bottom: var(--space-4);
    padding-right: var(--space-5);
}

.entry-content ul {
    list-style: disc;
}

.entry-content ol {
    list-style: decimal;
}

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

.entry-content blockquote {
    border-right: 4px solid var(--color-accent);
    padding: var(--space-3) var(--space-5);
    margin: var(--space-5) 0;
    background-color: var(--color-bg-alt);
    border-radius: var(--radius-md);
    font-style: italic;
    color: var(--color-text-muted);
}

.entry-content code {
    background-color: var(--color-bg-alt);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--color-primary);
    direction: ltr;
    display: inline-block;
}

.entry-content pre {
    background-color: var(--color-primary-dark);
    color: #fff;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-4) 0;
    direction: ltr;
    text-align: left;
}

.entry-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-5) 0;
}

.entry-content table th,
.entry-content table td {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    text-align: right;
}

.entry-content table th {
    background-color: var(--color-primary);
    color: #fff;
    font-weight: var(--font-weight-bold);
}

/* ---------- یوتیلیتی‌ها ---------- */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

.container--wide {
    max-width: var(--container-wide-width);
}

.container--narrow {
    max-width: 800px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-primary) !important; }
.text-accent { color: var(--color-accent) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-white { color: #fff !important; }

.bg-primary { background-color: var(--color-primary) !important; }
.bg-accent { background-color: var(--color-accent) !important; }
.bg-light { background-color: var(--color-bg-alt) !important; }

.font-bold { font-weight: var(--font-weight-bold) !important; }
.font-medium { font-weight: var(--font-weight-medium) !important; }

.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-flex { display: flex !important; }
.d-none { display: none !important; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ---------- استایل‌های وردپرس ---------- */
.alignleft {
    float: left;
    margin: var(--space-3) var(--space-4) var(--space-3) 0;
}

.alignright {
    float: right;
    margin: var(--space-3) 0 var(--space-3) var(--space-4);
}

.aligncenter {
    display: block;
    margin-inline: auto;
}

.alignwide {
    max-width: 100%;
    margin-inline: calc(var(--space-6) * -1);
}

.alignfull {
    max-width: none;
    margin-inline: calc(50% - 50vw);
    width: 100vw;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-2);
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    clip: auto;
    clip-path: none;
    color: var(--color-primary);
    display: block;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    height: auto;
    right: var(--space-5);
    line-height: normal;
    padding: var(--space-4) var(--space-5);
    text-decoration: none;
    top: var(--space-5);
    width: auto;
    z-index: 100000;
}

/* ---------- Skip Link ---------- */
.skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    background-color: var(--color-primary);
    color: #fff;
    padding: var(--space-3) var(--space-4);
    border-radius: 0 0 0 var(--radius-md);
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
    color: #fff;
}

/* ---------- اسکرول‌بار سفارشی ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary-lighter);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ---------- انتخاب متن ---------- */
::selection {
    background-color: var(--color-accent);
    color: var(--color-primary-dark);
}

/* ---------- Focus visible ---------- */
*:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- انیمیشن‌ها ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out; }
.animate-slide-in { animation: slideInRight 0.5s ease-out; }
.animate-scale-in { animation: scaleIn 0.4s ease-out; }
