:root {
	/* برند */
	--cds-primary: #173B5E;
	--cds-primary-hover: #0F2D49;
	--cds-primary-deep: #0F2740;
	--cds-secondary: #344A60;
	--cds-accent: #8B6330;
	--cds-accent-strong: #6F4E26;
	--cds-beige: #E8D6B8;
	--cds-sand: #F3EBDD;
	/* خنثی */
	--cds-text: #1B2733;
	--cds-muted: #566574;
	--cds-background: #F7F4EE;
	--cds-surface: #FFFFFF;
	--cds-tint: #E8F0F5;
	--cds-border: #DDE2E6;
	--cds-border-strong: #C9D3DB;
	--cds-input-border: #6B7A88;
	/* روی زمینه تیره */
	--cds-on-dark: #FFFFFF;
	--cds-on-dark-muted: #C9D3DB;
	--cds-on-dark-border: rgba(232, 214, 184, .18);
	/* وضعیت */
	--cds-focus: #1F6FB5;
	--cds-overlay: rgba(15, 39, 64, .6);
	--cds-shadow: rgba(15, 39, 64, .08);
}

.cds-ts-wrap :focus-visible,
.cds-ba :focus-visible,
.cds-gal :focus-visible,
.cds-lb :focus-visible {
	outline: 3px solid var(--cds-focus);
	outline-offset: 2px;
}

/* ---------- لیست نمونه‌ها ---------- */
.cds-ts-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; direction: rtl; }
.cds-ts-tab {
	appearance: none; -webkit-appearance: none;
	border: 1px solid var(--cds-border-strong);
	background: var(--cds-sand);
	color: var(--cds-primary);
	border-radius: 999px;
	padding: 8px 16px;
	font: inherit; font-size: 14px; font-weight: 500; line-height: 1.4;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.cds-ts-tab:hover { background: var(--cds-tint); }
.cds-ts-tab[aria-pressed="true"] { background: var(--cds-primary); border-color: var(--cds-primary); color: var(--cds-on-dark); }
.cds-ts-tab[aria-pressed="true"]:hover { background: var(--cds-primary-hover); }

.cds-ts-grid {
	display: grid;
	grid-template-columns: repeat(var(--cds-cols, 4), 1fr);
	gap: 20px;
	direction: rtl;
	margin: 20px 0;
}
.cds-ts-card {
	background: var(--cds-surface);
	border: 1px solid var(--cds-border);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 2px 8px var(--cds-shadow);
	display: flex; flex-direction: column;
	transition: transform .25s ease, box-shadow .25s ease;
}
.cds-ts-card[hidden] { display: none; }
@media (hover: hover) {
	.cds-ts-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px var(--cds-shadow); }
	.cds-ts-card:hover .cds-ts-thumb img { transform: scale(1.05); }
}
.cds-ts-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: var(--cds-tint); }
.cds-ts-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.cds-ts-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cds-ts-cat { font-size: 14px; font-weight: 500; color: var(--cds-accent-strong); }
.cds-ts-title { font-size: 16px; font-weight: 600; color: var(--cds-primary); margin: 0; line-height: 1.6; }
.cds-ts-title a { color: inherit; text-decoration: none; }
.cds-ts-title a:hover { color: var(--cds-primary-hover); text-decoration: underline; }
.cds-ts-excerpt { font-size: 14px; color: var(--cds-muted); margin: 0; line-height: 1.8; }
.cds-ts-follow {
	font-size: 13px; color: var(--cds-muted); margin: auto 0 0;
	padding-top: 8px; border-top: 1px dashed var(--cds-border-strong);
}
@media (max-width: 900px) { .cds-ts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cds-ts-grid { grid-template-columns: 1fr; } }

