/**
 * WordBuddy Builder — structural styles.
 *
 * No framework, no icon font, no utility-class explosion. Widget defaults and
 * per-page overrides are compiled separately and printed inline, so this file
 * only contains the structural rules shared by every builder page.
 */

.wbb-builder-page {
	position: relative;
}

.wbb-builder-page *,
.wbb-builder-page *::before,
.wbb-builder-page *::after {
	box-sizing: border-box;
}

.wbb-builder-page :where(img, video, svg) {
	max-width: 100%;
	height: auto;
}

.wbb-builder-page img {
	display: block;
}

.wbb-builder-page figure {
	margin: 0;
}

.wbb-builder-page :where(p, ul, ol, dl, blockquote, figure, table, pre) {
	margin-top: 0;
}

.wbb-builder-page :where(p) {
	margin-bottom: 1em;
}

.wbb-builder-page :where(p):last-child {
	margin-bottom: 0;
}

.wbb-builder-page :where(a) {
	color: var(--wbb-primary);
	text-decoration: underline;
	text-underline-offset: 0.16em;
}

.wbb-builder-page :where(a):hover {
	text-decoration-thickness: 2px;
}

.wbb-builder-page :where(h1, h2, h3, h4, h5, h6) {
	font-family: var(--wbb-font-heading);
	line-height: 1.2;
	margin: 0 0 0.5em;
}

.wbb-builder-page :where(h1, h2, h3, h4, h5, h6):last-child {
	margin-bottom: 0;
}

.wbb-builder-page :where(strong) {
	color: inherit;
}

.wbb-builder-page :where(code, kbd, pre) {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9em;
}

.wbb-builder-page :where(pre) {
	overflow: auto;
	padding: 1em;
	border-radius: 8px;
	background: var(--wbb-surface);
}

.wbb-builder-page :where(table) {
	width: 100%;
	border-collapse: collapse;
}

.wbb-builder-page :where(th, td) {
	padding: 0.6em 0.7em;
	border: 1px solid var(--wbb-border);
	text-align: left;
}

.wbb-builder-page :where(a, button, summary):focus-visible {
	outline: 2px solid var(--wbb-primary);
	outline-offset: 2px;
}

/* Layout ---------------------------------------------------------------- */

.wbb-section {
	position: relative;
}

.wbb-section > .wbb-inner {
	width: 100%;
	max-width: var(--wbb-content-width, none);
	margin-left: auto;
	margin-right: auto;
}

.wbb-column {
	min-width: 0;
}

.wbb-inner > .wbb-column {
	flex: 1 1 auto;
}

.wbb-spacer {
	display: block;
	flex: 0 0 auto;
}

/* Rich text ------------------------------------------------------------- */

.wbb-text > :first-child {
	margin-top: 0;
}

.wbb-text > :last-child {
	margin-bottom: 0;
}

.wbb-text :where(ul, ol) {
	margin: 0 0 1em;
	padding-left: 1.4em;
}

.wbb-text :where(ul) {
	list-style: disc;
}

.wbb-text :where(ol) {
	list-style: decimal;
}

.wbb-text :where(li) {
	margin: 0.3em 0;
}

.wbb-text :where(li)::marker {
	color: var(--wbb-muted);
}

.wbb-text :where(h2, h3, h4, h5, h6) {
	margin: 1.6em 0 0.5em;
}

.wbb-text :where(blockquote) {
	margin: 1.4em 0;
	padding: 0.2em 0 0.2em 1.1em;
	border-left: 3px solid var(--wbb-primary);
	color: var(--wbb-muted);
}

.wbb-text :where(hr) {
	border: 0;
	height: 1px;
	background: var(--wbb-border);
	margin: 2em 0;
}

.wbb-text :where(img) {
	border-radius: var(--wbb-radius);
}

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

.wbb-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.55em;
	font-family: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease;
}

.wbb-button:hover {
	filter: brightness(1.06);
}

.wbb-button-text {
	display: inline-block;
}

.wbb-button-icon svg,
.wbb-icon svg {
	width: 1em;
	height: 1em;
}

.wbb-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.wbb-icon-widget {
	display: inline-flex;
	line-height: 1;
}

/* Images ---------------------------------------------------------------- */

.wbb-image {
	display: block;
}

.wbb-image img {
	max-width: 100%;
	height: auto;
	margin: 0 auto;
	border-radius: var(--wbb-radius);
}

.wbb-image-link {
	display: block;
}

.wbb-image-caption {
	margin: 0.65em 0 0;
	font-size: 0.875em;
	line-height: 1.5;
	color: var(--wbb-muted);
	text-align: center;
}

