/* دانشنامه زیرساخت — style.css (بدون هیچ وابستگی خارجی) */
@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/vazirmatn-var.woff2") format("woff2-variations"),
       url("/assets/fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #151b2c;
  --muted: #566078;
  --faint: #7f88a0;
  --border: #e2e6ef;
  --primary: #2b5ce6;
  --primary-strong: #1d45c0;
  --primary-soft: #e8eeff;
  --on-primary: #ffffff;
  --accent: #0e9f74;
  --warn: #b45309;
  --warn-soft: #fff6e8;
  --tip-soft: #e9f8f2;
  --note-soft: #eef3ff;
  --code-bg: #0e1525;
  --code-text: #e3e8f4;
  --code-border: #1c2640;
  --inline-code-bg: #edf0f7;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 28px rgba(17, 24, 39, .07);
  --radius: 16px;
  --hero-grad: radial-gradient(1100px 420px at 90% -20%, rgba(43, 92, 230, .16), transparent 60%),
               radial-gradient(700px 320px at 0% 0%, rgba(14, 159, 116, .10), transparent 60%);
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "DejaVu Sans Mono", Menlo, "Vazirmatn", monospace;
  --c-linux: #2b5ce6; --c-network: #0e9f74; --c-webserver: #7c4dff; --c-security: #e5484d; --c-devops: #d97706;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1e; --surface: #10172a; --surface-2: #172037; --text: #e8ecf6; --muted: #a3adc4; --faint: #77829b;
    --border: #222d48; --primary: #7099ff; --primary-strong: #93b2ff; --primary-soft: rgba(112, 153, 255, .13);
    --on-primary: #0a0f1e; --accent: #34d3a1; --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .09);
    --tip-soft: rgba(52, 211, 161, .09); --note-soft: rgba(112, 153, 255, .09);
    --code-bg: #070b16; --code-border: #1b2440; --inline-code-bg: #1b2540;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 32px rgba(0, 0, 0, .35);
    --hero-grad: radial-gradient(1100px 420px at 90% -20%, rgba(112, 153, 255, .18), transparent 60%),
                 radial-gradient(700px 320px at 0% 0%, rgba(52, 211, 161, .09), transparent 60%);
    --c-linux: #7099ff; --c-network: #34d3a1; --c-webserver: #a78bfa; --c-security: #ff7b7f; --c-devops: #fbbf24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1e; --surface: #10172a; --surface-2: #172037; --text: #e8ecf6; --muted: #a3adc4; --faint: #77829b;
  --border: #222d48; --primary: #7099ff; --primary-strong: #93b2ff; --primary-soft: rgba(112, 153, 255, .13);
  --on-primary: #0a0f1e; --accent: #34d3a1; --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .09);
  --tip-soft: rgba(52, 211, 161, .09); --note-soft: rgba(112, 153, 255, .09);
  --code-bg: #070b16; --code-border: #1b2440; --inline-code-bg: #1b2540;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 32px rgba(0, 0, 0, .35);
  --hero-grad: radial-gradient(1100px 420px at 90% -20%, rgba(112, 153, 255, .18), transparent 60%),
               radial-gradient(700px 320px at 0% 0%, rgba(52, 211, 161, .09), transparent 60%);
  --c-linux: #7099ff; --c-network: #34d3a1; --c-webserver: #a78bfa; --c-security: #ff7b7f; --c-devops: #fbbf24;
  color-scheme: dark;
}

