/*
Theme Name: Sazmanchi
Theme URI: https://sazmanchi.com/
Author: Sazmanchi
Author URI: https://sazmanchi.com/
Description: قالب بلاگ سازمانچی، هم‌شکل با سایت اصلی sazmanchi.com (راست‌چین، فونت پیدا، رنگ‌های برند).
Version: 1.0.3
Requires at least: 6.0
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: sazmanchi
Tags: rtl-language-support, blog, custom-menu, featured-images, one-column
*/

/* ---------- Fonts (Peyda FaNum: Persian digits, same as the main site) ---------- */
@font-face { font-family: "Peyda"; src: url("fonts/PeydaFaNum-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Peyda"; src: url("fonts/PeydaFaNum-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Peyda"; src: url("fonts/PeydaFaNum-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Peyda"; src: url("fonts/PeydaFaNum-Black.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

/* ---------- Brand tokens (match src/app/globals.css) ---------- */
:root {
	--ink: #101010;
	--brand: #f5444f;
	--sand: #d7d3cb;
	--paper: #f1f1ef;
	--muted: rgba(16, 16, 16, 0.62);
	--line: rgba(16, 16, 16, 0.1);
	--wrap: 80rem;
	--read: 46rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: #fff;
	color: var(--ink);
	font-family: "Peyda", Tahoma, system-ui, sans-serif;
	font-size: 17px;
	line-height: 1.9;
	-webkit-font-smoothing: antialiased;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
::selection { background: var(--brand); color: #fff; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; right: 8px; z-index: 100; width: auto; height: auto; clip: auto; background: var(--ink); color: var(--paper); padding: 8px 16px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 2rem; } }
.site-main { flex: 1; }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(241, 241, 239, .95);
	backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }
.header-bar { display: flex; align-items: center; gap: 1rem; height: 64px; position: relative; }
.site-logo { display: flex; align-items: center; flex-shrink: 0; }
.site-logo svg { height: 2.4rem; width: auto; display: block; }
.logo-letters { fill: var(--ink); }
.logo-mark { fill: var(--brand); }
.blog-badge { font-size: 13px; font-weight: 700; color: var(--brand); border-inline-start: 1px solid var(--line); padding-inline-start: .75rem; margin-inline-start: .25rem; white-space: nowrap; }

.main-nav { margin-inline-start: 1.5rem; margin-inline-end: auto; display: none; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; }
.main-nav a { display: block; padding: .5rem .875rem; font-size: 15px; font-weight: 500; position: relative; }
.main-nav a::after {
	content: ""; position: absolute; right: .875rem; bottom: 2px; width: 10px; height: 9px;
	background: var(--brand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%);
	opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.main-nav a:hover::after, .main-nav .current-menu-item > a::after, .main-nav .is-current > a::after { opacity: 1; transform: none; }
.main-nav .current-menu-item > a, .main-nav .is-current > a { color: var(--brand); }
@media (min-width: 1024px) { .main-nav { display: block; } }

.header-actions { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; }
@media (min-width: 1024px) { .header-actions { margin-inline-start: 0; } }
.btn-outline {
	display: inline-flex; align-items: center; white-space: nowrap;
	border: 2px solid var(--ink); border-radius: 999px; padding: .4rem 1.25rem;
	font-size: 14px; font-weight: 600; transition: border-color .2s, color .2s, transform .2s;
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); transform: scale(1.04); }
.btn-solid {
	display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
	background: var(--brand); color: #fff; border-radius: 999px; padding: .6rem 1.5rem;
	font-weight: 600; transition: background .2s, transform .2s;
}
.btn-solid:hover { background: var(--ink); color: #fff; transform: scale(1.03); }
.menu-toggle {
	display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
	border: 0; border-radius: 999px; background: var(--brand); color: #fff; cursor: pointer;
}
.menu-toggle svg { width: 20px; height: 20px; }
@media (min-width: 1024px) { .menu-toggle { display: none; } }
.site-header.is-open .main-nav {
	display: block; position: absolute; top: 64px; right: 0; left: 0; margin: 0;
	background: var(--paper); border-bottom: 1px solid var(--line); padding: .75rem;
}
.site-header.is-open .main-nav ul { flex-direction: column; align-items: stretch; }
.site-header.is-open .main-nav a { padding: .75rem 1rem; }
@media (max-width: 479px) { .header-actions .btn-outline { display: none; } }

/* ---------- Blog hero ---------- */
.blog-hero { background: var(--paper); border-bottom: 1px solid var(--line); padding: 3.5rem 0 3rem; position: relative; overflow: hidden; }
.blog-hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 900; line-height: 1.35; margin: 0 0 .75rem; }
.blog-hero h1 .accent { color: var(--brand); }
.blog-hero p { margin: 0; max-width: 40rem; color: var(--muted); font-size: 1.05rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: 14px; font-weight: 700; color: var(--brand); margin-bottom: .75rem; }
.mark { display: inline-block; width: 12px; height: 11px; background: var(--brand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%); flex-shrink: 0; }
.hero-square { position: absolute; left: 6%; bottom: -30px; width: 160px; height: 144px; background: var(--sand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%); opacity: .7; }
@media (max-width: 767px) { .hero-square { display: none; } }

/* ---------- Post cards ---------- */
.posts-section { padding: 3rem 0 4rem; }
.post-grid { display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.card {
	display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
	border-radius: 1.25rem; overflow: hidden; transition: transform .3s, box-shadow .3s, border-color .3s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -18px rgba(16,16,16,.25); border-color: transparent; }
.card-thumb { display: block; aspect-ratio: 16 / 9; background: var(--paper); overflow: hidden; position: relative; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; }
.card-thumb .placeholder span { width: 64px; height: 58px; background: var(--brand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%); }
.card-body { padding: 1.25rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.card-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-bottom: .5rem; }
.card-meta a { color: var(--brand); font-weight: 600; }
.card-title { font-size: 1.2rem; font-weight: 700; line-height: 1.6; margin: 0 0 .5rem; }
.card-excerpt { color: var(--muted); font-size: 15px; line-height: 1.9; margin: 0 0 1rem; }
.card-more { margin-top: auto; font-weight: 600; font-size: 14px; color: var(--brand); display: inline-flex; align-items: center; gap: .35rem; }
.card-more svg { width: 16px; height: 16px; transition: transform .2s; }
.card:hover .card-more svg { transform: translateX(-4px); }
.card.is-featured { grid-column: 1 / -1; }
@media (min-width: 900px) {
	.card.is-featured { flex-direction: row; }
	.card.is-featured .card-thumb { width: 55%; aspect-ratio: auto; min-height: 320px; }
	.card.is-featured .card-body { padding: 2.25rem; justify-content: center; }
	.card.is-featured .card-title { font-size: 1.75rem; }
}

/* ---------- Pagination ---------- */
.pagination { margin-top: 3rem; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.pagination .page-numbers { min-width: 44px; height: 44px; padding: 0 .9rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; }
.pagination .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pagination a.page-numbers:hover { border-color: var(--brand); }

/* ---------- Single post ---------- */
.post-header { background: var(--paper); padding: 3rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.post-header .inner { max-width: var(--read); margin: 0 auto; }
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 1rem; }
.breadcrumbs a:hover { color: var(--brand); }
.post-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900; line-height: 1.45; margin: 0 0 1rem; }
.post-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: 14px; color: var(--muted); }
.post-meta .cat a { color: var(--brand); font-weight: 600; }
.post-cover { max-width: 60rem; margin: 2rem auto 0; padding: 0 1rem; }
.post-cover img { border-radius: 1.25rem; display: block; width: 100%; }

.entry-content { max-width: var(--read); margin: 0 auto; padding: 2.5rem 1rem 1rem; }
.entry-content > * + * { margin-top: 1.25em; }
.entry-content p { margin: 0; }
.entry-content p + p { margin-top: 1.1em; }
.entry-content h2 { font-size: 1.55rem; font-weight: 800; line-height: 1.6; margin: 2.2em 0 .6em; display: flex; align-items: center; gap: .6rem; }
.entry-content h2::before { content: ""; width: 14px; height: 13px; flex-shrink: 0; background: var(--brand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%); }
.entry-content h3 { font-size: 1.25rem; font-weight: 700; margin: 1.8em 0 .5em; }
.entry-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.entry-content a:hover { color: var(--ink); }
.entry-content ul, .entry-content ol { padding-inline-start: 1.4rem; }
.entry-content li { margin: .4em 0; }
.entry-content ul li::marker { color: var(--brand); }
.entry-content blockquote { margin: 2em 0; padding: 1.25rem 1.5rem; background: var(--paper); border-inline-start: 4px solid var(--brand); border-radius: .75rem; }
.entry-content blockquote p { margin: 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: .6rem .8rem; text-align: right; }
.entry-content th { background: var(--paper); font-weight: 700; }
.entry-content figure { margin: 2em 0; }
.entry-content img { border-radius: .75rem; }
.entry-content figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: .5rem; }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.entry-content code { background: var(--paper); padding: .1em .4em; border-radius: .3em; font-size: .9em; }
.entry-content .wp-block-button__link { background: var(--brand); color: #fff; text-decoration: none; border-radius: 999px; padding: .7rem 1.6rem; font-weight: 600; }
.entry-content .alignwide { max-width: 60rem; }
.entry-content .aligncenter { margin-inline: auto; }

.post-tags { max-width: var(--read); margin: 1.5rem auto 0; padding: 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.post-tags a { font-size: 13px; background: var(--paper); border-radius: 999px; padding: .3rem .9rem; }
.post-tags a:hover { background: var(--brand); color: #fff; }

/* Call to action that sends readers back to the main site */
.cta-box {
	max-width: var(--read); margin: 3rem auto 0; padding: 2rem; border-radius: 1.5rem;
	background: var(--ink); color: var(--paper); position: relative; overflow: hidden;
}
.cta-wrap { padding: 0 1rem; }
.cta-box h2 { margin: 0 0 .5rem; font-size: 1.4rem; font-weight: 800; }
.cta-box p { margin: 0 0 1.25rem; color: rgba(241,241,239,.7); }
.cta-box .cta-square { position: absolute; left: -10px; bottom: -14px; width: 110px; height: 99px; background: var(--brand); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 55%, 0 55%); opacity: .9; }
.cta-box .btn-solid:hover { background: var(--paper); color: var(--ink); }

.post-nav { max-width: var(--read); margin: 3rem auto 0; padding: 0 1rem; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav a { display: block; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.25rem; height: 100%; }
.post-nav a:hover { border-color: var(--brand); color: inherit; }
.post-nav small { display: block; color: var(--muted); font-size: 13px; }
.post-nav strong { font-weight: 700; }
.post-nav .next { text-align: left; }

.related { background: var(--paper); margin-top: 4rem; padding: 3rem 0 4rem; }
.section-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 1.5rem; display: flex; align-items: center; gap: .6rem; }

/* ---------- Comments ---------- */
.comments-area { max-width: var(--read); margin: 3rem auto 0; padding: 0 1rem; }
.comments-area .comment-list { list-style: none; padding: 0; }
.comments-area .comment-body { border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.comments-area .children { list-style: none; padding-inline-start: 1.5rem; }
.comments-area .avatar { border-radius: 999px; vertical-align: middle; margin-inline-end: .5rem; }
.comment-respond input[type=text], .comment-respond input[type=email], .comment-respond input[type=url], .comment-respond textarea, .search-form input[type=search] {
	width: 100%; font: inherit; border: 1px solid var(--line); border-radius: .75rem; padding: .7rem 1rem; background: #fff;
}
.comment-respond input:focus, .comment-respond textarea:focus, .search-form input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.comment-respond .submit, .search-form button {
	font: inherit; font-weight: 600; border: 0; cursor: pointer; background: var(--brand); color: #fff; border-radius: 999px; padding: .65rem 1.6rem;
}
.comment-respond .submit:hover, .search-form button:hover { background: var(--ink); }

/* ---------- Search / 404 / page ---------- */
.search-form { display: flex; gap: .5rem; max-width: 30rem; margin-top: 1.25rem; }
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state .big { font-size: 5rem; font-weight: 900; color: var(--brand); line-height: 1; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); margin-top: 4rem; }
.site-footer.flush { margin-top: 0; }
.footer-grid { display: grid; gap: 3rem; padding: 3.5rem 0; grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.3fr .8fr 1fr 1.2fr; } }
.footer-logo svg { height: 3rem; width: auto; }
.footer-logo .logo-letters { fill: var(--paper); }
.footer-about { margin: 1.25rem 0 0; max-width: 24rem; line-height: 2; color: rgba(241,241,239,.6); font-size: 15px; }
.footer-col h3 { margin: 0; font-size: 14px; font-weight: 700; color: rgba(241,241,239,.4); }
.footer-col ul { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.footer-col li { margin-bottom: .75rem; }
.footer-col a { color: rgba(241,241,239,.7); position: relative; }
.footer-col a:hover { color: var(--brand); }
.footer-contact li { display: flex; align-items: flex-start; gap: .75rem; color: rgba(241,241,239,.7); line-height: 1.8; }
.footer-contact .ic { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 999px; background: rgba(241,241,239,.05); color: var(--brand); }
.footer-contact .ic svg { width: 16px; height: 16px; }
.footer-bottom { border-top: 1px solid rgba(241,241,239,.1); }
.footer-bottom .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.25rem; padding-bottom: 1.25rem; font-size: 14px; color: rgba(241,241,239,.5); }
.footer-bottom .copy { display: flex; align-items: center; gap: .5rem; }
.to-top { border: 1px solid rgba(241,241,239,.2); border-radius: 999px; padding: .4rem 1rem; display: inline-flex; align-items: center; gap: .5rem; }
.to-top:hover { border-color: var(--brand); }
.to-top svg { width: 16px; height: 16px; }

/* Reading progress bar (same as the main site's scroll bar) */
.progress { position: fixed; top: 0; right: 0; left: 0; height: 4px; background: var(--brand); transform-origin: right; transform: scaleX(0); z-index: 60; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; }
}
