/*
Theme Name: صفاء (Safa Minimal)
Theme URI: https://example.com/safa-minimal
Author: Safa Minimal
Description: ثيم ووردبريس عربي خفيف جداً، بسيط، ونقي للمدونات الشخصية. بدون جافاسكربت وبدون تعقيدات تقنية.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: safa-minimal
Tags: blog, one-column, rtl-language-support, custom-logo, custom-menu
*/

:root {
    --bg-color: #ffffff;
    --surface-color: #f8f9fa;
    --text-color: #1a1a1a;
    --muted-color: #666666;
    --border-color: #eaeaea;
    --accent-color: #111111;
    --link-hover: #444444;
    --max-width: 820px;
    --font-main: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 1.05rem;
    line-height: 1.85;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border-color);
    padding: 24px 0;
    margin-bottom: 48px;
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-branding .custom-logo {
    max-height: 44px;
    width: auto;
}

.site-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.site-title a {
    color: var(--text-color);
}

/* Navigation */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--muted-color);
}

.main-nav a:hover,
.main-nav .current-menu-item > a {
    color: var(--text-color);
}

/* Section Titles */
.section-heading {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted-color);
    margin: 0 0 18px 0;
    letter-spacing: 0.02em;
}

/* Homepage Categories */
.categories-section {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-list a {
    display: inline-block;
    padding: 6px 14px;
    font-size: 0.9rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-color);
}

.category-list a:hover {
    background-color: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
    opacity: 1;
}

.category-count {
    font-size: 0.8em;
    opacity: 0.65;
    margin-right: 4px;
}

/* Posts List (Homepage & Archive) */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.post-item {
    padding-bottom: 36px;
    border-bottom: 1px solid var(--border-color);
}

.post-item:last-child {
    border-bottom: none;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.post-meta a {
    color: var(--muted-color);
}

.post-meta a:hover {
    color: var(--text-color);
}

.meta-sep {
    opacity: 0.5;
}

.post-item-title {
    margin: 0 0 10px 0;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.4;
}

.post-excerpt {
    margin: 0 0 12px 0;
    color: #3a3a3a;
    font-size: 1rem;
}

.post-excerpt p {
    margin: 0;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    display: inline-block;
}

/* Single Post & Page */
.single-article {
    margin-bottom: 56px;
}

.article-header {
    margin-bottom: 32px;
}

.article-title {
    margin: 0 0 14px 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.35;
}

.featured-image {
    margin: 0 0 32px 0;
}

.featured-image img {
    border-radius: 6px;
    width: 100%;
}

.article-content {
    font-size: 1.08rem;
    line-height: 1.95;
}

.article-content p {
    margin: 0 0 1.4em 0;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin: 2em 0 0.7em 0;
    line-height: 1.4;
    font-weight: 700;
}

.article-content h2 {
    font-size: 1.5rem;
}

.article-content h3 {
    font-size: 1.25rem;
}

.article-content a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1.4em 0;
    padding-right: 1.5em;
}

.article-content li {
    margin-bottom: 0.45em;
}

.article-content blockquote {
    margin: 1.8em 0;
    padding: 12px 20px;
    border-right: 3px solid var(--text-color);
    background-color: var(--surface-color);
    color: #333333;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content pre,
.article-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: var(--surface-color);
    border-radius: 4px;
}

.article-content code {
    padding: 2px 6px;
    font-size: 0.9em;
}

.article-content pre {
    padding: 16px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.article-content pre code {
    padding: 0;
    background: none;
}

.article-content figure {
    margin: 1.8em 0;
}

.article-content figcaption {
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-top: 8px;
    text-align: center;
}

.article-tags {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--muted-color);
}

.article-tags a {
    display: inline-block;
    margin-left: 8px;
    color: var(--muted-color);
}

.article-tags a:hover {
    color: var(--text-color);
}

/* Post Navigation */
.post-navigation {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.95rem;
}