/* ---------- پایه ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.85;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.5; }
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .container { padding-inline: 24px; } }
.narrow { max-width: 860px; }
.skip { position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 10px; }
.skip:focus { inset-inline-start: 16px; }
.sr-only { position: fixed; top: 0; inset-inline-start: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- لوگو ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.logo-bg { fill: var(--primary); }
.logo-top { fill: var(--on-primary); }
.logo-line { fill: none; stroke: var(--on-primary); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 1.05rem; font-weight: 800; }
.brand-text small { font-size: .72rem; color: var(--muted); }

/* ---------- هدر ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border);
  background: var(--bg); background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 66px; }
.header-inner > .brand { margin-inline-end: auto; }
.main-nav { display: flex; gap: 2px; }
.main-nav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .95rem; }
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.header-actions { display: flex; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.nav-toggle { display: none; }
@media (max-width: 880px) {
  .nav-toggle { display: inline-grid; }
  .main-nav {
    display: none; position: absolute; top: 66px; inset-inline: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 14px; }
}
@media (max-width: 420px) { .brand-text small { display: none; } }

/* ---------- دکمه و برچسب ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  border-radius: 11px; padding: 10px 20px; border: 1px solid transparent; cursor: pointer;
  background: var(--primary); color: var(--on-primary); white-space: nowrap;
}
.btn:hover { background: var(--primary-strong); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-size: .82rem;
}
a.tag:hover { border-color: var(--primary); color: var(--primary); }
.chip {
  --c: var(--primary); position: relative; z-index: 1; display: inline-flex; align-items: center; width: fit-content;
  font-size: .78rem; font-weight: 700; color: var(--c); padding: 3px 11px; border-radius: 999px;
  background: var(--primary-soft); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.chip:hover { color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.cat-linux { --c: var(--c-linux); } .cat-network { --c: var(--c-network); } .cat-webserver { --c: var(--c-webserver); }
.cat-security { --c: var(--c-security); } .cat-devops { --c: var(--c-devops); }

/* ---------- هیرو ---------- */
.hero { position: relative; overflow: hidden; background: var(--hero-grad); border-bottom: 1px solid var(--border); padding: 56px 0 52px; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 60% 0%, #000 25%, transparent 72%);
  mask-image: radial-gradient(ellipse at 60% 0%, #000 25%, transparent 72%);
}
.hero .container { position: relative; z-index: 1; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: 1.2fr .8fr; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 5px 14px 5px 12px; border-radius: 999px;
}
.eyebrow svg.i { width: 17px; height: 17px; }
.hero h1 { font-size: clamp(1.85rem, 4.6vw, 3rem); line-height: 1.4; margin: 18px 0 12px; font-weight: 900; max-width: 17ch; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .lead { font-size: clamp(1rem, 2vw, 1.12rem); color: var(--muted); max-width: 58ch; margin: 0 0 26px; }
.search-form {
  display: flex; align-items: center; gap: 8px; max-width: 580px; padding: 6px 6px 6px 6px; padding-inline-start: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow);
}
.search-form:focus-within { border-color: var(--primary); }
.search-form > svg.i { color: var(--faint); }
.search-form input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; padding: 8px 4px;
}
.search-form input::placeholder { color: var(--faint); }
.quick-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px 34px; margin-top: 30px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.6rem; font-weight: 900; line-height: 1.3; }
.hero-stats span { font-size: .85rem; color: var(--muted); }
.hero-term {
  display: none; direction: ltr; overflow: hidden; border-radius: 16px; background: var(--code-bg);
  border: 1px solid var(--code-border); box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
@media (min-width: 980px) { .hero-term { display: block; } }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--code-border); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-inline-start: auto; color: #7d8bab; font: 12px var(--mono); }
.hero-term pre { margin: 0; padding: 18px 20px 22px; color: var(--code-text); font: 13px/1.95 var(--mono); white-space: pre-wrap; }
.hero-term .p { color: #7099ff; } .hero-term .o { color: #8592b0; } .hero-term .ok { color: #34d399; }
.cursor { display: inline-block; width: 8px; height: 15px; vertical-align: -2px; background: #e3e8f4; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } html { scroll-behavior: auto; } }

/* ---------- بخش‌ها ---------- */
.section { padding: 52px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-alt .post-card, .section-alt .feature { background: var(--bg); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.25rem, 2.6vw, 1.5rem); margin: 0; font-weight: 850; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; font-size: .95rem; }
.link-more svg.i { width: 18px; height: 18px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 14px; }
.cat-card {
  --c: var(--primary); display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: var(--shadow); color: var(--text); }
.cat-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: var(--c);
  background: var(--primary-soft); background: color-mix(in srgb, var(--c) 13%, transparent);
}
.cat-icon svg.i { width: 23px; height: 23px; }
.cat-card h3 { margin: 2px 0 0; font-size: 1.06rem; }
.cat-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.cat-count { margin-top: auto; padding-top: 4px; font-size: .8rem; font-weight: 600; color: var(--c); }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
@media (max-width: 360px) { .post-grid { grid-template-columns: 1fr; } }
.post-card {
  position: relative; display: flex; flex-direction: column; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.post-card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-2px); }
.post-card h3 { margin: 12px 0 8px; font-size: 1.08rem; line-height: 1.65; }
.post-card h3 a { color: var(--text); }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card:hover h3 a { color: var(--primary); }
.post-card p { margin: 0 0 16px; color: var(--muted); font-size: .92rem; line-height: 1.85; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: auto; color: var(--faint); font-size: .82rem; }
.post-meta span { display: inline-flex; align-items: center; gap: 5px; }
.post-meta svg.i { width: 15px; height: 15px; }

