/* ==========================================================================
   Digi Genius — Product Page Design System
   Loaded only on single product pages (see functions.php).
   Scope: CSS only. No class names changed. No HTML/PHP/JS touched.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
:root {
	/* Color */
	--dg-primary: #3B82F6;
	--dg-primary-hover: #6366F1;
	--dg-dark: #0F172A;
	--dg-success: #22C55E;
	--dg-error: #EF4444;
	--dg-text-heading: #0F172A;
	--dg-text-body: #475569;
	--dg-text-muted: #64748B;
	--dg-border: #E2E8F0;
	--dg-bg-page: #F8FAFC;
	--dg-bg-surface: #FFFFFF;

	/* Radius */
	--dg-radius-sm: 8px;
	--dg-radius-md: 12px;
	--dg-radius-lg: 16px;

	/* Shadow */
	--dg-shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
	--dg-shadow-md: 0 12px 24px rgba(15, 23, 42, 0.08);
	--dg-shadow-lg: 0 -8px 24px rgba(15, 23, 42, 0.08);

	/* Motion */
	--dg-transition: 0.2s ease;

	/* Layout */
	--dg-container-width: 1140px;
	--dg-container-padding: 20px;

	/* Spacing scale — used consistently for section rhythm */
	--dg-space-xs: 8px;
	--dg-space-sm: 16px;
	--dg-space-md: 24px;
	--dg-space-lg: 40px;
	--dg-space-xl: 64px;
	--dg-space-2xl: 88px;

	/* Sticky bar height, used to reserve page space so nothing is
	   ever covered — kept as a token so both the bar and the page
	   padding stay in sync from one place. */
	--dg-sticky-bar-height: 76px;
}

@media (min-width: 600px) {
	:root {
		--dg-container-padding: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--dg-transition: 0s;
	}
}

/* --------------------------------------------------------------------------
   2. Base / Reset (scoped to the product page wrapper only)
   -------------------------------------------------------------------------- */
.dg-product-page {
	background: var(--dg-bg-page);
	color: var(--dg-text-body);
	font-size: 16px;
	line-height: 1.6;
	overflow-x: hidden;
}

.dg-product-page,
.dg-product-page *,
.dg-product-page *::before,
.dg-product-page *::after {
	box-sizing: border-box;
}

.dg-product-page img {
	max-width: 100%;
	height: auto;
}

.dg-product-page h1,
.dg-product-page h2,
.dg-product-page h3 {
	color: var(--dg-text-heading);
	line-height: 1.25;
	margin: 0 0 var(--dg-space-sm);
	font-weight: 700;
}

.dg-product-page p {
	margin: 0 0 var(--dg-space-sm);
}

.dg-product-page ul {
	margin: 0;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.dg-container {
	width: 100%;
	max-width: var(--dg-container-width);
	margin: 0 auto;
	padding: 0 var(--dg-container-padding);
}

.dg-container-narrow {
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
	padding: 0 var(--dg-container-padding);
}

/* Reserve space at the very bottom of the product page so the fixed
   Sticky Buy Bar never visually overlaps trailing content — including
   Cortics' own Newsletter block, or anything else the parent theme
   renders after the main content. This targets the page's own root
   wrapper rather than a foreign theme class, so it works regardless
   of what content happens to render last on the page. */
.dg-product-page {
	padding-bottom: var(--dg-sticky-bar-height);
}

/* --------------------------------------------------------------------------
   4. Breadcrumb
   -------------------------------------------------------------------------- */
.dg-breadcrumb {
	padding: var(--dg-space-sm) 0;
	font-size: 13px;
	color: var(--dg-text-muted);
}

.dg-breadcrumb a {
	color: var(--dg-text-muted);
	text-decoration: none;
	transition: color var(--dg-transition);
}

.dg-breadcrumb a:hover {
	color: var(--dg-primary);
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */
.dg-hero {
	padding: var(--dg-space-lg) 0;
	background: var(--dg-bg-surface);
	border-bottom: 1px solid var(--dg-border);
}

.dg-hero-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--dg-space-lg);
	align-items: start;
}

.dg-hero-gallery {
	width: 100%;
}

.dg-hero-gallery img {
	display: block;
	width: 100%;
	border-radius: var(--dg-radius-lg);
}

/* WooCommerce gallery wrapper: keep its own internal spacing intact
   but make sure it never overflows its column on small screens. */
.dg-hero-gallery .woocommerce-product-gallery {
	width: 100%;
}

