/* Shared Gutenberg Table styles for News Posts and Product content. */
:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table {
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scrollbar-color: #94a3b8 #f4f7f8;
	scrollbar-width: thin;
	border: 1px solid #dbe4e8;
	border-radius: 8px;
	background: #fff;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table::-webkit-scrollbar {
	height: 8px;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table::-webkit-scrollbar-track {
	border-radius: 8px;
	background: #f4f7f8;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table::-webkit-scrollbar-thumb {
	border: 2px solid #f4f7f8;
	border-radius: 8px;
	background: #94a3b8;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table::-webkit-scrollbar-thumb:hover {
	background: #4ebdc1;
}

/* Older product patterns may wrap the native Table block in a responsive Group. */
:where(
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .table-responsive-wrapper:has(> .wp-block-table) {
	max-width: 100%;
	overflow: visible;
	border: 0;
	border-radius: 0;
	background: transparent;
}

:where(
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .table-responsive-wrapper > .wp-block-table {
	margin: 0;
}

:where(
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper .product-content-section
) figure.wp-block-table {
	margin-block: 12px 28px;
}

:where(
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper .product-content-section
) :is(h2, h3, .wp-block-heading) + figure.wp-block-table {
	margin-block-start: 12px;
}

:where(
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper .product-content-section
) figure.wp-block-table + h3.wp-block-heading {
	margin-block-start: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table table {
	width: 100%;
	min-width: 0;
	border-collapse: collapse;
	font-size: 14px;
	line-height: 1.55;
	color: #334155;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table :is(th, td) {
	padding: 12px 16px;
	border: 0;
	border-bottom: 1px solid #dbe4e8;
	text-align: left;
	vertical-align: top;
	overflow-wrap: break-word;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table thead {
	border-bottom: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table thead th {
	background: #f4f7f8;
	color: #0f2445;
	font-weight: 600;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table tbody th,
:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table tbody td:first-child {
	color: #0f2445;
	font-weight: 600;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table tbody tr:last-child > * {
	border-bottom: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table tbody tr:hover > * {
	background: #f8fbfb;
}

/* Horizontal rules is the default. Full grid adds internal rules to the same frame. */
:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid {
	border-color: #dbe4e8;
	border-radius: 8px;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid table {
	min-width: 700px;
	border-collapse: separate;
	border-spacing: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid :is(th, td) {
	border: 0;
	border-right: 1px solid #dbe4e8;
	border-bottom: 1px solid #dbe4e8;
	vertical-align: middle;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid tr > :last-child {
	border-right: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid tbody tr:last-child > * {
	border-bottom: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid thead {
	border-bottom: 0;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid thead th {
	text-align: center;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid thead th:first-child {
	border-top-left-radius: 7px;
}

:where(
	.nordic-page--news-detail .news-article__body,
	.nordic-page--product-detail .product-content-section,
	.editor-styles-wrapper
) .wp-block-table.is-style-full-grid thead th:last-child {
	border-top-right-radius: 7px;
}

/* Keep row labels visible while a dense comparison table scrolls on mobile. */
@media (max-width: 768px) {
	:where(
		.nordic-page--news-detail .news-article__body,
		.nordic-page--product-detail .product-content-section,
		.editor-styles-wrapper
	) .wp-block-table.is-style-full-grid :is(thead th:first-child, tbody th:first-child, tbody td:first-child) {
		position: sticky;
		left: 0;
		z-index: 1;
		background: #fff;
	}

	:where(
		.nordic-page--news-detail .news-article__body,
		.nordic-page--product-detail .product-content-section,
		.editor-styles-wrapper
	) .wp-block-table.is-style-full-grid thead th:first-child {
		z-index: 2;
		background: #f4f7f8;
	}

	:where(
		.nordic-page--news-detail .news-article__body,
		.nordic-page--product-detail .product-content-section,
		.editor-styles-wrapper
	) .wp-block-table.is-style-full-grid tbody tr:hover > :first-child {
		background: #f8fbfb;
	}
}