.path { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 0; }
.path a {
  display: flex; align-items: center; gap: 12px; height: 100%; padding: 13px 16px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .94rem; line-height: 1.7;
}
.path a:hover { border-color: var(--primary); color: var(--primary); }
.path a::before {
  counter-increment: step; content: counter(step, persian); flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .9rem;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feature { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.fi { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.feature h3 { margin: 14px 0 6px; font-size: 1.03rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.85; }

/* ---------- سربرگ صفحه‌های داخلی ---------- */
.page-head { background: var(--hero-grad); border-bottom: 1px solid var(--border); padding: 34px 0 30px; }
.page-head h1 { margin: 10px 0 6px; font-size: clamp(1.6rem, 3.6vw, 2.25rem); font-weight: 900; }
.page-head p { margin: 0; color: var(--muted); max-width: 65ch; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .84rem; color: var(--faint); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .55; }
.breadcrumb [aria-current] { color: var(--faint); max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- مقاله ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 30px; padding-bottom: 56px; }
@media (min-width: 1040px) { .article-wrap { grid-template-columns: minmax(0, 1fr) 290px; } }
.article-head { margin-bottom: 22px; }
.article-head .breadcrumb { margin-bottom: 16px; }
.article-head h1 { font-size: clamp(1.6rem, 3.8vw, 2.35rem); line-height: 1.5; margin: 12px 0 10px; font-weight: 900; }
.article-head .lead { font-size: 1.07rem; color: var(--muted); margin: 0 0 14px; }
.article-body { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(20px, 4.2vw, 44px); }

.prose { font-size: 1.04rem; line-height: 2.05; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.38rem; font-weight: 850; margin: 2.1em 0 .55em; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.14rem; font-weight: 800; margin: 1.7em 0 .5em; scroll-margin-top: 90px; }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-inline-start: 1.5em; }
.prose ol { list-style: persian; }
.prose li { margin: .35em 0; padding-inline-start: .2em; }
.prose li::marker { color: var(--primary); font-weight: 700; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent); text-underline-offset: 5px; }
.prose a:hover { text-decoration-color: var(--primary); }
.prose strong { font-weight: 800; }
.prose code {
  direction: ltr; unicode-bidi: isolate; font-family: var(--mono); font-size: .84em; padding: .14em .45em;
  border-radius: 6px; background: var(--inline-code-bg); border: 1px solid var(--border); overflow-wrap: anywhere;
}

.codeblock { direction: ltr; margin: 0 0 1.35em; border-radius: 13px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--code-border); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px;
  background: rgba(255, 255, 255, .03); border-bottom: 1px solid var(--code-border); color: #8592b0; font: 12px var(--mono);
}
.copy-btn {
  font-family: "Vazirmatn", Tahoma, sans-serif; font-size: .76rem; color: #c3cde3; background: transparent;
  border: 1px solid #2a3656; border-radius: 8px; padding: 2px 12px; cursor: pointer; line-height: 1.9;
}
.copy-btn:hover { border-color: #7099ff; color: #fff; }
.copy-btn.ok { border-color: #34d399; color: #34d399; }
.codeblock pre { margin: 0; padding: 16px 18px; overflow-x: auto; color: var(--code-text); font: 13.5px/1.8 var(--mono); text-align: left; tab-size: 4; }
.codeblock pre code { all: unset; white-space: pre; font: inherit; }

.callout {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 1.35em; padding: 14px 18px; border-radius: 13px;
  border: 1px solid var(--border); font-size: .98rem; line-height: 1.95;
}
.callout p { margin: 0; }
.callout .ci { margin-top: 5px; }
.callout-tip { background: var(--tip-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.callout-tip .ci, .callout-tip strong:first-child { color: var(--accent); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout-warn .ci, .callout-warn strong:first-child { color: var(--warn); }
.callout-note { background: var(--note-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.callout-note .ci, .callout-note strong:first-child { color: var(--primary); }

.table-wrap { overflow-x: auto; margin: 0 0 1.35em; border: 1px solid var(--border); border-radius: 13px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.8; }
.prose th, .prose td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 800; white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; overflow-wrap: normal; }

.article-foot { margin-top: 22px; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.post-nav a { display: block; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); line-height: 1.7; font-weight: 600; }
.post-nav a:hover { border-color: var(--primary); color: var(--primary); }
.post-nav small { display: flex; align-items: center; gap: 4px; color: var(--faint); font-size: .78rem; font-weight: 500; margin-bottom: 2px; }
.post-nav small svg.i { width: 15px; height: 15px; }
.post-nav .next { text-align: end; }
.post-nav .next small { justify-content: flex-end; }
@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }

.sidebar-sticky { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1040px) { .sidebar-sticky { position: sticky; top: 88px; } }
.side-box { padding: 18px 18px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.side-box h2 { margin: 0 0 10px; font-size: .95rem; font-weight: 850; }
.toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--border); }
.toc a {
  display: block; margin-inline-start: -2px; padding: 5px 12px; border-inline-start: 2px solid transparent;
  color: var(--muted); font-size: .87rem; line-height: 1.75;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--primary); border-inline-start-color: var(--primary); font-weight: 700; }
.toc code { font-family: var(--mono); font-size: .9em; direction: ltr; unicode-bidi: isolate; }
.related a { display: block; padding: 9px 0; border-bottom: 1px dashed var(--border); color: var(--text); font-size: .9rem; line-height: 1.75; }
.related a:last-child { border-bottom: 0; }
.related a:hover { color: var(--primary); }
.toc-desktop { display: none; }
@media (min-width: 1040px) { .toc-desktop { display: block; } .toc-mobile { display: none; } }
.toc-mobile { margin-bottom: 16px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.toc-mobile summary { cursor: pointer; font-weight: 800; }
.toc-mobile .toc { margin-top: 10px; }

.progress { position: fixed; top: 0; inset-inline: 0; z-index: 60; height: 3px; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: 100% 50%; }

/* ---------- تماس، جستجو، ۴۰۴ ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 1.5em; }
.contact-card { padding: 16px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.contact-card a, .contact-card > span { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.contact-card svg.i { color: var(--primary); }

.search-page .search-form { max-width: none; }
.search-status { color: var(--muted); margin: 18px 4px 6px; font-size: .95rem; }
.search-results { display: grid; gap: 12px; }
.result { position: relative; padding: 18px 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.result:hover { border-color: var(--primary); }
.result h2 { margin: 6px 0 4px; font-size: 1.05rem; }
.result h2 a { color: var(--text); }
.result h2 a::after { content: ""; position: absolute; inset: 0; }
.result p { margin: 0; color: var(--muted); font-size: .92rem; }
.result .chip { pointer-events: none; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.notfound { text-align: center; padding: 80px 0; }
.nf-code { font-size: clamp(4rem, 14vw, 7rem); font-weight: 900; line-height: 1.1; color: var(--primary); opacity: .9; }
.notfound h1 { margin: 10px 0 8px; font-size: 1.6rem; }
.notfound p { color: var(--muted); margin: 0 0 24px; }
.nf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- فوتر ---------- */
.site-footer { margin-top: 0; padding: 44px 0 24px; background: var(--surface); border-top: 1px solid var(--border); font-size: .92rem; }
.footer-grid { display: grid; gap: 30px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.1fr; } }
.footer-grid h2 { margin: 4px 0 12px; font-size: .95rem; font-weight: 850; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--muted); }
.footer-grid a:hover { color: var(--primary); }
.footer-about p { margin: 12px 0 0; color: var(--muted); line-height: 1.95; max-width: 46ch; }
.contact-mini a, .contact-mini li > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.contact-mini svg.i { width: 17px; height: 17px; color: var(--primary); }
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.badges img { width: 84px; height: auto; padding: 4px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 30px; padding-top: 18px;
  border-top: 1px solid var(--border); color: var(--faint); font-size: .83rem;
}

/* ---------- مرکز دانلود ---------- */
.grp-os { --c: #2b5ce6; } .grp-sysadmin { --c: #0e9f74; } .grp-dev { --c: #7c4dff; } .grp-apps { --c: #d97706; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grp-os { --c: #7099ff; } :root:not([data-theme="light"]) .grp-sysadmin { --c: #34d3a1; }
  :root:not([data-theme="light"]) .grp-dev { --c: #a78bfa; } :root:not([data-theme="light"]) .grp-apps { --c: #fbbf24; }
}
:root[data-theme="dark"] .grp-os { --c: #7099ff; } :root[data-theme="dark"] .grp-sysadmin { --c: #34d3a1; }
:root[data-theme="dark"] .grp-dev { --c: #a78bfa; } :root[data-theme="dark"] .grp-apps { --c: #fbbf24; }

.ltr { direction: ltr; unicode-bidi: isolate; }
.btn-sm { padding: 7px 14px; font-size: .88rem; border-radius: 10px; }
.btn-sm svg.i { width: 17px; height: 17px; }
.btn-lg { width: 100%; padding: 13px 20px; font-size: 1.05rem; border-radius: 13px; }
.btn-disabled, .btn-disabled:hover { background: var(--surface-2); color: var(--faint); cursor: default; border-color: var(--border); }
.btn-size { font-weight: 500; font-size: .8em; opacity: .85; padding-inline-start: 8px; margin-inline-start: 2px; border-inline-start: 1px solid currentColor; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
@media (max-width: 360px) { .dl-grid { grid-template-columns: 1fr; } }
.dl-card {
  display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .18s ease, box-shadow .18s ease;
}
.dl-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow); }
.section-alt .dl-card { background: var(--bg); }
.dl-top { display: flex; align-items: center; gap: 12px; }
.dl-icon {
  --c: var(--primary); flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: var(--c);
  background: var(--primary-soft); background: color-mix(in srgb, var(--c) 13%, transparent);
}
.dl-icon svg.i { width: 23px; height: 23px; }
.dl-top h3 { margin: 0; font-size: 1.06rem; line-height: 1.5; }
.dl-top h3 a { color: var(--text); }
.dl-top h3 a:hover { color: var(--primary); }
.dl-fa { display: block; font-size: .82rem; color: var(--faint); }
.dl-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.dl-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: auto 0 0; font-size: .82rem; }
.dl-meta div { display: flex; gap: 6px; }
.dl-meta dt { color: var(--faint); }
.dl-meta dd { margin: 0; font-weight: 600; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-actions .btn:first-child { flex: 1; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 22px; border-radius: 14px;
  background: var(--note-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); font-size: .95rem; line-height: 1.95;
}
.notice svg.i { color: var(--primary); margin-top: 4px; }
.notice p { margin: 0; }
.group-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.dl-group { padding-top: 6px; margin-bottom: 40px; scroll-margin-top: 84px; }
.dl-group h2 { display: flex; align-items: center; gap: 10px; }
.dl-group h2 svg.i { color: var(--primary); width: 24px; height: 24px; }

.dl-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 30px; padding-bottom: 56px; }
@media (min-width: 1000px) {
  .dl-layout { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "main box"; align-items: start; }
  .dl-box { grid-area: box; position: sticky; top: 88px; }
  .dl-main { grid-area: main; }
}
.dl-box { padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.dl-box-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.dl-box-head strong { display: block; font-size: 1.12rem; }
.dl-box-head span:not(.dl-icon) { display: block; font-size: .85rem; color: var(--faint); }
.kv { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: .9rem; }
.kv th, .kv td { padding: 9px 0; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.kv th { color: var(--faint); font-weight: 500; width: 34%; white-space: nowrap; padding-inline-end: 10px; }
.kv td { font-weight: 600; overflow-wrap: anywhere; }
.kv code { font-family: var(--mono); font-size: .85em; font-weight: 500; }
.hash { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.hash span { display: block; font-size: .78rem; color: var(--faint); margin-bottom: 2px; }
.hash code { display: block; font-family: var(--mono); font-size: .78rem; line-height: 1.7; word-break: break-all; text-align: left; }
.dl-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: .9rem; }
.dl-links a { display: inline-flex; align-items: center; gap: 6px; }
.dl-links svg.i { width: 16px; height: 16px; }
.dl-main .article-body { margin-bottom: 18px; }
.more-dl a { display: flex; justify-content: space-between; gap: 10px; }
.more-dl small { color: var(--faint); }
.side-dl a { display: flex; align-items: center; gap: 8px; }
.side-dl svg.i { width: 17px; height: 17px; color: var(--primary); }

@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr; } }

@media print {
  .site-header, .site-footer, .sidebar, .toc-mobile, .post-nav, .progress, .copy-btn { display: none !important; }
  .article-body { border: 0; padding: 0; }
  body { background: #fff; color: #000; }
}

.knowledge-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.knowledge-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.knowledge-list a { font-weight: 700; color: var(--primary); }
.knowledge-list span, .knowledge-attribution { color: var(--muted); }
.knowledge-reading { max-width: 1040px; padding-block: 20px 48px; }
.knowledge-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.knowledge-toc ul { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-inline-start: 24px; }
.knowledge-chapter { margin-block: 32px; scroll-margin-top: 90px; }
.knowledge-source { direction: ltr; text-align: left; overflow-wrap: anywhere; padding: clamp(14px, 3vw, 30px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow-x: auto; }
.knowledge-source pre { white-space: pre; overflow-x: auto; }
.knowledge-source table { min-width: 0; }
.knowledge-pdf { width: 100%; height: min(75vh, 900px); min-height: 380px; border: 1px solid var(--border); border-radius: 12px; }

.reference-filter { display: block; width: min(100%, 34rem); margin-block: 6px 18px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.knowledge-list li[hidden] { display: none; }
