/**
 * @package     Joomla.Site
 * @subpackage  mod_featurebox
 *
 * @copyright   (C) 2026 Symphony Theme. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 *
 * Every rule is scoped under .mod-featurebox so the generic class names
 * (.feature-btn, .heading-title, .feature-title, .feature-img, …) can never
 * clash with the active template or another module on the same page.
 */

.mod-featurebox {
	--fb-card-bg: #16225c;          /* default navy */
	--fb-card-color: #ffffff;
	--fb-desc-color: rgba(255, 255, 255, 0.82);
	--fb-accent: #f4a91f;           /* gold button */
	--fb-accent-hover: #d9941a;
	--fb-accent-color: #16225c;
	--fb-radius: 4px;
	--fb-btn-radius: 0px;           /* square button */
	--fb-gap: 24px;
	--fb-pad: 28px;
	--fb-transition: 0.25s ease;
	--fb-cols: 4;

	display: grid;
	grid-template-columns: repeat(var(--fb-cols), minmax(0, 1fr));
	gap: var(--fb-gap);
}

.mod-featurebox.featurebox--cols-1 { --fb-cols: 1; }
.mod-featurebox.featurebox--cols-2 { --fb-cols: 2; }
.mod-featurebox.featurebox--cols-3 { --fb-cols: 3; }
.mod-featurebox.featurebox--cols-4 { --fb-cols: 4; }
.mod-featurebox.featurebox--cols-6 { --fb-cols: 6; }

/* ------------------------------------------------------------------ Card */
.mod-featurebox .feature-box {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--fb-radius);
	background-color: var(--fb-card-bg);
	color: var(--fb-card-color);
	isolation: isolate;
	transition: transform var(--fb-transition), box-shadow var(--fb-transition);
}

.mod-featurebox .feature-box:hover,
.mod-featurebox .feature-box:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 14px 30px -12px rgba(10, 18, 50, 0.55);
}

/* Solid: allow a per-card custom background colour. */
.mod-featurebox .feature-box--solid {
	background-color: var(--fb-bg, var(--fb-card-bg));
}

/* Overlay: background image + colour overlay. */
.mod-featurebox .feature-box--overlay {
	background-image: var(--fb-image);
	background-size: cover;
	background-position: center;
}

.mod-featurebox .feature-box__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background-color: var(--fb-overlay, #16225c);
	opacity: var(--fb-overlay-opacity, 0.7);
	transition: opacity var(--fb-transition);
}

.mod-featurebox .feature-box--overlay:hover .feature-box__overlay,
.mod-featurebox .feature-box--overlay:focus-within .feature-box__overlay {
	opacity: calc(var(--fb-overlay-opacity, 0.7) + 0.08);
}

/* --------------------------------------------------- Whole-card link */
/* Pure overlay link: no box model footprint, no padding, no flex gap.
   It sits above the content (z-index 3) but below the button (z-index 4). */
.mod-featurebox .feature-box__link {
	position: absolute;
	inset: 0;
	z-index: 3;
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 0;
	line-height: 0;
	text-indent: -9999px;
	background: transparent;
	overflow: hidden;
}

/* ------------------------------------------------------------------ Media */
.mod-featurebox .feature-box__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background-color: rgba(0, 0, 0, 0.06);
}

.mod-featurebox .feature-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.mod-featurebox .feature-box--image:hover .feature-img,
.mod-featurebox .feature-box--image:focus-within .feature-img {
	transform: scale(1.05);
}

/* ------------------------------------------------------------------ Body */
.mod-featurebox .feature-box__body {
	position: relative;
	z-index: 2;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 12px;
	padding: var(--fb-pad);
}

/* Heading row: icon + title */
.mod-featurebox .heading-title {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mod-featurebox .feature-icon {
	font-size: 1.6rem;
	line-height: 1;
	flex: 0 0 auto;
	color: currentColor;
}

.mod-featurebox .feature-title {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1.2;
	color: currentColor;
}

.mod-featurebox .feature-desc {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--fb-desc-color);
}

/* ------------------------------------------------------------------ Button */
/* Real link, layered above the whole-card wrapper so it stays clickable. */
.mod-featurebox .feature-btn {
	position: relative;
	z-index: 4;
	align-self: flex-start;
	margin-top: 8px;
	padding: 14px 24px;
	border-radius: var(--fb-btn-radius);
	background-color: var(--fb-accent);
	color: var(--fb-accent-color);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color var(--fb-transition), transform var(--fb-transition);
}

.mod-featurebox .feature-btn:hover,
.mod-featurebox .feature-btn:focus-visible {
	background-color: var(--fb-accent-hover);
	color: var(--fb-accent-color);
}

/* Card-wide hover feedback driven by either link. */
.mod-featurebox .feature-box:hover .feature-btn {
	background-color: var(--fb-accent-hover);
}

/* Keyboard focus visibility on the clickable card. */
.mod-featurebox .feature-box:focus-within {
	outline: 3px solid var(--fb-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1199.98px) {
	.mod-featurebox.featurebox--cols-6 { --fb-cols: 4; }
}

@media (max-width: 991.98px) {
	.mod-featurebox.featurebox--cols-4,
	.mod-featurebox.featurebox--cols-6 { --fb-cols: 3; }
}

@media (max-width: 767.98px) {
	.mod-featurebox.featurebox--cols-3,
	.mod-featurebox.featurebox--cols-4,
	.mod-featurebox.featurebox--cols-6 { --fb-cols: 2; }
}

@media (max-width: 575.98px) {
	.mod-featurebox { --fb-cols: 1 !important; }
}

@media (prefers-reduced-motion: reduce) {
	.mod-featurebox .feature-box,
	.mod-featurebox .feature-img,
	.mod-featurebox .feature-btn,
	.mod-featurebox .feature-box__overlay {
		transition: none;
	}

	.mod-featurebox .feature-box:hover,
	.mod-featurebox .feature-box:focus-within {
		transform: none;
	}
}
