/* ==========================================================================
   راهنمای افزونهٔ ویرا — استایل
   کانون آگهی و تبلیغاتی ویرا · وب گستر حرف اول

   فونت‌ها: مُدَم برای تیترها، پیدا برای متن — طبق راهنمای رسمی برند.
   رنگ‌ها همان توکن‌های سایت‌اند تا راهنما و سایت یک زبان داشته باشند.
   ========================================================================== */

/* --------------------------------------------------------------
 * فونت‌ها
 * ------------------------------------------------------------ */

@font-face {
	font-family: "Modam";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("fonts/modam/ModamFaNumWeb-Regular.woff2") format("woff2");
}

@font-face {
	font-family: "Modam";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("fonts/modam/ModamFaNumWeb-Medium.woff2") format("woff2");
}

@font-face {
	font-family: "Modam";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("fonts/modam/ModamFaNumWeb-SemiBold.woff2") format("woff2");
}

@font-face {
	font-family: "Modam";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("fonts/modam/ModamFaNumWeb-Bold.woff2") format("woff2");
}

@font-face {
	font-family: "Modam";
	font-style: normal;
	font-weight: 800;
	font-display: swap;
	src: url("fonts/modam/ModamFaNumWeb-ExtraBold.woff2") format("woff2");
}

@font-face {
	font-family: "Peyda";
	font-style: normal;
	font-weight: 300;
	font-display: swap;
	src: url("fonts/peyda/PeydaWeb-Light.woff2") format("woff2");
}

@font-face {
	font-family: "Peyda";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("fonts/peyda/PeydaWeb-Regular.woff2") format("woff2");
}

@font-face {
	font-family: "Peyda";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("fonts/peyda/PeydaWeb-Medium.woff2") format("woff2");
}

@font-face {
	font-family: "Peyda";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("fonts/peyda/PeydaWeb-SemiBold.woff2") format("woff2");
}

@font-face {
	font-family: "Peyda";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("fonts/peyda/PeydaWeb-Bold.woff2") format("woff2");
}

/* --------------------------------------------------------------
 * توکن‌ها — همان پالت سایت ویرا
 * ------------------------------------------------------------ */

:root {
	--brand:          #8A263A;
	--brand-hover:    #6E1E2E;
	--brand-deep:     #3D1019;
	--on-brand:       #FFFFFF;

	--surface:        #FBF8F9;
	--surface-2:      #F2E4E8;
	--surface-3:      #EDDDE0;
	--white:          #FFFFFF;

	--text:           #262626;   /* ۱۵.۱ روی سفید ✔ AAA */
	--text-muted:     #4B3D40;   /* ۱۰.۳ ✔ AAA */
	--text-subtle:    #6B6B6B;   /* ۵.۰۵ ✔ AA  */

	--border:         #E8E2E2;
	--border-strong:  #D6C9CC;

	--ok:             #1E6B44;
	--ok-bg:          #E7F3EC;
	--warn:           #8A5B00;
	--warn-bg:        #FCF3E0;
	--stop:           #8A263A;
	--stop-bg:        #F7E7EA;

	--radius-sm:      8px;
	--radius-md:      16px;
	--radius-lg:      24px;
	--radius-pill:    999px;

	--shadow-sm:      0 1px 2px rgba(38, 38, 38, 0.04);
	--shadow-md:      0 4px 16px rgba(38, 38, 38, 0.06);
	--shadow-lg:      0 12px 40px rgba(138, 38, 58, 0.10);

	--font-head:      "Modam", "Segoe UI", Tahoma, sans-serif;
	--font-body:      "Peyda", "Segoe UI", Tahoma, sans-serif;

	--sidebar:        280px;
	--gutter:         clamp(1rem, 3vw, 2.5rem);
}

/* --------------------------------------------------------------
 * پایه
 * ------------------------------------------------------------ */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	/* تیتر زیر نوار بالایی گم نشود */
	scroll-padding-block-start: 5rem;
}

body {
	margin: 0;
	background: var(--surface);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 1rem;
	/* متن فارسی به فضای سطر بیشتری از لاتین نیاز دارد */
	line-height: 1.95;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
	font-family: var(--font-head);
	line-height: 1.45;
	letter-spacing: -0.01em;
	margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.1vw, 2rem);  font-weight: 700; }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem); font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 1.1em; }