.nav-previous,
.nav-next {
    max-width: 48%;
}

.nav-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted-color);
    margin-bottom: 4px;
}

/* Archive Header */
.archive-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.archive-title {
    margin: 0 0 8px 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.archive-description {
    margin: 0;
    color: var(--muted-color);
}

/* Pagination */
.pagination {
    margin: 48px 0 24px 0;
    text-align: center;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
    background-color: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
    opacity: 1;
}

/* Comments */
.comments-area {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.comments-title,
.comment-reply-title {
    font-size: 1.25rem;
    margin: 0 0 24px 0;
}

.comment-list {
    list-style: none;
    margin: 0 0 36px 0;
    padding: 0;
}

.comment-list .comment {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-list .children {
    list-style: none;
    padding-right: 24px;
    margin-top: 16px;
}

.comment-author {
    font-weight: 600;
    font-size: 0.95rem;
}

.comment-metadata {
    font-size: 0.8rem;
    color: var(--muted-color);
    margin-bottom: 10px;
}

.comment-form label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.comment-form input[type="submit"] {
    background-color: var(--text-color);
    color: var(--bg-color);
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    cursor: pointer;
}

.comment-form input[type="submit"]:hover {
    opacity: 0.85;
}

/* 404 */
.error-404 {
    text-align: center;
    padding: 48px 0;
}

.error-404 h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.error-404 p {
    color: var(--muted-color);
    margin-bottom: 24px;
}

.back-home-btn {
    display: inline-block;
    padding: 10px 22px;
    background-color: var(--text-color);
    color: var(--bg-color);
    border-radius: 4px;
    font-size: 0.95rem;
}

.back-home-btn:hover {
    color: var(--bg-color);
    opacity: 0.85;
}

/* Footer */
.site-footer {
    margin-top: 72px;
    padding: 28px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.88rem;
    color: var(--muted-color);
}

/* Responsive */
@media (max-width: 600px) {
    .site-header {
        padding: 18px 0;
        margin-bottom: 32px;
    }
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .article-title {
        font-size: 1.65rem;
    }
    .post-item-title {
        font-size: 1.3rem;
    }
    .post-navigation {
        flex-direction: column;
    }
    .nav-previous,
    .nav-next {
        max-width: 100%;
    }
}

/* ضبط حاوية الصور التي تحتوي على كلمات توضيحية لتطابق عرض النص */
.wp-caption,
figure,
.wp-block-image {
    max-width: 100% !important;
    width: 100% !important;
    margin: 1.5rem auto;
    box-sizing: border-box;
}

/* جعل الصور داخل المقال تأخذ كامل عرض عمود الكتابة مثل الصورة البارزة */
.entry-content img,
.wp-caption img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* تنسيق النص التوضيحي أسفل الصورة */
.wp-caption-text,
figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

/* تنسيق مربع البحث داخل القائمة الرئيسية */
.menu-search-item {
    display: flex;
    align-items: center;
}

.menu-search-form {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 2px 10px;
    background: #fafafa;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.menu-search-form:focus-within {
    border-color: #333;
    background: #fff;
}

.menu-search-field {
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.85rem;
    width: 120px;
    padding: 4px 0;
    color: inherit;
}

.menu-search-submit {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 4px 0 0;
    color: #555;
    display: flex;
    align-items: center;
}

.menu-search-submit:hover {
    color: #000;
}

/* توسيط الهيدر وضبط المسافات بين اللوغو والوصف والقائمة */
.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 18px;
}

.site-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.site-branding .custom-logo-link {
    display: block;
    line-height: 0;
}

.site-description {
    margin: 0 0 6px 0;
    font-size: 0.85rem;
    color: #666;
    font-weight: 400;
    line-height: 1.4;
}

.main-nav {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 6px;
}

.main-nav ul {
    justify-content: center;
    align-items: center;
}

@media (max-width: 600px) {
    .header-inner {
        align-items: center;
    }
}