/**
 * CliniEd — Blocks, editor output and remaining site pieces.
 *
 * Loaded last, so it can correct anything Kadence or core blocks bring in.
 */

/* ===========================================================================
 * Long-form content ("prose")
 * ======================================================================== */
.ce-prose { font-size: var(--ce-fs-md); line-height: var(--ce-lh-relaxed); }

.ce-prose > * + * { margin-top: var(--ce-space-6); }

.ce-prose :is(h2, h3, h4) { margin-top: var(--ce-space-12); margin-bottom: var(--ce-space-4); }
.ce-prose > :first-child { margin-top: 0; }

.ce-prose h2 { font-size: var(--ce-fs-2xl); }
.ce-prose h3 { font-size: var(--ce-fs-xl); }
.ce-prose h4 { font-size: var(--ce-fs-lg); }

.ce-prose :is(ul, ol) {
	padding-left: var(--ce-space-6);
	display: flex;
	flex-direction: column;
	gap: var(--ce-space-3);
}
.ce-prose li::marker { color: var(--ce-primary); }

.ce-prose img,
.ce-prose figure { border-radius: var(--ce-radius-lg); overflow: hidden; }

.ce-prose figcaption {
	margin-top: var(--ce-space-3);
	font-size: var(--ce-fs-sm);
	color: var(--ce-text-muted);
	text-align: center;
}

.ce-prose table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--ce-fs-base);
}
.ce-prose :is(th, td) {
	padding: var(--ce-space-3) var(--ce-space-4);
	border: 1px solid var(--ce-border);
	text-align: left;
}
.ce-prose th { background: var(--ce-surface-alt); font-family: var(--ce-font-heading); font-weight: var(--ce-fw-heading); }

/* Tables must scroll rather than push the page sideways */
.ce-prose .wp-block-table { overflow-x: auto; }

.ce-prose pre {
	padding: var(--ce-space-5);
	border-radius: var(--ce-radius-md);
	background: var(--ce-indigo);
	color: #e6ecf4;
	overflow-x: auto;
	font-size: var(--ce-fs-sm);
	line-height: 1.6;
}
.ce-prose pre code { background: none; padding: 0; color: inherit; }

/* Page-break links from wp_link_pages() */
.ce-page-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ce-space-2);
	margin-top: var(--ce-space-8);
	font-family: var(--ce-font-heading);
	font-weight: var(--ce-fw-heading);
	font-size: var(--ce-fs-sm);
}
.ce-page-links a,
.ce-page-links > span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 var(--ce-space-3);
	border: 1px solid var(--ce-border);
	border-radius: var(--ce-radius-sm);
	text-decoration: none;
}

/* ===========================================================================
 * Search form
 * ======================================================================== */
.ce-search-form__inner {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--ce-space-2);
	padding: 5px 5px 5px var(--ce-space-4);
	border: 1px solid var(--ce-border-strong);
	border-radius: var(--ce-radius-pill);
	background: var(--ce-bg);
	transition: border-color var(--ce-dur-fast) var(--ce-ease), box-shadow var(--ce-dur-fast) var(--ce-ease);
}
.ce-search-form__inner:focus-within {
	border-color: var(--ce-primary);
	box-shadow: var(--ce-focus-ring);
}

.ce-search-form__icon { flex: none; color: var(--ce-text-muted); }

.ce-search-form__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: none;
	padding: 0.55em 0;
	font-size: var(--ce-fs-base);
}
.ce-search-form__input:focus { outline: none; box-shadow: none; border: 0; }

.ce-search-form__submit { flex: none; }

/* ===========================================================================
 * Footer columns
 * ======================================================================== */
