/*
Theme Name: Chalak Blog
Theme URI: https://chalakhesab.ir/blog/
Author: Chalak Hesab
Author URI: https://chalakhesab.ir/
Description: قالب سبک، سریع و سئوشده مجله مالی و حسابداری چالاک حساب. بدون jQuery و فونت‌آیکن، با فهرست مطالب خودکار، تاریخ شمسی و داده‌های ساختاریافته.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License: GPLv2 or later
Text Domain: chalak-blog
*/

/* ---------- Tokens ---------- */
:root {
  --brand: #EF4826;
  --brand-ink: #C2381A;
  --brand-soft: #FFF1EC;
  --navy: #2D2C3A;
  --ink: #1F1E2B;
  --text: #3A3947;
  --muted: #6B6A7A;
  --line: #ECEAF0;
  --bg: #F7F7FA;
  --card: #FFFFFF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 30, 43, .04), 0 4px 16px rgba(31, 30, 43, .06);
  --shadow-hover: 0 2px 4px rgba(31, 30, 43, .06), 0 12px 32px rgba(31, 30, 43, .10);
  --container: 1200px;
  --header-h: 68px;
  --font: "IRANSans", Tahoma, system-ui, sans-serif;
}

@font-face {
  font-family: "IRANSans";
  src: url("assets/fonts/IRANSansWeb.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANSans";
  src: url("assets/fonts/IRANSansWeb_Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
/* Safety net: nothing (e.g. an off-screen honeypot) may widen an RTL page. clip, unlike hidden, keeps position: sticky working. */
html, body { overflow-x: clip; }
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-ink); }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.5; margin: 0; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.screen-reader-text, .sr-only {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 12px; right: 12px; z-index: 1000; width: auto; height: auto; clip: auto;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px;
}
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 12px; border: 0;
  font-weight: 700; font-size: 15px; line-height: 1; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s, transform .2s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { color: var(--brand-ink); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand-ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; } }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 40px; width: auto; }
