/*
Theme Name: Sarnakh Mag
Theme URI: https://example.com/
Author: Sarnakh
Author URI: https://example.com/
Description: RTL-first, minimal magazine theme inspired by esanj style.
Version: 0.1.0
Text Domain: sarnakh-mag
*/

html {
    direction: rtl
}

body {
    font-family: Vazirmatn, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #f7f8fa;
    color: #111827;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column
}

/* Ensure footer sticks to bottom when content is short */
.site-main {
    flex: 1;
    padding-top: 24px;
}

a {
    color: #0e9e8a;
    text-decoration: none
}

a:hover {
    color: #0b8273
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px
}

.section {
    padding-top: 24px;
    padding-bottom: 8px
}

/* Remove top padding for related section placements */
.article-body .section {
    padding-top: 0
}

.right-col.section {
    padding-top: 0
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    color: #111827
}

.header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(6px);
    border-bottom: 1px solid #e5e7eb;
    z-index: 10
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: #111827
}

.topbar {
    background: #fde68a;
    color: #a16207;
    text-align: center;
    font-size: 12px;
    padding: 6px 8px
}

.topbar .pill {
    display: inline-block;
    margin-inline-start: 8px;
    background: #2563eb;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px
}

.grid {
    display: grid;
    gap: 16px
}

@media (min-width: 768px) {
    .grid-3 {
        grid-template-columns:repeat(3, minmax(0, 1fr))
    }
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, .06)
}

.card:hover {
    box-shadow: 0 12px 32px rgba(17, 24, 39, .10)
}

.badge {
    display: inline-block;
    background: #f3f4f6;
    color: #374151;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 12px
}

.post-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 8px 0
}

.post-excerpt {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.8
}

.footer {
    border-top: 1px solid #e5e7eb;
    background: #fff;
    margin-top: 16px
}

/* Footer redesign */
.footer-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 16px;
    padding: 24px
}

.footer-title {
    font-weight: 800;
    margin-bottom: 8px;
    color: #111827
}

.footer-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0
}

.footer-links a {
    color: #374151
}

.footer-links a:hover {
    color: #111827
}

.footer-bottom {
    border-top: 1px solid #e5e7eb;
    background: #f9fafb
}

.footer-bottom .copy {
    font-size: 12px;
    color: #6b7280;
    padding: 12px 0
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns:1fr;
        padding: 16px
    }
}

.menu {
    display: flex;
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0
}

.menu a {
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 10px
}

.menu a:hover {
    color: #111827;
    background: #f3f4f6
}

/* Hamburger hidden by default (visible on small screens) */
.menu-toggle {
    display: none
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 24px 0
}

.pagination a, .pagination span {
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 14px
}

.pagination .current {
    background: #16b39a;
    color: #fff;
    border-color: #16b39a
}

/* Hero */
.hero-wrap {
    /*background: #f0f5f7*/
}

.hero-grid {
    display: grid;
    grid-template-columns:2fr 1fr;
    gap: 16px
}

.hero-main {
    overflow: hidden
}

.hero-side {
    display: grid;
    gap: 16px
}

/* Promo card (compact media) */
.promo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    overflow: hidden
}

.promo-thumb {
    flex: 0 0 auto;
    width: 96px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center
}

.promo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.promo-body {
    padding: 0;
    min-width: 0
}

.promo-title {
    font-weight: 800;
    color: #111827;
    font-size: 13px;
    margin: 0 0 4px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.promo-excerpt {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

/* Slider */
.slider {
    position: relative
}

.slide {
    position: relative
}

.container.section .card .attachment-card-large.wp-post-image {
    height: 235px !important;
    object-fit: cover;
}

.slide .thumb img {
    width: 100%;
    height: 265px;
    display: block;
    object-fit: cover;
}

.thumb {
    display: block
}

.thumb-fallback {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #ecfdf7, #cffafe);
}

.slide-caption {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .55) 80%);
    color: #fff;
    padding: 12px 16px
}

.slide-title {
    margin: 0;
    font-size: 16px
}

.slide-excerpt {
    margin: 6px 0 0;
    font-size: 13px;
    opacity: .9
}

.slider-dots {
    position: absolute;
    bottom: 8px;
    left: 12px;
    display: flex;
    gap: 6px
}

.slider-dots::before {
    content: ''
}

.slider-dots span {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 9999px;
    opacity: .5
}

.slider-dots span.active {
    opacity: 1
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(17, 24, 39, .08);
    cursor: pointer;
    z-index: 5
}

.slider-prev {
    right: 8px
}

.slider-next {
    left: 8px
}