/* ---------- اسلایدر قبل / بعد ---------- */
.cds-ba {
	position: relative;
	max-width: 100%;
	height: var(--cds-ba-h, 450px);
	max-height: 75vh;
	overflow: hidden;
	direction: ltr;
	border-radius: 12px;
	background: var(--cds-tint);
	user-select: none; -webkit-user-select: none;
	-webkit-touch-callout: none;
	/* اسکرول عمودی همیشه با مرورگر است؛ فقط حرکت افقی به اسلایدر می‌رسد */
	touch-action: pan-y;
}
.cds-ba-img {
	position: absolute; inset: 0; width: 100%; height: 100%;
	object-fit: cover; pointer-events: none; -webkit-user-drag: none;
}
.cds-ba-before { clip-path: inset(0 50% 0 0); }
.cds-ba-handle {
	position: absolute; top: 0; bottom: 0; left: 50%;
	width: 44px; margin-left: -22px; z-index: 3;
	display: flex; justify-content: center;
	cursor: ew-resize; touch-action: pan-y;
}
.cds-ba-line { width: 3px; height: 100%; background: var(--cds-surface); box-shadow: 0 0 10px var(--cds-overlay); }
.cds-ba-knob {
	position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
	width: 40px; height: 40px; border-radius: 50%;
	background: var(--cds-surface); color: var(--cds-primary);
	box-shadow: 0 0 10px var(--cds-overlay);
	display: flex; align-items: center; justify-content: center;
	font-size: 16px; font-weight: bold; pointer-events: none;
}
.cds-ba-handle:focus-visible { outline: none; }
.cds-ba-handle:focus-visible .cds-ba-knob { outline: 3px solid var(--cds-focus); outline-offset: 2px; }
.cds-ba-label {
	position: absolute; top: 12px; z-index: 4;
	background: rgba(15, 39, 64, .78); color: var(--cds-on-dark);
	padding: 4px 10px; border-radius: 6px; font-size: 13px; pointer-events: none;
}
.cds-ba-label-before { left: 12px; }
.cds-ba-label-after  { right: 12px; }

/* ---------- گالری ---------- */
.cds-gal { margin: 20px 0; direction: rtl; }
.cds-gal-title { margin: 0 0 12px; font-size: 18px; color: var(--cds-primary); }
.cds-gal-grid {
	display: grid;
	grid-template-columns: repeat(var(--cds-gal-cols, 4), 1fr);
	gap: 12px;
}
.cds-gal-item {
	appearance: none; -webkit-appearance: none;
	padding: 0; margin: 0; cursor: zoom-in;
	border: 1px solid var(--cds-border); border-radius: 10px; overflow: hidden;
	background: var(--cds-tint);
	aspect-ratio: 1 / 1; display: block;
	box-shadow: 0 2px 8px var(--cds-shadow);
}
.cds-gal-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
@media (hover: hover) { .cds-gal-item:hover img { transform: scale(1.06); } }
@media (max-width: 900px) { .cds-gal-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .cds-gal-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

/* ---------- لایت‌باکس ---------- */
html.cds-lb-lock { overflow: hidden; }
.cds-lb {
	position: fixed; inset: 0; z-index: 99999; display: none;
	align-items: center; justify-content: center; direction: ltr;
	background: var(--cds-overlay); overscroll-behavior: contain;
}
.cds-lb.is-open { display: flex; }
.cds-lb-stage { max-width: 94vw; max-height: 86vh; touch-action: pan-y pinch-zoom; }
.cds-lb-img {
	display: block; max-width: 94vw; max-height: 86vh; object-fit: contain;
	border-radius: 8px; background: var(--cds-primary-deep); user-select: none; -webkit-user-drag: none;
}
.cds-lb-btn {
	position: absolute; width: 44px; height: 44px; border-radius: 50%;
	border: 1px solid var(--cds-on-dark-border);
	background: var(--cds-primary-deep); color: var(--cds-on-dark);
	font-size: 26px; line-height: 1; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.cds-lb-btn:hover { background: var(--cds-primary-hover); }
.cds-lb-close { top: 16px; right: 16px; }
.cds-lb-prev  { left: 12px;  top: 50%; transform: translateY(-50%); }
.cds-lb-next  { right: 12px; top: 50%; transform: translateY(-50%); }
.cds-lb-count { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--cds-on-dark-muted); font-size: 14px; }
@media (max-width: 560px) {
	.cds-lb-prev, .cds-lb-next { top: auto; bottom: 12px; transform: none; }
	.cds-lb-prev { left: 12px; } .cds-lb-next { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.cds-ts-card, .cds-ts-thumb img, .cds-gal-item img, .cds-ts-tab { transition: none; }
}