.dg-hero-summary {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.dg-eyebrow {
	display: inline-block;
	align-self: flex-start;
	font-size: 13px;
	font-weight: 600;
	color: var(--dg-primary);
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: var(--dg-space-xs);
}

.dg-hero-title {
	font-size: 26px;
	margin-bottom: var(--dg-space-xs);
}

.dg-hero-rating {
	margin-bottom: var(--dg-space-sm);
	line-height: 1;
}

.dg-hero-rating .star-rating {
	display: inline-block;
	vertical-align: middle;
}

.dg-hero-price {
	font-size: 26px;
	font-weight: 700;
	color: var(--dg-primary);
	margin-bottom: var(--dg-space-sm);
}

.dg-hero-price del {
	color: var(--dg-text-muted);
	font-weight: 400;
	font-size: 16px;
	margin-right: var(--dg-space-xs);
	text-decoration: line-through;
}

.dg-hero-price ins {
	text-decoration: none;
}

.dg-hero-short-desc {
	color: var(--dg-text-body);
	margin-bottom: var(--dg-space-md);
}

.dg-hero-short-desc p:last-child {
	margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   6. WooCommerce Add to Cart form (Hero)
   -------------------------------------------------------------------------- */
.dg-hero-cta {
	margin-bottom: var(--dg-space-md);
}

.dg-hero-cta form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--dg-space-sm);
}

.dg-hero-cta .quantity {
	display: flex;
	margin: 0;
}

.dg-hero-cta .quantity input.qty {
	width: 72px;
	padding: 12px 14px;
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-md);
	font-size: 15px;
	background: var(--dg-bg-surface);
}

.dg-hero-cta .single_add_to_cart_button,
.dg-hero-cta button.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--dg-primary);
	color: #fff;
	border: none;
	padding: 14px 32px;
	font-size: 16px;
	font-weight: 600;
	border-radius: var(--dg-radius-md);
	cursor: pointer;
	transition: background var(--dg-transition), transform var(--dg-transition);
	white-space: nowrap;
}

.dg-hero-cta .single_add_to_cart_button:hover,
.dg-hero-cta button.button:hover {
	background: var(--dg-primary-hover);
	transform: translateY(-1px);
}

/* Variable product variation table/select — keep it from overflowing
   its column and give consistent spacing above the button row. */
.dg-hero-cta table.variations {
	width: 100%;
	margin-bottom: var(--dg-space-sm);
	border-collapse: collapse;
}

.dg-hero-cta table.variations select {
	width: 100%;
	max-width: 320px;
	padding: 10px 12px;
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-sm);
	background: var(--dg-bg-surface);
}

.dg-hero-cta .woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--dg-space-sm);
	width: 100%;
}

.dg-trust-badges {
	list-style: none;
	padding: var(--dg-space-sm) 0 0;
	margin: 0;
	border-top: 1px solid var(--dg-border);
	display: flex;
	flex-wrap: wrap;
	gap: var(--dg-space-sm) var(--dg-space-md);
	font-size: 13px;
	color: var(--dg-text-muted);
}

.dg-trust-badges li {
	display: flex;
	align-items: center;
}

.dg-trust-badges li::before {
	content: "✓";
	color: var(--dg-success);
	margin-right: 6px;
	font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. WooCommerce Notices
   -------------------------------------------------------------------------- */
.dg-product-page .woocommerce-notices-wrapper {
	width: 100%;
	max-width: var(--dg-container-width);
	margin: var(--dg-space-sm) auto 0;
	padding: 0 var(--dg-container-padding);
}

.dg-product-page .woocommerce-notices-wrapper:empty {
	margin: 0;
}

.dg-product-page .woocommerce-message,
.dg-product-page .woocommerce-error,
.dg-product-page .woocommerce-info {
	list-style: none;
	background: var(--dg-bg-surface);
	border-left: 4px solid var(--dg-primary);
	border-radius: var(--dg-radius-md);
	box-shadow: var(--dg-shadow-sm);
	padding: 14px 20px;
	margin: 0 0 var(--dg-space-sm);
	font-size: 14px;
	color: var(--dg-text-heading);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--dg-space-sm);
	flex-wrap: wrap;
}

.dg-product-page .woocommerce-error {
	border-left-color: var(--dg-error);
}

