/*
Theme Name:        JHLC-v2
Author:            isometria.dev
Version:           1.3.0
Requires at least: 7.1
Tested up to:      7.1
Requires PHP:      8.2
Text Domain:       jhlc
Tags:              jhlc
*/

/* Tilda Sans (assets/fonts) is © 2021 Tilda Publishing, released under the SIL Open Font License 1.1. */

/*
 * What is here is what blocks cannot say: how the page behaves (the pinned header, the
 * front page's screens, which assets/js/frontpage.js moves between), and the form plugin's
 * fields. Colour, type, spacing, buttons and layout are in theme.json, styles/*.json and
 * the blocks themselves, so the editor shows what the site shows.
 */

:root {
	--jhlc-header-height: 68px;
	/* What covers the top of the window: the pinned header, and the admin bar when signed in (below). */
	--jhlc-top: var(--jhlc-header-height);

	/* The 404 page keeps its own navy look. */
	--jhlc-navy: #001836;
	--jhlc-blue: #326fbd;
	--jhlc-ink: #1f2a3a;
	--jhlc-muted: #5b6678;
	--jhlc-line: #e3e8ef;
	--jhlc-tint: #f4f7fb;
}

body {
	-webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
 * Header: one part on every template, pinned to the top of the window.
 * ------------------------------------------------------------------------ */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

/* Below the admin bar for somebody signed in (it stops being fixed on a phone). */
.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

/* Signed in on a wide screen, the admin bar sits above the header: sections fit under both.
 * (They land under both too: WordPress pads the page by the admin bar's height, and the
 * margin below adds the header's.) */
@media (min-width: 601px) {
	html:has(body.admin-bar) {
		--jhlc-top: calc(var(--jhlc-header-height) + var(--wp-admin--admin-bar--height, 32px));
	}
}

/* The links fit beside the logo and Support us from 1024px; narrower, the burger takes
 * over (WordPress only switches below 600px), so the header stays one 68px row. */
@media (min-width: 600px) and (max-width: 1023px) {
	.jhlc-masthead__nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.jhlc-masthead__nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

/* The opened menu: the header's grey, the links large. */
.jhlc-masthead__nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 24px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px));
	background: var(--wp--preset--color--header-bg);
}

.jhlc-masthead__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	gap: 20px;
	padding-top: 56px;
	font-size: 26px;
	font-weight: 600;
}

.jhlc-masthead__nav .wp-block-navigation__responsive-container-open svg {
	width: 28px;
	height: 28px;
}

/* An in-page link lands just below the pinned header, not under it. A margin on the
 * targets, not padding on the page: page padding would count the header's own strip as
 * out of view, and focusing a header link would scroll the page. */
[id],
.jhlc-snap {
	scroll-margin-top: var(--jhlc-header-height);
}

/* Glide to an in-page link; not on the front page, whose own script moves the window
 * (assets/js/frontpage.js) and would be fought by the browser's smoothing. */
@media (prefers-reduced-motion: no-preference) {
	html:not(:has(body.home)) {
		scroll-behavior: smooth;
	}
}

/* Keyboard focus on a button: a solid ring, white on the dark footer. */
.wp-block-button__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--ink);
	outline-offset: 2px;
}

.jhlc-footer .wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--white);
}

.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* For a dark background: the 404. */
.jhlc-button--light .wp-block-button__link {
	border: 1px solid rgba(255, 255, 255, 0.7);
	background: transparent;
	color: #fff;
}

.jhlc-button--light .wp-block-button__link:hover,
.jhlc-button--light .wp-block-button__link:focus-visible {
	border-color: #fff;
	background: #fff;
	color: var(--jhlc-ink);
}

/* ---------------------------------------------------------------------------
 * Front page: a section per screen on a wide screen — the hero, Services,
 * About us, the support band, Contact us. Each takes 90% of the window under
 * the header, so the top of the next one, its label or title, shows beneath
 * it and invites a scroll. assets/js/frontpage.js moves the window between
 * them down to Contact; from there the page scrolls as usual.
 * ------------------------------------------------------------------------ */

