/* -------------------------------------------------------------
   ناحیه بحرانی | قالب عمومی، پنل مدیریت و نصب‌کننده
   فونت محلی، RTL، بدون وابستگی خارجی
   ------------------------------------------------------------- */

@font-face {
  font-family: "Vazirmatn";
  src: url("Vazirmatn.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Typography */
  --font: "Vazirmatn", Tahoma, sans-serif;
  --text-base: 1rem;

  /* Colors */
  --page: #f5f8f6;
  --surface: #ffffff;
  --surface-soft: #f0f5f2;
  --surface-muted: #f8faf9;
  --ink: #1c2925;
  --ink-soft: #4e5e57;
  --muted: #66756e;
  --line: #e1e9e4;
  --line-strong: #ccd9d1;
  --brand: #176b5b;
  --brand-dark: #0e5143;
  --brand-deep: #093f35;
  --brand-soft: #e5f2ec;
  --brand-hover: #d6ebe1;
  --danger: #a33b35;
  --danger-soft: #fff5f3;
  --success: #23714e;
  --success-soft: #eff8f2;

  /* Shape and elevation */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 19px;
  --shadow-sm: 0 2px 8px rgba(25, 48, 40, 0.045);
  --shadow-md: 0 10px 28px rgba(25, 48, 40, 0.075);
  --shadow-header: 0 2px 12px rgba(24, 52, 43, 0.035);

  /* Layout and interaction */
  --content-width: 960px;
  --header-width: 1160px;
  --focus-ring: 0 0 0 3px rgba(23, 107, 91, 0.2);
  --transition-fast: 160ms ease;
}

/* 1. پایه و دسترس‌پذیری */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.9;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #d8ebe2;
  color: var(--ink);
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input[type="hidden"] {
  display: none !important;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

p {
  text-align: justify;
  text-justify: inter-word;
}

h2 {
  margin: 0 0 13px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.65;
}

h3 {
  color: var(--ink);
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition-fast), background-color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
}

a:hover {
  border-radius: 4px;
  background-color: var(--brand-hover);
  box-shadow: 0 0 0 3px var(--brand-hover);
  color: var(--brand-deep);
  text-decoration: none;
}

/* تأکید hover برای پیوندهای متنی؛ بدون خط زیر و بدون جابه‌جایی متن */
.body a:hover,
.files a:hover,
.post-meta-links a:hover,
td a:hover,
.disclaimer-page a:hover {
  border-radius: 4px;
  background-color: var(--brand-hover);
  box-shadow: 0 0 0 3px var(--brand-hover);
  color: var(--brand-deep);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

a:focus-visible {
  border-radius: 4px;
  background-color: var(--brand-soft);
  color: var(--brand-deep);
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  inset-inline-start: 8px;
  padding: 8px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
  background: var(--ink);
  color: #fff;
}

/* 2. ساختار صفحات و تیترها */
.wrap {
  width: min(var(--content-width), calc(100% - 40px));
  min-height: calc(100vh - 190px);
  margin: 34px auto 56px;
}

.muted {
  color: var(--muted);
}

.page-title,
main > h1 {
  margin: 0 0 22px;
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: -0.035em;
}

main > h1::after,
.page-title::after {
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 11px;
  border-radius: 999px;
  background: var(--brand);
  content: "";
}

/* 3. سربرگ و ناوبری */
.hd {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-header);
}

.hd-inner {
  display: flex;
  width: min(var(--header-width), calc(100% - 40px));
  min-height: 82px;
  align-items: center;
  gap: 18px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.logo:hover {
  background: transparent;
  color: var(--brand);
  box-shadow: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.hd nav {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.hd nav a {
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 0.91rem;
  font-weight: 550;
  white-space: nowrap;
}

.hd nav a:hover {
  background: var(--surface-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

.sf {
  position: relative;
  display: flex;
  width: 245px;
  height: 42px;
  flex: 0 1 245px;
  align-items: center;
}

.sf input {
  width: 100%;
  height: 100%;
  padding: 0 42px 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.sf input::placeholder {
  color: #89968f;
}

.sf input:focus {
  border-color: #91bdae;
  background: var(--surface);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.sf button {
  position: absolute;
  inset-inline-start: 3px;
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.sf button:hover {
  transform: none;
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}

.tgi {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
}

.tgi svg {
  width: 21px;
  height: 21px;
}

.tgi:hover {
  transform: translateY(-1px);
  border-color: #b8d5c8;
  background: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}

/* 4. برچسب‌ها و فهرست مطالب */
.topic-cloud {
  margin: 0 0 24px;
  padding: 17px 19px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.featured-section {
  margin: 0 0 24px;
  padding: 20px;
  border: 1px solid #d5e5dc;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #f1f8f4 0%, #ffffff 72%);
  box-shadow: var(--shadow-sm);
}

.featured-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.featured-heading .section-kicker {
  margin-bottom: 2px;
  color: var(--brand);
}

.featured-heading h2 {
  margin: 0;
}

.featured-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.featured-card {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.featured-card:hover {
  transform: translateY(-2px);
  border-color: #b9d5c7;
  box-shadow: var(--shadow-md);
}

.featured-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.74rem;
}

.featured-badge,
.featured-status.is-featured {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-dark);
  font-weight: 750;
}

.featured-card h3 {
  margin: 10px 0 0;
  font-size: 1rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.featured-card h3 a {
  color: var(--ink);
}

.featured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.featured-tags .tag {
  min-height: 26px;
  padding: 2px 9px;
  font-size: 0.72rem;
}

.featured-status {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.featured-check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
}

.featured-check-label input {
  flex: 0 0 auto;
  margin: 0;
}

.post-featured-options p {
  margin: 7px 0 0;
  font-size: 0.82rem;
}

.section-kicker {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  margin: 0;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: nowrap;
}

.tag:hover {
  border-color: #b7d4c6;
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

.list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 40px;
  grid-template-areas: "t go" "m go";
  align-items: center;
  gap: 5px 12px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.list li:hover {
  transform: translateY(-2px);
  border-color: #c4d9ce;
  box-shadow: var(--shadow-md);
}

.list .t {
  grid-area: t;
  min-width: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.list .t:hover {
  background: var(--brand-hover);
  color: var(--brand-deep);
  box-shadow: 0 0 0 3px var(--brand-hover);
}

.list .m {
  display: flex;
  min-width: 0;
  grid-area: m;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.list .tg {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 10px;
  overflow: hidden;
}

.list .tg a {
  border-radius: 4px;
  color: var(--muted);
  white-space: nowrap;
}

.list .tg a:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

.list .d {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.list .go {
  display: grid;
  width: 36px;
  height: 36px;
  grid-area: go;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--brand);
}

.list .go:hover {
  border-color: #b7d4c6;
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: none;
}

.list .go svg {
  width: 17px;
  height: 17px;
}

.pg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 25px;
}

.pg a,
.pg b,
.pg span {
  display: grid;
  min-width: 37px;
  height: 37px;
  place-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 650;
}

.pg a:hover {
  border-color: #b7d4c6;
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

.pg b[aria-current="page"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.pg .dots {
  min-width: 20px;
  border: 0;
  background: transparent;
}

/* 5. صفحهٔ مطلب و محتوای HTML */
.post {
  padding: clamp(19px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.post > h1 {
  margin: 0 0 11px;
  color: var(--ink);
  font-size: clamp(1.55rem, 3.8vw, 2.05rem);
  font-weight: 850;
  line-height: 1.65;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.post .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 13px;
  margin-bottom: 25px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.post .meta .tag {
  min-height: 27px;
  padding: 2px 9px;
  font-size: 0.72rem;
}

.post-meta-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 13px;
}

 .post-meta-links a {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 650;
}

.post-meta-links a.post-edit-btn {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 4px 11px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.post-meta-links a.post-edit-btn:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
}

.post-danger-zone {
  margin-top: 16px;
  border-color: #ead5d5;
}

.post-danger-zone h3 {
  margin-top: 0;
}

.admin-list-summary {
  margin: 0 0 12px;
  font-size: 0.82rem;
}

.body {
  color: #33413c;
  font-size: 1rem;
  line-height: 2.15;
  overflow-wrap: anywhere;
  word-break: normal;
}

.body > :first-child {
  margin-top: 0;
}

.body p {
  margin: 0 0 1.15em;
}

.body h2 {
  margin: 1.9em 0 0.65em;
  padding-inline-start: 13px;
  border-inline-start: 3px solid var(--brand);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.7;
}

.body h3 {
  margin: 1.5em 0 0.5em;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 750;
}

.body ul,
.body ol {
  margin: 0.6em 0 1.3em;
  padding-inline-start: 1.5em;
}

.body li {
  margin: 0.35em 0;
  padding-inline-start: 0.25em;
}

.body li::marker {
  color: var(--brand);
}

.body strong,
.body b {
  color: #263a34;
  font-weight: 800;
}

.body blockquote {
  margin: 1.4em 0;
  padding: 13px 18px;
  border: 1px solid #dbe9e2;
  border-inline-start: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f5faf7;
  color: var(--ink-soft);
}

.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: start;
}

code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--brand-deep);
  direction: ltr;
  unicode-bidi: plaintext;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

.post section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.post section h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
}

.files {
  margin: 0;
  padding-inline-start: 1.3em;
  color: var(--muted);
}

.files li {
  margin: 9px 0;
  padding-inline-start: 3px;
}

.files li::marker {
  color: var(--brand);
}

.files a {
  color: var(--brand);
  overflow-wrap: anywhere;
}

.attachments-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachments-list li.file-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.attachments-list li.file-item::marker {
  content: none;
}

.attachments-list li.file-item:hover {
  border-color: #c4d9ce;
  background: var(--surface);
}

.attachments-list a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid #d9eae1;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
}

.file-icon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.file-icon.is-telegram {
  border-color: #cde8f2;
  background: #eaf6fb;
  color: #1688b7;
}

.attachment-link-item a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

.disclaimer-page {
  line-height: 2.1;
}

.disclaimer-page h1 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  font-weight: 800;
}

.disclaimer-page p {
  margin: 0;
  color: var(--ink-soft);
}

.gal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  margin: 25px 0;
}

.gal a {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.gal a:hover {
  border-color: #a9cbbd;
  background: var(--surface-soft);
  box-shadow: var(--shadow-md);
}

.gal img {
  display: block;
  width: 100%;
  height: 165px;
  margin: 0;
  object-fit: cover;
}

/* 6. نمایش تمام‌صفحهٔ تصویر */
.lb {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 20px;
  background: rgba(13, 23, 20, 0.94);
}

.lb[hidden] {
  display: none;
}

.lb img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

.lb-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  font-size: 0.85rem;
  direction: ltr;
}

.lb-bar .btn {
  border-color: #fff;
  background: #fff;
  color: var(--ink);
}

.lb-x,
.lb-n {
  position: absolute;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.lb-x {
  top: 17px;
  inset-inline-end: 17px;
}

.lb-n {
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  inset-inline-end: 14px;
}

.lb-prev {
  inset-inline-start: 14px;
}

.lb-x:hover,
.lb-n:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.lb-x:hover {
  transform: none;
}

.lb-n:hover,
.lb-n:active {
  transform: translateY(-50%);
}

/* 7. فرم‌ها، کنترل‌ها و پیام‌ها */
.form,
.box {
  margin: 0 0 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form {
  max-width: 620px;
}

label {
  display: block;
  margin-bottom: 15px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 650;
}

label input,
label textarea,
label select {
  display: block;
  margin-top: 6px;
}

input,
textarea,
select {
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.7;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: #89968f;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #91bdae;
  outline: 0;
  box-shadow: var(--focus-ring);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

textarea,
.form input,
.box input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.box select {
  width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  accent-color: var(--brand);
}

input[type="file"] {
  padding: 8px;
  background: var(--surface-muted);
}

button,
.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 17px;
  border: 1px solid var(--brand);
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  transition: background-color var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-image: none;
}

button:active,
.btn:active {
  transform: translateY(0);
}

button.red {
  border-color: #e3c3c0;
  background: var(--danger-soft);
  color: var(--danger);
}

button.red:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

button.gray {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink-soft);
}

button.gray:hover {
  border-color: #b9cbc3;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.form .hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.ok,
.err {
  margin: 0 0 18px;
  padding: 12px 15px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 0.9rem;
  text-align: start;
}

.ok {
  border-color: #b8d9c7;
  background: var(--success-soft);
  color: var(--success);
}

.err {
  border-color: #e5c2bf;
  background: var(--danger-soft);
  color: var(--danger);
}

/* 8. پنل مدیریت */
.narrow {
  width: min(100%, 430px);
  margin-inline: auto;
}

.inline {
  display: inline;
}

.unread {
  border-inline-start: 4px solid var(--brand);
}

.scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

.row select {
  width: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

td,
th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 750;
}

td {
  color: var(--ink-soft);
  font-size: 0.87rem;
}

.scroll table {
  min-width: 620px;
}

.scroll tr:last-child td {
  border-bottom: 0;
}

fieldset {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}

legend {
  padding: 0 7px;
  color: var(--ink);
  font-weight: 750;
}

.tb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.tb button {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 0.8rem;
}

#editor {
  min-height: 300px;
  margin-bottom: 17px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  line-height: 2;
  outline: 0;
}

#editor:focus {
  border-color: #91bdae;
  box-shadow: var(--focus-ring);
}

#editor p,
#editor h2,
#editor li {
  unicode-bidi: plaintext;
}

.editor-source[hidden],
.editor-help[hidden],
#editor[hidden],
.tb button[hidden] {
  display: none !important;
}

.editor-source {
  display: block;
  width: 100%;
  min-height: 380px;
  margin-bottom: 9px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #17211e;
  color: #e8f2ed;
  direction: ltr;
  text-align: left;
  font: 0.9rem/1.75 ui-monospace, SFMono-Regular, Consolas, monospace;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor-source:focus {
  outline: 0;
  border-color: #91bdae;
  box-shadow: var(--focus-ring);
}

.editor-help {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.8;
}

.body img,
.body video,
.body audio {
  max-width: 100%;
}

.body img,
.body video {
  height: auto;
  border-radius: var(--radius-sm);
}

.body figure {
  margin: 22px 0;
}

.body figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 20px 0;
}

.body th,
.body td {
  min-width: 90px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  text-align: start;
  vertical-align: top;
}

.body th {
  background: var(--surface-soft);
  font-weight: 750;
}

.body pre {
  max-width: 100%;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  direction: ltr;
  text-align: left;
  white-space: pre;
}

.body code,
.body kbd,
.body samp {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  direction: ltr;
}

.body iframe {
  display: block;
  width: min(100%, 800px);
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 22px auto;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.body details {
  margin: 14px 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.body summary {
  cursor: pointer;
  font-weight: 750;
}

.body hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.settings-advanced {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.settings-advanced summary {
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
  list-style-position: inside;
}

.settings-advanced[open] summary {
  margin-bottom: 12px;
}

.settings-advanced label {
  margin-top: 14px;
}

.settings-advanced textarea {
  min-height: 100px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  direction: ltr;
  text-align: left;
}

/* 9. نصب‌کننده؛ استایل‌ها در فایل اصلی نگهداری می‌شوند */
.install-shell {
  width: min(760px, calc(100% - 32px));
  margin: 42px auto 64px;
}

.install-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 850;
}

.install-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}

.install-card {
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.install-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.install-card textarea,
.install-card select {
  width: 100%;
}

.install-lead {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: start;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 26px;
}

.install-check {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  font-size: 0.83rem;
}

.install-check b {
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.install-check.fail b {
  color: var(--danger);
}

.install-section {
  margin: 24px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 800;
}

.install-submit {
  width: 100%;
  margin-top: 10px;
}

.install-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.83rem;
  text-align: start;
}

.install-success {
  padding: 18px 4px;
  text-align: center;
}

.install-success .symbol {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.8rem;
}

.install-success h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.install-success p {
  color: var(--ink-soft);
  text-align: center;
}

.install-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

/* 10. فوتر */
.ft {
  padding: 24px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* 11. تبلت و نمایشگرهای متوسط */
@media (max-width: 900px) {
  .hd-inner {
    gap: 12px;
  }

  .hd nav a {
    padding-inline: 9px;
  }

  .sf {
    width: 215px;
    flex-basis: 215px;
  }
}

@media (max-width: 760px) {
  .hd-inner {
    min-height: 72px;
    flex-wrap: wrap;
    gap: 8px 13px;
    padding-block: 10px;
  }

  .hd nav {
    flex: 1 1 auto;
    justify-content: flex-start;
    gap: 2px;
  }

  .hd nav a {
    padding-inline: 9px;
    font-size: 0.85rem;
  }

  .sf {
    order: 4;
    width: auto;
    height: 40px;
    flex: 1 1 calc(100% - 55px);
  }

  .tgi {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .wrap {
    margin-top: 25px;
  }

  .hd-inner > .inline {
    margin-inline-start: auto;
  }
}

/* 12. موبایل */
@media (max-width: 520px) {
  body {
    font-size: 16px;
    line-height: 1.9;
  }

  input,
  textarea,
  select,
  .sf input {
    font-size: 16px;
  }

  .hd-inner {
    width: calc(100% - 28px);
    gap: 7px 9px;
  }

  .featured-section {
    padding: 14px;
  }

  .featured-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .logo {
    gap: 8px;
    font-size: 1.02rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 10px;
  }

  .hd nav {
    justify-content: flex-end;
  }

  .hd nav a {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .sf {
    order: 5;
    flex-basis: 100%;
  }

  .tgi {
    margin-inline-start: auto;
  }

  .wrap {
    width: calc(100% - 28px);
    min-height: calc(100vh - 190px);
    margin: 21px auto 38px;
  }

  .page-title,
  main > h1 {
    margin-bottom: 17px;
    font-size: 1.45rem;
  }

  .topic-cloud {
    margin-bottom: 16px;
    padding: 13px;
  }

  .tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .tags::-webkit-scrollbar {
    display: none;
  }

  .tags .tag {
    flex: 0 0 auto;
  }

  .list {
    gap: 8px;
  }

  .list li {
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 4px 8px;
    padding: 12px;
    border-radius: 12px;
  }

  .list .t {
    font-size: 0.92rem;
    line-height: 1.7;
  }

  .list .m {
    flex-wrap: nowrap;
    gap: 7px;
    font-size: 0.72rem;
  }

  .list .tg {
    flex-wrap: nowrap;
  }

  .list .go {
    width: 32px;
    height: 32px;
  }

  .post {
    padding: 18px 15px;
    border-radius: 14px;
  }

  .post > h1 {
    font-size: 1.42rem;
    line-height: 1.75;
  }

  .post .meta {
    gap: 7px 9px;
    margin-bottom: 19px;
    padding-bottom: 14px;
    font-size: 0.73rem;
  }

  .post-meta-links {
    gap: 6px 10px;
  }

  .post-meta-links a {
    font-size: 0.72rem;
  }

  .body {
    font-size: 0.96rem;
    line-height: 2.08;
  }

  .body h2 {
    font-size: 1.18rem;
  }

  .body h3 {
    font-size: 1.04rem;
  }

  .gal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .gal img {
    height: 130px;
  }

  .form,
  .box {
    padding: 16px 13px;
  }

  .row.between {
    align-items: flex-start;
  }

  td,
  th {
    padding: 9px;
    font-size: 0.8rem;
  }

  .lb {
    padding: 12px;
  }

  .lb-n {
    width: 39px;
    height: 39px;
  }

  .lb-next {
    inset-inline-end: 7px;
  }

  .lb-prev {
    inset-inline-start: 7px;
  }

  .install-shell {
    margin: 22px auto 40px;
  }

  .install-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  .hd nav a {
    padding-inline: 6px;
    font-size: 0.76rem;
  }

  .list .m {
    gap: 5px;
    font-size: 0.7rem;
  }
}

/* احترام به تنظیم کاهش حرکت سیستم‌عامل */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}


/* بلوک‌های کد سفارشی مقاله و ویرایشگر */
.custom-code-placeholder {
  display: flex;
  min-height: 58px;
  margin: 18px 0;
  padding: 16px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--brand);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--brand-deep);
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.custom-code-placeholder.is-selected {
  outline: 3px solid var(--focus-ring-color, rgba(35, 113, 78, 0.24));
  outline-offset: 2px;
}

.custom-code-frame-wrap {
  width: 100%;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.custom-code-frame {
  display: block;
  width: 100%;
  min-height: 160px;
  border: 0;
  background: #fff;
  resize: vertical;
}

.custom-code-dialog {
  width: min(900px, calc(100% - 24px));
  max-width: 900px;
  max-height: min(92vh, 1000px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
}

.custom-code-dialog::backdrop {
  background: rgba(10, 20, 16, 0.68);
  backdrop-filter: blur(3px);
}

.custom-code-dialog-inner {
  display: grid;
  gap: 14px;
  padding: clamp(16px, 3vw, 26px);
}

.custom-code-dialog-inner h2 {
  margin: 0;
}

.custom-code-dialog-inner p {
  margin: 0;
}

.custom-code-dialog textarea {
  display: block;
  width: 100%;
  min-height: 130px;
  margin-top: 7px;
  padding: 12px;
  direction: ltr;
  text-align: left;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.custom-code-height-label {
  max-width: 240px;
}

.custom-code-dialog-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .custom-code-dialog {
    width: calc(100% - 16px);
    max-height: 94vh;
  }

  .custom-code-dialog-inner {
    padding: 14px;
  }
}

/* اندازه و رفتار iframe کد سفارشی بر قواعد عمومی iframe مقاله مقدم است. */
.body .custom-code-frame {
  width: 100%;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
}
