/*
 * JWC theme styles that theme.json cannot express:
 * sticky header, cards, service cards, gallery, lead form, small typographic details.
 * Colors and sizes always come from theme.json presets.
 */

:root {
	--jwc-radius: var(--wp--custom--radius--card, 4px);
	--jwc-ease: cubic-bezier(.2, .7, .2, 1);
}

html { scroll-padding-top: 96px; }
/* clip (not hidden) keeps the sticky header working. */
body, .wp-site-blocks { overflow-x: clip; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; }
:where(a, button, summary, input, textarea):focus-visible { outline: 2px solid var(--wp--preset--color--cedar); outline-offset: 3px; }

/* ---------- Section rhythm ---------- */

/* Full-width bands sit flush against each other and the header/footer. */
.wp-site-blocks > * { margin-block-start: 0; }
.wp-block-post-content > .alignfull,
.wp-block-post-content > .alignfull + * { margin-block-start: 0; }

/* Two neighboring bands with the same background read as one section: drop the second's top padding. */
.wp-block-post-content > .alignfull:not(.has-background):not(.wp-block-cover) + .alignfull:not(.has-background):not(.wp-block-cover),
.wp-block-post-content > .has-cream-background-color + .has-cream-background-color { padding-top: 0 !important; }

/* Text rhythm: eyebrow sits tight to its heading, headings lead into text, actions get room. */
.wp-site-blocks :not(.is-layout-flex) > .is-style-eyebrow + :is(h1, h2, h3) { margin-block-start: .6rem; }
.wp-site-blocks :not(.is-layout-flex) > :is(h1, h2) + :is(p, .wp-block-list) { margin-block-start: 1rem; }
.wp-site-blocks :not(.is-layout-flex) > :is(h3, h4) + p { margin-block-start: .5rem; }
.wp-site-blocks :not(.is-layout-flex) > :is(p, .wp-block-list, .wp-block-image) + .wp-block-buttons { margin-block-start: 1.75rem; }
.wp-site-blocks :not(.is-layout-flex) > .jwc-lede + p { margin-block-start: 1rem; }
.wp-site-blocks :not(.is-layout-flex) > :is(h2) + .wp-block-group.is-layout-grid,
.wp-site-blocks :not(.is-layout-flex) > :is(p) + .wp-block-group.is-layout-grid,
.wp-site-blocks :not(.is-layout-flex) > :is(p, h2) + .wp-block-query { margin-block-start: var(--wp--preset--spacing--40); }

/* ---------- Dark sections ---------- */

:is(.has-charcoal-background-color, .has-timber-background-color, .wp-block-cover.is-dark) :is(h1, h2, h3, h4, h5, h6):not([class*="-color"]) { color: var(--wp--preset--color--white); }
:is(.has-charcoal-background-color, .has-timber-background-color, .wp-block-cover.is-dark) a:not(.wp-element-button) { color: inherit; }
:is(.has-charcoal-background-color, .has-timber-background-color, .wp-block-cover.is-dark) a:not(.wp-element-button):hover { color: var(--wp--preset--color--white); }

/* ---------- Header ---------- */

/* The template part wrapper is the sticky element. */
.wp-site-blocks > header:has(.jwc-header) { position: sticky; top: 0; z-index: 50; }
.admin-bar .wp-site-blocks > header:has(.jwc-header) { top: 32px; }
@media (max-width: 782px) {
	.admin-bar .wp-site-blocks > header:has(.jwc-header) { top: 46px; }
}
.jwc-header { transition: box-shadow .25s var(--jwc-ease); }
.jwc-header.is-scrolled { box-shadow: 0 6px 24px rgba(0, 0, 0, .28); }

.jwc-header .jwc-brand { flex: none; }
.jwc-header .jwc-brand img { display: block; }
@media (max-width: 600px) {
	.jwc-header .jwc-brand img { width: 104px !important; }
}