.brand-name { font-weight: 700; color: var(--ink); font-size: 15px; line-height: 1.3; }
.brand-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.primary-nav { flex: 1; min-width: 0; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.primary-nav a {
  display: block; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--text); white-space: nowrap;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current-category-ancestor > a {
  background: var(--brand-soft); color: var(--brand-ink);
}
.primary-nav .sub-menu { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.menu-toggle { display: none; }
@media (max-width: 1360px) { .brand-name { display: none; } }
@media (max-width: 1080px) {
  .primary-nav { display: none; }
  .menu-toggle { display: inline-grid; }
}
@media (max-width: 560px) {
  .header-actions .btn-primary { display: none; }
  .brand-name { display: none; }
}

/* Reading progress */
.read-progress {
  position: absolute; inset-inline: 0; bottom: -1px; height: 3px; background: transparent; pointer-events: none;
}
.read-progress span {
  display: block; height: 100%; width: 100%; background: var(--brand);
  transform-origin: right; transform: scaleX(0);
}

/* Drawer (mobile nav) */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(31, 30, 43, .45); opacity: 0; transition: opacity .25s; }
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; right: 0; width: min(86vw, 360px);
  background: #fff; padding: 20px; overflow-y: auto;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 18px;
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-nav ul { list-style: none; margin: 0; padding: 0; }
.drawer-nav a { display: block; padding: 12px 14px; border-radius: 12px; font-weight: 700; color: var(--ink); }
.drawer-nav a:hover { background: var(--brand-soft); color: var(--brand-ink); }
.drawer-nav .sub-menu a { font-weight: 400; padding-inline-start: 28px; }

/* Search overlay */
.search-overlay { position: fixed; inset: 0; z-index: 110; visibility: hidden; display: grid; align-items: start; padding: 12vh 20px 20px; }
.search-overlay.is-open { visibility: visible; }
.search-overlay .drawer-backdrop { opacity: 0; }
.search-overlay.is-open .drawer-backdrop { opacity: 1; }
.search-box {
  position: relative; width: 100%; max-width: 640px; margin-inline: auto; background: #fff;
  border-radius: 20px; padding: 18px; box-shadow: 0 24px 64px rgba(31, 30, 43, .25);
  transform: translateY(-12px); opacity: 0; transition: transform .25s, opacity .25s;
}
.search-overlay.is-open .search-box { transform: none; opacity: 1; }
.search-hints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.search-hints span { font-size: 13px; color: var(--muted); align-self: center; }

/* Search form */
.search-form { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px 4px 4px 4px; }
.search-form:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-form input[type="search"] {
  flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; padding: 0 12px; outline: none; font-size: 15px;
}
.search-form button { height: 44px; padding: 0 18px; border-radius: 11px; border: 0; background: var(--ink); color: #fff; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.search-form button:hover { background: var(--brand); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--text); white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip small { color: var(--muted); font-size: 12px; }
.chip.is-active small { color: #C9C6D3; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand-ink); font-size: 12.5px; font-weight: 700; line-height: 1.6;
}
.badge-on-image { background: rgba(255, 255, 255, .92); color: var(--ink); }

/* ---------- Home intro ---------- */
.home-intro { padding-block: 32px 20px; }
.home-intro-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.home-intro h1 { font-size: clamp(22px, 3vw, 30px); }
.home-intro p { color: var(--muted); margin-top: 4px; }
.home-intro .search-form { width: min(100%, 420px); background: #fff; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.hero-side { display: grid; grid-template-rows: 1fr 1fr; gap: 20px; }
.card-feature .card-body { padding: 22px 26px 24px; gap: 12px; }
.card-feature .card-title { font-size: clamp(19px, 2.2vw, 25px); line-height: 1.6; }
.card-feature .card-excerpt { font-size: 15px; -webkit-line-clamp: 3; }
.hero-side .card-title { font-size: 15.5px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-side { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) { .hero-side { grid-template-columns: 1fr; } }

/* ---------- Sections ---------- */
.section { padding-block: 36px 8px; }
.section-tight { padding-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-title { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 6px; height: 22px; border-radius: 3px; background: var(--brand); }
.section-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--brand-ink); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* ---------- Card ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .grid, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .grid-4.scroller { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 80%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 6px; }
  .grid-4.scroller::-webkit-scrollbar { display: none; }
  .grid-4.scroller > * { scroll-snap-align: start; }
}
.card {
  position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .25s, transform .25s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-media { position: relative; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .badge { position: absolute; top: 12px; right: 12px; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; flex: 1; }
.card-title { font-size: 16.5px; line-height: 1.7; }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card-title a:hover { color: var(--brand-ink); }
.card-excerpt { color: var(--muted); font-size: 14px; line-height: 1.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; align-items: center; }
.card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.thumb-fallback { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy), #4A3A45); color: #fff; font-weight: 700; font-size: 18px; padding: 16px; text-align: center; }

/* Compact list (popular) */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; counter-reset: rank; }
@media (max-width: 760px) { .rank-list { grid-template-columns: 1fr; } }
.rank-list li { counter-increment: rank; display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); position: relative; }
.rank-list li::before { content: counter(rank, persian); font-size: 26px; font-weight: 700; color: var(--brand); width: 28px; text-align: center; flex: none; }
.rank-list img { width: 72px; height: 54px; object-fit: cover; border-radius: 10px; flex: none; }
.rank-list a { font-weight: 700; font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.rank-list a::after { content: ""; position: absolute; inset: 0; }
.rank-list a:hover { color: var(--brand-ink); }

/* ---------- CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden; border-radius: 24px; padding: 36px clamp(20px, 4vw, 48px);
  background: radial-gradient(circle at 12% 30%, #4A2E33 0%, var(--navy) 55%); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.cta-title { color: #fff; font-weight: 700; line-height: 1.5; font-size: clamp(19px, 2.4vw, 25px); }
.cta-band p { color: #D3D0DC; margin-top: 6px; max-width: 60ch; }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cta-band .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.cta-band .btn-ghost:hover { border-color: #fff; color: #fff; }
.cta-band::after { content: ""; position: absolute; left: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%; border: 36px solid rgba(239, 72, 38, .18); pointer-events: none; }

/* ---------- Archive header ---------- */
.archive-head { padding-block: 28px 8px; }
.archive-head h1 { font-size: clamp(22px, 3vw, 30px); }
.archive-desc { color: var(--muted); margin-top: 8px; max-width: 75ch; }
.archive-count { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chip-row.is-wrap { justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 13.5px; color: var(--muted); padding-top: 18px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before { content: "‹"; color: #B3B0BF; }
.breadcrumbs a:hover { color: var(--brand-ink); }
.breadcrumbs .breadcrumb_last, .breadcrumbs [aria-current] { color: var(--text); }
.breadcrumbs > span > span a, .breadcrumbs > span > a { color: var(--muted); }

/* ---------- Pagination ---------- */
.pagination { margin: 36px 0 8px; }
.pagination .nav-links { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pagination .page-numbers {
  min-width: 44px; height: 44px; padding: 0 12px; display: inline-grid; place-items: center;
  border-radius: 12px; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--text);
}
.pagination .page-numbers:hover { border-color: var(--brand); color: var(--brand-ink); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .dots { background: transparent; border: 0; }

/* ---------- Single ---------- */
.single-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; padding-top: 8px; }
.single-aside { align-self: stretch; } /* full column height so the sticky TOC can travel */
@media (max-width: 1080px) { .single-wrap { grid-template-columns: minmax(0, 1fr); } .single-aside { display: none; } }
.post-header { padding-block: 18px 22px; }
.post-header .badge { margin-bottom: 12px; }
.post-title { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.55; }
.post-lead { font-size: 17px; color: var(--muted); margin-top: 12px; line-height: 2; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 18px; color: var(--muted); font-size: 13.5px; }
.post-meta .author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.post-meta .author img { width: 40px; height: 40px; border-radius: 50%; }
.post-meta .author small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.post-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.post-cover { border-radius: 20px; overflow: hidden; background: var(--line); margin-bottom: 28px; }
.post-cover img { width: 100%; height: auto; }

.article { background: #fff; border-radius: 20px; padding: clamp(20px, 4vw, 44px); box-shadow: var(--shadow); }

/* TOC */
.toc { border: 1px solid var(--line); border-radius: 16px; background: var(--bg); margin: 0 0 28px; }
.toc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 700; color: var(--ink); }
.toc summary::-webkit-details-marker { display: none; }
.toc summary .chev { margin-inline-start: auto; transition: transform .2s; }
.toc[open] summary .chev { transform: rotate(180deg); }
.toc ol { list-style: none; margin: 0; padding: 0 18px 16px; counter-reset: toc; }
.toc li { font-size: 14.5px; line-height: 1.8; }
.toc li a { display: block; padding: 5px 0; color: var(--text); border-radius: 8px; }
.toc li a:hover, .toc li a.is-active { color: var(--brand-ink); }
.toc li.lvl-3 a { padding-inline-start: 18px; font-size: 13.5px; color: var(--muted); }
.toc-side { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 16px; }
.toc-side .toc { background: #fff; margin: 0; max-height: calc(100vh - var(--header-h) - 260px); overflow-y: auto; box-shadow: var(--shadow); border: 0; }
.toc-side .toc li a.is-active { font-weight: 700; }
@media (min-width: 1081px) { .toc-inline { display: none; } }


/* Entry content typography */
.entry-content { font-size: 17px; line-height: 2.15; color: var(--text); overflow-wrap: break-word; }
.entry-content > * + * { margin-top: 1.1em; }
.entry-content h2, .entry-content h3, .entry-content h4 { scroll-margin-top: calc(var(--header-h) + 24px); }
.entry-content h2 { font-size: clamp(21px, 2.4vw, 25px); margin-top: 1.9em; padding-top: .2em; }
.entry-content h3 { font-size: clamp(18.5px, 2vw, 21px); margin-top: 1.6em; }
.entry-content h4 { font-size: 18px; margin-top: 1.4em; }
.entry-content a { color: var(--brand-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.entry-content a:hover { text-decoration-thickness: 2px; }
.entry-content strong { color: var(--ink); }
.entry-content ul, .entry-content ol { padding-inline-start: 1.4em; }
.entry-content li + li { margin-top: .35em; }
.entry-content li::marker { color: var(--brand); }
.entry-content img { border-radius: 14px; margin-inline: auto; }
.entry-content figure, .entry-content .wp-caption { margin-inline: 0; max-width: 100% !important; }
.entry-content .wp-caption-text, .entry-content figcaption { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.entry-content .aligncenter { margin-inline: auto; }
.entry-content blockquote { margin-inline: 0; padding: 18px 22px; border-inline-start: 4px solid var(--brand); background: var(--brand-soft); border-radius: 12px; color: var(--ink); }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry-content iframe, .entry-content video { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; -webkit-overflow-scrolling: touch; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.9; min-width: 520px; }
.entry-content th, .entry-content td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.entry-content tr:last-child td { border-bottom: 0; }
.entry-content thead th, .entry-content tr:first-child th { background: var(--navy); color: #fff; font-weight: 700; }
.entry-content tbody tr:nth-child(even) { background: #FAFAFC; }
/* legacy highlight spans */
.pinout { padding: 1px 6px; border-radius: 6px; font-weight: 700; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.pinout-red { background: #FDECEC; color: #B42318; }
.pinout-orange { background: #FFF1E6; color: #B54708; }
.pinout-purple { background: #F3EEFF; color: #6941C6; }
.pinout-blue { background: #EAF2FF; color: #175CD3; }
.pinout-dark-blue { background: #E8EAF6; color: #1D2A6B; }
.pinout-green { background: #E8F7EE; color: #067647; }
.pinout-turquoise { background: #E3F8F7; color: #0E7090; }

/* Shortcodes */
.note { display: flex; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid; font-size: 16px; line-height: 2; }
.note > .icon { width: 24px; height: 24px; margin-top: 4px; }
.note-body > * + * { margin-top: .6em; }
.note-title { font-weight: 700; color: var(--ink); }
.note-info { background: #EFF6FF; border-color: #CFE0FB; } .note-info > .icon { color: #175CD3; }
.note-success { background: #ECFDF3; border-color: #C6EFD6; } .note-success > .icon { color: #067647; }
.note-warning { background: #FFF8EB; border-color: #F8DFB1; } .note-warning > .icon { color: #B54708; }
.note-danger { background: #FEF1F1; border-color: #F8CFCF; } .note-danger > .icon { color: #B42318; }
.note-primary { background: var(--brand-soft); border-color: #FBD3C6; } .note-primary > .icon { color: var(--brand-ink); }
.dl-btn {
  display: flex !important; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  border: 1px dashed #D9D5E0; background: #FCFCFD; text-decoration: none !important; color: var(--ink) !important; font-weight: 700;
  transition: border-color .2s, background .2s;
}
.dl-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.dl-btn .dl-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.dl-btn.is-pdf .dl-ico { background: #D92D20; }
.dl-btn.is-document .dl-ico { background: #175CD3; }
.dl-btn.is-archive .dl-ico { background: #6941C6; }
.dl-btn .dl-arrow { margin-inline-start: auto; color: var(--muted); }
.ilink {
  display: flex !important; gap: 14px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; text-decoration: none !important; color: var(--ink) !important; transition: border-color .2s, box-shadow .2s;
}
.ilink:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.ilink img { width: 120px; height: 76px; object-fit: cover; border-radius: 10px; flex: none; margin: 0; }
.ilink-label { display: block; font-size: 12.5px; color: var(--brand-ink); font-weight: 700; }
.ilink-title { display: block; font-weight: 700; line-height: 1.7; font-size: 15.5px; }
.ilink-desc { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.8; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ilink.is-compact { padding: 10px 14px; border-style: dashed; }
@media (max-width: 520px) { .ilink img { width: 88px; height: 64px; } .ilink-desc { display: none; } }
.code-block { direction: ltr; text-align: left; background: #1F1E2B; color: #E6E3EC; padding: 16px 18px; border-radius: 14px; overflow-x: auto; font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Share + tags */
.post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.share { display: flex; align-items: center; gap: 8px; }
.share > span { font-size: 14px; color: var(--muted); margin-inline-end: 4px; }
.share .icon-btn { width: 40px; height: 40px; border-radius: 10px; }
.copy-done { color: #067647 !important; border-color: #067647 !important; }

/* Author box */
.author-box { display: flex; gap: 16px; align-items: flex-start; margin-top: 24px; padding: 20px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.author-box img { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.author-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.author-job { font-size: 13px; color: var(--brand-ink); font-weight: 700; margin-top: 2px; }
.author-more { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--brand-ink); }
.author-box p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

/* Inline CTA (end of post) */
.post-cta { margin-top: 24px; }

/* Comments */
.comments { margin-top: 24px; background: #fff; border-radius: 20px; padding: clamp(20px, 4vw, 32px); box-shadow: var(--shadow); }
.comments-title { font-size: 19px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }
.comment-reply-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.comment-reply-title:empty { display: none; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; padding-inline-start: 24px; border-inline-start: 2px solid var(--line); }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-author { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.comment-author img { border-radius: 50%; }
.comment-author .says { display: none; }
.comment-metadata { font-size: 12.5px; color: var(--muted); }
.comment-content { margin-top: 8px; font-size: 15px; }
.reply a { font-size: 13px; font-weight: 700; color: var(--brand-ink); }
/* Replies from the site team: labelled so they're never mistaken for readers */
.bypostauthor > .comment-body { background: var(--brand-soft); border-radius: 14px; padding: 14px 16px; border-bottom: 0; margin-top: 8px; }
.bypostauthor > .comment-body .comment-author .fn::after { content: "پاسخ تیم چالاک"; margin-inline-start: 8px; padding: 2px 10px; border-radius: 999px; background: var(--brand-ink); color: #fff; font-size: 11.5px; font-weight: 700; vertical-align: middle; }
.comment-content a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.comment-form { display: grid; gap: 14px; margin-top: 12px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--bg);
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: #fff; }
.comment-form .submit { background: var(--brand); color: #fff; border: 0; height: 46px; padding: 0 26px; border-radius: 12px; font-weight: 700; }
.comment-form .submit:hover { background: var(--brand-ink); }
/* Comment captcha (mu-plugin): visible question, properly hidden honeypot */
.comment-form-captcha input[type="text"] { width: 100%; max-width: 160px !important; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--bg); }
.comment-form-captcha [aria-hidden="true"] { position: absolute !important; left: auto !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.comment-form-cookies-consent { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.comment-form-cookies-consent label { display: inline; font-weight: 400; margin: 0; }

/* Page / 404 / empty */
.page-article { max-width: 860px; margin-inline: auto; }
.empty-state { text-align: center; padding: 56px 20px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.empty-state .big { font-size: clamp(64px, 12vw, 120px); font-weight: 700; color: var(--brand); line-height: 1.1; }
.empty-state h1 { font-size: clamp(20px, 3vw, 26px); margin-top: 8px; }
.empty-state p { color: var(--muted); margin-top: 8px; }
.empty-state .search-form { max-width: 480px; margin: 22px auto 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; background: var(--ink); color: #BDBACA; font-size: 14.5px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 48px 0 32px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-title { color: #fff; font-size: 15.5px; font-weight: 700; margin-bottom: 12px; }
.site-footer a:hover { color: #fff; }
.footer-about p { margin-top: 12px; line-height: 2; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.footer-brand img { height: 40px; width: auto; background: #fff; border-radius: 10px; padding: 4px 6px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-menu { grid-column: span 2; }
@media (max-width: 560px) { .footer-menu { grid-column: auto; } }
.footer-menu > ul { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 24px; }
.footer-menu > ul > li > a[href="#"] { pointer-events: none; color: #fff; font-weight: 700; }
.footer-menu .sub-menu { margin-top: 10px; }
.contact-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.contact-line a { direction: ltr; unicode-bidi: embed; font-weight: 700; color: #fff; }
.socials { display: flex; gap: 8px; margin-top: 16px; }
.socials a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .06); color: #fff; }
.socials a:hover { background: var(--brand); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); padding: 18px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }

/* Back to top */
.to-top { position: fixed; left: 20px; bottom: 20px; z-index: 40; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .25s, transform .25s; box-shadow: var(--shadow-hover); }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }



/* ---------- Guided paths ---------- */
.section-head-stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.section-head-stack p { color: var(--muted); font-size: 14.5px; padding-inline-start: 16px; }
.start-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) { .start-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .start-grid { grid-template-columns: 1fr; gap: 10px; } }
.start-card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, transform .2s;
}
.start-card:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); transform: translateY(-2px); color: inherit; }
.start-kicker { font-size: 13px; color: var(--muted); }
.start-title { font-size: 18px; color: var(--ink); line-height: 1.6; }
.start-desc { font-size: 14px; color: var(--muted); line-height: 1.9; }
.start-foot { margin-top: auto; padding-top: 6px; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--brand-ink); }
.start-card:hover .start-foot .icon { transform: translateX(-4px); }
.start-foot .icon { transition: transform .2s; }
@media (max-width: 520px) {
  .start-card { padding: 16px 18px; gap: 6px; }
  .start-foot { position: absolute; }
  .start-card { position: relative; padding-inline-end: 64px; }
  .start-foot { left: 18px; top: 50%; transform: translateY(-50%); padding: 0; font-size: 0; }
  .start-foot .icon { width: 22px; height: 22px; }
}
.more-topics { margin-top: 18px; align-items: center; }
.more-topics > span { font-size: 13.5px; color: var(--muted); white-space: nowrap; }

/* News (auto-imported later) */
.news-list { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.news-list li { display: flex; gap: 18px; align-items: baseline; padding: 14px 20px; border-top: 1px solid var(--line); }
.news-list li:first-child { border-top: 0; }
.news-list time { flex: none; width: 104px; font-size: 13px; color: var(--muted); }
.news-list a { font-weight: 700; color: var(--ink); line-height: 1.8; }
.news-list a:hover { color: var(--brand-ink); }
@media (max-width: 520px) { .news-list li { flex-direction: column; gap: 2px; } }

/* Next step at the end of a post */
.next-step {
  display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: center; margin-top: 24px; padding: 14px;
  border-radius: 20px; background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.next-step:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); color: inherit; }
.next-step img, .next-step .thumb-fallback { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; height: auto; }
.next-step-body { display: flex; flex-direction: column; gap: 6px; }
.next-step-label { font-size: 13px; font-weight: 700; color: var(--brand-ink); }
.next-step-title { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.7; }
.next-step-go { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.next-step:hover .next-step-go { color: var(--brand-ink); }
@media (max-width: 600px) { .next-step { grid-template-columns: 1fr; gap: 12px; } }


/* ---------- Search page ---------- */
.search-head { padding-block: 28px 4px; max-width: 860px; margin-inline: auto; }
.search-head h1 { font-size: clamp(21px, 2.8vw, 28px); margin-bottom: 16px; }
.search-head .search-form { background: #fff; box-shadow: var(--shadow); border-color: transparent; padding: 6px; }
.search-head .search-form input[type="search"] { height: 50px; font-size: 16px; }
.search-head .search-form button { height: 50px; padding: 0 24px; }
.search-count { color: var(--muted); font-size: 14px; margin-top: 14px; }
.search-facets { margin-top: 10px; }
.result-list { list-style: none; margin: 20px auto 0; padding: 0; max-width: 860px; display: grid; gap: 14px; }
.result {
  position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start;
  padding: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .2s;
}
.result:hover { box-shadow: var(--shadow-hover); }
.result-media { display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--line); }
.result-media img { width: 100%; height: 100%; object-fit: cover; }
.result-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.result-cat { font-size: 12.5px; font-weight: 700; color: var(--brand-ink); }
.result-title { font-size: 17px; line-height: 1.7; }
.result-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.result-title a:hover { color: var(--brand-ink); }
.result-snippet { font-size: 14px; line-height: 2; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result mark, .result-title mark { background: #FFE9A8; color: var(--ink); padding: 0 2px; border-radius: 4px; }
.result .card-meta { margin-top: 4px; }
@media (max-width: 600px) {
  .result { grid-template-columns: 96px 1fr; gap: 12px; padding: 12px; }
  .result-title { font-size: 15px; }
  .result-snippet { -webkit-line-clamp: 2; font-size: 13.5px; }
  .result .card-meta span:last-child { display: none; }
}
.search-empty { margin: 20px auto 0; max-width: 860px; padding: 28px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.search-empty h2 { font-size: 20px; }
.search-tips { margin: 12px 0 0; padding-inline-start: 1.2em; color: var(--muted); font-size: 14.5px; line-height: 2.1; }
.search-empty .chip-row.is-wrap { justify-content: flex-start; }


/* ---------- Author page ---------- */
.author-hero { margin-top: 20px; padding: clamp(20px, 4vw, 36px); background: #fff; border-radius: 20px; box-shadow: var(--shadow); display: grid; gap: 24px; }
.author-hero-main { display: flex; gap: 24px; align-items: center; }
.author-hero-avatar { width: 120px; height: 120px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px var(--brand-soft); }
.author-hero h1 { font-size: clamp(22px, 3vw, 30px); }
.author-hero-job { color: var(--brand-ink); font-weight: 700; margin-top: 2px; }
.author-facts { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; }
.author-facts strong { color: var(--ink); }
.author-links { display: flex; gap: 8px; margin-top: 14px; }
.author-bio { font-size: 16px; line-height: 2.1; color: var(--text); max-width: 80ch; }
.author-bio p + p { margin-top: .8em; }
.author-block h2 { font-size: 16px; margin-bottom: 10px; }
.author-expertise { justify-content: flex-start; margin-top: 0; }
.author-cv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; border-top: 1px solid var(--line); padding-top: 22px; }
.author-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.author-list li { position: relative; padding-inline-start: 18px; font-size: 15px; line-height: 1.9; }
.author-list li::before { content: ""; position: absolute; right: 0; top: .8em; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
@media (max-width: 700px) {
  .author-hero-main { flex-direction: column; align-items: flex-start; gap: 14px; }
  .author-hero-avatar { width: 88px; height: 88px; }
  .author-cv { grid-template-columns: 1fr; }
}

/* ---------- UX layer ---------- */
/* Auto-hiding header (mobile, while reading) */
.site-header { transition: transform .25s ease; }
.site-header.is-hidden { transform: translateY(-100%); }

/* Live search results */
.live-results { margin-top: 12px; display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.live-results a { display: block; padding: 10px 14px; border-radius: 10px; font-size: 15px; line-height: 1.8; color: var(--ink); }
.live-results a:hover, .live-results a:focus { background: var(--brand-soft); color: var(--brand-ink); outline: none; }
.live-results mark { background: transparent; color: var(--brand-ink); font-weight: 700; }
.live-results .search-all { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; font-weight: 700; color: var(--brand-ink); font-size: 14px; }
.search-status { padding: 10px 14px; color: var(--muted); font-size: 14px; }

/* Heading anchors */
.h-anchor { margin-inline-start: 8px; color: var(--muted) !important; text-decoration: none !important; font-weight: 400; opacity: 0; transition: opacity .15s; }
.entry-content h2:hover .h-anchor, .entry-content h3:hover .h-anchor, .h-anchor:focus { opacity: 1; }
.h-anchor.copy-done { color: #067647 !important; opacity: 1; }
@media (hover: none) { .h-anchor { display: none; } }

/* Mobile reading bar */
.read-bar { display: none; }
@media (max-width: 1080px) {
  .read-bar {
    position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 45;
    display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 18px;
    background: rgba(31, 30, 43, .94); color: #fff; box-shadow: 0 12px 32px rgba(31, 30, 43, .3);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transform: translateY(140%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .read-bar.is-visible { transform: none; }
  .read-bar .btn { height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; flex: none; }
  .read-bar-toc { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #fff; text-align: right; padding: 4px 8px; }
  .read-bar-toc .icon { width: 22px; height: 22px; color: var(--brand); }
  .read-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; padding-inline-start: 4px; }
  .read-bar-section { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .read-bar-left { font-size: 12px; color: #C9C6D3; }
  .single .site-footer { padding-bottom: 76px; }
}

/* Bottom sheet (TOC on mobile) */
.sheet .drawer-panel {
  top: auto; right: 0; left: 0; width: auto; max-height: 75vh; border-radius: 22px 22px 0 0;
  padding-bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%);
}
.sheet.is-open .drawer-panel { transform: none; }
.sheet .drawer-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
.sheet .drawer-head strong { color: var(--ink); font-size: 16px; }
.toc-sheet { border: 0; background: none; margin: 0; }
.toc-sheet ol { padding: 0; }
.toc-sheet li a { padding: 9px 12px; border-radius: 10px; }
.toc-sheet li a.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }

/* Resume-reading toast */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--header-h) + 14px); transform: translate(-50%, -20px); opacity: 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px; padding-inline-start: 16px; border-radius: 16px;
  background: #fff; box-shadow: var(--shadow-hover); border: 1px solid var(--line); width: max-content; max-width: calc(100vw - 24px);
  transition: transform .3s, opacity .3s; font-size: 14px; color: var(--ink);
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast .btn { height: 38px; padding: 0 16px; font-size: 14px; }
.toast .icon-btn { width: 38px; height: 38px; border: 0; }

/* Tables that scroll sideways */
.table-hint { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: -6px; transition: opacity .3s; }
.table-hint::before { content: "⇠"; color: var(--brand); font-size: 16px; }
.table-hint.is-done { opacity: 0; }
.table-wrap.is-scrollable { background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 40px 100% no-repeat local, linear-gradient(to right, rgba(31, 30, 43, .12), rgba(31, 30, 43, 0)) left center / 14px 100% no-repeat scroll; }

/* Image zoom */
.entry-content img.zoomable { cursor: zoom-in; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(20, 19, 30, .88); }
.lightbox[open] { display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; width: auto; height: auto; border-radius: 12px; background: #fff; }
.lightbox-close { position: fixed; top: 16px; right: 16px; }

/* Breadcrumbs: on phones the title is right below, so drop it from the trail */
@media (max-width: 600px) {
  .breadcrumbs [aria-current="page"], .breadcrumbs .breadcrumb_last, .breadcrumbs .sep:has(+ .breadcrumb_last), .breadcrumbs li:has(+ li[aria-current]) + li { display: none; }
}

/* Print */
@media print {
  .site-header, .site-footer, .single-aside, .read-bar, .toast, .lightbox, .share, .comments, .post-nav, .related, .to-top, .post-cta, .toc { display: none !important; }
  body { background: #fff; }
  .article { box-shadow: none; padding: 0; }
}
