/*
Theme Name: Paul Thompson Solicitors
Description: A WordPress block theme built with Shader and VX Framework, with block templates and theme.json.
Author: Stenson Wolf
Author URI: https://stensonwolf.com/
Text Domain: paul-thompson-solicitors
Version: 0.1.0
Requires at least: 7.1
Requires PHP: 8.1
Update URI: false
Theme URI: https://stensonwolf.com/
*/

/*
 * Plumbing only. The look lives in theme.json; this file holds what theme.json
 * can't express. It loads on the site and in the editor, so its rules must hold
 * in both.
 */

/* Room for a scrollbar on every page, so a short page and a long one line up
   where scrollbars take space, as on Windows, instead of the layout jumping
   sideways between them. */
html {
	scrollbar-gutter: stable;
}

/* WordPress puts a block gap between the template's top-level blocks: the
   header part, main and the footer part. Sections own their spacing instead.
   The editor's canvas root is .wp-site-blocks too while it shows a template,
   but there WordPress prints that gap after this file, so :root makes this win. */
:root .wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* With that gap gone, main keeps its distance from the header and footer. A
   template whose main starts or ends with a full-bleed section adds the
   is-flush class to main. */
.wp-site-blocks main {
	padding-block: var(--wp--preset--spacing--50);
}

.wp-site-blocks main.is-flush {
	padding-block: 0;
}

/* Keyboard focus stays visible on every control, and only there: in the
   editor, the text being typed in has focus too. */
:where(a, button, input, select, textarea, summary, [tabindex]:not([contenteditable])):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---- Site chrome ---- */

/* The header is a sticky group in each template; its parts paint their own backgrounds. */
.site-header-wrap {
	z-index: 50;
}
.site-header .site-logo,
.site-header .site-logo img {
	margin: 0;
}
.site-header .site-logo img {
	display: block;
	height: auto;
}
.site-header__nav {
	flex: 1 1 auto;
	justify-content: flex-end;
}
.site-header .wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--white);
}
.site-header .wp-block-navigation__submenu-container {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--mist);
	border-radius: 6px;
	box-shadow: var(--wp--preset--shadow--soft);
	color: var(--wp--preset--color--ink);
	min-width: 17rem;
	padding: var(--wp--preset--spacing--20);
}
.site-header .wp-block-navigation__submenu-container a {
	color: var(--wp--preset--color--ink);
}
.site-header .wp-block-navigation-item.current-menu-item > a,
.site-header .wp-block-navigation-item[class*="current"] > a {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--gold);
	text-underline-offset: 0.4em;
}
.site-topbar .wp-block-buttons {
	margin: 0;
}
.site-topbar p {
	margin: 0;
}

/* Footer */
.site-footer .wp-block-heading {
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	letter-spacing: 0.02em;
	margin-bottom: var(--wp--preset--spacing--30);
}
.site-footer a {
	text-decoration: none;
}
.site-footer a:hover {
	text-decoration: underline;
}
.site-footer .footer-list {
	list-style: none;
	padding: 0;
}
.site-footer .wp-block-separator {
	border-color: var(--wp--preset--color--ink-soft);
	opacity: 1;
}
.site-footer .footer-legal {
	margin-top: var(--wp--preset--spacing--30);
}
.site-footer .footer-legal p {
	margin: 0;
}

/* Sticky side card on service pages */
@media (min-width: 783px) {
	/* Written with the card's own selectors so it beats the card style's position: relative. */
	body:not(.editor-styles-wrapper) .wp-block-group.is-style-card.sticky-side {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 8rem);
	}
}

/* Contact band links keep white focus rings on the olive background. */
.cta-band :where(a):focus-visible {
	outline-color: var(--wp--preset--color--white);
}
:where(.has-ink-background-color, .has-ink-soft-background-color) :where(a, button):focus-visible {
	outline-color: var(--wp--preset--color--gold-light);
}

/* Article body: comfortable reading text. */
.article-body {
	font-size: var(--wp--preset--font-size--md);
	line-height: 1.7;
}
.article-body :where(h2, h3) {
	margin-top: var(--wp--preset--spacing--50);
}

/*
 * Page content: plain text sits in a reading column with space above and below; full-width sections (from the
 * pattern library) run edge to edge and carry their own spacing.
 */
.wp-site-blocks .page-content {
	margin-block-start: 0;
}
.page-content > :where(:not(.alignfull, .alignwide)) {
	font-size: var(--wp--preset--font-size--md);
	line-height: 1.7;
}
/* Blocks keep the theme's normal gap, but full-width sections sit flush against each other. */
.page-content > .alignfull + .alignfull {
	margin-block-start: 0;
}
.page-content > :where(h2, h3) {
	margin-top: var(--wp--preset--spacing--50);
}
.page-content:has(> :first-child:not(.alignfull, .alignwide)) {
	padding-top: var(--wp--preset--spacing--70);
}
.page-content:has(> :last-child:not(.alignfull, .alignwide)) {
	padding-bottom: var(--wp--preset--spacing--70);
}