/* Cat icons */
.cat-icons {
    display: grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap: 16px
}

.cat-icon {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px
}

.cat-icon .ico {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: #ecfdf7;
    color: #0e9e8a;
    display: flex;
    align-items: center;
    justify-content: center
}

.cat-icon .name {
    font-size: 14px;
    color: #111827
}

/* Horizontal strip */
.h-scroll {
    overflow: auto;
    position: relative
}

.h-strip {
    display: flex;
    gap: 12px;
    padding-bottom: 6px
}

.h-card {
    min-width: 260px;
    overflow: hidden
}

.h-body {
    padding: 10px
}

.h-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0
}

.h-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(17, 24, 39, .08);
    cursor: pointer
}

.h-prev {
    right: 8px;
    z-index: 5
}

.h-next {
    left: 8px;
    z-index: 5
}

/* Useful shortcuts */
.quick-links {
    display: grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap: 16px
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    align-items: flex-start
}

.quick-ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center
}

.quick-title {
    font-weight: 800
}

.quick-hint {
    font-size: 12px;
    color: #6b7280
}

/* Reading progress bar */
#reading-progress {
    position: fixed;
    top: 0;
    right: 0;
    height: 3px;
    background: #16b39a;
    width: 0;
    z-index: 9999
}

/* Single post layout */
.single-layout {
    display: grid;
    grid-template-columns:320px 1fr;
    gap: 24px
}

.single-sidebar .widget {
    margin-bottom: 16px
}

.widget.card {
    padding: 12px
}

.single-layout .right-col {
    grid-column: 2
}

.single-sidebar {
    position: sticky;
    top: 88px;
    align-self: start
}

.single-sidebar .widget {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff
}

.single-sidebar .widget + .widget {
    margin-top: 12px
}

.single-sidebar .widget-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
    color: #111827
}

.single-sidebar .list-clean {
    list-style: none;
    margin: 0;
    padding: 0
}

.single-sidebar .list-clean li {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6
}

.single-sidebar .list-clean li:last-child {
    border-bottom: 0
}

.single-sidebar .recent-link {
    display: block;
    color: #374151
}

.single-sidebar .recent-link:hover {
    color: #111827
}

.single-sidebar .promo-widget .promo-body {
    padding: 12px
}

.single-sidebar .promo-title {
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px
}

.single-sidebar .promo-excerpt {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px
}

.comments {
    margin-top: 24px
}

/* Comments toggle + panel */
.comments-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    color: #111827;
    cursor: pointer
}

.comments-toggle:hover {
    background: #f9fafb
}

#comments-panel {
    display: none
}

#comments-panel.is-open {
    display: block
}

.single-layout .full-span {
    grid-column: 1 / -1
}

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

.comment-list .comment {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    margin: 10px 0;
    background: #fff
}

.comment-list .children {
    list-style: none;
    margin: 8px 12px 0 0;
    padding: 0;
    border-right: 2px solid #f3f4f6
}

.comment-body {
    display: grid;
    grid-template-columns:40px 1fr;
    gap: 10px;
    align-items: start
}

.comment-author {
    font-weight: 800;
    color: #111827
}

.comment-author .avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px
}

.comment-metadata {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px
}

.comment-content {
    margin-top: 6px;
    line-height: 1.9;
    color: #374151
}

.reply a, .comment-reply-link {
    display: inline-block;
    margin-top: 8px;
    background: #ecfdf7;
    color: #0e9e8a;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 12px
}

.reply a:hover, .comment-reply-link:hover {
    background: #d1fae5
}

.comment-respond {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #fff
}

.comment-respond label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin: 4px 0
}

.comment-form p {
    margin: 10px 0
}

.comment-form textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form input[type="tel"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff
}

.comment-form input[type="submit"] {
    background: #16b39a;
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer
}

.comment-form input[type="submit"]:hover {
    background: #0e9e8a
}

/* Contact form sizing inside cards */
.contact-form {
    max-width: 640px;
    margin: 12px auto 0
}

.contact-form p {
    margin: 10px 0
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form input[type="url"],
.contact-form textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box
}

/* Article content */
.article-wrap .article-body {
    max-width: 860px;
    margin-inline: auto
}

.article-wrap .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 8px
}

.article-wrap .meta .meta-dot {
    opacity: .6
}

.article-wrap .content {
    font-size: 16px;
    line-height: 1.95;
    color: #111827
}

.article-wrap .content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 30px 0 12px 0;
    border-radius: 12px
}

.article-wrap .featured-media {
    margin-top: 16px
}

