/* =============================================================
   Rinnai Category Grid
   rinnai-category-grid.css
   ============================================================= */

/* ── Root ─────────────────────────────────────────────────── */

.rcg {
	width: 100%;
}

/* ── Intro text ───────────────────────────────────────────── */

.rcg__intro {
	font-size: 16px;
	color: #333333;
	text-align: center;
	margin-bottom: 32px;
	margin-top: 0;
	line-height: 1.5;
}

/* ── Outer wrapper — position anchor for mobile chevron ───── */

.rcg__outer {
	position: relative;
}

/* ── Grid ─────────────────────────────────────────────────── */

.rcg__grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr); /* overridden by Elementor grid_columns control */
	column-gap: 16px;
	row-gap: 16px;
	/* Default alignment: centre. Overridden by .rcg-align-* prefix classes. */
	margin-left: auto;
	margin-right: auto;
}

/* Grid alignment prefix classes (set by Elementor grid_alignment control) */
.rcg-align-left .rcg__grid {
	margin-left: 0;
	margin-right: auto;
}
.rcg-align-center .rcg__grid {
	margin-left: auto;
	margin-right: auto;
}
.rcg-align-right .rcg__grid {
	margin-left: auto;
	margin-right: 0;
}

/* ── Item ─────────────────────────────────────────────────── */

.rcg__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: 24px;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	cursor: pointer;
	text-align: center;
	background-color: transparent;
	transition:
		border-color 0.2s ease,
		background-color 0.2s ease;
	box-sizing: border-box;
	user-select: none;
}

/* Hover — inactive items only */
.rcg__item:not(.is-active):hover {
	border-color: #cc0000;
}

/* Focus-visible ring for keyboard users */
.rcg__item:focus-visible {
	outline: 2px solid #cc0000;
	outline-offset: 2px;
}

/* Active */
.rcg__item.is-active {
	background-color: #cc0000;
	border-color: #cc0000;
}

/* ── Icon wrap ────────────────────────────────────────────── */

.rcg__icon-wrap {
	position: relative;
	width: 48px;
	height: 48px;
	margin-bottom: 12px;
	flex-shrink: 0;
}

/* ── Icon images ──────────────────────────────────────────── */

.rcg__icon {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* By default show inactive, hide active */
.rcg__icon--active {
	display: none;
}

/* When active: swap icons */
.rcg__item.is-active .rcg__icon--inactive {
	display: none;
}

.rcg__item.is-active .rcg__icon--active {
	display: block;
}

/*
 * Fallback: no separate active SVG was uploaded.
 * The inactive SVG is reused and turned white via filter.
 */
.rcg__item.is-active .rcg__icon--fallback {
	filter: brightness(0) invert(1);
}

/* ── Icon placeholder (no image uploaded) ─────────────────── */

.rcg__icon-placeholder {
	width: 100%;
	height: 100%;
	background-color: #e0e0e0;
	border-radius: 2px;
}

.rcg__item.is-active .rcg__icon-placeholder {
	background-color: rgba(255, 255, 255, 0.3);
}

/* ── Label ────────────────────────────────────────────────── */

.rcg__label {
	font-size: 14px;
	color: #333333;
	line-height: 1.3;
	transition: color 0.2s ease;
}

.rcg__item:not(.is-active):hover .rcg__label {
	color: #cc0000;
}

.rcg__item.is-active .rcg__label {
	color: #ffffff;
}

/* ── Mobile chevron — hidden on desktop ───────────────────── */

.rcg__mobile-chevron {
	display: none;
}

/* =============================================================
   REVEAL TARGET
   Controlled by JS; this widget only adds/removes .is-visible.
   The target itself lives outside this widget — these rules
   must be global so they apply wherever .rinnai-reveal-target
   appears in the page.
   ============================================================= */

.rinnai-reveal-target {
	display: none;
}

.rinnai-reveal-target.is-visible {
	display: block;
	animation: rinnai-reveal 0.35s ease forwards;
}

@keyframes rinnai-reveal {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* =============================================================
   RESPONSIVE — Mobile (≤ 767px)
   ============================================================= */

@media (max-width: 767px) {
	/* Switch grid to horizontal scroll row */
	.rcg__grid {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: scroll;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none; /* Firefox */
		padding-bottom: 4px;
		/* Reset desktop alignment margins */
		margin-left: 0 !important;
		margin-right: 0 !important;
		max-width: none !important;
	}

	.rcg__grid::-webkit-scrollbar {
		display: none; /* WebKit */
	}

	/* Fixed-width items */
	.rcg__item {
		flex-shrink: 0;
		width: 140px;
		min-width: 140px;
		padding: 16px;
	}

	/* Smaller icon */
	.rcg__icon-wrap {
		width: 40px;
		height: 40px;
	}

	/* Smaller label */
	.rcg__label {
		font-size: 13px;
	}

	/* ── Scroll chevron ─────────────────────────────────────── */

	.rcg__mobile-chevron {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 32px;
		height: 32px;
		border-radius: 50%;
		background-color: #ffffff;
		box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
		border: none;
		padding: 0;
		margin: 0;
		cursor: pointer;
		font-size: 18px;
		line-height: 1;
		color: #333333;
		pointer-events: auto;
		transition: opacity 0.3s ease;
		z-index: 1;
	}

	.rcg__mobile-chevron--right {
		right: 20px;
	}

	.rcg__mobile-chevron--left {
		left: 0;
		opacity: 0;
		pointer-events: none;
	}

	.rcg__mobile-chevron:focus-visible {
		outline: 2px solid #cc0000;
	}

	.rcg__chevron-icon {
		width: 24px;
		height: 24px;
		object-fit: contain;
		display: block;
	}

	.rcg__chevron-icon--flipped {
		transform: scaleX(-1);
	}
}
