/*
Theme Name: Akharin Akhbar AI
Theme URI: https://akharinakhbarai.com
Author: Akharin Akhbar AI
Description: قالب پرسرعت و سئوپسند برای آخرین اخبار هوش مصنوعی. فارسی، RTL، Tailwind CSS، بدون jQuery.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: akharinakhbarai-theme
RTL: Yes
*/

/* Theme overrides & CLS prevention - main styles via Tailwind */
img[loading="lazy"] { content-visibility: auto; }
body { font-family: 'Vazirmatn', system-ui, sans-serif; }

/* Single: reading progress bar (RTL-friendly) */
.reading-progress-bar { transform-origin: right; }
[dir="rtl"] .reading-progress-bar { transform-origin: left; }

/* Header nav links (fallback menu and assigned menu) */
.site-header nav a {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    color: var(--tw-prose-body, #52525b);
    transition: color 0.2s, background 0.2s;
}
.site-header nav a:hover { background: rgba(0,0,0,0.08); color: #18181b; }
[data-color-scheme="dark"] .site-header nav a { color: #a1a1aa; }
[data-color-scheme="dark"] .site-header nav a:hover { background: rgba(255,255,255,0.08); color: #fafafa; }
/* Desktop nav: compact inline links (hamburger/drawer only on mobile) */
.site-header .header-nav-desktop ul { list-style: none; margin: 0; padding: 0; }
.site-header .header-nav-desktop a { padding: 0.5rem 0.75rem; border-radius: 0.5rem; }

/* Hamburger only on mobile: force with CSS so it works even if Tailwind purges classes */
@media (min-width: 768px) {
    .site-header #menu-toggle,
    .site-header #nav-drawer,
    .site-header #menu-overlay { display: none !important; }
    .site-header .header-nav-desktop { display: flex !important; align-items: center; gap: 0.25rem; margin-inline-end: auto; }
}
@media (max-width: 767px) {
    .site-header .header-nav-desktop { display: none !important; }
}

/* Custom logo size to prevent CLS */
.site-header .custom-logo-link { display: flex; align-items: center; }
.site-header .custom-logo { max-height: 40px; width: auto; height: auto; }
@media (min-width: 640px) { .site-header .custom-logo { max-height: 48px; } }

/* Single post: consistent image sizes */
.entry-thumbnail {
    max-height: 28rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
}
[data-color-scheme="dark"] .entry-thumbnail { background: #27272a; }
.entry-thumbnail img {
    width: 100%;
    height: auto;
    max-height: 28rem;
    object-fit: cover;
    object-position: center;
    display: block;
}
.entry-content img,
.entry-content .wp-block-image img,
.entry-content figure img,
.entry-content p img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}
.entry-content figure {
    margin: 1rem 0;
    max-width: 100%;
}
/* Hide image captions/alt text in content */
.entry-content figure figcaption {
    display: none;
}

/* Entry footer: categories & tags (links styled via Tailwind) */
.entry-footer a:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }

/* Comments */
.comment-form--styled .comment-reply-title { font-size: 1.25rem; }
.comment-form--styled .comment-form-row { margin-bottom: 1.25rem; }
.comment-form--styled .comment-form-comment { margin-bottom: 1.5rem; }
.comment-form--styled .comment-form-author,
.comment-form--styled .comment-form-email,
@media (min-width: 640px) {
    .comment-form--styled form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem 1.25rem;
    }
    .comment-form--styled .comment-reply-title,
    .comment-form--styled .comment-notes,
    .comment-form--styled .comment-form-comment,
    .comment-form--styled .comment-form-cookies-consent,
    .comment-form--styled .form-submit { grid-column: 1 / -1; }
    .comment-form--styled .comment-form-author,
    .comment-form--styled .comment-form-email { margin-bottom: 0; }
}
.comment-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #3f3f46;
    font-size: 0.9375rem;
}
[data-color-scheme="dark"] .comment-form label { color: #d4d4d8; }
.comment-form .required { color: #7c3aed; }
[data-color-scheme="dark"] .comment-form .required { color: #a78bfa; }
.comment-form .comment-input,
.comment-form .comment-textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d4d4d8;
    background: #fff;
    color: #18181b;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.comment-form .comment-textarea,
.comment-form textarea { min-height: 140px; resize: vertical; }
.comment-form .comment-input::placeholder,
.comment-form .comment-textarea::placeholder,
.comment-form input::placeholder,
.comment-form textarea::placeholder { color: #71717a; }
.comment-form .comment-input:focus,
.comment-form .comment-textarea:focus,
.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}
[data-color-scheme="dark"] .comment-form .comment-input,
[data-color-scheme="dark"] .comment-form .comment-textarea,
[data-color-scheme="dark"] .comment-form input[type="text"],
[data-color-scheme="dark"] .comment-form input[type="email"],
[data-color-scheme="dark"] .comment-form textarea {
    border-color: #52525b;
    background: #27272a;
    color: #fafafa;
}
[data-color-scheme="dark"] .comment-form .comment-input::placeholder,
[data-color-scheme="dark"] .comment-form .comment-textarea::placeholder,
[data-color-scheme="dark"] .comment-form input::placeholder,
[data-color-scheme="dark"] .comment-form textarea::placeholder { color: #a1a1aa; }
[data-color-scheme="dark"] .comment-form .comment-input:focus,
[data-color-scheme="dark"] .comment-form .comment-textarea:focus,
[data-color-scheme="dark"] .comment-form input[type="text"]:focus,
[data-color-scheme="dark"] .comment-form input[type="email"]:focus,
[data-color-scheme="dark"] .comment-form textarea:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}
.comment-form .comment-cookies-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 400;
    font-size: 0.875rem;
    color: #52525b;
    cursor: pointer;
}
[data-color-scheme="dark"] .comment-form .comment-cookies-label { color: #a1a1aa; }
.comment-form .comment-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
    accent-color: #7c3aed;
    cursor: pointer;
}
.comment-form .form-submit { margin-bottom: 0; margin-top: 1.5rem; }
.comment-form .comment-submit { cursor: pointer; }
.comment .comment-reply a { text-decoration: none; }
.comment .comment-reply a:hover { text-decoration: underline; }

/* Sidebar: card-style blocks, Persian-friendly */
.sidebar-single {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.sidebar-single .widget {
    margin-bottom: 0;
    padding: 1.25rem 1.25rem 1.5rem;
    border: 1px solid #e4e4e7;
    background: #fafafa;
}
[data-color-scheme="dark"] .sidebar-single .widget {
    border-color: #3f3f46;
    background: #18181b;
}
.sidebar-single .widget-title {
    color: #18181b;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e4e4e7;
    letter-spacing: 0;
}
[data-color-scheme="dark"] .sidebar-single .widget-title {
    color: #fafafa;
    border-bottom-color: #3f3f46;
}
/* Search: hidden on single post (خبر) – removed from sidebar */
.sidebar-single .widget_search { display: none !important; }
/* Search: compact one row, no duplicate title (if used elsewhere) */
.sidebar-single .widget_search .widget-title { display: none; }
.sidebar-single .widget_search .search-form {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.sidebar-single .widget_search .search-form label { display: none; }
.sidebar-single .widget_search .search-field {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d4d4d8;
    font-size: 0.9375rem;
    background: #fff;
    color: #18181b;
}
.sidebar-single .widget_search .search-field::placeholder { color: #71717a; }
[data-color-scheme="dark"] .sidebar-single .widget_search .search-field {
    border-color: #52525b;
    background: #27272a;
    color: #fafafa;
}
[data-color-scheme="dark"] .sidebar-single .widget_search .search-field::placeholder { color: #a1a1aa; }
.sidebar-single .widget_search .search-submit {
    padding: 0.625rem 1rem;
    background: #7c3aed;
    color: #fff;
    border: none;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.sidebar-single .widget_search .search-submit:hover { background: #6d28d9; }
/* Lists: recent posts, recent comments */
.sidebar-single .widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-single .widget ul li {
    padding: 0.625rem 0;
    border-bottom: 1px solid #e4e4e7;
    font-size: 0.9375rem;
    line-height: 1.5;
}
[data-color-scheme="dark"] .sidebar-single .widget ul li { border-bottom-color: #3f3f46; }
.sidebar-single .widget ul li:last-child { border-bottom: none; }
.sidebar-single .widget ul li a {
    color: #3f3f46;
    text-decoration: none;
    display: block;
    transition: color 0.15s;
}
.sidebar-single .widget ul li a:hover { color: #7c3aed; }
[data-color-scheme="dark"] .sidebar-single .widget ul li a { color: #d4d4d8; }
[data-color-scheme="dark"] .sidebar-single .widget ul li a:hover { color: #a78bfa; }
/* Empty state (e.g. no comments) */
.sidebar-single .widget .recentcomments,
.sidebar-single .widget p {
    margin: 0;
    font-size: 0.875rem;
    color: #71717a;
}
[data-color-scheme="dark"] .sidebar-single .widget .recentcomments,
[data-color-scheme="dark"] .sidebar-single .widget p { color: #a1a1aa; }