/* Icon box -------------------------------------------------------------- */

.wbb-icon-box {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.65em;
}

.wbb-ib-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	color: var(--wbb-primary);
	font-size: 1.7em;
}

.wbb-ib-title {
	margin: 0;
	font-size: 1.15em;
	line-height: 1.3;
}

.wbb-ib-text > :last-child {
	margin-bottom: 0;
}

/* List ------------------------------------------------------------------ */

.wbb-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wbb-list li {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	margin: 0.45em 0;
}

.wbb-list-icon {
	flex: 0 0 auto;
	display: inline-flex;
	margin-top: 0.28em;
	color: var(--wbb-primary);
}

.wbb-list-icon svg {
	width: 1em;
	height: 1em;
}

.wbb-list-text {
	min-width: 0;
}

.wbb-list-text a {
	color: inherit;
	text-decoration: underline;
}

/* Divider --------------------------------------------------------------- */

.wbb-divider {
	border: 0;
	height: 1px;
	width: 100%;
	background-color: var(--wbb-border);
}

/* Video ----------------------------------------------------------------- */

.wbb-video {
	position: relative;
	width: 100%;
	aspect-ratio: var(--wbb-aspect, 16 / 9);
	overflow: hidden;
	background: #0f172a;
	border-radius: var(--wbb-radius);
}

.wbb-video iframe,
.wbb-video video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	object-fit: cover;
}

/* Accordion ------------------------------------------------------------- */

.wbb-accordion {
	border-top: 1px solid var(--wbb-border);
}

.wbb-acc-item {
	border-bottom: 1px solid var(--wbb-border);
}

.wbb-acc-question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 1.1em 0;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
	color: inherit;
}

.wbb-acc-question::-webkit-details-marker {
	display: none;
}

.wbb-acc-question::marker {
	content: "";
}

.wbb-acc-icon {
	flex: 0 0 auto;
	font-size: 1.35em;
	line-height: 1;
	font-weight: 400;
	color: var(--wbb-muted);
	transition: transform 0.2s ease;
}

.wbb-acc-item[open] .wbb-acc-icon {
	transform: rotate(45deg);
}

.wbb-acc-answer {
	padding: 0 0 1.2em;
}

.wbb-acc-answer > :last-child {
	margin-bottom: 0;
}

.wbb-accordion > .wbb-placeholder,
.wbb-gallery > .wbb-placeholder,
.wbb-image > .wbb-placeholder,
.wbb-video > .wbb-placeholder {
	padding: 1.25em;
	border: 1px dashed var(--wbb-border);
	border-radius: 8px;
	color: var(--wbb-muted);
	text-align: center;
}

/* TOC ------------------------------------------------------------------- */

.wbb-toc-title {
	margin: 0 0 0.7em;
	font-weight: 700;
	color: var(--wbb-heading);
	font-size: 0.95em;
	letter-spacing: 0.01em;
}

.wbb-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wbb-toc-item {
	margin: 0.4em 0;
	line-height: 1.45;
}

.wbb-toc-item a {
	color: inherit;
	text-decoration: none;
	opacity: 0.82;
}

.wbb-toc-item a:hover,
.wbb-toc-item a:focus-visible {
	color: var(--wbb-primary);
	opacity: 1;
	text-decoration: underline;
}

.wbb-toc-item--l3 {
	padding-left: 1em;
	font-size: 0.94em;
}

.wbb-toc-item--l4 {
	padding-left: 2em;
	font-size: 0.9em;
}

.wbb-toc--numbered .wbb-toc-list {
	list-style: decimal;
	padding-left: 1.3em;
}

.wbb-toc--numbered .wbb-toc-item {
	padding-left: 0;
}

.wbb-toc--sticky {
	position: sticky;
	top: 24px;
}

.wbb-toc-empty {
	margin: 0;
	color: var(--wbb-muted);
	font-size: 0.9em;
}

/* Quote ----------------------------------------------------------------- */

.wbb-quote {
	margin: 0;
	padding: 1.4em 1.6em;
	border-left: 4px solid var(--wbb-primary);
	border-radius: 0 var(--wbb-radius) var(--wbb-radius) 0;
	background: var(--wbb-surface);
}

.wbb-quote-text > :last-child {
	margin-bottom: 0;
}

.wbb-quote-author {
	display: flex;
	align-items: center;
	gap: 0.75em;
	margin-top: 1em;
	font-style: normal;
	color: var(--wbb-muted);
	font-size: 0.9em;
}