/* The hero is a Cover block with a fixed background (the Cover's parallax setting): the
 * building stays put while the page scrolls over it, and shows again through the support
 * band, the one section with no ground of its own (a Cover onto the same photo, darkened).
 * The clock sits right of centre (the Cover's position). */
.wp-block-cover.jhlc-hero,
.wp-block-cover.jhlc-band {
	min-height: calc(90vh - var(--jhlc-top));
	min-height: calc(90svh - var(--jhlc-top));
}

.wp-block-cover.jhlc-hero .wp-block-cover__inner-container {
	width: auto;
}

/* The band's label stays at its top; its statement and button, one group, sit in the middle
 * of the height left below the label. */
.wp-block-cover.jhlc-band > .wp-block-cover__inner-container {
	display: flex;
	flex-direction: column;
	align-self: stretch;
}

.wp-block-cover.jhlc-band .jhlc-band__inner {
	flex: 1;
}

.wp-block-cover.jhlc-band .jhlc-band__statement {
	margin-block: auto;
}

.wp-block-group.jhlc-snap {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	box-sizing: border-box;
	min-height: calc(90vh - var(--jhlc-top));
	min-height: calc(90svh - var(--jhlc-top));
}

/* In a column that centres its content, each block still takes the column's width. */
.wp-block-group.jhlc-snap > * {
	box-sizing: border-box;
	width: 100%;
}


/* A short window (a 768px laptop, more so with the admin bar) still takes Services' label,
 * cards and button in one screen: the icons and the space above them give a little. */
@media (min-width: 768px) and (max-height: 820px) {
	.jhlc-services .jhlc-card {
		padding-top: 24px !important;
	}

	.jhlc-services .jhlc-card__icon img {
		width: 110px !important;
	}
}

/* A phone shows each section at its own height (stretched to the screen, a short one
 * would stand in empty space) and the clock centred, at the size of the screen. */
@media (max-width: 767px) {
	.wp-block-group.jhlc-snap {
		min-height: 0;
	}

	.wp-block-cover.jhlc-hero {
		min-height: 0;
		padding: 32px 0 48px !important;
	}

	.wp-block-cover.jhlc-band {
		min-height: 0;
		padding-block: 60px !important;
	}

	.wp-block-cover.jhlc-hero .wp-block-cover__inner-container {
		width: 100%;
		margin-inline: auto;
	}

	.jhlc-hero .element-clock-menu {
		margin-inline: auto;
	}
}

/* A large phone or a small tablet has room for more than the 360px clock... */
@media (min-width: 480px) and (max-width: 767px) {
	.jhlc-hero .element-clock-menu {
		zoom: 1.25;
	}
}

/* ...and a phone narrower than it plus a little air shrinks it to fit. */
@media (max-width: 379px) {
	.jhlc-hero .element-clock-menu {
		zoom: 0.85;
	}
}

/* ---------------------------------------------------------------------------
 * Contact: the Ax form's own fields take the system's input — square, 60px,
 * a 1px ink line on the ground — and its submit the teal pill. The rules hang
 * on #contact to outrank the form plugin's (form.css), written to be firm.
 * ------------------------------------------------------------------------ */

#contact form input[type="text"],
#contact form input[type="email"],
#contact form input[type="tel"],
#contact form select,
#contact form textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 60px;
	padding: 0 20px;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	background: var(--wp--preset--color--ground);
	color: var(--wp--preset--color--ink);
	font: 400 16px/21px var(--wp--preset--font-family--tilda-sans);
}

/* The Shortcode block puts the form through WordPress's paragraph filter, which leaves
 * empty paragraphs between its fields (and around the clock): they take no room. */
#contact form p:empty,
.jhlc-hero .wp-block-cover__inner-container > p:empty {
	display: none;
}

