/*
 * Shared content styles: loaded on the front AND as an editor style
 * (add_editor_style auto-prefixes selectors with .editor-styles-wrapper,
 * `body` included), so the editor canvas matches the front pixel-close.
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--sf-surface);
	color: var(--sf-text);
	font-family: var(--sf-font-body);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--sf-font-heading);
	font-weight: 700;
	line-height: 1.25;
	margin: 1.6em 0 0.6em;
	text-wrap: balance;
}

h1 {
	font-size: clamp(1.7rem, 4vw, 2.3rem);
	margin-top: 0;
}

h2 {
	font-size: clamp(1.35rem, 3vw, 1.7rem);
}

h3 {
	font-size: 1.15rem;
}

p,
ul,
ol {
	margin: 0 0 1em;
}

li {
	margin: 0.3em 0;
}

a {
	color: var(--sf-link);
}

a:hover {
	color: var(--sf-link-hover);
}

:focus-visible {
	outline: 3px solid var(--sf-focus-ring);
	outline-offset: 2px;
}

img {
	max-width: 100%;
	height: auto;
}

hr {
	border: 0;
	border-top: 1px solid var(--sf-border);
	margin: 2rem 0;
}

blockquote {
	margin: 1.5rem 0;
	padding: 0.5rem 1.25rem;
	border-left: 3px solid var(--sf-accent);
	background: var(--sf-surface-raised);
	border-radius: var(--sf-radius);
}

code,
kbd {
	background: var(--sf-surface-sunken);
	padding: 0.15em 0.4em;
	border-radius: 4px;
	font-size: 0.92em;
}

/* --- Tables --- */

.wp-block-table {
	overflow-x: auto;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

th,
td {
	padding: 0.6em 0.8em;
	text-align: left;
	border-bottom: 1px solid var(--sf-border);
}

thead th,
tfoot td {
	background: var(--sf-surface-raised);
	font-family: var(--sf-font-heading);
	font-weight: 700;
}

/* --- Buttons --- */

.wp-block-button__link,
.sf-btn {
	display: inline-block;
	background: var(--sf-accent);
	color: var(--sf-on-accent);
	font-family: var(--sf-font-heading);
	font-weight: 700;
	text-decoration: none;
	border: 0;
	border-radius: var(--sf-radius);
	padding: 0.75em 1.6em;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wp-block-button__link:hover,
.sf-btn:hover {
	background: var(--sf-accent-hover);
	color: var(--sf-on-accent);
}

.wp-block-button__link:active,
.sf-btn:active {
	background: var(--sf-accent-active);
}

.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--sf-accent);
	border: 2px solid var(--sf-accent);
}

.is-style-outline .wp-block-button__link:hover {
	background: var(--sf-accent-tint);
	color: var(--sf-link-hover);
}

/* --- Components (patterns + ToC) --- */

/* Hero (Cover block) */

.wp-block-cover.sf-hero {
	border-radius: var(--sf-radius);
	overflow: hidden;
	margin-bottom: 1rem;
}

.sf-hero h1 {
	margin: 0 0 0.4em;
}

.sf-hero__lead {
	font-size: 1.15rem;
	color: var(--sf-text-muted);
}

.wp-block-cover.sf-hero .sf-hero__lead {
	color: inherit;
	opacity: 0.85;
}

/* Anchor menu under the H1 */

.sf-anchor-nav {
	gap: 0.4rem;
}

.sf-anchor-nav .wp-block-button__link {
	background: var(--sf-surface-raised);
	color: var(--sf-text);
	border: 1px solid var(--sf-border);
	border-radius: 999px;
	padding: 0.35em 1em;
	font-size: 0.85rem;
	font-weight: 600;
}

.sf-anchor-nav .wp-block-button__link:hover {
	background: var(--sf-accent-tint);
	border-color: var(--sf-accent);
	color: var(--sf-text);
}

.sf-pros,
.sf-cons {
	border-radius: var(--sf-radius);
	padding: 1rem 1.25rem;
	height: 100%;
}

.sf-pros {
	background: var(--sf-success-tint);
	border: 1px solid var(--sf-success);
}

.sf-cons {
	background: var(--sf-danger-tint);
	border: 1px solid var(--sf-danger);
}

.sf-pros h3,
.sf-cons h3 {
	margin-top: 0;
}

.sf-pros ul,
.sf-cons ul {
	margin-bottom: 0;
	padding-left: 1.1em;
}

.sf-pros li::marker {
	content: '✓ ';
	color: var(--sf-success);
}

.sf-cons li::marker {
	content: '✗ ';
	color: var(--sf-danger);
}

.sf-cta-card {
	background: var(--sf-accent-tint);
	border: 1px solid var(--sf-accent);
	border-radius: var(--sf-radius);
	padding: 1.5rem;
	margin: 1.5rem 0;
}

