/* ─── H1 / H2 heading styles (mobile-first) ─────────────────────────────── */

body:not(.error404) h1.wp-block-heading,
body:not(.error404) h1.wp-block-post-title {
	border-left: 7px solid var(--wp--preset--color--primary);
	padding-left: 20px;
	line-height: 1.3;
	font-size: 32px;
	font-weight: 500;
	font-family: var(--wp--preset--font-family--benton-sans);
	color: var(--wp--preset--color--navy);
}

h2.wp-block-heading {
	border-left: 7px solid var(--wp--preset--color--primary);
	padding-left: 20px;
	line-height: 1.4;
	font-size: 24px;
	font-weight: 500;
	font-family: var(--wp--preset--font-family--benton-sans);
	color: var(--wp--preset--color--navy);
}

@media (min-width: 768px) {
	body:not(.error404) h1.wp-block-heading,
	body:not(.error404) h1.wp-block-post-title {
		border-left-width: 14px;
		padding-left: 24px;
		line-height: 1.4;
		font-size: 40px;
	}

	h2.wp-block-heading {
		border-left-width: 14px;
		padding-left: 40px;
		line-height: 1.4;
		font-size: 28px;
	}
}

.error404 h1 {
	border-left: none !important;
	padding-left: 0 !important;
}

/* ─── Button Block Styles ────────────────────────────────────────────────── */

/* Shared base — applies to all Sovella button styles */
.wp-block-button .wp-block-button__link {
	font-family: var(--wp--preset--font-family--benton-sans);
	font-weight: 500;
	font-size: 18px;
	line-height: normal;
	text-align: center;
	border-radius: 0;
	padding: 18px 36px;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease,
	            border-color 0.15s ease;
}

/* ─── Primary (red filled) ───────────────────────────────────────────────── */

.wp-block-button.is-style-sovella-primary .wp-block-button__link,
.wp-block-button.is-style-sovella-primary .wp-block-button__link:link,
.wp-block-button.is-style-sovella-primary .wp-block-button__link:visited {
	background-color: var(--wp--preset--color--primary);
	color: #ffffff;
	border: 1px solid var(--wp--preset--color--primary);
}

.wp-block-button.is-style-sovella-primary .wp-block-button__link:hover,
.wp-block-button.is-style-sovella-primary .wp-block-button__link:focus-visible {
	background-color: #ffffff !important;
	color: var(--wp--preset--color--primary) !important;
	border: 1px solid var(--wp--preset--color--primary) !important;
	text-decoration: underline;
}

/* ─── Secondary (bracket border) ────────────────────────────────────────── */

