/* ===== قالب مینیمال بلاگ شخصی ===== */
/* فونت اختیاری: اگر فایل assets/fonts/Vazirmatn.woff2 را بگذارید، خودکار فعال می‌شود (layout.php) */
[hidden] { display: none !important; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #667085;
  --border: #e4e7ec;
  --soft: #f0f2f5;
  --accent: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
  --font: "Vazirmatn", "Vazir", "IRANSans", Tahoma, "Segoe UI", system-ui, sans-serif;
}
html[data-theme="dark"] {
  --bg: #0e1015; --surface: #161a22; --text: #e8eaf0; --muted: #98a2b3;
  --border: #262b36; --soft: #1d222c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0e1015; --surface: #161a22; --text: #e8eaf0; --muted: #98a2b3;
    --border: #262b36; --soft: #1d222c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ----- هدر ----- */
.site-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.brand-text strong { font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; align-items: center; gap: 8px; }
.search-mini { display: flex; align-items: center; background: var(--soft); border-radius: 999px; padding: 0 6px 0 12px; border: 1px solid transparent; }
.search-mini:focus-within { border-color: var(--accent); background: var(--surface); }
.search-mini input { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; padding: 8px 10px; width: 150px; outline: none; }
.search-mini button { border: 0; background: transparent; cursor: pointer; font-size: 15px; padding: 4px 6px; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 18px; cursor: pointer; display: grid; place-items: center; font-family: inherit;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-btn { display: none; }

.main-nav { border-top: 1px solid var(--border); background: var(--surface); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav a { display: block; padding: 11px 14px; font-size: 14.5px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.main-nav a:hover { color: var(--text); }
.main-nav a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ----- چیدمان ----- */
main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 32px; align-items: start; }
.content-col { min-width: 0; }

/* ----- کارت‌ها ----- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); }
.card-cover { display: block; aspect-ratio: 16 / 9; background: var(--soft); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .card-cover img { transform: scale(1.04); }
.cover-ph {
  width: 100%; height: 100%; display: grid; place-items: center; font-size: 56px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #7c3aed));
}
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { margin: 0; font-size: 18px; line-height: 1.6; font-weight: 800; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.9; }
.card-big { flex-direction: row; margin-bottom: 22px; }
.card-big .card-cover { flex: 0 0 52%; aspect-ratio: auto; min-height: 280px; }
.card-big .card-title { font-size: 24px; }
.card-big .card-body { justify-content: center; padding: 26px; }
.chip {
  align-self: flex-start; font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 12px; border-radius: 999px;
}
.chip:hover { background: var(--accent); color: #fff; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12.5px; margin-top: auto; padding-top: 6px; }
.meta span + span::before { content: "·"; margin-inline-end: 14px; opacity: .6; }

/* ----- صفحه‌بندی ----- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 30px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 12px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 14px;
}
.pager span { border: 0; background: transparent; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager a.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ----- سایدبار ----- */
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 130px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.widget-title {
  margin: 0 0 12px; font-size: 15.5px; font-weight: 800; padding-bottom: 10px; border-bottom: 2px solid var(--border);
  position: relative;
}
.widget-title::after { content: ""; position: absolute; right: 0; bottom: -2px; width: 44px; height: 2px; background: var(--accent); }
.widget.about p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 2; }
.cat-list, .pop-list, .mini-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px; }
.cat-list li:last-child { border-bottom: 0; }
.cat-list a:hover, .pop-list a:hover, .mini-list a:hover { color: var(--accent); }
.cat-list span { background: var(--soft); color: var(--muted); font-size: 12px; border-radius: 999px; padding: 0 9px; }
.mini-list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.mini-thumb { flex: none; width: 64px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.mini-thumb img, .mini-thumb .cover-ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-thumb .cover-ph { font-size: 22px; }
.mini-list div a { font-size: 14px; font-weight: 700; line-height: 1.6; display: block; }
.mini-list small { color: var(--muted); font-size: 12px; }
.pop-list { counter-reset: n; }
.pop-list li { counter-increment: n; display: flex; gap: 10px; padding: 7px 0; font-size: 14.5px; line-height: 1.7; }
.pop-list li::before { content: counter(n, persian); color: var(--accent); font-weight: 800; flex: none; min-width: 22px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a { font-size: 13px; padding: 2px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.tag-cloud a:hover { background: var(--accent); color: #fff; }

/* ----- سرتیتر آرشیو ----- */
.archive-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; margin-bottom: 26px; box-shadow: var(--shadow); }
.archive-head .kicker { color: var(--accent); font-weight: 700; font-size: 13px; }
.archive-head h1 { margin: 2px 0 4px; font-size: 26px; line-height: 1.5; }
.archive-head p { margin: 0; color: var(--muted); }
.search-big { display: flex; gap: 8px; margin-top: 16px; }
.search-big input { flex: 1; min-width: 0; font: inherit; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.search-big input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.btn, .search-big button {
  font: inherit; font-weight: 700; background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 22px; cursor: pointer; display: inline-block;
}
.btn:hover, .search-big button:hover { filter: brightness(1.08); }
.btn-ghost { font: inherit; font-size: 14px; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 7px 16px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ----- نوشته ----- */
.single { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 36px; box-shadow: var(--shadow); }
.single-head { margin-bottom: 18px; }
.single-head h1 { margin: 10px 0 6px; font-size: 30px; line-height: 1.65; font-weight: 800; }
.single-cover { margin: 0 -36px 26px; }
.single-cover img { width: 100%; max-height: 460px; object-fit: cover; display: block; }
.prose { font-size: 17px; line-height: 2.1; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 24px; margin: 1.8em 0 .5em; line-height: 1.6; }
.prose h3 { font-size: 20px; margin: 1.6em 0 .4em; line-height: 1.6; }
.prose h4 { font-size: 17.5px; margin: 1.4em 0 .4em; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.prose img { border-radius: 10px; margin: 1em auto; display: block; }
.prose ul, .prose ol { padding-inline-start: 1.6em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .3em; }
.prose blockquote {
  margin: 1.4em 0; padding: 14px 22px; border-inline-start: 4px solid var(--accent);
  background: var(--soft); border-radius: 0 10px 10px 0; color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 10px; overflow: auto; direction: ltr; text-align: left; font-size: 14px; line-height: 1.7; }
.prose code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; direction: ltr; unicode-bidi: embed; }
.prose pre code { background: transparent; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: start; }
.prose th { background: var(--soft); }
.prose figure { margin: 1.2em 0; }
.prose figcaption { text-align: center; color: var(--muted); font-size: 13.5px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.post-tags a { font-size: 13.5px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 14px; }
.post-tags a:hover { color: #fff; background: var(--accent); }
.share { margin-top: 16px; }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.pn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.pn small { color: var(--muted); font-size: 12.5px; }
.pn span { font-weight: 700; line-height: 1.7; }
.pn:hover span { color: var(--accent); }
.pn-left { text-align: left; }
.section-title { font-size: 19px; margin: 34px 0 14px; font-weight: 800; }
.notice { background: #fff7e0; color: #7a5b00; border: 1px solid #f1d98b; border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
html[data-theme="dark"] .notice { background: #3a3014; color: #f5d97a; border-color: #5c4b1a; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty.big { padding: 90px 20px; }
.empty h1 { color: var(--text); font-size: 24px; margin: 6px 0; }
.num404 { font-size: 80px; font-weight: 800; color: var(--accent); line-height: 1.2; }

/* ----- فوتر ----- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; padding-top: 22px; padding-bottom: 22px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--accent); }

/* ----- واکنش‌گرا ----- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .menu-btn { display: grid; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 6px 0; }
  .main-nav a { border-bottom: 0; border-inline-start: 3px solid transparent; padding: 10px 6px; }
  .main-nav a.on { border-inline-start-color: var(--accent); }
  .search-mini { display: none; }
  .brand-text small { display: none; }
  .grid, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card-big { flex-direction: column; }
  .card-big .card-cover { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
  .card-big .card-title { font-size: 21px; }
  .single { padding: 22px 18px; }
  .single-cover { margin: 0 -18px 20px; }
  .single-head h1 { font-size: 24px; }
  .prose { font-size: 16.5px; }
  .prev-next { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .sidebar, .site-footer, .share, .prev-next, .related { display: none !important; }
  body { background: #fff; }
  .single { border: 0; box-shadow: none; padding: 0; }
}

@counter-style persian {
  system: numeric;
  symbols: "۰" "۱" "۲" "۳" "۴" "۵" "۶" "۷" "۸" "۹";
}