/*
 * The page editor draws a page's content in its own root container, which does not carry the template's
 * "page-content" class, so the same text rules are repeated for it.
 */
.editor-styles-wrapper .is-root-container > :where(:not(.alignfull, .alignwide)) {
	font-size: var(--wp--preset--font-size--md);
	line-height: 1.7;
}
.editor-styles-wrapper .is-root-container > .alignfull + .alignfull {
	margin-block-start: 0 !important;
}
.editor-styles-wrapper .is-root-container > :where(h2, h3) {
	margin-top: var(--wp--preset--spacing--50);
}

/* Reveal on scroll: the script sets the start state, so nothing is hidden without it. */
@media (prefers-reduced-motion: no-preference) {
	.js-reveal [data-reveal] {
		opacity: 0;
		transform: translateY(14px);
		transition: opacity 0.6s ease, transform 0.6s ease;
	}
	.js-reveal [data-reveal].is-revealed {
		opacity: 1;
		transform: none;
	}
}


/* The phone-sized menu: left-aligned items, with the services indented beneath their parent. */
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	align-items: flex-start;
	text-align: left;
}
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	background: transparent;
	border: 0;
	box-shadow: none;
	padding-left: var(--wp--preset--spacing--30);
}
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container a {
	color: var(--wp--preset--color--mist);
}

