/* TBS page sections: the device page's look (bordered cards, green labels, icons, hairline rows)
 * as block styles any page can use. Pick them in the block sidebar → Styles, or insert a pattern
 * from Patterns → TBS. Loaded on the front end and in the editor. */

body,
.editor-styles-wrapper {
	--tbs-text: var(--wp--preset--color--contrast, #111);
	--tbs-surface: var(--wp--preset--color--base, #fff);
	--tbs-green: var(--wp--preset--color--accent-1, #0f8544);
	--tbs-green-dark: color-mix(in srgb, var(--tbs-green) 85%, #000);
	--tbs-blue: var(--wp--preset--color--accent-2, #1054a5);
	--tbs-border: color-mix(in srgb, var(--tbs-text) 16%, var(--tbs-surface));
	--tbs-tint: color-mix(in srgb, var(--tbs-text) 5%, var(--tbs-surface));
	--tbs-green-tint: color-mix(in srgb, var(--tbs-green) 10%, var(--tbs-surface));
	--tbs-muted: color-mix(in srgb, var(--tbs-text) 70%, var(--tbs-surface));
	--tbs-radius: 8px;
	--tbs-pad: var(--wp--preset--spacing--40, 1.5rem);
}

/* ---------- Containers ---------- */

/* Group → Card: white, hairline border, rounded. */
.is-style-tbs-card {
	box-sizing: border-box;
	padding: var(--tbs-pad);
	border: 1px solid var(--tbs-border);
	border-radius: var(--tbs-radius);
	background: var(--tbs-surface);
	color: var(--tbs-text);
}

/* Group → Panel: light gray, no border. For a call to action or an aside. */
.is-style-tbs-panel {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--50, 2rem);
	border-radius: var(--tbs-radius);
	background: var(--tbs-tint);
	color: var(--tbs-text);
}

/* Columns → Cards: every column becomes a card of equal height; a button in it sits at the bottom. */
.wp-block-columns.is-style-tbs-cards {
	gap: var(--wp--preset--spacing--30, 1rem);
}

.wp-block-columns.is-style-tbs-cards > .wp-block-column {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: var(--tbs-pad);
	border: 1px solid var(--tbs-border);
	border-radius: var(--tbs-radius);
	background: var(--tbs-surface);
	color: var(--tbs-text);
}

.wp-block-columns.is-style-tbs-cards > .wp-block-column > * {
	margin-block: 0;
}

.wp-block-columns.is-style-tbs-cards > .wp-block-column > .wp-block-buttons {
	margin-top: auto;
	padding-top: 0.5rem;
}

.is-style-tbs-card > :first-child,
.is-style-tbs-panel > :first-child {
	margin-top: 0;
}

.is-style-tbs-card > :last-child,
.is-style-tbs-panel > :last-child,
.wp-block-columns.is-style-tbs-cards > .wp-block-column > p:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
}

/* ---------- Text ---------- */

/* Paragraph → Eyebrow: the small green label above a heading (like the brand name on device cards). */
p.is-style-tbs-eyebrow {
	margin-bottom: 0.25rem;
	padding-bottom: 0;
	color: var(--tbs-green);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

p.is-style-tbs-eyebrow + .wp-block-heading {
	margin-top: 0;
}

/* Paragraph → Lead: a larger, muted intro under a section heading. */
p.is-style-tbs-lead {
	max-width: 48rem;
	color: var(--tbs-muted);
	font-size: var(--wp--preset--font-size--large, 1.2rem);
	line-height: 1.5;
}

.has-text-align-center.is-style-tbs-lead {
	margin-inline: auto;
}

/* Paragraph → Stat: a big blue number. */
p.is-style-tbs-stat {
	margin: 0;
	padding-bottom: 0;
	color: var(--tbs-blue);
	font-size: clamp(1.75rem, 3.2vw, 2.5rem);
	font-weight: 700;
	line-height: 1.1;
	white-space: nowrap;
}

/* ---------- Lists ---------- */

/* List → Checklist: green check icons. */
ul.is-style-tbs-checklist {
	padding-left: 0;
	list-style: none;
}

ul.is-style-tbs-checklist > li {
	position: relative;
	margin-block: 0.45em;
	padding-left: 1.8em;
}

ul.is-style-tbs-checklist > li::before {
	content: "";
	position: absolute;
	top: 0.2em;
	left: 0;
	width: 1.15em;
	height: 1.15em;
	background: var(--tbs-green);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* List → Chips: green outlined pills (like the brand/category pills on device pages). */
ul.is-style-tbs-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding-left: 0;
	list-style: none;
}

ul.is-style-tbs-chips > li {
	margin: 0;
	padding: 0.45em 1em;
	border: 1px solid var(--tbs-green);
	border-radius: 999px;
	color: var(--tbs-green);
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	font-weight: 600;
	line-height: 1.2;
}

ul.is-style-tbs-chips > li a {
	color: inherit;
}

/* Numbered list → Steps: green numbered circles. */
ol.is-style-tbs-steps {
	display: grid;
	gap: var(--wp--preset--spacing--30, 1rem);
	padding-left: 0;
	list-style: none;
	counter-reset: tbs-step;
}

ol.is-style-tbs-steps > li {
	position: relative;
	min-height: 2.25rem;
	margin: 0;
	padding-left: 3.25rem;
	counter-increment: tbs-step;
}

ol.is-style-tbs-steps > li::before {
	content: counter(tbs-step);
	position: absolute;
	top: -0.1em;
	left: 0;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--tbs-green);
	color: #fff;
	font-weight: 700;
}

/* ---------- Data ---------- */

/* Table → Spec rows: hairline rows like the device spec table. */
.wp-block-table.is-style-tbs-specs table {
	width: 100%;
	border-collapse: collapse;
	border: 0;
}

.wp-block-table.is-style-tbs-specs th,
.wp-block-table.is-style-tbs-specs td {
	padding: 0.65em 0.75em;
	border: 0;
	border-bottom: 1px solid var(--tbs-border);
	text-align: left;
	vertical-align: top;
}

.wp-block-table.is-style-tbs-specs thead {
	border: 0;
}

.wp-block-table.is-style-tbs-specs thead th {
	border-bottom: 2px solid var(--tbs-blue);
	color: var(--tbs-blue);
}

.wp-block-table.is-style-tbs-specs tbody td:first-child {
	font-weight: 600;
}

.wp-block-table.is-style-tbs-specs figcaption {
	color: var(--tbs-muted);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

@media (max-width: 600px) {
	.wp-block-table.is-style-tbs-specs {
		overflow-x: auto;
	}
}

/* Details → FAQ: bordered rows with a +/– marker. */
.wp-block-details.is-style-tbs-faq {
	margin-block: 0.75rem 0;
	border: 1px solid var(--tbs-border);
	border-radius: var(--tbs-radius);
	background: var(--tbs-surface);
}

.wp-block-details.is-style-tbs-faq > summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 1rem 1.25rem;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
}

.wp-block-details.is-style-tbs-faq > summary::-webkit-details-marker {
	display: none;
}

.wp-block-details.is-style-tbs-faq > summary::after {
	content: "+";
	flex: none;
	color: var(--tbs-green);
	font-size: 1.5em;
	font-weight: 400;
	line-height: 1;
}

.wp-block-details.is-style-tbs-faq[open] > summary::after {
	content: "\2013";
}

.wp-block-details.is-style-tbs-faq > summary:focus-visible {
	outline: 2px solid var(--tbs-green);
	outline-offset: 2px;
	border-radius: var(--tbs-radius);
}

.wp-block-details.is-style-tbs-faq > :not(summary) {
	margin-inline: 1.25rem;
}

.wp-block-details.is-style-tbs-faq > :last-child:not(summary) {
	margin-bottom: 1rem;
	padding-bottom: 0;
}

/* Quote → Review card. */
.wp-block-quote.is-style-tbs-review {
	box-sizing: border-box;
	height: 100%;
	margin: 0;
	padding: var(--tbs-pad);
	border: 1px solid var(--tbs-border);
	border-left: 4px solid var(--tbs-green);
	border-radius: var(--tbs-radius);
	background: var(--tbs-surface);
	font-size: inherit;
	font-style: normal;
}

.wp-block-quote.is-style-tbs-review p {
	font-size: inherit;
	font-style: normal;
}

.wp-block-quote.is-style-tbs-review cite {
	display: block;
	margin-top: 0.75rem;
	color: var(--tbs-blue);
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	font-style: normal;
	font-weight: 600;
}

/* ---------- Media ---------- */

/* Image → Framed: white tile with a hairline border; the image fits inside without cropping (like device photos). */
.wp-block-image.is-style-tbs-framed img {
	box-sizing: border-box;
	width: 100%;
	padding: 1rem;
	border: 1px solid var(--tbs-border);
	border-radius: var(--tbs-radius);
	background: #fff;
	object-fit: contain;
}

/* Group → Logo tiles: each Image block inside becomes a white bordered tile with the logo centered and
 * scaled to fit (the supplier SVGs have no padding of their own). Linked logos get the catalog card hover. */
.wp-block-group.is-style-tbs-logos {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--wp--preset--spacing--30, 1rem);
}

.wp-block-group.is-style-tbs-logos > * {
	margin: 0 !important;
}

.wp-block-group.is-style-tbs-logos > .wp-block-image {
	box-sizing: border-box;
	display: grid;
	flex: 0 1 12rem;
	place-items: center;
	height: 6rem;
	padding: 0 1.25rem;
	border: 1px solid var(--tbs-border);
	border-radius: var(--tbs-radius);
	background: #fff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.wp-block-group.is-style-tbs-logos > .wp-block-image > a {
	display: grid;
	place-items: center;
	align-self: stretch;
	justify-self: stretch;
}

.wp-block-group.is-style-tbs-logos > .wp-block-image img {
	display: block;
	width: 100%;
	height: 2.75rem;
	max-width: 10rem;
	margin: 0 auto;
	object-fit: contain;
	box-shadow: none;
}

.wp-block-group.is-style-tbs-logos > .wp-block-image:has(> a:hover),
.wp-block-group.is-style-tbs-logos > .wp-block-image:has(> a:focus-visible) {
	border-color: var(--tbs-green);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.wp-block-group.is-style-tbs-logos > .wp-block-image > a:focus-visible {
	outline: 2px solid var(--tbs-green);
	outline-offset: 4px;
	border-radius: var(--tbs-radius);
}

@media (max-width: 600px) {
	.wp-block-group.is-style-tbs-logos {
		gap: 0.75rem;
	}

	.wp-block-group.is-style-tbs-logos > .wp-block-image {
		flex-basis: calc(50% - 0.375rem);
		height: 4.5rem;
		padding: 0 1rem;
	}

	.wp-block-group.is-style-tbs-logos > .wp-block-image img {
		height: 1.75rem;
	}
}

/* ---------- Buttons ---------- */

.wp-block-button.is-style-tbs-solid > .wp-block-button__link,
.wp-block-button.is-style-tbs-outline > .wp-block-button__link {
	border: 2px solid var(--tbs-green);
	border-radius: var(--tbs-radius);
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wp-block-button.is-style-tbs-solid > .wp-block-button__link {
	background: var(--tbs-green);
	color: #fff;
}

.wp-block-button.is-style-tbs-solid > .wp-block-button__link:hover,
.wp-block-button.is-style-tbs-solid > .wp-block-button__link:focus-visible {
	border-color: var(--tbs-green-dark);
	background: var(--tbs-green-dark);
	color: #fff;
}

.wp-block-button.is-style-tbs-outline > .wp-block-button__link {
	background: transparent;
	color: var(--tbs-green);
}

.wp-block-button.is-style-tbs-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-tbs-outline > .wp-block-button__link:focus-visible {
	background: var(--tbs-green);
	color: #fff;
}

.wp-block-button.is-style-tbs-solid > .wp-block-button__link:focus-visible,
.wp-block-button.is-style-tbs-outline > .wp-block-button__link:focus-visible {
	outline: 2px solid var(--tbs-green);
	outline-offset: 2px;
}

/* Icon highlights row (pattern "Icon highlights", class tbs-icon-row): 4 across, 2 across on phones. */
.wp-block-columns.tbs-icon-row {
	gap: var(--wp--preset--spacing--30, 1rem);
	color: var(--tbs-blue);
}

.wp-block-columns.tbs-icon-row p {
	margin-top: 0.5em;
	padding-bottom: 0;
	font-size: var(--wp--preset--font-size--medium, 1.1rem);
}

@media (max-width: 600px) {
	.wp-block-columns.tbs-icon-row {
		flex-wrap: wrap !important;
	}

	.wp-block-columns.tbs-icon-row > .wp-block-column {
		flex-basis: calc(50% - var(--wp--preset--spacing--30, 1rem)) !important;
	}
}

/* ---------- Icon block (tbs/icon) ---------- */

.tbs-icon {
	--tbs-icon-size: 2.25rem;
	display: flex;
	line-height: 0;
	color: var(--tbs-blue);
}

.tbs-icon.is-size-small { --tbs-icon-size: 1.5rem; }
.tbs-icon.is-size-large { --tbs-icon-size: 3rem; }
.tbs-icon.is-color-green { color: var(--tbs-green); }
.tbs-icon.is-color-white { color: #fff; }
.tbs-icon.is-color-inherit { color: inherit; }
.tbs-icon.is-align-center { justify-content: center; }

.tbs-icon svg {
	width: auto;
	height: var(--tbs-icon-size);
}

/* Badge: the icon in a tinted circle. */
.tbs-icon.is-badge .tbs-icon__shape {
	display: grid;
	place-items: center;
	width: calc(var(--tbs-icon-size) * 2);
	height: calc(var(--tbs-icon-size) * 2);
	border-radius: 50%;
	background: var(--tbs-green-tint);
}

.tbs-icon.is-badge.is-color-blue .tbs-icon__shape {
	background: color-mix(in srgb, var(--tbs-blue) 10%, var(--tbs-surface));
}

.tbs-icon.is-badge.is-color-white .tbs-icon__shape {
	background: rgba(255, 255, 255, 0.15);
}

.tbs-icon.is-badge svg {
	height: var(--tbs-icon-size);
	max-width: calc(var(--tbs-icon-size) * 1.25);
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-button.is-style-tbs-solid > .wp-block-button__link,
	.wp-block-button.is-style-tbs-outline > .wp-block-button__link {
		transition: none;
	}
}