a {
	color: var(--brand);
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

a:hover { color: var(--brand-hover); }

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
	border-radius: 4px;
}

code, kbd, .mono {
	font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
	font-size: 0.875em;
	direction: ltr;
	unicode-bidi: isolate;
}

code {
	background: var(--surface-2);
	padding: 0.15em 0.45em;
	border-radius: 5px;
	color: var(--brand-hover);
}

/* --------------------------------------------------------------
 * چیدمان
 * ------------------------------------------------------------ */

.wrap {
	display: grid;
	grid-template-columns: var(--sidebar) minmax(0, 1fr);
	gap: var(--gutter);
	max-inline-size: 1320px;
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.side {
	position: sticky;
	inset-block-start: 0;
	align-self: start;
	block-size: 100dvh;
	overflow-y: auto;
	padding-block: 1.75rem;
	/* اسکرول‌بار داخلی نباید به متن بچسبد */
	padding-inline-end: 0.5rem;
}

.side__brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 1.25rem;
	font-family: var(--font-head);
	font-weight: 800;
	font-size: 1.05rem;
	color: var(--brand);
}

.side__mark {
	inline-size: 34px;
	block-size: 34px;
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 3px;
}

.side__mark i {
	display: block;
	border-radius: 50%;
	background: var(--brand);
	opacity: 0.35;
}

.side__mark i:nth-child(1),
.side__mark i:nth-child(5),
.side__mark i:nth-child(9) { opacity: 1; }

.toc { margin: 0; padding: 0; list-style: none; }

.toc a {
	display: block;
	padding: 0.42rem 0.75rem;
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	text-decoration: none;
	font-size: 0.9rem;
	line-height: 1.6;
	transition: background-color 140ms ease, color 140ms ease;
}

.toc a:hover {
	background: var(--surface-2);
	color: var(--brand);
}

.toc a.is-current {
	background: var(--brand);
	color: var(--on-brand);   /* ۸.۶۸ ✔ AAA */
	font-weight: 600;
}

.toc li.sub a {
	padding-inline-start: 1.7rem;
	font-size: 0.85rem;
}

.main {
	padding-block: 2.5rem 5rem;
	min-inline-size: 0;   /* بدون این، کد طولانی گرید را می‌کشد */
}

/* --------------------------------------------------------------
 * سربرگ
 * ------------------------------------------------------------ */

.hero {
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
	color: var(--on-brand);
	border-radius: var(--radius-lg);
	padding: clamp(1.75rem, 4vw, 3rem);
	margin-bottom: 2.5rem;
}

.hero h1 { color: var(--on-brand); margin-bottom: 0.4em; }

.hero p {
	margin: 0;
	font-size: 1.05rem;
	opacity: 0.93;
	max-inline-size: 60ch;
}

.hero__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1.5rem;
}

.hero__meta span {
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: var(--radius-pill);
	padding: 0.3rem 0.85rem;
	font-size: 0.83rem;
}

/* --------------------------------------------------------------
 * بخش‌ها
 * ------------------------------------------------------------ */

section { margin-bottom: 3.25rem; }

section > h2 {
	padding-bottom: 0.4rem;
	border-bottom: 2px solid var(--surface-2);
}

.lead {
	font-size: 1.08rem;
	color: var(--text-muted);
	max-inline-size: 68ch;
}

/* --------------------------------------------------------------
 * جعبه‌های نکته
 * ------------------------------------------------------------ */

.note {
	border-inline-start: 4px solid var(--brand);
	background: var(--white);
	border-radius: var(--radius-sm);
	padding: 1rem 1.1rem;
	margin: 1.5rem 0;
	box-shadow: var(--shadow-sm);
}

.note > :last-child { margin-bottom: 0; }

.note__title {
	display: block;
	font-family: var(--font-head);
	font-weight: 700;
	margin-bottom: 0.35rem;
}

.note--ok   { border-color: var(--ok);   background: var(--ok-bg); }
.note--warn { border-color: var(--warn); background: var(--warn-bg); }
.note--stop { border-color: var(--stop); background: var(--stop-bg); }

.note--ok   .note__title { color: var(--ok); }
.note--warn .note__title { color: var(--warn); }
.note--stop .note__title { color: var(--stop); }