/* Grids with a set number of columns (key points, services, news) become one column on phones. */
@media (max-width: 600px) {
	.wp-block-group.is-layout-grid,
	.wp-block-post-template.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Four-card rows fill the width: four across, two on tablets, one on phones. */
.is-layout-grid.grid-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1000px) {
	.is-layout-grid.grid-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 600px) {
	.is-layout-grid.grid-4 {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Headings break into even lines, and paragraphs avoid a lone last word. */
:where(h1, h2, h3, h4, .wp-block-post-title) {
	text-wrap: balance;
}
:where(p, li, figcaption) {
	text-wrap: pretty;
}

/* Pull quotes: serif, left-aligned, set off with gold rules. */
.wp-block-pullquote {
	border-block: 2px solid var(--wp--preset--color--gold);
	padding: var(--wp--preset--spacing--40) 0;
	text-align: left;
}
.wp-block-pullquote blockquote {
	margin: 0;
}
.wp-block-pullquote p {
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1.3;
}
.wp-block-pullquote cite {
	color: var(--wp--preset--color--gold-dark);
	font-size: var(--wp--preset--font-size--sm);
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Call-to-action banner (synced pattern): big staggered headline, a line drawing of Mussenden Temple cropped at the corner. */
.cta-temple {
	--cta-size: clamp(2.1rem, 6.4vw, 5.25rem);
	--cta-indent: calc(var(--cta-size) * 0.9);
	border-bottom: 1px solid var(--wp--preset--color--mist);
	overflow: hidden;
	position: relative;
}
.cta-temple__content {
	position: relative;
	z-index: 1;
}
.cta-temple__eyebrow {
	align-items: center;
	display: flex;
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 600;
	gap: 0.6rem;
	letter-spacing: 0.14em;
	margin: 0 0 var(--wp--preset--spacing--60);
	text-transform: uppercase;
}
.cta-temple__eyebrow::before {
	background: var(--wp--preset--color--gold);
	content: "";
	height: 0.5rem;
	width: 0.5rem;
}
.cta-temple__title {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--cta-size);
	font-weight: 700;
	letter-spacing: -0.035em;
	line-height: 0.95;
	margin: 0;
	padding-left: var(--cta-indent);
	text-indent: calc(var(--cta-indent) * -1);
	text-transform: uppercase;
	text-wrap: nowrap;
}
.cta-temple__content .wp-block-buttons {
	margin-top: var(--wp--preset--spacing--40);
	padding-left: var(--cta-indent);
}
.cta-temple .wp-block-button__link {
	align-items: center;
	display: inline-flex;
	gap: 1.5rem;
}
.cta-temple .wp-block-button__link::after {
	content: "\2192";
}
.cta-temple__art {
	bottom: -9rem;
	color: var(--wp--preset--color--gold);
	margin: 0;
	max-width: none;
	pointer-events: none;
	position: absolute;
	right: -8rem;
	width: min(64vw, 860px);
}
.cta-temple__art svg {
	display: block;
	height: auto;
	width: 100%;
}
@media (max-width: 782px) {
	.cta-temple {
		--cta-indent: calc(var(--cta-size) * 0.5);
	}
	/* On phones the drawing sits under the text instead of behind it. */
	.cta-temple {
		padding-bottom: 0 !important;
	}
	.cta-temple__art {
		bottom: auto;
		margin: var(--wp--preset--spacing--50) -3rem -3rem auto;
		position: relative;
		right: auto;
		width: 95%;
	}
}

/* Footer accreditation logos: small, old files, so each sits on a white tile. */
.footer-accreditations .footer-accreditations__row {
	margin: 0;
}
.footer-accreditation {
	border-radius: 4px;
}
.footer-accreditation .wp-block-image {
	margin: 0;
}
.footer-accreditation img {
	display: block;
	height: 40px;
	max-width: none;
	width: auto;
}
.site-footer .footer-accreditations {
	margin-top: var(--wp--preset--spacing--50);
}

/* The Featured image block in the editor follows the post's focus point (set by assets/js/focal-point.js). */
.editor-styles-wrapper .wp-block-post-featured-image img {
	object-position: var(--pdt-focus, 50% 50%);
}

/*
 * Gravity Forms: every colour below comes from a theme.json token (--wp--preset--color--*), so changing the
 * palette in theme.json restyles the form. Change the token on the right to change that part of the form.
 */
.gform-theme.gform-theme--framework {
	/* Brand: Gravity Forms' primary colour (focus rings, ticks and similar) */
	--gf-color-primary: var(--wp--preset--color--ink);
	--gf-color-primary-darker: var(--wp--preset--color--gold-dark);
	--gf-color-primary-contrast: var(--wp--preset--color--white);
	--gf-color-danger: #9b1c1c;

	/* Font */
	--gf-font-family-base: inherit;

	/* Submit button */
	--gf-ctrl-btn-bg-color-primary: var(--wp--preset--color--ink);
	--gf-ctrl-btn-bg-color-hover-primary: var(--wp--preset--color--gold-dark);
	--gf-ctrl-btn-bg-color-focus-primary: var(--wp--preset--color--gold-dark);
	--gf-ctrl-btn-color-primary: var(--wp--preset--color--white);
	--gf-ctrl-btn-color-hover-primary: var(--wp--preset--color--white);
	--gf-ctrl-btn-color-focus-primary: var(--wp--preset--color--white);
	--gf-ctrl-btn-radius: 4px;
	--gf-ctrl-btn-font-size: var(--wp--preset--font-size--sm);
	--gf-ctrl-btn-font-weight: 500;

	/* Inputs, selects and text areas: background, text and border */
	--gf-ctrl-bg-color: var(--wp--preset--color--white);
	--gf-ctrl-bg-color-hover: var(--wp--preset--color--white);
	--gf-ctrl-bg-color-focus: var(--wp--preset--color--white);
	--gf-ctrl-bg-color-error: var(--wp--preset--color--white);
	--gf-ctrl-color: var(--wp--preset--color--body-text);
	--gf-ctrl-color-hover: var(--wp--preset--color--body-text);
	--gf-ctrl-color-focus: var(--wp--preset--color--body-text);
	--gf-ctrl-placeholder-color: var(--wp--preset--color--slate);
	--gf-ctrl-border-color: var(--wp--preset--color--slate);
	--gf-ctrl-border-color-hover: var(--wp--preset--color--ink);
	--gf-ctrl-border-color-focus: var(--wp--preset--color--ink);
	--gf-ctrl-border-color-error: #9b1c1c;
	--gf-ctrl-border-width: 1px;
	--gf-ctrl-radius: 4px;
	--gf-ctrl-outline-color-focus: var(--wp--preset--color--gold-dark);
	--gf-ctrl-accent-color: var(--wp--preset--color--ink);

	/* Labels: field labels, sub-labels, tick-box labels, "(Required)", and help text */
	--gf-ctrl-label-color-primary: var(--wp--preset--color--ink);
	--gf-ctrl-label-color-secondary: var(--wp--preset--color--slate);
	--gf-ctrl-label-color-tertiary: var(--wp--preset--color--body-text);
	--gf-ctrl-label-color-req: #9b1c1c;
	--gf-ctrl-desc-color: var(--wp--preset--color--slate);
	--gf-ctrl-label-font-weight-primary: 500;
	--gf-ctrl-label-font-size-primary: var(--wp--preset--font-size--sm);
}

/*
 * Column order for a text-and-picture section. The "Column order" panel (assets/js/section-order.js) adds
 * `order-swap` and `order-media-first-mobile` to a section (a Group holding Columns) or to the Columns block itself.
 * The picture is assumed to be the second column. The editor wraps the columns in an extra element, so each rule is
 * written for both.
 */
@media (min-width: 782px) {
	.wp-block-columns.order-swap > .wp-block-column:nth-child(1),
	.wp-block-group.order-swap .wp-block-columns > .wp-block-column:nth-child(1),
	.wp-block-columns.order-swap > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(1),
	.wp-block-group.order-swap .wp-block-columns > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(1) {
		order: 2;
	}
	.wp-block-columns.order-swap > .wp-block-column:nth-child(2),
	.wp-block-group.order-swap .wp-block-columns > .wp-block-column:nth-child(2),
	.wp-block-columns.order-swap > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(2),
	.wp-block-group.order-swap .wp-block-columns > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(2) {
		order: 1;
	}
}
@media (max-width: 781px) {
	.wp-block-columns.order-media-first-mobile > .wp-block-column:nth-child(2),
	.wp-block-group.order-media-first-mobile .wp-block-columns > .wp-block-column:nth-child(2),
	.wp-block-columns.order-media-first-mobile > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(2),
	.wp-block-group.order-media-first-mobile .wp-block-columns > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-column:nth-child(2) {
		order: -1;
	}
}
