/* ==========================================================================
   CWD Service Grid – front-end styles  v1.1
   Split-card design: photo top / dark body bottom.
   Amber accents, dashicon badge, hover CTA arrow animation.
   ========================================================================== */

/* ── Amber brand colour & shared tokens ─────────────────────────────────── */
:root {
	--cwd-sg-amber:        #f5c518;
	--cwd-sg-amber-hover:  #ffd740;
	--cwd-sg-dark:         #1e1e1e;
	--cwd-sg-dark-card:    #232323;
	--cwd-sg-radius:       8px;
	--cwd-sg-gap:          20px;
}

/* ── Grid wrapper ────────────────────────────────────────────────────────── */
.cwd-service-grid {
	display: grid;
	gap: var(--cwd-sg-gap);
	width: 100%;
	box-sizing: border-box;
}

.cwd-service-grid.cwd-sg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cwd-service-grid.cwd-sg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cwd-service-grid.cwd-sg-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Card shell ──────────────────────────────────────────────────────────── */
.cwd-sg-card {
	position: relative;
	border-radius: var(--cwd-sg-radius);
	overflow: hidden;
	background: var(--cwd-sg-dark-card);
	display: flex;
	flex-direction: column;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cwd-sg-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

/* Full-card link – flex column to fill height */
.cwd-sg-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

/* ── Image section ───────────────────────────────────────────────────────── */
.cwd-sg-card__img-wrap {
	position: relative;
	width: 100%;
	height: var(--cwd-sg-img-height, 220px);
	overflow: hidden;
	flex-shrink: 0;
}

.cwd-sg-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.45s ease;
}

.cwd-sg-card__link:hover .cwd-sg-card__img {
	transform: scale(1.05);
}

.cwd-sg-card__img--placeholder {
	background: #2a2a2a;
}

/* Lighter overlay – image stays clearly visible */
.cwd-sg-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0.05) 0%,
		rgba(0, 0, 0, 0.25) 55%,
		rgba(0, 0, 0, 0.68) 100%
	);
	pointer-events: none;
}

/* ── Image footer: title + amber rule + icon badge ───────────────────────── */
.cwd-sg-card__img-footer {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 14px 18px 16px;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 10px;
	z-index: 2;
}

.cwd-sg-card__title-wrap {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	min-width: 0;
}

.cwd-sg-card__title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.2;
	color: #ffffff;
	letter-spacing: 0.01em;
}

/* Short amber rule under the title */
.cwd-sg-card__rule {
	display: block;
	width: 36px;
	height: 3px;
	background: var(--cwd-sg-amber);
	border-radius: 2px;
	flex-shrink: 0;
}

/* ── Icon badge ──────────────────────────────────────────────────────────── */
.cwd-sg-card__icon-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: var(--cwd-sg-amber);
	color: var(--cwd-sg-dark);
	transition: background 0.25s ease, transform 0.25s ease;
}

.cwd-sg-card__link:hover .cwd-sg-card__icon-badge {
	background: var(--cwd-sg-amber-hover);
	transform: scale(1.08);
}

/* Dashicons reset inside badge */
.cwd-sg-card__icon-badge .dashicons {
	font-size: 22px;
	width: 22px;
	height: 22px;
	color: var(--cwd-sg-dark);
	/* Override any WordPress line-height */
	line-height: 1;
}

/* ── Card body (dark section below image) ────────────────────────────────── */
.cwd-sg-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 18px 20px 20px;
	background: var(--cwd-sg-dark-card);
}

.cwd-sg-card__desc {
	margin: 0 0 auto;
	padding-bottom: 18px;
	font-size: 0.875rem;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.80);
}

/* ── Footer row: "More Details" + arrow badge ────────────────────────────── */
.cwd-sg-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: auto;
}

.cwd-sg-card__cta {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--cwd-sg-amber);
	transition: color 0.2s ease;
}

.cwd-sg-card__link:hover .cwd-sg-card__cta {
	color: var(--cwd-sg-amber-hover);
}

/* Arrow badge – amber circle with inline SVG arrow */
.cwd-sg-card__arrow-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--cwd-sg-amber);
	color: var(--cwd-sg-dark);
	transition: background 0.25s ease;
}

.cwd-sg-card__link:hover .cwd-sg-card__arrow-badge {
	background: var(--cwd-sg-amber-hover);
}

/* Arrow icon: rotates –45° at rest → 0° on hover (points fully right) */
.cwd-sg-card__arrow-icon {
	display: block;
	color: var(--cwd-sg-dark);
	transform: rotate(-45deg);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cwd-sg-card__link:hover .cwd-sg-card__arrow-icon {
	transform: rotate(0deg);
}

/* ── Focus ring for keyboard users ──────────────────────────────────────── */
.cwd-sg-card__link:focus-visible {
	outline: 3px solid var(--cwd-sg-amber);
	outline-offset: 3px;
	border-radius: var(--cwd-sg-radius);
}

/* ── Admin / debug messages ──────────────────────────────────────────────── */
.cwd-sg-error,
.cwd-sg-missing {
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	padding: 10px 14px;
	font-size: 0.875rem;
	color: #856404;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.cwd-service-grid.cwd-sg-cols-3,
	.cwd-service-grid.cwd-sg-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.cwd-service-grid,
	.cwd-service-grid.cwd-sg-cols-2,
	.cwd-service-grid.cwd-sg-cols-3,
	.cwd-service-grid.cwd-sg-cols-4 {
		grid-template-columns: 1fr;
	}
}