.wp-block-button.is-style-sovella-secondary .wp-block-button__link {
	position: relative;
	background-color: transparent;
	color: var(--wp--preset--color--navy);
	border: none;
	padding: 18px 36px;
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link::before,
.wp-block-button.is-style-sovella-secondary .wp-block-button__link::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 16px;
	border-left: 2px solid var(--wp--preset--color--primary);
	border-right: 2px solid var(--wp--preset--color--primary);
	pointer-events: none;
	transition: border-color 0.15s ease;
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link::before {
	top: 0;
	border-top: 2px solid var(--wp--preset--color--primary);
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link::after {
	bottom: 0;
	border-bottom: 2px solid var(--wp--preset--color--primary);
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link:hover,
.wp-block-button.is-style-sovella-secondary .wp-block-button__link:focus-visible {
	background-color: transparent;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link:hover::before,
.wp-block-button.is-style-sovella-secondary .wp-block-button__link:focus-visible::before {
	border-top-color: var(--wp--preset--color--navy);
	border-left-color: var(--wp--preset--color--navy);
	border-right-color: var(--wp--preset--color--navy);
}

.wp-block-button.is-style-sovella-secondary .wp-block-button__link:hover::after,
.wp-block-button.is-style-sovella-secondary .wp-block-button__link:focus-visible::after {
	border-bottom-color: var(--wp--preset--color--navy);
	border-left-color: var(--wp--preset--color--navy);
	border-right-color: var(--wp--preset--color--navy);
}

/* ─── Dark (navy filled) ─────────────────────────────────────────────────── */

.wp-block-button.is-style-sovella-dark .wp-block-button__link {
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--light-bg);
	border: none;
	padding: 16px 18px;
}

.wp-block-button.is-style-sovella-dark .wp-block-button__link:hover,
.wp-block-button.is-style-sovella-dark .wp-block-button__link:focus-visible {
	background-color: var(--wp--preset--color--accent-blue);
	color: var(--wp--preset--color--light-bg);
	text-decoration: underline;
}

/* ─── Light (outlined, red text) ────────────────────────────────────────── */

.wp-block-button.is-style-sovella-light .wp-block-button__link {
	background-color: transparent;
	color: var(--wp--preset--color--primary);
	border: 1px solid var(--wp--preset--color--gray-border);
	padding: 12px 6px;
}

.wp-block-button.is-style-sovella-light .wp-block-button__link:hover,
.wp-block-button.is-style-sovella-light .wp-block-button__link:focus-visible {
	background-color: transparent;
	color: var(--wp--preset--color--navy);
	border: 1px solid var(--wp--preset--color--gray-border);
	text-decoration: underline;
}

/* ─── Equal-width button row (core/buttons parent block) ─────────────────── */

.wp-block-buttons.is-style-sovella-equal-row {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	align-items: stretch;
}

.wp-block-buttons.is-style-sovella-equal-row .wp-block-button {
	width: 100%;
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
}

.wp-block-buttons.is-style-sovella-equal-row .wp-block-button .wp-block-button__link {
	width: 100%;
	box-sizing: border-box;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

@media (min-width: 768px) {
	.wp-block-buttons.is-style-sovella-equal-row {
		flex-direction: row;
		gap: 32px;
		align-items: stretch;
	}
}

/* ─── Social links — base ───────────────────────────────── */

.wp-block-social-links {
	gap: 20px;
}

.wp-block-social-links .wp-social-link {
	width: 42px !important;
	height: 42px !important;
	padding: 0 !important;
	border-radius: 50%;
	border: 2px solid transparent !important;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
	box-sizing: border-box;
	margin: 0;
	background-color: transparent !important;
}

.wp-block-social-links .wp-social-link svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.wp-block-social-links .wp-social-link a {
	width: 100%;
	height: 100%;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	color: inherit;
	background: transparent;
}

/* ─── On dark surface (default) ─────────────────────────── */

.wp-block-social-links.is-style-sovella-dark-surface .wp-social-link,
.wp-block-social-links.is-style-sovella-dark-surface .wp-social-link.wp-social-link-facebook,
.wp-block-social-links.is-style-sovella-dark-surface .wp-social-link.wp-social-link-instagram {
	background-color: #ffffff !important;
	color: var(--wp--preset--color--navy) !important;
}

.wp-block-social-links.is-style-sovella-dark-surface .wp-social-link:hover,
.wp-block-social-links.is-style-sovella-dark-surface .wp-social-link:focus-within {
	border-color: var(--wp--preset--color--primary) !important;
	background-color: #ffffff !important;
	color: var(--wp--preset--color--navy) !important;
	transform: none !important;
}

/* ─── On light surface ──────────────────────────────────── */

.wp-block-social-links.is-style-sovella-light-surface .wp-social-link,
.wp-block-social-links.is-style-sovella-light-surface .wp-social-link.wp-social-link-facebook,
.wp-block-social-links.is-style-sovella-light-surface .wp-social-link.wp-social-link-instagram {
	background-color: var(--wp--preset--color--accent-blue) !important;
	color: #ffffff !important;
}

.wp-block-social-links.is-style-sovella-light-surface .wp-social-link:hover,
.wp-block-social-links.is-style-sovella-light-surface .wp-social-link:focus-within {
	border-color: var(--wp--preset--color--navy) !important;
	background-color: var(--wp--preset--color--accent-blue) !important;
	color: #ffffff !important;
}

/* ─── Full-bleed section — alignfull breakout ───────────── */

/*
 * WordPress's alignfull mechanism uses --wp--style--root--padding-left
 * to calculate negative margins, but that custom property is 0px in this
 * theme (root padding in theme.json is 0). The template's outer <main>
 * group carries the content padding as an inline style instead, which
 * WP's system can't account for.
 *
 * Fix: calc(50% - 50vw) computes the exact margin needed to reach the
 * viewport left edge, because .wp-block-post-content is always
 * horizontally centered: 50% of its width equals its offset from the
 * viewport center, and 50vw is the viewport half-width.
 */
.wp-block-post-content > .wp-block-group.alignfull {
	width: 100vw;
	margin-left: calc(50% - 50vw);
	max-width: none;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.wp-block-post-content > .wp-block-group.alignfull > * {
	max-width: var(--wp--style--global--content-size, 1140px);
	margin-left: auto;
	margin-right: auto;
	padding-left: 16px;
	padding-right: 16px;
	box-sizing: border-box;
}

/* ─── core/table — Sovella Styled variation ─────────────── */

.sovella-table-wrapper {
	display: block;
	width: 100%;
	position: relative;
}

/* Scroll wrapper — always active, not just mobile */
figure.wp-block-table.is-style-sovella-styled {
	overflow-x: auto;
	overflow-y: visible;
	-webkit-overflow-scrolling: touch;
	display: block;
	width: 100%;
	margin: 0;
}


.wp-block-table.is-style-sovella-styled table {
	width: 100%;
	min-width: max-content;
	table-layout: fixed;
	border-collapse: collapse;
	border: none;
	font-family: var(--wp--preset--font-family--benton-sans);
	font-size: 16px;
	line-height: 1.4;
	color: var(--wp--preset--color--navy);
}

/* Reset WP default table borders */
.wp-block-table.is-style-sovella-styled td,
.wp-block-table.is-style-sovella-styled th,
.is-style-sovella-styled table thead th,
.is-style-sovella-styled table thead td {
	border: none !important;
	padding: 16px;
	text-align: left;
	width: 120px;
	min-width: 120px;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Core injects border-bottom/border-top on thead/tfoot elements themselves */
.wp-block-table.is-style-sovella-styled thead {
	border-bottom: none !important;
}

.wp-block-table.is-style-sovella-styled tfoot {
	border-top: none !important;
}

.wp-block-table.is-style-sovella-styled tbody tr td:first-child,
.wp-block-table.is-style-sovella-styled thead tr th:first-child,
.wp-block-table.is-style-sovella-styled thead tr td:first-child {
	width: 180px;
	min-width: 180px;
}

/* Header row */
.wp-block-table.is-style-sovella-styled thead tr {
	background: var(--wp--preset--color--gray-border);
}

/* Benton Sans has no Bold file — 500 (Medium) is the heaviest available.
   Selector mirrors Big Card's working pattern: no >, no tr, no figure prefix. */
.is-style-sovella-styled table thead th,
.is-style-sovella-styled table thead td {
	font-weight: 500;
}

/* Body rows — alternating stripe (odd = white, even = gray) */
.wp-block-table.is-style-sovella-styled tbody tr:nth-child(odd) {
	background: #ffffff;
}

.wp-block-table.is-style-sovella-styled tbody tr:nth-child(even) {
	background: var(--wp--preset--color--gray-border);
}

/* Body cells — nowrap to enable horizontal scroll */
.wp-block-table.is-style-sovella-styled tbody tr td {
	font-weight: 400;
	color: var(--wp--preset--color--navy);
	white-space: nowrap !important;
	min-width: 120px;
}

/* Header cells — allow wrapping for long Finnish text */
.wp-block-table.is-style-sovella-styled thead th,
.wp-block-table.is-style-sovella-styled thead td {
	white-space: normal;
	word-break: break-word;
}

/* ─── Reseller Search page spacing ──────────────────────────────────────── */
/* The theme blockGap (54px) adds margin-block-start between the H1 and the  */
/* post-content block. Resetting that here and using padding-top alone gives  */
/* the exact 56px gap shown in Figma between the heading and the filter row. */

.wp-block-post-content:has(.sovella-reseller-search) {
	margin-block-start: 0;
	padding-top: 56px;
}

/* ─── Page title visibility ──────────────────────────────────────────────── */

.hide-page-title .wp-block-post-title:not(.wp-block-query .wp-block-post-title) {
	display: none;
}

.hide-page-title .wp-block-post-title:not(.wp-block-query .wp-block-post-title) + * {
	margin-block-start: 0 !important;
}

/* ─── Social share buttons ───────────────────────────────────────────────── */

.sovella-share-buttons {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 24px;
	margin-top: 60px;
	margin-bottom: 60px;
}

.sovella-share-buttons__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent-blue);
	border: 2px solid transparent;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	text-decoration: none;
	flex-shrink: 0;
	position: relative;
}

.sovella-share-buttons__btn:hover,
.sovella-share-buttons__btn:focus {
	border-color: var(--wp--preset--color--navy);
	box-shadow: 0 0 0 1px var(--wp--preset--color--navy);
	outline: none;
}

.sovella-share-buttons__btn svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

/* ─── CookieHub YouTube consent wrapper ──────────────────────────────────── */

.sovella-youtube-consent-wrapper {
	width: 100%;
	position: relative;
}

.sovella-consent-placeholder {
	background-color: #385e9d;
	padding: 16px;
	width: 100%;
	aspect-ratio: 16 / 9;
	display: flex;
	align-items: flex-start;
	box-sizing: border-box;
}

.sovella-consent-placeholder p {
	color: #ffffff;
	font-family: var(--wp--preset--font-family--benton-sans);
	font-size: 18px;
	font-weight: 400;
	line-height: 1.55;
	margin: 0;
}

.sovella-youtube-embed {
	width: 100%;
}

.sovella-youtube-consent-wrapper.consent-given .sovella-consent-placeholder {
	display: none !important;
}

.sovella-youtube-consent-wrapper.consent-given .sovella-youtube-embed {
	display: block !important;
}

.sovella-juicer-wrapper .sovella-consent-placeholder {
	aspect-ratio: unset;
	height: 427px;
}