.dg-product-page .woocommerce-message .button {
	background: var(--dg-primary);
	color: #fff;
	padding: 8px 16px;
	border-radius: var(--dg-radius-sm);
	text-decoration: none;
	font-size: 13px;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   8. Section rhythm (shared)
   -------------------------------------------------------------------------- */
.dg-benefits,
.dg-included,
.dg-faq,
.dg-related,
.dg-reviews {
	padding: var(--dg-space-xl) 0;
}

.dg-included,
.dg-related {
	background: var(--dg-bg-surface);
}

.dg-benefits h2,
.dg-included h2,
.dg-faq h2,
.dg-related h2 {
	text-align: center;
	font-size: 26px;
	margin-bottom: var(--dg-space-lg);
}

/* --------------------------------------------------------------------------
   9. Benefits
   -------------------------------------------------------------------------- */
.dg-benefits-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--dg-space-sm);
}

.dg-benefit-card {
	background: var(--dg-bg-surface);
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-lg);
	padding: var(--dg-space-md);
	text-align: center;
	box-shadow: var(--dg-shadow-sm);
	transition: transform var(--dg-transition), box-shadow var(--dg-transition);
}

.dg-benefit-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--dg-shadow-md);
}

.dg-benefit-card h2 {
	font-size: 16px;
	margin: 0 0 var(--dg-space-xs);
}

.dg-benefit-card p {
	color: var(--dg-text-muted);
	font-size: 13px;
	margin: 0;
}

/* --------------------------------------------------------------------------
   10. What's Included
   -------------------------------------------------------------------------- */
.dg-included-content {
	color: var(--dg-text-body);
	font-size: 16px;
	line-height: 1.85;
	max-width: 720px;
	margin: 0 auto;
}

.dg-included-content p {
	margin-bottom: var(--dg-space-sm);
}

.dg-included-content p:last-child {
	margin-bottom: 0;
}

.dg-included-content ul,
.dg-included-content ol {
	margin: 0 0 var(--dg-space-sm);
	padding-left: 22px;
}

.dg-included-content li {
	margin-bottom: var(--dg-space-xs);
}

.dg-included-content img {
	border-radius: var(--dg-radius-md);
	margin: var(--dg-space-sm) 0;
}

/* --------------------------------------------------------------------------
   11. FAQ
   -------------------------------------------------------------------------- */
.dg-faq-list {
	max-width: 720px;
	margin: 0 auto;
}

.dg-faq-item {
	background: var(--dg-bg-surface);
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-md);
	padding: var(--dg-space-sm) var(--dg-space-md);
	margin-bottom: var(--dg-space-sm);
	transition: box-shadow var(--dg-transition);
}

.dg-faq-item:hover {
	box-shadow: var(--dg-shadow-sm);
}

.dg-faq-item summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--dg-text-heading);
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--dg-space-sm);
	line-height: 1.5;
}

.dg-faq-item summary::-webkit-details-marker {
	display: none;
}

.dg-faq-item summary::after {
	content: "+";
	flex-shrink: 0;
	color: var(--dg-primary);
	font-size: 20px;
	line-height: 1;
}

.dg-faq-item[open] summary::after {
	content: "\2212";
}

.dg-faq-item p {
	color: var(--dg-text-muted);
	margin: var(--dg-space-sm) 0 0;
	font-size: 14px;
	line-height: 1.7;
}

/* --------------------------------------------------------------------------
   12. Related Products
   -------------------------------------------------------------------------- */
.dg-related-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--dg-space-sm);
}

.dg-related-card {
	background: var(--dg-bg-page);
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-lg);
	overflow: hidden;
	text-decoration: none;
	display: flex;
	flex-direction: column;
	transition: transform var(--dg-transition), box-shadow var(--dg-transition);
}

.dg-related-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--dg-shadow-md);
}

.dg-related-card img {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
}

.dg-related-card-body {
	padding: var(--dg-space-sm);
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: var(--dg-space-xs);
}

.dg-related-card-body h3 {
	font-size: 15px;
	margin: 0;
	color: var(--dg-text-heading);
}

.dg-related-price {
	color: var(--dg-primary);
	font-weight: 600;
	font-size: 14px;
	margin-top: auto;
}

/* --------------------------------------------------------------------------
   13. Reviews (WooCommerce native template output)
   -------------------------------------------------------------------------- */
.dg-reviews .dg-container-narrow {
	max-width: 720px;
}

.dg-reviews #reviews {
	max-width: 100%;
}

.dg-reviews .woocommerce-Reviews-title {
	font-size: 22px;
	margin-bottom: var(--dg-space-md);
}

.dg-reviews ol.commentlist {
	list-style: none;
	margin: 0 0 var(--dg-space-md);
	padding: 0;
}

.dg-reviews ol.commentlist li {
	background: var(--dg-bg-surface);
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-md);
	padding: var(--dg-space-sm) var(--dg-space-md);
	margin-bottom: var(--dg-space-sm);
}