#contact form textarea {
	min-height: 150px;
	padding-block: 18px;
}

#contact form ::placeholder {
	color: var(--wp--preset--color--ink);
	opacity: 0.5;
}

#contact form input:focus,
#contact form select:focus,
#contact form textarea:focus {
	outline: 2px solid var(--wp--preset--color--teal-strong);
	outline-offset: 0;
}

#contact form button[type="submit"] {
	min-height: 60px;
	padding: 0 60px;
	border: 0;
	border-radius: 30px;
	background: var(--wp--preset--color--teal);
	color: var(--wp--preset--color--white);
	font: 600 16px/22px var(--wp--preset--font-family--tilda-sans);
	cursor: pointer;
}

#contact form button[type="submit"]:hover,
#contact form button[type="submit"]:focus-visible {
	background: var(--wp--preset--color--teal-strong);
}

/* ---------------------------------------------------------------------------
 * 404: the front page's photo under a navy veil, one centred message.
 * ------------------------------------------------------------------------ */

.wp-block-group.jhlc-404 {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 72vh;
	min-height: 72svh;
	margin: 0;
	padding: 72px 24px;
	background:
		linear-gradient(180deg, rgba(0, 24, 54, 0.82) 0%, rgba(0, 24, 54, 0.94) 100%),
		url("https://new.jhlc.org/wp-content/uploads/2026/09/hero-bg-1.jpg") center / cover no-repeat;
	color: #fff;
	text-align: center;
}

.wp-block-group.jhlc-404__inner {
	width: 100%;
	max-width: 640px;
}

.jhlc-404__inner > * {
	margin-inline: auto;
}

.jhlc-404 .jhlc-404__code {
	margin-top: 0;
	margin-bottom: 8px;
	background: linear-gradient(135deg, #70cd49 0%, var(--jhlc-blue) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-family: var(--wp--preset--font-family--tilda-sans);
	font-size: clamp(88px, 18vw, 160px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
}

.jhlc-404 .jhlc-404__title {
	margin-top: 0;
	margin-bottom: 16px;
	color: #fff;
	font-family: var(--wp--preset--font-family--tilda-sans);
	font-size: clamp(26px, 4vw, 38px);
	line-height: 1.2;
}

.jhlc-404 .jhlc-404__lead {
	max-width: 520px;
	margin-top: 0;
	margin-bottom: 32px;
	color: #d5dcea;
	font-size: clamp(16px, 1.6vw, 18px);
	line-height: 1.7;
}

.jhlc-404__search {
	max-width: 480px;
	margin-bottom: 24px;
}

.jhlc-404__search .wp-block-search__inside-wrapper {
	gap: 8px;
}

.jhlc-404__search .wp-block-search__input {
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.96);
	color: var(--jhlc-ink);
	font-size: 16px;
}

.jhlc-404__search .wp-block-search__button {
	min-height: 44px;
	margin: 0;
	padding: 0 1.4em;
	border: 1px solid #fff;
	border-radius: 5px;
	background: transparent;
	color: #fff;
}

.jhlc-404__search .wp-block-search__button:hover,
.jhlc-404__search .wp-block-search__button:focus-visible {
	background: #fff;
	color: var(--jhlc-navy);
}

.jhlc-404 .jhlc-404__actions {
	justify-content: center;
	gap: 12px;
	margin-bottom: 32px;
}

.jhlc-404 .jhlc-404__help {
	margin: 0;
	color: #a9b4c6;
	font-size: 14px;
}

.jhlc-404__help a {
	color: #fff;
}

@media (max-width: 600px) {
	.wp-block-group.jhlc-404 {
		padding: 56px 16px;
	}

	.jhlc-404__search .wp-block-search__inside-wrapper {
		flex-wrap: wrap;
	}

	.jhlc-404__search .wp-block-search__input,
	.jhlc-404__search .wp-block-search__button,
	.jhlc-404 .jhlc-404__actions .wp-block-button {
		width: 100%;
	}
}

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