.jwc-header .wp-block-navigation { margin-left: auto; }
.jwc-header .wp-block-navigation a { text-decoration: none; }
.jwc-header .wp-block-navigation-item__content { white-space: nowrap; }
.jwc-header .wp-block-navigation .wp-block-navigation-item__content:hover,
.jwc-header .wp-block-navigation [aria-current="page"] { color: var(--wp--preset--color--white); }
.jwc-header .wp-block-navigation__submenu-container {
	border: 0 !important;
	border-radius: var(--jwc-radius);
	box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
	padding: .5rem 0;
	min-width: 220px !important;
	background: var(--wp--preset--color--charcoal) !important;
}
.jwc-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: .55rem 1.1rem !important; }
.jwc-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--charcoal) !important;
	color: var(--wp--preset--color--sand) !important;
	padding: 1.5rem;
}
.jwc-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.jwc-header .is-menu-open .wp-block-navigation__container,
.jwc-header .is-menu-open .wp-block-navigation-item { align-items: flex-start !important; text-align: left; }
.jwc-header .is-menu-open .wp-block-navigation__container { gap: 1.1rem !important; font-size: var(--wp--preset--font-size--large); padding-top: 1rem; }
.jwc-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container { box-shadow: none; padding: .5rem 0 0 1rem; font-size: var(--wp--preset--font-size--medium); }
.jwc-header .jwc-phone a { color: inherit; text-decoration: none; white-space: nowrap; font-weight: 600; }
.jwc-header .jwc-phone a:hover { color: var(--wp--preset--color--white); }
.jwc-header .wp-block-button__link { white-space: nowrap; padding: .8em 1.3em; }
.jwc-header .jwc-header-actions { flex-shrink: 0; }
@media (max-width: 1080px) { .jwc-header .jwc-phone { display: none; } }
@media (max-width: 600px) {
	.jwc-header .wp-block-button__link { font-size: .75rem !important; padding: .7em .9em; letter-spacing: .06em; }
	.jwc-header .jwc-header-actions { gap: .5rem; }
}
@media (max-width: 380px) { .jwc-header .jwc-header-cta { display: none; } }
/* Below 900px the full menu doesn't fit beside the button: use the overlay menu (core switches only at 600px). */
@media (max-width: 899px) {
	.jwc-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.jwc-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}
/* The phone and button sit after the menu; with the compact menu, the menu button comes last. */
@media (max-width: 899px) {
	.jwc-header .wp-block-navigation { order: 3; margin-left: .25rem; }
	.jwc-header .jwc-header-actions { margin-left: auto; }
}

/* ---------- Typography helpers ---------- */

.is-style-eyebrow {
	font-family: var(--wp--preset--font-family--source-sans) !important;
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 700 !important;
	letter-spacing: .16em !important;
	text-transform: uppercase;
	line-height: 1.4 !important;
	display: flex;
	align-items: center;
	gap: .75rem;
}
.is-style-eyebrow::before {
	content: "";
	width: 2rem;
	height: 2px;
	background: currentColor;
	flex: none;
}
.has-text-align-center.is-style-eyebrow { justify-content: center; }
.wp-block-post-terms.is-style-eyebrow a { color: inherit; text-decoration: none; }

.jwc-lede { font-size: var(--wp--preset--font-size--large); line-height: 1.55; }
.jwc-fine { font-size: var(--wp--preset--font-size--x-small); line-height: 1.6; opacity: .8; }
/* Hero text lines up with the header's content column; core shrinks a positioned cover's inner container to its content. */
.jwc-hero .wp-block-cover__inner-container { width: 100% !important; max-width: var(--wp--style--global--wide-size, 1240px); margin-inline: auto !important; }
.jwc-hero .wp-block-cover__inner-container > * { margin-left: 0 !important; margin-right: 0 !important; }
.jwc-hero h1 { text-shadow: 0 2px 24px rgba(0, 0, 0, .25); max-width: 18ch; }
.jwc-hero .jwc-lede { max-width: 640px; text-shadow: 0 1px 12px rgba(0, 0, 0, .4); }
.jwc-hero .is-style-eyebrow { text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }

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

.wp-block-button.is-style-ghost .wp-block-button__link {
	background: transparent;
	color: currentColor;
	border-color: currentColor;
}
.wp-block-button.is-style-ghost .wp-block-button__link:hover {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--charcoal);
	border-color: var(--wp--preset--color--white);
}
/* Ghost on a light background: dark outline, fills charcoal on hover. */
:is(.has-cream-background-color, .has-white-background-color, .has-sand-background-color) .wp-block-button.is-style-ghost .wp-block-button__link:hover {
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--charcoal);
}
.wp-block-button.is-style-link .wp-block-button__link {
	background: none;
	border: 0;
	padding: 0;
	color: var(--wp--preset--color--cedar);
}
.wp-block-button.is-style-link .wp-block-button__link::after { content: " →"; transition: margin .2s var(--jwc-ease); }
.wp-block-button.is-style-link .wp-block-button__link:hover { color: var(--wp--preset--color--cedar-dark); background: none; }
.wp-block-button.is-style-link .wp-block-button__link:hover::after { margin-left: .25em; }
.wp-block-button.is-style-link.jwc-back-link .wp-block-button__link::after { content: none; }
.wp-block-button.is-style-link.jwc-back-link .wp-block-button__link::before { content: "← "; }