/* --------------------------------------------------------------
 * گام‌ها
 * ------------------------------------------------------------ */

.steps {
	counter-reset: step;
	list-style: none;
	margin: 1.5rem 0;
	padding: 0;
}

.steps > li {
	counter-increment: step;
	position: relative;
	padding-inline-start: 3rem;
	padding-bottom: 1.4rem;
	margin-bottom: 0;
}

.steps > li::before {
	content: counter(step);
	position: absolute;
	inset-inline-start: 0;
	inset-block-start: 0.1rem;
	inline-size: 2rem;
	block-size: 2rem;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--brand);
	color: var(--on-brand);
	font-family: var(--font-head);
	font-weight: 700;
	font-size: 0.9rem;
	/* عدد فارسی در دایره باید دقیقاً وسط بنشیند */
	line-height: 1;
}

/* خط پیوند بین گام‌ها */
.steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	inset-inline-start: calc(1rem - 1px);
	inset-block-start: 2.3rem;
	inline-size: 2px;
	block-size: calc(100% - 2.3rem);
	background: var(--surface-2);
}

.steps strong { color: var(--brand-hover); }

/* --------------------------------------------------------------
 * جدول
 * ------------------------------------------------------------ */

.table-wrap {
	overflow-x: auto;
	margin: 1.5rem 0;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: var(--white);
}

table {
	inline-size: 100%;
	border-collapse: collapse;
	font-size: 0.94rem;
}

th, td {
	padding: 0.7rem 0.9rem;
	text-align: start;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

thead th {
	background: var(--surface-2);
	font-family: var(--font-head);
	font-weight: 700;
	color: var(--brand-hover);
	white-space: nowrap;
}

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

tbody tr:hover { background: var(--surface); }

/* --------------------------------------------------------------
 * ماکت متاباکس — شبیه‌سازی صفحهٔ پیشخوان
 * ------------------------------------------------------------ */

.mock {
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
	background: var(--white);
	margin: 1.5rem 0;
	overflow: hidden;
	box-shadow: var(--shadow-md);
}

.mock__bar {
	background: #F6F7F7;
	border-bottom: 1px solid var(--border);
	padding: 0.6rem 0.9rem;
	font-family: var(--font-head);
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--text-muted);
}

.mock__body { padding: 0.9rem; }

.block {
	border: 1px solid var(--border);
	border-radius: 6px;
	margin-bottom: 0.75rem;
	background: var(--white);
}

.block:last-child { margin-bottom: 0; }

.block__head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.65rem;
	background: #F6F7F7;
	border-bottom: 1px solid var(--border);
	flex-wrap: wrap;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	border: 1px solid var(--border-strong);
	border-radius: 5px;
	background: var(--white);
	padding: 0.28rem 0.6rem;
	font-size: 0.85rem;
	white-space: nowrap;
}

.pill--input {
	flex: 1 1 12rem;
	min-inline-size: 0;
	color: var(--text-subtle);
}

.pill--brand {
	background: var(--brand);
	border-color: var(--brand);
	color: var(--on-brand);
}

.block__body {
	display: grid;
	grid-template-columns: 170px minmax(0, 1fr);
	gap: 1rem;
	padding: 0.85rem;
}

.block__label {
	font-family: var(--font-head);
	font-weight: 600;
	font-size: 0.88rem;
	display: block;
	margin-bottom: 0.4rem;
}

.block__hint {
	font-size: 0.8rem;
	color: var(--text-subtle);
	line-height: 1.7;
	margin-top: 0.45rem;
}

.thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-bottom: 0.6rem;
}

.thumbs i {
	inline-size: 46px;
	block-size: 46px;
	border-radius: 4px;
	background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
	border: 1px solid var(--border);
	display: block;
}

.ph {
	inline-size: 88px;
	block-size: 62px;
	border-radius: 5px;
	background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
	border: 1px solid var(--border);
	display: grid;
	place-items: center;
	font-size: 1.3rem;
	color: var(--brand);
	opacity: 0.6;
}

.urlbox {
	border: 1px solid var(--border-strong);
	border-radius: 5px;
	padding: 0.5rem 0.65rem;
	background: #FCFCFC;
	direction: ltr;
	text-align: left;
	font-size: 0.83rem;
	color: var(--text-muted);
	margin-bottom: 0.6rem;
}

