/*
Theme Name: KSM Twenty Twenty-Five Child
Theme URI: https://kawarthascalemodellers.com/
Description: A Kawartha Scale Modellers child theme for Twenty Twenty-Five. Charcoal masthead, KSM red accent system, editorial layouts, and reusable block patterns.
Author: Kawartha Scale Modellers
Template: twentytwentyfive
Version: 1.2.2
Requires at least: 6.7
Requires PHP: 7.2
Text Domain: ksm-twentytwentyfive
*/

/*
 * Most visual settings live in theme.json so they remain editable through
 * WordPress Global Styles. This file is intentionally small and structural.
 */

:root {
	--ksm-focus-ring: 3px solid var(--wp--preset--color--ksm-red, #d71920);
}

/* Charcoal brand shell. */
.ksm-masthead {
	position: relative;
	z-index: 20;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ksm-brand-rule {
	min-height: 4px;
}

.ksm-masthead .wp-block-site-title,
.ksm-masthead .wp-block-site-tagline {
	margin: 0;
}

.ksm-masthead .wp-block-site-title a {
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.055em;
}

.ksm-masthead .wp-block-site-tagline {
	opacity: 0.72;
	letter-spacing: 0.035em;
}

.ksm-masthead .wp-block-navigation-item__content {
	text-decoration: none;
	text-underline-offset: 0.32em;
}

.ksm-masthead .wp-block-navigation-item__content:hover,
.ksm-masthead .wp-block-navigation-item__content:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-decoration-color: var(--wp--preset--color--ksm-red, #d71920);
}

/* Strong keyboard focus for accessibility without changing the visual system. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.wp-element-button:focus-visible {
	outline: var(--ksm-focus-ring);
	outline-offset: 3px;
}


/*
 * Section colour inheritance:
 * headings follow the colour of the section/group they sit in unless an
 * explicit heading colour is assigned. This keeps titles visible on both
 * charcoal and light section backgrounds.
 */
.has-text-color :where(.wp-block-heading:not(.has-text-color)),
.has-text-color :where(h1:not(.has-text-color), h2:not(.has-text-color), h3:not(.has-text-color), h4:not(.has-text-color), h5:not(.has-text-color), h6:not(.has-text-color)) {
	color: inherit;
}

/* Brand display details. */
.ksm-eyebrow {
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.ksm-red-rule {
	width: 72px;
	min-height: 4px;
	margin-top: 0.5rem;
	background: var(--wp--preset--color--ksm-red, #d71920);
}

.ksm-card {
	border: 1px solid var(--wp--preset--color--line, #dadcde);
	background: var(--wp--preset--color--white, #ffffff);
	box-shadow: 0 8px 28px rgba(20, 22, 24, 0.05);
}

.ksm-card > .wp-block-group__inner-container,
.ksm-card.wp-block-group {
	min-height: 100%;
}

.ksm-card:hover {
	border-color: color-mix(in srgb, var(--wp--preset--color--ksm-red, #d71920) 45%, var(--wp--preset--color--line, #dadcde));
}

.ksm-article-grid .wp-block-post-featured-image img {
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.ksm-article-grid .wp-block-post-title a {
	text-decoration: none;
}

.ksm-article-grid .wp-block-post-title a:hover,
.ksm-article-grid .wp-block-post-title a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--ksm-red, #d71920);
	text-underline-offset: 0.18em;
}

/* Keep long technical articles readable inside the broader KSM page field. */
.ksm-prose,
.entry-content > p,
.entry-content > ul,
.entry-content > ol,
.entry-content > blockquote {
	text-wrap: pretty;
}

/*
 * v1.2 layout strategy:
 * - the site shell and page templates are full-width
 * - the normal global content field is 1080px for inherited/legacy layouts
 * - wide blocks can use up to 1600px
 * - page content defaults to a broad 1440px working field
 * - full-aligned blocks and featured images can run edge-to-edge
 * - long single-post prose remains approximately 800px for comfortable reading
 */

:root {
	--ksm-page-edge: clamp(18px, 4vw, 64px);
	--ksm-page-field: 1440px;
	--ksm-wide-field: 1600px;
	--ksm-reading-field: 820px;
}

/* Full-width page architecture. The page is broad by default; reading width is opt-in. */
.ksm-main,
.ksm-page-content,
.ksm-front-page-content,
.ksm-single-content {
	width: 100%;
	max-width: none;
}

.ksm-featured-image-full {
	width: 100%;
	max-width: none;
	margin: 0;
}

.ksm-featured-image-full img {
	display: block;
	width: 100%;
	height: auto;
}

body.page .ksm-page-content > :where(:not(.alignfull):not(.alignwide)),
.ksm-front-page-content > :where(:not(.alignfull):not(.alignwide)) {
	width: min(calc(100% - (2 * var(--ksm-page-edge))), var(--ksm-page-field));
	max-width: var(--ksm-page-field);
	margin-left: auto;
	margin-right: auto;
}

body.page .ksm-page-content > .alignwide,
.ksm-front-page-content > .alignwide {
	width: min(calc(100% - (2 * var(--ksm-page-edge))), var(--ksm-wide-field));
	max-width: var(--ksm-wide-field);
	margin-left: auto;
	margin-right: auto;
}

body.page .ksm-page-content > .alignfull,
.ksm-front-page-content > .alignfull {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

/* Apply this class only where a deliberately narrower reading measure is useful. */
.ksm-reading-width {
	width: min(calc(100% - (2 * var(--ksm-page-edge))), var(--ksm-reading-field)) !important;
	max-width: var(--ksm-reading-field) !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

body.single-post .wp-block-post-content > p,
body.single-post .wp-block-post-content > ul,
body.single-post .wp-block-post-content > ol,
body.single-post .wp-block-post-content > blockquote,
body.single-post .entry-content > p,
body.single-post .entry-content > ul,
body.single-post .entry-content > ol,
body.single-post .entry-content > blockquote {
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

/* Crisp, industrial geometry: restrained radius rather than pill-heavy UI. */
.wp-element-button,
.wp-block-button__link,
.wp-block-search__input,
.wp-block-search__button {
	border-radius: 3px;
}

.wp-element-button,
.wp-block-button__link {
	transition: filter 140ms ease, transform 140ms ease;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	filter: brightness(0.93);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(1px);
}


/* Footer uses the same responsive page-edge gutter as the full-width layout. */
.ksm-footer {
	box-sizing: border-box;
}

.ksm-footer a {
	text-underline-offset: 0.2em;
}

@media (max-width: 782px) {
	.ksm-masthead .wp-block-site-tagline {
		display: none;
	}

	.ksm-masthead .wp-block-site-logo img {
		max-width: 82px;
		height: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-element-button,
	.wp-block-button__link {
		transition: none;
	}
}