/* ---------- Cards ---------- */

.is-style-card {
	background: var(--wp--preset--color--white);
	border-radius: var(--jwc-radius);
	box-shadow: var(--wp--preset--shadow--card);
	overflow: hidden;
	height: 100%;
	display: flex;
	flex-direction: column;
}
/* A card's link sits at the bottom, so links line up across a row. */
.is-style-card > .wp-block-buttons:last-child { margin-top: auto; padding-top: 1rem; }
.has-white-background-color .is-style-card,
.wp-block-post-content > :not(.has-background) .is-style-card { box-shadow: 0 0 0 1px var(--wp--preset--color--stone), var(--wp--preset--shadow--card); }

/* Service cards: a cedar rule on top, whole card clickable through its heading link. */
.jwc-service-card { position: relative; border-top: 3px solid var(--wp--preset--color--cedar); transition: transform .3s var(--jwc-ease), box-shadow .3s var(--jwc-ease); }
.jwc-service-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(30,27,24,.06), 0 16px 36px rgba(30,27,24,.12); }
.jwc-service-card h3 a { color: inherit; text-decoration: none; }
.jwc-service-card h3 a::after { content: ""; position: absolute; inset: 0; }
.jwc-service-card .jwc-card-more { margin-top: auto !important; padding-top: .75rem; }