.dg-reviews .comment_container {
	display: flex;
	gap: var(--dg-space-sm);
	align-items: flex-start;
}

.dg-reviews .comment_container img {
	border-radius: 50%;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
}

.dg-reviews .comment-text {
	min-width: 0;
	flex: 1;
}

.dg-reviews .star-rating {
	margin-bottom: var(--dg-space-xs);
}

.dg-reviews #review_form_wrapper {
	background: var(--dg-bg-surface);
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-lg);
	padding: var(--dg-space-md);
}

.dg-reviews #review_form_wrapper .comment-form-rating select,
.dg-reviews #review_form_wrapper input[type="text"],
.dg-reviews #review_form_wrapper input[type="email"],
.dg-reviews #review_form_wrapper textarea {
	width: 100%;
	max-width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--dg-border);
	border-radius: var(--dg-radius-sm);
	font-family: inherit;
	font-size: 14px;
	background: var(--dg-bg-page);
}

.dg-reviews #review_form_wrapper textarea {
	min-height: 120px;
	resize: vertical;
}

.dg-reviews #review_form_wrapper p {
	margin-bottom: var(--dg-space-sm);
}

.dg-reviews #review_form_wrapper .form-submit input[type="submit"] {
	background: var(--dg-primary);
	color: #fff;
	border: none;
	padding: 12px 28px;
	border-radius: var(--dg-radius-md);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--dg-transition);
}

.dg-reviews #review_form_wrapper .form-submit input[type="submit"]:hover {
	background: var(--dg-primary-hover);
}

/* --------------------------------------------------------------------------
   14. Sticky Buy Bar
   -------------------------------------------------------------------------- */
.dg-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	transform: translateY(100%);
	background: var(--dg-bg-surface);
	border-top: 1px solid var(--dg-border);
	box-shadow: var(--dg-shadow-lg);
	z-index: 999;
	transition: transform 0.3s ease;
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.dg-sticky-bar-visible {
	transform: translateY(0);
}

.dg-sticky-bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--dg-space-sm);
	padding: 14px var(--dg-container-padding);
	max-width: var(--dg-container-width);
	margin: 0 auto;
}

.dg-sticky-bar-title {
	display: none;
	font-weight: 600;
	color: var(--dg-text-heading);
	font-size: 14px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dg-sticky-bar-price {
	color: var(--dg-primary);
	font-weight: 700;
	font-size: 15px;
	margin-right: auto;
	white-space: nowrap;
}

.dg-sticky-bar-btn {
	flex-shrink: 0;
	background: var(--dg-primary);
	color: #fff;
	border: none;
	padding: 12px 24px;
	font-size: 14px;
	font-weight: 600;
	border-radius: var(--dg-radius-md);
	text-decoration: none;
	transition: background var(--dg-transition);
}

.dg-sticky-bar-btn:hover {
	background: var(--dg-primary-hover);
}

/* --------------------------------------------------------------------------
   15. Accessibility
   -------------------------------------------------------------------------- */
.dg-product-page a:focus-visible,
.dg-product-page button:focus-visible,
.dg-product-page summary:focus-visible,
.dg-product-page input:focus-visible,
.dg-product-page select:focus-visible,
.dg-product-page textarea:focus-visible {
	outline: 3px solid var(--dg-primary-hover);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   16. Responsive — mobile-first base above, tablet and desktop below
   -------------------------------------------------------------------------- */
@media (min-width: 600px) {
	.dg-benefits-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.dg-related-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.dg-sticky-bar-title {
		display: block;
		max-width: 260px;
	}

	.dg-reviews .comment_container img {
		width: 48px;
		height: 48px;
	}
}

@media (min-width: 900px) {
	:root {
		--dg-sticky-bar-height: 84px;
	}

	.dg-hero {
		padding: var(--dg-space-xl) 0;
	}

	.dg-hero-grid {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--dg-space-xl);
	}

	.dg-hero-title {
		font-size: 34px;
	}

	.dg-hero-price {
		font-size: 30px;
	}

	.dg-benefits-grid {
		grid-template-columns: repeat(4, 1fr);
	}

	.dg-related-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.dg-included h2,
	.dg-faq h2,
	.dg-related h2 {
		font-size: 30px;
	}
}

@media (max-width: 480px) {
	.dg-hero-cta form.cart {
		flex-direction: column;
		align-items: stretch;
	}

	.dg-hero-cta .single_add_to_cart_button,
	.dg-hero-cta button.button {
		width: 100%;
	}

	.dg-sticky-bar-inner {
		gap: var(--dg-space-xs);
	}
}