/* ==========================================================================
   Hamrah Destinations Widget
   ========================================================================== */

/* ── Grid ── */
.hd-grid {
	display: grid;
	gap: 16px;
	width: 100%;
}
.hd-grid--cols-1 { grid-template-columns: repeat(1, 1fr); }
.hd-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.hd-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.hd-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Attached mode ── */
.hd-grid--attached { gap: 0; }

.hd-grid--attached .hd-card {
	--hd-divider: rgba(255,255,255,0.15);
	/* گوشه‌ها از CSS variable می‌آیند که PHP روی هر کارت تنظیم می‌کند */
	border-radius: 0;
}
.hd-grid--attached .hd-card + .hd-card {
	border-inline-start: 1px solid var(--hd-divider);
}
.hd-grid--cols-2.hd-grid--attached .hd-card:nth-child(n+3),
.hd-grid--cols-3.hd-grid--attached .hd-card:nth-child(n+4),
.hd-grid--cols-4.hd-grid--attached .hd-card:nth-child(n+5) {
	border-block-start: 1px solid var(--hd-divider);
}
.hd-grid--cols-2.hd-grid--attached .hd-card:nth-child(2n+1),
.hd-grid--cols-3.hd-grid--attached .hd-card:nth-child(3n+1),
.hd-grid--cols-4.hd-grid--attached .hd-card:nth-child(4n+1) {
	border-inline-start: none;
}

/* ════════════════════════════════════════════════════════
   CARD
   ════════════════════════════════════════════════════════
   overflow: visible  →  تصویر دکوراتیو می‌تواند از باکس خارج شود
   پس‌زمینه و clip فقط با ::before انجام می‌شود
   ════════════════════════════════════════════════════════ */
.hd-card {
	position: relative;
	overflow: visible;           /* ← کلید اصلی: اجازه خروج تصویر */
	border-radius: 16px;
	min-height: 200px;
	display: flex;
	flex-direction: row;
	align-items: stretch;
	background: linear-gradient(135deg, #3a5a8c 0%, #1e3a5f 100%);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* ::before برای clip کردن پس‌زمینه داخل border-radius
   از CSS variables استفاده می‌کند تا در حالت attached هم درست کار کند */
.hd-card::before {
	content: '';
	position: absolute;
	inset: 0;
	/* border-radius از variable می‌آید — PHP آن را per-card تنظیم می‌کند */
	border-radius: var(--hd-card-radius, inherit);
	background: inherit;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
}

/* overlay هم باید از همان radius پیروی کند */
.hd-card__overlay {
	border-radius: var(--hd-card-radius, inherit);
}

.hd-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(0,0,0,0.2);
}
.hd-grid--attached .hd-card:hover {
	transform: none;
	box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15);
	z-index: 1;
}

/* ── Overlay (روی تصویر پس‌زمینه) ── */
.hd-card__overlay {
	position: absolute;
	inset: 0;
	/* border-radius از بالا override شده */
	z-index: 1;
	pointer-events: none;
}

/* ════════════════════════════════════════════════════════
   DECO IMAGE
   ════════════════════════════════════════════════════════
   flex item کنار محتوا — margin منفی = خروج از باکس
   ════════════════════════════════════════════════════════ */
.hd-card__deco {
	flex-shrink: 0;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	width: var(--hd-deco-width, 160px);
	pointer-events: none;
	position: relative;
	z-index: 3;              /* بالاتر از ::before و overlay */
	/* margin‌ها از inline style تنظیم می‌شوند */
}

.hd-card__deco img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	object-fit: contain;
	object-position: bottom center;
}

/* موقعیت تصویر: راست */
.hd-card--deco-end   { flex-direction: row; }
.hd-card--deco-end   .hd-card__body { order: 1; }
.hd-card--deco-end   .hd-card__deco { order: 2; }

/* موقعیت تصویر: چپ */
.hd-card--deco-start { flex-direction: row; }
.hd-card--deco-start .hd-card__deco { order: 1; }
.hd-card--deco-start .hd-card__body { order: 2; }

/* نمایش بر اساس دستگاه */
@media (max-width: 767px) { .hd-card__deco--desktop { display: none; } }
@media (min-width: 768px) { .hd-card__deco--mobile  { display: none; } }

/* ════════════════════════════════════════════════════════
   CARD BODY
   ════════════════════════════════════════════════════════ */
.hd-card__body {
	flex: 1;
	min-width: 0;
	position: relative;
	z-index: 2;              /* بالاتر از ::before */
	padding: 24px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 20px;
}

.hd-card__header {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.hd-card__flag { flex-shrink: 0; line-height: 0; }

.hd-card__flag img {
	width: 25px;
	height: 25px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.hd-card__titles { display: flex; flex-direction: column; gap: 2px; }

.hd-card__title-fa,
.hd-card__title-en { margin: 0; padding: 0; line-height: 1.3; }

.hd-card__title-fa {
	font-size: 1.1rem;
	font-weight: 700;
	color: #fff;
}

.hd-card__title-en {
	font-size: 0.85rem;
	font-weight: 400;
	color: rgba(255,255,255,0.7);
	letter-spacing: 0.02em;
}

/* ── Actions ── */
.hd-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* ── Buttons ── */
.hd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	text-decoration: none;
	padding: 8px 16px;
	border-radius: 8px;
	font-size: 0.82rem;
	font-weight: 500;
	color: #fff;
	background-color: rgba(255,255,255,0.18);
	border: 1px solid rgba(255,255,255,0.25);
	backdrop-filter: blur(6px);
	transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
	white-space: nowrap;
}

.hd-btn:hover {
	background-color: rgba(255,255,255,0.32);
	border-color: rgba(255,255,255,0.5);
	color: #fff;
	text-decoration: none;
	transform: translateY(-1px);
}

.hd-btn--arrow { gap: 6px; }

.hd-btn--arrow svg {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	fill: currentColor;
	display: block;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
	.hd-grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
	.hd-grid--cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
	.hd-grid--cols-2,
	.hd-grid--cols-3,
	.hd-grid--cols-4 { grid-template-columns: 1fr; }

	.hd-grid--attached .hd-card + .hd-card {
		border-inline-start: none;
		border-block-start: 1px solid var(--hd-divider);
	}

	.hd-card { flex-direction: column !important; }

	.hd-card__deco {
		order: 10 !important;
		width: 100% !important;
		max-height: 140px;
		justify-content: flex-end;
		/* reset margin‌های موبایل تا از کارت خارج نشود مگر با تنظیم عمدی */
	}

	.hd-card__deco img {
		max-height: 140px;
		width: auto;
		margin: 0 auto;
	}

	.hd-card__body { padding: 18px; }
	.hd-card__title-fa { font-size: 1rem; }
	.hd-btn { font-size: 0.78rem; padding: 7px 12px; }
}