.ce-footer__col { min-width: 0; }
.ce-footer__widgets {
	padding-block: var(--ce-space-8);
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===========================================================================
 * Comments
 * ======================================================================== */
.comments-area { margin-top: var(--ce-space-12); }

.comments-title,
.comment-reply-title {
	font-family: var(--ce-font-heading);
	font-size: var(--ce-fs-xl);
	margin-bottom: var(--ce-space-6);
}

.comment-list { margin: 0 0 var(--ce-space-10); padding: 0; list-style: none; }
.comment-list ol.children { list-style: none; padding-left: var(--ce-space-8); }

.comment-body {
	padding: var(--ce-space-5) var(--ce-space-6);
	margin-bottom: var(--ce-space-4);
	border: 1px solid var(--ce-border);
	border-radius: var(--ce-radius-md);
	background: var(--ce-bg);
}

.comment-author { display: flex; align-items: center; gap: var(--ce-space-3); font-family: var(--ce-font-heading); font-weight: var(--ce-fw-heading); }
.comment-author img { border-radius: 50%; }
.comment-metadata { font-size: var(--ce-fs-xs); color: var(--ce-text-muted); margin-bottom: var(--ce-space-3); }
.comment-metadata a { color: inherit; text-decoration: none; }

.reply a {
	font-family: var(--ce-font-heading);
	font-size: var(--ce-fs-sm);
	font-weight: var(--ce-fw-heading);
	text-decoration: none;
}

.comment-form { display: flex; flex-direction: column; gap: var(--ce-space-4); }
.comment-form label { font-family: var(--ce-font-heading); font-weight: var(--ce-fw-heading); font-size: var(--ce-fs-sm); display: block; margin-bottom: var(--ce-space-2); }
.comment-form .form-submit { margin: 0; }
.comment-form input[type="submit"] {
	padding: 0.85em 1.7em;
	border: 0;
	border-radius: var(--ce-radius-pill);
	background: var(--ce-primary);
	color: var(--ce-white);
	font-family: var(--ce-font-heading);
	font-weight: var(--ce-fw-heading);
	cursor: pointer;
}
.comment-form input[type="submit"]:hover { background: var(--ce-primary-hover); }

/* ===========================================================================
 * Core block overrides
 * ======================================================================== */
.wp-block-button__link {
	border-radius: var(--ce-radius-pill);
	font-family: var(--ce-font-heading);
	font-weight: var(--ce-fw-heading);
	padding: 0.85em 1.7em;
	background-color: var(--ce-primary);
}
.wp-block-button__link:hover { background-color: var(--ce-primary-hover); }

.wp-block-button.is-style-outline .wp-block-button__link {
	border-color: var(--ce-border-strong);
	color: var(--ce-text);
	background: transparent;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--ce-primary);
	color: var(--ce-primary);
	background: var(--ce-primary-soft);
}

.wp-block-quote {
	border-left: 4px solid var(--ce-accent);
	padding-left: var(--ce-space-6);
	font-style: normal;
}

.wp-block-separator { border-color: var(--ce-border); opacity: 1; }

.wp-block-image img { border-radius: var(--ce-radius-md); }

.wp-block-pullquote {
	border-top: 2px solid var(--ce-accent);
	border-bottom: 2px solid var(--ce-accent);
	padding: var(--ce-space-8) 0;
}

/* Editor colour palette classes (registered in inc/blocks.php) */
.has-ce-primary-color        { color: var(--ce-primary) !important; }
.has-ce-primary-background-color { background-color: var(--ce-primary) !important; }
.has-ce-accent-color         { color: var(--ce-accent-light) !important; }
.has-ce-accent-background-color  { background-color: var(--ce-accent-light) !important; }
.has-ce-navy-color           { color: var(--ce-indigo) !important; }
.has-ce-navy-background-color    { background-color: var(--ce-indigo) !important; }
.has-ce-ink-color            { color: var(--ce-ink) !important; }
.has-ce-ink-background-color     { background-color: var(--ce-ink) !important; }
.has-ce-surface-alt-background-color { background-color: var(--ce-surface-alt) !important; }
.has-ce-white-color          { color: var(--ce-white) !important; }
.has-ce-white-background-color   { background-color: var(--ce-white) !important; }

/* ===========================================================================
 * Kadence corrections
 * ---------------------------------------------------------------------------
 * The child theme supplies its own header and footer, so Kadence's own chrome
 * must not also render. These are defensive: if Kadence's templates are
 * reached through a plugin-supplied template, its header/footer stay hidden.
 * ======================================================================== */
#masthead.site-header,
#colophon.site-footer,
.kadence-scroll-to-top,
#mobile-drawer.popup-drawer {
	display: none !important;
}

/* Kadence wraps content in .content-area / .site-main with its own spacing */
.ce-site .content-area,
.ce-site .site-main {
	margin: 0;
	padding: 0;
	max-width: none;
}

/* ===========================================================================
 * Utility: page section spacing inside the editor-managed content
 * ======================================================================== */
.ce-main > section:first-child { margin-top: 0; }

/* Keep wide/full alignments from breaking the horizontal scroll rule */
.alignfull { max-width: 100vw; overflow-x: clip; }
