/*
Theme Name: Science Driven Residential Ventilation
Author: Science Driven Residential Ventilation
Description: Block theme for Science Driven Residential Ventilation.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 0.3.3
Text Domain: sdrv-wp-theme
*/

/*
 * theme.json can set a focus color, but not an outline ring.
 * The dark ring is the default. Brand backgrounds use the light ring.
 */
:focus-visible {
	outline: 2px solid var(--wp--custom--color--focus, #14233e);
	outline-offset: 2px;
}

.has-brand-background-color :focus-visible {
	outline-color: var(--wp--custom--color--focus-on-dark, #7fd0e8);
}

.wp-block-site-title a {
	align-items: center;
	display: inline-flex;
	gap: 0.75rem;
}

.sdrv-logo {
	display: block;
	height: 2.5rem;
	max-width: 16rem;
	width: auto;
}

/*
 * Landing hero. Layout only: every colour and size comes from theme.json.
 */

/*
 * WordPress only relaxes alignwide when the PARENT layout is constrained, and the
 * front page main element is not, so an alignwide hero was being sized to the 40rem
 * content width and squeezing the four point columns. Set the wide width here so it
 * does not depend on the parent.
 */
.wp-block-group.sdrv-hero {
	margin-inline: auto;
	max-width: var(--wp--style--global--wide-size, 75rem);
}

.sdrv-hero__grid {
	display: grid;
	gap: var(--wp--preset--spacing--50, 1.5rem);
	/*
	 * A grid column is auto sized, which means max-content, and that lets a long
	 * uppercase line push the whole page wider than the viewport and scroll
	 * sideways. minmax(0, 1fr) keeps the column inside its container.
	 */
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 48rem) {
	.sdrv-hero__grid {
		align-items: start;
		/*
		 * From here up the house becomes a full size background anchored to the
		 * bottom of this container, so the whole illustration shows rather than the
		 * band the file is cropped to. The image element is hidden at this width and
		 * comes back on narrow screens, where the crop is the better fit.
		 */
		background-image: url(assets/images/hero-ventilation-2525.webp);
		background-position: bottom center;
		background-repeat: no-repeat;
		background-size: contain;
		grid-template-columns: minmax(0, 50%) minmax(0, 1fr);
		/*
		 * Room below the text, which pushes the bottom anchored illustration down.
		 * The pad is what keeps the text out of the artwork, so it is measured
		 * rather than eyeballed. Ken's 2525px file is a wider crop than the 1168px
		 * one it replaced, aspect 4.19 against 3.41, so drawn to the same 1168px
		 * wide it is shorter, 279px against 343px, and its treeline sits lower in
		 * the frame, 66 percent down the left half against 53. The pad has to
		 * exceed 34 percent of the drawn height, which is 94px at the widest, so
		 * 150px leaves about 56px of clear sky below the tagline. Below 1280px the
		 * illustration is drawn smaller again, so the clearance only grows.
		 */
		padding-bottom: 150px;
	}

	.sdrv-hero__house {
		display: none;
	}
}

.sdrv-hero__brand {
	text-align: center;
}

/*
 * The wordmark is the largest thing in the hero, so its size is what sets the
 * height of the text block. 26rem drew it 316px tall at desktop widths, which
 * read as top heavy against the illustration. 22rem returns about 50px to the
 * composition. The clearance from the artwork itself comes from the grid's
 * bottom pad below, not from this.
 */
.sdrv-hero__lockup {
	margin: 0 auto;
	max-width: min(22rem, 100%);
}

.sdrv-hero__lockup img {
	height: auto;
	width: 100%;
}

.sdrv-hero__tagline {
	color: var(--wp--preset--color--text-heading, #14233e);
	font-size: var(--wp--preset--font-size--medium, 1rem);
	font-weight: 400;
	letter-spacing: 0.055em;
	line-height: 1.35;
	margin: var(--wp--preset--spacing--40, 1rem) 0 0;
	text-transform: uppercase;
}

.sdrv-hero__strap {
	border-left: 1px solid var(--wp--preset--color--text-heading, #14233e);
	color: var(--wp--preset--color--text-heading, #14233e);
	font-size: clamp(0.9rem, 0.6rem + 0.9vw, 1rem);
	font-weight: 600;
	letter-spacing: 0.07em;
	line-height: 1.65;
	margin: 0 0 var(--wp--preset--spacing--40, 1rem);
	padding-left: 10px;
	text-transform: uppercase;
}

/*
 * The strapline only exists in the two column layout. Below this it is the first
 * thing to go, since the wordmark, the tagline and the house still carry the
 * message. The 47.99rem matches the 48rem (768px) layout breakpoint, so the
 * strapline and the split layout appear and disappear together.
 */
@media (max-width: 47.99rem) {
	.sdrv-hero__strap {
		display: none;
	}
}

.sdrv-hero__strap-green {
	color: var(--wp--custom--color--leaf, #2e7c18);
}

.sdrv-hero__house {
	margin: 0;
}

/*
 * On phones the illustration is an element rather than a background, cropped to
 * the house. The minimum height is what sets how much of the file survives that
 * crop: at 13rem a 375px screen saw 38 percent of the width, which took the left
 * side off the house once Ken's wider export was in, where the previous file
 * showed 46 percent. At 11rem it sees 44 percent, which holds the whole house
 * and matches the framing the old file gave at 13rem.
 */
.sdrv-hero__house img {
	display: block;
	height: clamp(11rem, 26vw, 21rem);
	object-fit: cover;
	object-position: 84% 50%;
	width: 100%;
}

.sdrv-points {
	border-block: 1px solid var(--wp--preset--color--accent, #00799c);
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	list-style: none;
	margin: 0;
	margin-block-start: var(--wp--preset--spacing--30, 0.5rem);
	padding: 0;
}

.sdrv-point {
	align-items: start;
	border-top: 1px solid var(--wp--preset--color--accent, #00799c);
	display: grid;
	gap: 0.85rem;
	grid-template-columns: auto minmax(0, 1fr);
	padding: var(--wp--preset--spacing--40, 1rem) 0;
}

.sdrv-point:first-child {
	border-top: 0;
}

@media (min-width: 48rem) {
	.sdrv-points {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.sdrv-point {
		border-left: 1px solid var(--wp--preset--color--accent, #00799c);
		border-top: 0;
		padding: var(--wp--preset--spacing--40, 1rem) var(--wp--preset--spacing--50, 1.5rem);
	}

	.sdrv-point:first-child {
		border-left: 0;
		padding-left: 0;
	}
}

.sdrv-point__ring {
	align-items: center;
	border: 1px solid currentColor;
	border-radius: 50%;
	display: flex;
	height: 2.75rem;
	justify-content: center;
	width: 2.75rem;
}

.sdrv-point__ring svg {
	height: 1.375rem;
	width: 1.375rem;
}

.sdrv-point--accent {
	color: var(--wp--preset--color--accent, #00799c);
}

.sdrv-point--leaf {
	color: var(--wp--custom--color--leaf, #2e7c18);
}

.sdrv-point--lime {
	color: var(--wp--custom--color--lime, #6fa405);
}

.sdrv-point__title,
.sdrv-point__text {
	display: block;
}

.sdrv-point__title {
	color: var(--wp--preset--color--text-heading, #14233e);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	letter-spacing: 0.045em;
	line-height: 1.35;
	margin: 0;
	text-transform: uppercase;
}

.sdrv-point__text {
	color: var(--wp--preset--color--text-muted, #646c79);
	font-size: 0.8125rem;
	line-height: 1.5;
	margin: 0.15em 0 0;
}

/* The uppercase lines size themselves with the clamps above, so no step down is needed. */

/*
 * Forms.
 *
 * The PortNW CRM subscribe form and the contact form both arrive with controls
 * that carry no styling of their own, so every field falls back to the browser
 * default and the Subscribe button renders as a small grey native button beside
 * a finished hero.
 *
 * The selectors are written as .entry-content form <control> rather than against
 * the plugin's own classes. The plugin's sheet loads first, so matching its
 * specificity would still win today, but the result would then depend on load
 * order, and one set of rules written this way covers every form in the content.
 */
.entry-content form label {
	color: var(--wp--preset--color--text-heading, #14233e);
	display: block;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	margin-bottom: var(--wp--preset--spacing--30, 0.5rem);
}

.entry-content form input[type="text"],
.entry-content form input[type="email"],
.entry-content form input[type="tel"],
.entry-content form input[type="url"],
.entry-content form input[type="number"],
.entry-content form input[type="search"],
.entry-content form select,
.entry-content form textarea {
	background: var(--wp--preset--color--bg, #ffffff);
	border: 1px solid var(--wp--custom--color--border-control, #8597a9);
	border-radius: 6px;
	box-sizing: border-box;
	color: var(--wp--preset--color--text-body, #3a4657);
	font: inherit;
	max-width: 100%;
	padding: 0.625rem 0.75rem;
	width: 100%;
}

.entry-content form textarea {
	min-height: 8rem;
}

.entry-content form input::placeholder,
.entry-content form textarea::placeholder {
	color: var(--wp--preset--color--text-muted, #646c79);
	opacity: 1;
}

.entry-content form button,
.entry-content form input[type="submit"] {
	background: var(--wp--preset--color--brand, #14233e);
	border: 1px solid transparent;
	border-radius: 6px;
	color: var(--wp--preset--color--text-on-dark, #f4f7fa);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 0.75rem 1.25rem;
}

.entry-content form button:hover,
.entry-content form input[type="submit"]:hover {
	background: var(--wp--custom--color--brand-hover, #0c1627);
}

/*
 * The PortNW CRM subscribe form. The plugin already lays the fields out in a
 * column and hides its honeypot off screen, so only the parts it leaves open are
 * set here. Its note softened the text with opacity, which makes the contrast
 * depend on whatever sits behind it, so that is replaced with the palette muted
 * colour at full opacity.
 */
.entry-content .portnw-crm-subscribe__title {
	margin: 0 0 var(--wp--preset--spacing--40, 1rem);
}

.entry-content .portnw-crm-subscribe__form {
	gap: var(--wp--preset--spacing--40, 1rem);
}

.entry-content .portnw-crm-subscribe__note {
	color: var(--wp--preset--color--text-muted, #646c79);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	opacity: 1;
}

.entry-content .portnw-crm-subscribe .required {
	color: var(--wp--custom--color--danger-text, #9a211a);
}

/*
 * The message the form shows above itself after a submit, which carries
 * role="status" so it is announced. The palette's notice shape is a tint with a
 * solid left rule, and the plugin's own green and red are replaced with the
 * palette values.
 */
.entry-content .portnw-crm-subscribe__notice {
	border: 1px solid;
	border-left-width: 4px;
	border-radius: 6px;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
	padding: var(--wp--preset--spacing--30, 0.5rem) var(--wp--preset--spacing--40, 1rem);
}

.entry-content .portnw-crm-subscribe__notice--success {
	background: var(--wp--custom--color--success-subtle, #e8f5ee);
	border-color: var(--wp--custom--color--success-border, #78b192);
	border-left-color: var(--wp--custom--color--success-base, #1d7a46);
	color: var(--wp--custom--color--success-text, #165d35);
}

.entry-content .portnw-crm-subscribe__notice--error {
	background: var(--wp--custom--color--danger-subtle, #fbeceb);
	border-color: var(--wp--custom--color--danger-border, #d37f7a);
	border-left-color: var(--wp--custom--color--danger-base, #b3261e);
	color: var(--wp--custom--color--danger-text, #9a211a);
}