.jwc-project-card { position: relative; }
.jwc-project-card .wp-block-post-featured-image { margin: 0; overflow: hidden; }
.jwc-project-card .wp-block-post-featured-image img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; transition: transform .6s var(--jwc-ease); }
.jwc-project-card:hover .wp-block-post-featured-image img { transform: scale(1.04); }
.jwc-project-card .wp-block-post-title a { text-decoration: none; }
.jwc-project-card .wp-block-post-title a::after { content: ""; position: absolute; inset: 0; }
.jwc-project-card .jwc-card-type { position: relative; z-index: 1; }
.jwc-card-more { color: var(--wp--preset--color--cedar); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.jwc-card-more::after { content: " →"; transition: margin .2s var(--jwc-ease); }
:is(.jwc-project-card, .jwc-service-card):hover .jwc-card-more::after { margin-left: .25em; }

.wp-block-post-template.is-layout-grid { align-items: stretch; }
.wp-block-post-template > li { display: flex; }
.wp-block-post-template > li > * { flex: 1; }

/* ---------- Photo + text sections ---------- */

/* The photo fills the height of the text beside it instead of floating in the middle. */
@media (min-width: 782px) {
	.jwc-two-up > .wp-block-column:has(> .wp-block-image:only-child) { display: flex; }
	.jwc-two-up > .wp-block-column > .wp-block-image:only-child { flex: 1; margin: 0; position: relative; min-height: 420px; }
	.jwc-two-up > .wp-block-column > .wp-block-image:only-child img { position: absolute; inset: 0; width: 100%; height: 100% !important; aspect-ratio: auto !important; object-fit: cover; }
	.jwc-two-up > .wp-block-column:not(:has(> .wp-block-image:only-child)) { align-self: center; }
}

/* ---------- Values ---------- */

.jwc-value h3 { display: flex; align-items: baseline; gap: .6rem; }
.jwc-value-number { color: var(--wp--preset--color--cedar); font-family: var(--wp--preset--font-family--bitter); font-weight: 400; }

/* ---------- Steps ---------- */

.jwc-step-number {
	font-family: var(--wp--preset--font-family--bitter);
	font-size: var(--wp--preset--font-size--xx-large) !important;
	line-height: 1 !important;
	color: var(--wp--preset--color--cedar);
	font-weight: 400 !important;
}

/* ---------- Lists ---------- */

.is-style-checks { list-style: none; padding-left: 0; }
.is-style-checks li { position: relative; padding-left: 1.9rem; margin-bottom: .6rem; }
.is-style-checks li::before {
	content: "";
	position: absolute;
	left: 0;
	top: .4em;
	width: 1rem;
	height: .55rem;
	border-left: 2px solid var(--wp--preset--color--cedar);
	border-bottom: 2px solid var(--wp--preset--color--cedar);
	transform: rotate(-45deg);
}

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

.wp-block-gallery.is-style-masonry { display: block !important; columns: 3 300px; column-gap: .75rem; }
.wp-block-gallery.is-style-masonry .wp-block-image { width: 100% !important; margin: 0 0 .75rem !important; break-inside: avoid; display: block; }
.wp-block-gallery.is-style-masonry .wp-block-image img { width: 100%; height: auto !important; object-fit: initial !important; }
.wp-block-gallery .wp-block-image img { border-radius: 3px; }

/* ---------- Quotes ---------- */

.jwc-quote-mark { font-family: var(--wp--preset--font-family--bitter); font-size: 5rem !important; line-height: .6 !important; color: var(--wp--preset--color--cedar); }
.wp-block-pullquote { padding: var(--wp--preset--spacing--20) 0; }
.wp-block-pullquote blockquote p { font-size: inherit; }
.wp-block-pullquote cite {
	display: block;
	margin-top: 1rem;
	color: inherit;
	opacity: .85;
	font-family: var(--wp--preset--font-family--source-sans);
	font-size: var(--wp--preset--font-size--x-small);
	font-style: normal;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
}
.wp-block-pullquote cite::before { content: "— "; }

/* ---------- Footer ---------- */

.jwc-footer a { color: inherit; text-decoration: none; }
.jwc-footer a:hover { color: var(--wp--preset--color--white); text-decoration: underline; }
.jwc-footer-logo { display: inline-block; margin-bottom: .5rem; }
.jwc-footer-logo img { display: block; width: 180px; max-width: 100%; height: auto; }
.jwc-footer-heading { letter-spacing: .16em; text-transform: uppercase; font-family: var(--wp--preset--font-family--source-sans) !important; font-weight: 700 !important; }
.jwc-footer .wp-block-navigation { font-weight: 400; letter-spacing: 0; }
.jwc-footer-rule { border-color: rgba(233, 223, 208, .18) !important; opacity: 1; }
.jwc-cta .jwc-lede { color: var(--wp--preset--color--sand); }

/* ---------- Lead form ---------- */

.jwc-form-wrap { background: var(--wp--preset--color--white); border-radius: var(--jwc-radius); box-shadow: var(--wp--preset--shadow--card); padding: clamp(1.25rem, 3vw, 2.25rem); }
.jwc-form { display: grid; gap: 1rem; }
.jwc-form p { margin: 0; }
.jwc-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.jwc-form__row--3 { grid-template-columns: 2fr 1fr 1.2fr; }
@media (max-width: 560px) {
	.jwc-form__row { grid-template-columns: 1fr; }
	.jwc-form__row--3 { grid-template-columns: 1fr 1fr; }
	.jwc-form__row--3 > :first-child { grid-column: 1 / -1; }
}
.jwc-field label, .jwc-checks legend { display: block; font-weight: 600; font-size: var(--wp--preset--font-size--small); margin-bottom: .35rem; color: var(--wp--preset--color--charcoal); }
.jwc-field label span { color: var(--wp--preset--color--cedar); }
.jwc-form input[type="text"], .jwc-form input[type="email"], .jwc-form input[type="tel"], .jwc-form textarea {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	font-size: 1rem;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--stone);
	border-radius: 3px;
	padding: .7rem .8rem;
	transition: border-color .2s, box-shadow .2s;
}
.jwc-form input:focus, .jwc-form textarea:focus { outline: none; border-color: var(--wp--preset--color--cedar); box-shadow: 0 0 0 3px rgba(160, 86, 43, .18); }
.jwc-checks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.jwc-checks legend { width: 100%; padding: 0; }
.jwc-check { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border: 1px solid var(--wp--preset--color--stone); border-radius: 999px; cursor: pointer; font-size: var(--wp--preset--font-size--small); transition: border-color .2s, background .2s; }
.jwc-check:hover { border-color: var(--wp--preset--color--cedar); }
.jwc-check:has(input:checked) { border-color: var(--wp--preset--color--cedar); background: rgba(160, 86, 43, .08); }
.jwc-check input { accent-color: var(--wp--preset--color--cedar); margin: 0; }
.jwc-other { display: none; width: 100%; margin-top: .25rem !important; }
.jwc-checks:has(.jwc-other-toggle:checked) .jwc-other { display: block; }
.jwc-form__submit .wp-element-button { cursor: pointer; width: 100%; font-size: var(--wp--preset--font-size--small); padding: 1.05em 1.7em; }
.jwc-form__fine { font-size: var(--wp--preset--font-size--x-small); color: var(--wp--preset--color--muted); }
.jwc-form__notice { padding: .8rem 1rem; border-left: 3px solid var(--wp--preset--color--cedar); background: var(--wp--preset--color--cream); }
.jwc-form__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Contact details beside the form. */
.jwc-contact-list p { margin: 0; }
.jwc-contact-list a { color: inherit; text-decoration: none; }
.jwc-contact-list a:hover { color: var(--wp--preset--color--cedar); text-decoration: underline; }

/* ---------- Motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