.wbb-quote-avatar {
	display: inline-flex;
	flex: 0 0 auto;
}

.wbb-avatar-img {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	margin: 0;
}

.wbb-quote-meta {
	display: flex;
	flex-direction: column;
	line-height: 1.4;
}

.wbb-quote-name {
	font-style: normal;
	font-weight: 600;
	color: var(--wbb-heading);
}

.wbb-quote-role {
	color: var(--wbb-muted);
}

/* Gallery --------------------------------------------------------------- */

.wbb-gallery {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.wbb-gal-item {
	display: block;
	overflow: hidden;
	border-radius: var(--wbb-radius);
	background: var(--wbb-surface);
}

.wbb-gal-img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	margin: 0;
}

/* Breadcrumb ------------------------------------------------------------ */

.wbb-breadcrumbs {
	font-size: 0.875em;
	line-height: 1.5;
}

.wbb-breadcrumb-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wbb-breadcrumb-item {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
}

.wbb-breadcrumb-item a {
	color: inherit;
	text-decoration: none;
}

.wbb-breadcrumb-item a:hover {
	color: var(--wbb-primary);
	text-decoration: underline;
}

.wbb-breadcrumb-item [aria-current="page"] {
	color: var(--wbb-text);
}

.wbb-breadcrumb-sep {
	color: var(--wbb-border);
}

/* Byline --------------------------------------------------------------- */

.wbb-byline {
	display: flex;
	align-items: center;
	gap: 0.8em;
	font-size: 0.9em;
	line-height: 1.45;
}

.wbb-byline-avatar {
	flex: 0 0 auto;
}

.wbb-byline-main {
	min-width: 0;
}

.wbb-byline-author {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5em;
}

.wbb-byline-name {
	font-weight: 600;
	color: var(--wbb-heading);
}

.wbb-byline-role,
.wbb-byline-reviewer {
	color: var(--wbb-muted);
}

.wbb-byline-dates {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	margin-top: 0.15em;
	color: var(--wbb-muted);
}

.wbb-byline-dot {
	color: var(--wbb-border);
}

/* Direct answer block --------------------------------------------------- */

.wbb-answer-label {
	margin: 0 0 0.55em;
	font-size: 0.78em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wbb-primary);
}

.wbb-answer-body > :last-child {
	margin-bottom: 0;
}

/* Sources --------------------------------------------------------------- */

.wbb-sources-title {
	margin: 0 0 0.6em;
	font-weight: 700;
	color: var(--wbb-heading);
}

.wbb-sources-list {
	margin: 0;
	padding-left: 1.3em;
	font-size: 0.92em;
}

.wbb-sources-list li {
	margin: 0.35em 0;
	line-height: 1.55;
}

.wbb-sources-publisher {
	color: var(--wbb-muted);
}

/* Address / NAP --------------------------------------------------------- */

.wbb-address {
	display: flex;
	flex-direction: column;
	gap: 0.28em;
	font-style: normal;
	line-height: 1.55;
}

.wbb-address-name {
	display: block;
	font-weight: 700;
	color: var(--wbb-heading);
	margin-bottom: 0.18em;
}

.wbb-address-line {
	display: block;
}

.wbb-address a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.wbb-address a:hover {
	color: var(--wbb-primary);
}

/* Table ----------------------------------------------------------------- */

.wbb-table {
	margin: 0;
}

.wbb-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.wbb-table table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-size: 0.95em;
}

.wbb-table caption {
	caption-side: top;
	padding: 0 0 0.7em;
	text-align: left;
	font-weight: 600;
	color: var(--wbb-heading);
}

.wbb-table th,
.wbb-table td {
	padding: 0.7em 0.8em;
	border: 1px solid var(--wbb-border);
	text-align: left;
	vertical-align: top;
}

.wbb-table th {
	background: var(--wbb-surface);
	font-weight: 600;
	color: var(--wbb-heading);
}

/* Misc ------------------------------------------------------------------ */

.wbb-builder-page :where([id]) {
	scroll-margin-top: 90px;
}

.wbb-builder-page .wbb-empty-hint,
.wbb-builder-page .wbb-placeholder {
	/* Only rendered in editor preview. */
}

.wbb-canvas-main {
	padding: 0;
}

.wbb-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
	padding: 10px 16px;
	background: #ffffff;
	color: #0f172a;
	font-size: 14px;
	text-decoration: none;
	border-radius: 0 0 6px 0;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}

.wbb-skip-link:focus {
	left: 0;
}

@media (prefers-reduced-motion: reduce) {
	.wbb-button,
	.wbb-acc-icon {
		transition: none;
	}
}