.sf-cta-card h3 {
	margin-top: 0;
}

.sf-related-card {
	background: var(--sf-surface-raised);
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	padding: 1rem 1.25rem;
	height: 100%;
}

.sf-related-card h3 {
	margin-top: 0;
	font-size: 1.05rem;
}

.sf-related-card a {
	text-decoration: none;
}

.sf-related-card p {
	margin-bottom: 0;
	color: var(--sf-text-muted);
	font-size: 0.92rem;
}

/* Details/summary (FAQ placeholder + generic accordions) */
.wp-block-details {
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	padding: 0.75rem 1rem;
	margin-bottom: 0.75rem;
}

.wp-block-details summary {
	cursor: pointer;
	font-family: var(--sf-font-heading);
	font-weight: 700;
}

.wp-block-details[open] summary {
	margin-bottom: 0.5em;
}

/* --- Yoast FAQ / How-To blocks --- */

.schema-faq-section {
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	padding: 0.75rem 1rem;
	margin-bottom: 0.75rem;
}

.schema-faq-question {
	display: block;
	font-family: var(--sf-font-heading);
	font-weight: 700;
	margin-bottom: 0.35em;
}

.schema-faq-answer {
	margin: 0;
	color: var(--sf-text-muted);
}

.schema-how-to-steps {
	counter-reset: sf-step;
	list-style: none;
	padding-left: 0;
}

.schema-how-to-step {
	position: relative;
	padding-left: 3rem;
	margin-bottom: 1rem;
}

.schema-how-to-step::before {
	counter-increment: sf-step;
	content: counter(sf-step);
	position: absolute;
	left: 0;
	top: 0;
	display: grid;
	place-items: center;
	width: 2.1rem;
	height: 2.1rem;
	border-radius: 50%;
	background: var(--sf-accent-tint);
	border: 1px solid var(--sf-accent);
	color: var(--sf-text);
	font-family: var(--sf-font-heading);
	font-weight: 700;
}

.schema-how-to-step-name {
	display: block;
	font-family: var(--sf-font-heading);
}

.schema-how-to-step-text {
	margin: 0.25em 0 0;
	color: var(--sf-text-muted);
}

/* --- Demo block (facade + iframe) --- */

.sf-demo {
	margin: 1.5rem 0;
}

.sf-demo--16-9 {
	aspect-ratio: 16 / 9;
}

.sf-demo--4-3 {
	aspect-ratio: 4 / 3;
}

.sf-demo--1-1 {
	aspect-ratio: 1 / 1;
}

.sf-demo--9-16 {
	aspect-ratio: 9 / 16;
	max-width: 420px;
	margin-inline: auto;
}

.sf-demo .sf-demo__facade,
.sf-demo iframe {
	width: 100%;
	height: 100%;
	border: 1px solid var(--sf-border);
	border-radius: var(--sf-radius);
	display: block;
}

.sf-demo__facade {
	background-color: var(--sf-surface-sunken);
	background-size: cover;
	background-position: center;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	color: var(--sf-text);
	font-family: var(--sf-font-heading);
	font-weight: 700;
}

.sf-demo__play {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--sf-accent);
	color: var(--sf-on-accent);
	font-size: 1.5rem;
	transition: background-color 0.15s ease;
}

.sf-demo__facade:hover .sf-demo__play {
	background: var(--sf-accent-hover);
}

.sf-demo__label {
	background: rgba(0, 0, 0, 0.45);
	padding: 0.2em 0.8em;
	border-radius: 999px;
	font-size: 0.9rem;
}

/* --- Table block styles --- */

.is-style-sf-params td:first-child {
	background: var(--sf-surface-raised);
	font-family: var(--sf-font-heading);
	font-weight: 700;
	width: 42%;
}

.is-style-sf-scale thead th {
	background: var(--sf-accent-tint);
	border-bottom: 2px solid var(--sf-accent);
}

.is-style-sf-scale td:first-child {
	font-family: var(--sf-font-heading);
	font-weight: 700;
}

/* --- Front-end content column: a HARD frame (no-op in the editor) ---
 *
 * The container itself is constrained, not its children. Pasted custom HTML
 * (own <style> tags, margins, wide tables) physically cannot escape the
 * content width — geometry is enforced by the DOM, not by specificity wars
 * with in-content styles. overflow-x: clip kills 100vw bleed tricks; wide
 * tables must scroll inside their own wrappers.
 */

.entry-content {
	max-width: var(--sf-container);
	margin-inline: auto;
	padding-inline: clamp(1.25rem, 4vw, 2rem);
	overflow-x: clip;
}

/* Alignments stay within the frame: wide/full = the full frame width. */
.entry-content > .alignwide,
.entry-content > .alignfull {
	max-width: none;
}