/* --------------------------------------------------------------
 * کاشی‌های نمونه — پیش‌نمایش خروجی
 * ------------------------------------------------------------ */

.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 0.9rem;
	margin: 1.5rem 0;
}

.tile {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius-md);
	overflow: hidden;
	background: linear-gradient(135deg, #7d4a55, var(--brand-deep));
	display: grid;
	place-items: center;
	color: var(--on-brand);
	box-shadow: var(--shadow-md);
}

.tile__icon {
	inline-size: 42px;
	block-size: 42px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.85);
	display: grid;
	place-items: center;
	font-size: 1.15rem;
}

.tile__cap {
	position: absolute;
	inset-inline: 0.85rem;
	inset-block-end: 0.7rem;
	text-align: start;
	font-size: 0.85rem;
	line-height: 1.7;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.tile__cap b {
	display: block;
	font-family: var(--font-head);
	font-weight: 700;
}

.tile__cap small { opacity: 0.85; }

/* --------------------------------------------------------------
 * بنتو — نمایش اندازه‌های کاشی
 * ------------------------------------------------------------ */

.bento {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 78px;
	grid-auto-flow: dense;
	gap: 8px;
	margin: 1.5rem 0;
}

.bento div {
	border-radius: var(--radius-sm);
	background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
	border: 1px solid var(--border);
	display: grid;
	place-items: center;
	font-size: 0.8rem;
	color: var(--text-muted);
	font-family: var(--font-head);
	font-weight: 500;
}

.bento .wide  { grid-column: span 2; }
.bento .tall  { grid-row: span 2; }
.bento .large { grid-column: span 2; grid-row: span 2; }

/* --------------------------------------------------------------
 * پرسش و پاسخ
 * ------------------------------------------------------------ */

details {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--white);
	margin-bottom: 0.6rem;
	overflow: hidden;
}

summary {
	cursor: pointer;
	padding: 0.8rem 1rem;
	font-family: var(--font-head);
	font-weight: 600;
	font-size: 0.97rem;
	list-style: none;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	/* هدف لمسی ۴۴px */
	min-block-size: 2.75rem;
}

summary::-webkit-details-marker { display: none; }

summary::before {
	content: "+";
	flex: 0 0 auto;
	inline-size: 1.4rem;
	block-size: 1.4rem;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--surface-2);
	color: var(--brand);
	font-weight: 700;
	line-height: 1;
}

details[open] summary::before { content: "−"; }

details[open] summary { background: var(--surface); }

details > :not(summary) {
	padding-inline: 1rem;
}

details > :last-child { padding-bottom: 0.9rem; }

/* --------------------------------------------------------------
 * پانوشت
 * ------------------------------------------------------------ */

.foot {
	margin-top: 3.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
	color: var(--text-subtle);
	font-size: 0.87rem;
}

/* --------------------------------------------------------------
 * ریسپانسیو
 * ------------------------------------------------------------ */

@media (max-width: 900px) {
	.wrap { grid-template-columns: 1fr; }

	.side {
		position: static;
		block-size: auto;
		overflow: visible;
		padding-block: 1.25rem 0;
		border-bottom: 1px solid var(--border);
	}

	.toc {
		display: flex;
		flex-wrap: wrap;
		gap: 0.3rem;
	}

	.toc li.sub { display: none; }   /* در موبایل فقط سرفصل‌ها */

	.toc a {
		border: 1px solid var(--border);
		font-size: 0.83rem;
		padding: 0.3rem 0.7rem;
	}

	.block__body { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
	.bento { grid-template-columns: repeat(2, 1fr); }
	.bento .wide, .bento .large { grid-column: span 2; }
}

/* --------------------------------------------------------------
 * چاپ — راهنما ممکن است پرینت شود
 * ------------------------------------------------------------ */

@media print {
	.side { display: none; }
	.wrap { grid-template-columns: 1fr; max-inline-size: none; }
	.hero { background: none; color: var(--text); border: 2px solid var(--brand); }
	.hero h1 { color: var(--brand); }
	details[open] > :not(summary),
	details > :not(summary) { display: block; }
	a { color: var(--text); }
}

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