.article-wrap .content h2 {
    font-size: 20px;
    margin-top: 20px
}

.article-wrap .content h3 {
    font-size: 18px;
    margin-top: 16px
}

.article-wrap .content p {
    margin: 12px 0
}

.article-wrap .content ul {
    padding-right: 18px
}

.article-wrap .content blockquote {
    border-right: 3px solid #16b39a;
    background: #ecfdf7;
    padding: 8px 12px;
    border-radius: 10px
}

.toc {
    padding: 12px;
    margin-bottom: 12px
}

.toc-title {
    font-weight: 800;
    margin-bottom: 6px
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0
}

.toc-list li {
    margin: 4px 0
}

.toc-list li.toc-sub {
    margin-right: 12px
}

.share {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px
}

.search-submit, .search-field {
    font-family: 'Vazirmatn', serif;
}

.article-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Vazirmatn", sans-serif; /* فونت فارسی زیبا (می‌توانید تغییر دهید) */
    font-size: 15px;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    direction: rtl;
}

.article-wrap table thead tr {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    text-align: center;
    font-weight: 600;
}

.article-wrap table th,
.article-wrap table td {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    vertical-align: middle;
}

.article-wrap table tbody tr {
    transition: background 0.2s ease;
}

.article-wrap table tbody tr:hover {
    background: #eef2ff; /* افکت هاور */
}

.article-wrap table td strong {
    color: #4f46e5;
}

/* گوشه‌های گرد برای هدر */
.article-wrap table thead tr:first-child th:first-child {
    border-top-right-radius: 12px;
}

.article-wrap table thead tr:first-child th:last-child {
    border-top-left-radius: 12px;
}

/* ---------- Responsive tweaks ---------- */
/* Media objects */
img, video, iframe {
    max-width: 100%;
    height: auto
}

/* Header/nav/search layout on small screens */
@media (max-width: 768px) {
    .container {
        padding: 16px
    }

    .header .container {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 16px
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid #e5e7eb;
        background: #fff;
        border-radius: 10px;
        padding: 8px 10px;
        color: #111827;
        cursor: pointer
    }

    .menu-toggle .burger {
        position: relative;
        width: 18px;
        height: 2px;
        background: #111827;
        display: inline-block
    }

    .menu-toggle .burger::before, .menu-toggle .burger::after {
        content: "";
        position: absolute;
        right: 0;
        left: 0;
        height: 2px;
        background: #111827
    }

    .menu-toggle .burger::before {
        top: -6px
    }

    .menu-toggle .burger::after {
        top: 6px
    }

    .nav {
        width: 100%;
        display: none
    }

    .nav.is-open {
        display: block
    }

    .menu {
        flex-direction: column;
        gap: 8px;
        overflow: visible;
        padding: 8px 0
    }

    .menu a {
        font-size: 13px
    }

    .search-form {
        width: 100%
    }
}

@media (max-width: 480px) {
    .topbar {
        font-size: 11px;
        padding: 5px 6px
    }

    .topbar .pill {
        display: none
    }
}

/* Hero area stacks on tablets/phones */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns:1fr
    }
}

/* Generic grids */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns:repeat(2, minmax(0, 1fr))
    }
}

@media (max-width: 767px) {
    .grid-3 {
        grid-template-columns:1fr
    }
}

/* Category icons grid */
@media (max-width: 1024px) {
    .cat-icons {
        grid-template-columns:repeat(3, minmax(0, 1fr))
    }
}

@media (max-width: 640px) {
    .cat-icons {
        grid-template-columns:repeat(2, minmax(0, 1fr))
    }
}

/* Horizontal strip */
@media (max-width: 768px) {
    .h-card {
        min-width: 220px
    }
}

/* Slider caption/font sizes on small screens */
@media (max-width: 640px) {
    .slide-title {
        font-size: 14px
    }

    .slide-excerpt {
        font-size: 12px
    }

    .slider-prev {
        right: 6px
    }

    .slider-next {
        left: 6px
    }
}

/* Single post and sidebar stack */
@media (max-width: 1024px) {
    .single-layout {
        grid-template-columns:1fr
    }

    .single-layout .right-col {
        grid-column: auto
    }

    /* Prevent sidebar from overlapping content when stacked */
    .single-sidebar {
        position: static;
        top: auto;
    }
}

/* Quick links grid responsive */
@media (max-width: 1024px) {
    .quick-links {
        grid-template-columns:repeat(3, minmax(0, 1fr))
    }
}

@media (max-width: 640px) {
    .quick-links {
        grid-template-columns:repeat(2, minmax(0, 1fr))
    }
}
