/**
 * WooCommerce Product Categories Cards CSS
 * Exact Match to Astrological Dark Navy & Orange Design
 *
 * @package    Custom_Astro_Handler_By_Hewabahithage
 * @author     Nirosh Hewabahithage <https://niroshhewabahithage.com/>
 * @copyright  Copyright (c) 2026 Nirosh Hewabahithage. All rights reserved.
 * @license    GPL-2.0-or-later
 * @link       https://niroshhewabahithage.com/
 */

:root {
	--cahbh-font-serif: var(--e-global-typography-primary-font-family, var(--wp--preset--font-family--primary, "Cinzel", "Playfair Display", Georgia, "Times New Roman", serif));
	--cahbh-font-sans: var(--e-global-typography-text-font-family, var(--e-global-typography-secondary-font-family, var(--wp--preset--font-family--text, inherit)));

	/* Palette matching the exact screenshot */
	--cahbh-bg-navy: #071526;
	--cahbh-card-navy: #0b2239;
	--cahbh-card-hover-navy: #0d2843;
	--cahbh-circle-bg: #112d48;
	--cahbh-accent-orange: #f25c05;
	--cahbh-accent-orange-hover: #ff7324;
	--cahbh-dashed-ring: rgba(255, 255, 255, 0.22);
	--cahbh-text-white: #ffffff;
	--cahbh-text-muted: #8a9ba8;
	--cahbh-card-border: rgba(255, 255, 255, 0.04);

	--cahbh-wc-gap: 1.75rem;
	--cahbh-transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Outer Container */
.cahbh-wc-astro-wrapper {
	width: 100%;
	/* background-color: var(--cahbh-bg-navy); */
	padding: 2.5rem 1rem;
	box-sizing: border-box;
	font-family: var(--cahbh-font-sans);
}

.cahbh-wc-astro-wrapper *,
.cahbh-wc-astro-wrapper *::before,
.cahbh-wc-astro-wrapper *::after {
	box-sizing: border-box;
}

/* 4-Column Grid */
.cahbh-wc-categories-grid {
	display: grid;
	grid-template-columns: repeat(var(--cahbh-columns, 4), minmax(0, 1fr));
	gap: var(--cahbh-wc-gap);
	margin: 0 auto;
	max-width: 1320px;
	list-style: none;
	padding: 0;
}

/* Card Component */
.cahbh-wc-card {
	background-color: var(--cahbh-card-navy);
	border: 1px solid var(--cahbh-card-border);
	border-radius: 6px;
	padding: 3rem 1.75rem 2.25rem 1.75rem;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	transition: var(--cahbh-transition);
	overflow: visible;
	/* Required so tooltip is not clipped */
}

.cahbh-wc-card:hover {
	background-color: var(--cahbh-card-hover-navy);
	transform: translateY(-5px);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

/* Top Circular Container with Dashed Ring */
.cahbh-wc-circle-outer {
	position: relative;
	width: 90px;
	height: 90px;
	margin: 0 auto 1.5rem auto;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* Outer Dashed Border Ring */
.cahbh-wc-circle-dashed-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1.5px dashed var(--cahbh-dashed-ring);
	transition: var(--cahbh-transition);
	pointer-events: none;
}

.cahbh-wc-card:hover .cahbh-wc-circle-dashed-ring {
	border-color: var(--cahbh-accent-orange);
	transform: rotate(45deg);
}

/* Inner Solid Circle */
.cahbh-wc-circle-inner {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background-color: var(--cahbh-circle-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	text-decoration: none;
	overflow: hidden;
	transition: var(--cahbh-transition);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	position: relative;
	z-index: 1;
}

/* Highlight / Hover effect: Circle turns vibrant orange as in screenshot */
.cahbh-wc-card:hover .cahbh-wc-circle-inner {
	background-color: var(--cahbh-accent-orange);
	transform: scale(1.05);
}

/* Category Thumbnail Circle */
.cahbh-wc-thumb-circle {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cahbh-wc-thumb-circle img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 50%;
	transition: transform 0.4s ease;
}

.cahbh-wc-card:hover .cahbh-wc-thumb-circle img {
	transform: scale(1.12);
}

/* SVG Icon */
.cahbh-wc-icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.cahbh-wc-icon-wrap svg {
	width: 32px;
	height: 32px;
	stroke-width: 1.75;
	stroke: #ffffff;
	transition: transform 0.3s ease;
}

.cahbh-wc-card:hover .cahbh-wc-icon-wrap svg {
	transform: scale(1.1);
}

/* Card Body */
.cahbh-wc-card-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	flex-grow: 1;
}

/* Main Category Name (Serif Heading) */
.cahbh-wc-main-name {
	font-family: var(--cahbh-font-serif);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 0.5rem 0;
	color: var(--cahbh-text-white);
	text-align: center;
}

.cahbh-wc-main-name a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.cahbh-wc-main-name a:hover {
	color: var(--cahbh-accent-orange);
}

/* English Custom Field Name */
.cahbh-wc-english-name {
	font-family: var(--cahbh-font-serif);
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	color: var(--cahbh-accent-orange);
	margin-bottom: 0.75rem;
	text-transform: uppercase;
	opacity: 0.95;
}

/* Description */
.cahbh-wc-desc-wrapper {
	position: relative;
	margin: 0.5rem 0 1.5rem 0;
	width: 100%;
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.cahbh-wc-desc-text {
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--cahbh-text-muted);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
	max-width: 95%;
}

.cahbh-wc-desc-wrapper.has-tooltip {
	cursor: help;
}

.cahbh-wc-desc-wrapper.has-tooltip .cahbh-wc-desc-text {
	border-bottom: 1px dotted rgba(138, 155, 168, 0.4);
	padding-bottom: 2px;
}

/* Hover Tooltip */
.cahbh-wc-tooltip {
	position: absolute;
	bottom: calc(100% + 14px);
	left: 50%;
	transform: translateX(-50%) translateY(6px);
	width: max-content;
	max-width: 280px;
	padding: 0.85rem 1rem;
	background-color: #05101c;
	color: #e2e8f0;
	border: 1px solid rgba(242, 92, 5, 0.35);
	font-size: 0.82rem;
	line-height: 1.55;
	border-radius: 8px;
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	z-index: 1000;
	text-align: left;
}

.cahbh-wc-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 6px;
	border-style: solid;
	border-color: #05101c transparent transparent transparent;
}

/* Tooltip Flipped Down */
.cahbh-wc-tooltip.flipped-down {
	bottom: auto;
	top: calc(100% + 14px);
}

.cahbh-wc-tooltip.flipped-down::after {
	top: auto;
	bottom: 100%;
	border-color: transparent transparent #05101c transparent;
}

/* Tooltip Hover Visibility */
.cahbh-wc-desc-wrapper.has-tooltip:hover .cahbh-wc-tooltip,
.cahbh-wc-desc-wrapper.has-tooltip:focus-within .cahbh-wc-tooltip,
.cahbh-wc-desc-wrapper.tooltip-active .cahbh-wc-tooltip {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
	pointer-events: auto;
}

/* "READ MORE" Action Link */
.cahbh-wc-card-action {
	margin-top: auto;
	padding-top: 0.5rem;
}

.cahbh-wc-read-more {
	display: inline-block;
	color: var(--cahbh-accent-orange);
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	padding-bottom: 3px;
	border-bottom: 1.5px solid var(--cahbh-accent-orange);
	transition: var(--cahbh-transition);
}

.cahbh-wc-read-more:hover {
	color: var(--cahbh-accent-orange-hover);
	border-bottom-color: var(--cahbh-accent-orange-hover);
	letter-spacing: 0.12em;
}

/* Empty Notice */
.cahbh-wc-empty-notice {
	padding: 2.5rem;
	background-color: var(--cahbh-card-navy);
	border: 1px dashed var(--cahbh-dashed-ring);
	border-radius: 6px;
	text-align: center;
	color: var(--cahbh-text-muted);
	font-size: 1rem;
	max-width: 600px;
	margin: 0 auto;
}

/* Responsive Grid */
@media (max-width: 1200px) {
	.cahbh-wc-categories-grid {
		grid-template-columns: repeat(min(var(--cahbh-columns, 4), 3), minmax(0, 1fr));
		gap: 1.5rem;
	}
}

@media (max-width: 991px) {
	.cahbh-wc-categories-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.5rem;
	}

	.cahbh-wc-card {
		padding: 2.5rem 1.5rem 2rem 1.5rem;
	}
}

@media (max-width: 600px) {
	.cahbh-wc-categories-grid {
		grid-template-columns: 1fr;
		gap: 1.25rem;
	}

	.cahbh-wc-card {
		padding: 2.25rem 1.25rem 1.75rem 1.25rem;
	}

	.cahbh-wc-main-name {
		font-size: 1.25rem;
	}
}