/*
Theme Name: Gridline Electrical
Description: Custom block theme for Gridline Electrical Services.
Version: 2.1.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Author: Gridline Electrical Services
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gridline-electrical
*/

/* Design tokens, shared with the Projects and quotation plugins. */
:root {
	--gl-dark: var(--wp--preset--color--charcoal);
	--gl-dark-2: var(--wp--preset--color--charcoal-light);
	--gl-accent: var(--wp--preset--color--blue);
	--gl-accent-hover: #0f47d6;
	--gl-accent-bright: var(--wp--preset--color--blue-bright);
	--gl-accent-soft: var(--wp--preset--color--blue-soft);
	--gl-surface: var(--wp--preset--color--white);
	--gl-surface-alt: var(--wp--preset--color--mist);
	--gl-line: var(--wp--preset--color--line);
	--gl-muted: var(--wp--preset--color--muted);
	--gl-radius: 16px;
	--gl-shadow: 0 24px 48px -28px rgb(16 24 40 / 40%);
	--gl-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html {
	scroll-padding-top: 6rem;
	-webkit-text-size-adjust: 100%;
}

body {
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

::selection {
	background: var(--gl-accent);
	color: #fff;
}

.wp-site-blocks > * {
	margin-block-start: 0;
}

.wp-block-post-content > .alignfull,
main > .alignfull {
	margin-block: 0;
}

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

@media (min-width: 601px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 46px;
	}
}

@media (min-width: 783px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 32px;
	}
}

.gl-header {
	border-bottom: 1px solid rgb(255 255 255 / 8%);
	box-shadow: 0 10px 30px -20px rgb(0 0 0 / 60%);
}

.gl-header .wp-block-site-title {
	font-size: clamp(0.98rem, 0.85rem + 0.6vw, 1.2rem);
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
	max-width: 14rem;
}

.gl-header .wp-block-site-title a {
	align-items: center;
	color: #fff;
	display: inline-flex;
	gap: 0.6rem;
	text-decoration: none;
}

/* Brand mark: a bolt in an electric-blue tile, drawn in CSS so it costs no request. */
.gl-header .wp-block-site-title a::before {
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M13.6 2 5 13.5h6.1L9.9 22l8.6-11.7h-6.1z'/%3E%3C/svg%3E") center / 18px no-repeat,
		linear-gradient(135deg, #3b7bff, var(--gl-accent));
	border-radius: 9px;
	box-shadow: 0 6px 18px -6px rgb(26 92 255 / 70%);
	content: "";
	flex: none;
	height: 34px;
	width: 34px;
}

.gl-header__actions {
	flex-wrap: nowrap;
}

.gl-header .wp-block-button__link {
	font-size: 0.92rem;
	padding: 0.65rem 1rem;
	white-space: nowrap;
}

.gl-header .wp-block-navigation {
	font-size: 0.95rem;
	font-weight: 600;
	gap: 1.6rem;
}

.gl-header .wp-block-navigation a {
	color: rgb(255 255 255 / 86%);
	transition: color 0.2s ease;
}

.gl-header .wp-block-navigation a:hover,
.gl-header .wp-block-navigation a:focus-visible {
	color: #fff;
}

.gl-header .wp-block-navigation .wp-block-navigation-item__content {
	position: relative;
}

@media (min-width: 600px) {
	.gl-header .wp-block-navigation > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content::after {
		background: var(--gl-accent-bright);
		bottom: -6px;
		content: "";
		height: 2px;
		left: 0;
		position: absolute;
		right: 0;
		transform: scaleX(0);
		transform-origin: left;
		transition: transform 0.25s var(--gl-ease);
	}

	.gl-header .wp-block-navigation > .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content::after {
		transform: scaleX(1);
	}
}

.gl-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background: var(--gl-dark-2);
	border: 1px solid rgb(255 255 255 / 10%);
	border-radius: 12px;
	box-shadow: 0 24px 48px -20px rgb(0 0 0 / 70%);
	min-width: 16rem;
	padding: 0.5rem;
}

.gl-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	border-radius: 8px;
	padding: 0.55rem 0.8rem;
}

.gl-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background: rgb(255 255 255 / 6%);
}

/* The desktop menu is right-aligned; the open phone menu reads better as one left-aligned list. */
.gl-header .wp-block-navigation__responsive-container.is-menu-open {
	padding: 1.5rem;
}

.gl-header .wp-block-navigation__responsive-container.is-menu-open :is(.wp-block-navigation__responsive-container-content, .wp-block-navigation__container, .wp-block-navigation-item, .wp-block-navigation__submenu-container) {
	align-items: flex-start !important;
	text-align: left;
}

.gl-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	font-size: 1.15rem;
	gap: 1.1rem;
	padding-top: 2.5rem;
}

.gl-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	background: transparent;
	border: 0;
	border-left: 2px solid var(--gl-accent);
	border-radius: 0;
	box-shadow: none;
	gap: 0.85rem;
	margin-left: 0.25rem;
	padding: 0.85rem 0 0.25rem 1rem !important;
}

/* ---------- Sections ---------- */
.gl-section {
	padding-block: clamp(3.5rem, 2.2rem + 5vw, 7rem);
	padding-inline: var(--wp--style--root--padding-right, 1.25rem);
}

.gl-section--mist {
	background: var(--gl-surface-alt);
}

.gl-section--navy {
	background: var(--gl-dark);
	color: #fff;
}

.gl-section--navy :is(h1, h2, h3) {
	color: #fff;
}

.gl-section--navy a:not(.wp-element-button) {
	color: var(--gl-accent-bright);
}

/* Dark hero with a faint grid and an electric-blue glow, drawn in CSS. */
.gl-hero {
	background-color: var(--gl-dark);
	background-image:
		radial-gradient(60rem 30rem at 85% -10%, rgb(26 92 255 / 28%), transparent 60%),
		radial-gradient(40rem 24rem at -10% 110%, rgb(26 92 255 / 14%), transparent 60%),
		linear-gradient(rgb(255 255 255 / 4%) 1px, transparent 1px),
		linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px);
	background-size: auto, auto, 56px 56px, 56px 56px;
	position: relative;
}

.gl-hero .wp-block-columns {
	align-items: center;
	gap: clamp(2rem, 1rem + 4vw, 4.5rem);
}

.gl-hero h1 {
	max-width: 18ch;
}

.gl-hero__lead {
	color: rgb(255 255 255 / 80%);
	font-size: clamp(1.08rem, 1rem + 0.45vw, 1.3rem);
	line-height: 1.6;
	max-width: 40rem;
}

.gl-hero__art img {
	display: block;
	filter: drop-shadow(0 30px 60px rgb(26 92 255 / 25%));
	height: auto;
	width: 100%;
}

.gl-hero .is-style-outline .wp-block-button__link {
	border-color: rgb(255 255 255 / 35%);
	color: #fff;
}

.gl-hero .is-style-outline .wp-block-button__link:hover {
	background: #fff;
	border-color: #fff;
	color: var(--gl-dark);
}

.gl-eyebrow {
	align-items: center;
	color: var(--gl-accent);
	display: flex;
	width: fit-content;
	font-size: 0.82rem;
	font-weight: 700;
	gap: 0.55rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.gl-eyebrow::before {
	background: currentColor;
	border-radius: 2px;
	content: "";
	height: 2px;
	width: 22px;
}

.gl-section--navy .gl-eyebrow {
	color: var(--gl-accent-bright);
}

.gl-eyebrow a {
	color: inherit !important;
	text-decoration: none;
}

.gl-eyebrow a:hover {
	text-decoration: underline;
}

/* Core centres every child of a constrained group. These line up with the 1240px content area instead,
   including everything placed directly in a hero (eyebrow, title, lead, buttons). */
.gl-section > .gl-intro,
.gl-section > .gl-hero__lead,
.gl-section > .gl-icon,
.gl-section > .gl-chips,
.gl-hero > :where(.gl-eyebrow, h1, h2, .wp-block-buttons) {
	margin-left: max(0px, calc((100% - 1240px) / 2)) !important;
	margin-right: 0 !important;
}

.gl-intro {
	margin-bottom: clamp(2rem, 1.5rem + 1.5vw, 3rem);
	max-width: 46rem;
}

.gl-intro > p:not(.gl-eyebrow) {
	color: var(--gl-muted);
	font-size: 1.1rem;
}

.gl-section--navy .gl-intro > p:not(.gl-eyebrow) {
	color: rgb(255 255 255 / 75%);
}

/* Trust chips under the hero text. */
.gl-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	list-style: none;
	margin-top: 1.75rem;
	padding: 0;
}

.gl-chips li {
	align-items: center;
	background: rgb(255 255 255 / 6%);
	border: 1px solid rgb(255 255 255 / 12%);
	border-radius: 999px;
	color: rgb(255 255 255 / 88%);
	display: inline-flex;
	font-size: 0.88rem;
	font-weight: 600;
	gap: 0.5rem;
	margin: 0;
	padding: 0.45rem 0.9rem;
}

.gl-chips li::before {
	background: var(--gl-accent-bright);
	border-radius: 50%;
	box-shadow: 0 0 0 4px rgb(91 149 255 / 20%);
	content: "";
	height: 7px;
	width: 7px;
}

/* ---------- Cards ---------- */
.gl-card {
	background: var(--gl-surface);
	border: 1px solid var(--gl-line);
	border-radius: var(--gl-radius);
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	padding: clamp(1.4rem, 1.1rem + 0.8vw, 1.9rem);
	position: relative;
	transition: transform 0.3s var(--gl-ease), box-shadow 0.3s var(--gl-ease), border-color 0.3s ease;
}

.gl-card:hover {
	border-color: rgb(26 92 255 / 35%);
	box-shadow: var(--gl-shadow);
	transform: translateY(-4px);
}

.gl-card > * {
	margin-block: 0;
}

.gl-card h3 a {
	color: inherit;
	text-decoration: none;
}

/* The heading link covers the whole card, so the card is one large target. */
.gl-card h3 a::after {
	content: "";
	inset: 0;
	position: absolute;
	z-index: 1;
}

.gl-card h3 a:focus-visible {
	outline: none;
}

.gl-card:has(h3 a:focus-visible) {
	outline: 3px solid var(--gl-accent);
	outline-offset: 3px;
}

.gl-card p:not(.gl-step-number) {
	color: var(--gl-muted);
}

.gl-card .wp-block-buttons {
	margin-top: auto;
	padding-top: 0.25rem;
	position: relative;
	z-index: 2;
}

/* Card buttons read as quiet links; the main call to action stays the solid button. */
.gl-card .is-style-outline .wp-block-button__link {
	background: none;
	border: 0;
	color: var(--gl-accent);
	padding: 0;
}

.gl-card .is-style-outline .wp-block-button__link::after {
	content: " →";
	display: inline-block;
	transition: transform 0.25s var(--gl-ease);
}

.gl-card:hover .is-style-outline .wp-block-button__link::after {
	transform: translateX(4px);
}

.gl-card--accent {
	background:
		radial-gradient(28rem 16rem at 100% 0%, rgb(26 92 255 / 35%), transparent 60%),
		var(--gl-dark);
	border-color: var(--gl-dark);
	color: #fff;
}

.gl-card--accent h3,
.gl-card--accent p:not(.gl-step-number) {
	color: #fff;
}

.gl-card--accent p:not(.gl-step-number) {
	opacity: 0.8;
}

.gl-icon {
	align-items: center;
	background: var(--gl-accent-soft);
	border-radius: 14px;
	box-sizing: border-box;
	display: flex;
	height: 60px;
	justify-content: center;
	transition: background 0.3s ease, transform 0.3s var(--gl-ease);
	width: 60px;
}

.gl-icon img {
	display: block;
	height: 32px;
	width: 32px;
}

.gl-card:hover .gl-icon {
	transform: scale(1.06);
}

.gl-hero .gl-icon {
	background: rgb(255 255 255 / 92%);
	margin-bottom: 1.25rem;
}

.gl-step-number {
	align-items: center;
	background: var(--gl-accent-soft);
	border-radius: 999px;
	color: var(--gl-accent);
	display: inline-flex;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	padding: 0.3rem 0.75rem;
	text-transform: uppercase;
	width: fit-content;
}

/* Trust points on the homepage. */
.gl-trust {
	border-top: 1px solid rgb(255 255 255 / 12%);
	padding-top: 1.5rem;
}

.gl-trust h3 {
	color: #fff;
	margin: 0 0 0.5rem;
}

.gl-trust p {
	color: rgb(255 255 255 / 72%);
	margin: 0;
}

.gl-trust__number {
	color: var(--gl-accent-bright) !important;
	font-size: 0.85rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	margin-bottom: 0.75rem !important;
}

/* Content still to be supplied by the business. Not used on public pages. */
.gl-placeholder {
	background: #fff8d1;
	border: 2px dashed #8a6d00;
	border-radius: 4px;
	color: var(--gl-dark);
	font-weight: 600;
	padding: 0.5rem 0.75rem;
}

/* ---------- Call to action ---------- */
.gl-cta-band {
	background: var(--gl-surface);
	padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem);
}

.gl-cta {
	align-items: center;
	background:
		radial-gradient(40rem 22rem at 100% 0%, rgb(26 92 255 / 45%), transparent 60%),
		radial-gradient(30rem 20rem at 0% 100%, rgb(26 92 255 / 18%), transparent 60%),
		var(--gl-dark);
	border-radius: calc(var(--gl-radius) + 8px);
	color: #fff;
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	justify-content: space-between;
	margin-inline: auto;
	max-width: 1240px;
	overflow: hidden;
	padding: clamp(2rem, 1.2rem + 3.5vw, 4rem);
}

.gl-cta__text {
	flex: 1 1 26rem;
}

.gl-cta__text > * {
	margin-block: 0;
}

.gl-cta__text h2 {
	color: #fff;
	margin-block: 0.5rem 0.75rem;
}

.gl-cta__text p:not(.gl-eyebrow) {
	color: rgb(255 255 255 / 78%);
	font-size: 1.1rem;
}

.gl-cta .gl-eyebrow {
	color: var(--gl-accent-bright);
}

.gl-cta .is-style-outline .wp-block-button__link {
	border-color: rgb(255 255 255 / 35%);
	color: #fff;
}

.gl-cta .is-style-outline .wp-block-button__link:hover {
	background: #fff;
	border-color: #fff;
	color: var(--gl-dark);
}

/* ---------- Footer ---------- */
.gl-footer {
	background: #0c0e11;
	color: rgb(255 255 255 / 78%);
}

.gl-footer .wp-block-site-title {
	color: #fff;
	font-weight: 800;
}

.gl-footer a:not(.wp-element-button) {
	color: rgb(255 255 255 / 78%);
	text-decoration: none;
	transition: color 0.2s ease;
}

.gl-footer a:not(.wp-element-button):hover {
	color: #fff;
	text-decoration: underline;
}

.gl-footer h2 {
	color: #fff;
	font-size: 0.85rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.gl-footer ul {
	list-style: none;
	padding-left: 0;
}

.gl-footer li {
	margin-bottom: 0.55rem;
}

.gl-footer__legal {
	border-top: 1px solid rgb(255 255 255 / 10%);
	color: rgb(255 255 255 / 55%);
	font-size: 0.85rem;
	line-height: 1.7;
	margin-top: 2.5rem;
	padding-top: 1.5rem;
}

.gl-footer .gl-footer__legal a {
	text-decoration: underline;
}

/* ---------- Scroll reveal (only when JavaScript is running and motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
	.gl-js .gl-reveal {
		opacity: 0;
		transform: translateY(18px);
		transition: opacity 0.7s var(--gl-ease), transform 0.7s var(--gl-ease);
		transition-delay: var(--gl-delay, 0s);
	}

	.gl-js .gl-reveal.is-visible {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gl-card,
	.gl-icon,
	.gl-card .is-style-outline .wp-block-button__link::after {
		transition: none;
	}

	.gl-card:hover,
	.gl-card:hover .gl-icon {
		transform: none;
	}
}

/* ---------- Project pages ---------- */
.gl-project-hero {
	padding-bottom: clamp(5rem, 3rem + 8vw, 10rem);
}

.gl-project-body {
	padding-top: 0;
}

.gl-project-body > .glp-hero-image {
	margin-top: clamp(-8rem, -2rem - 6vw, -3.5rem) !important;
	position: relative;
}

.gl-project-text {
	font-size: 1.1rem;
	margin-top: clamp(2rem, 1.5rem + 2vw, 3.5rem) !important;
	max-width: 46rem;
}

.gl-section > .gl-project-text {
	margin-left: max(0px, calc((100% - 1240px) / 2)) !important;
}

/* Very small phones: keep the name, menu and quote button on one line without sideways scrolling. */
@media (max-width: 380px) {
	.gl-header .wp-block-site-title a::before {
		display: none;
	}

	.gl-header .wp-block-site-title {
		font-size: 0.92rem;
	}

	.gl-header__actions {
		gap: 0.6rem !important;
	}

	.gl-header .wp-block-button__link {
		font-size: 0.82rem;
		padding: 0.55rem 0.7rem;
	}
}

/* The examples link closes the Services menu, set apart from the seven services. */
.gl-header .wp-block-navigation__submenu-container .gl-nav-examples {
	border-top: 1px solid rgb(255 255 255 / 10%);
	margin-top: 0.35rem;
	padding-top: 0.35rem;
}

/* ---------- Phone: CALL button and number links ---------- */
.gl-button-call .wp-block-button__link {
	align-items: center;
	background: #fff;
	border: 0;
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%);
	color: #000;
	display: inline-flex;
	gap: 0.5rem;
	letter-spacing: 0.06em;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gl-button-call .wp-block-button__link::before,
.gl-tel::before {
	background-color: currentColor;
	content: "";
	flex: none;
	height: 1.05em;
	-webkit-mask: url("assets/icons/phone.svg") center / contain no-repeat;
	mask: url("assets/icons/phone.svg") center / contain no-repeat;
	width: 1.05em;
}

.gl-button-call .wp-block-button__link:hover,
.gl-button-call .wp-block-button__link:focus-visible {
	background: #f1f4f9;
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%), 0 6px 18px rgb(0 0 0 / 18%);
	color: #000;
	transform: translateY(-1px);
}

.gl-tel {
	align-items: center;
	display: inline-flex;
	font-weight: 700;
	gap: 0.45rem;
}

/* Buttons in a row with CALL share one height, outline buttons included. */
.wp-block-buttons:has(.gl-button-call) {
	align-items: stretch;
}

.wp-block-buttons:has(.gl-button-call) > .wp-block-button {
	display: flex;
}

.wp-block-buttons:has(.gl-button-call) .wp-block-button__link {
	align-items: center;
	display: inline-flex;
	justify-content: center;
}

/* Header buttons stay on one row; on phones the header CALL shows its icon only
   (it is still announced as "Call 07495 874316"), with the full button in the hero below. */
.gl-header .wp-block-buttons {
	align-items: stretch;
	flex-wrap: nowrap;
	gap: 0.5rem;
}

.gl-header .wp-block-buttons > .wp-block-button {
	display: flex;
}

@media (max-width: 599px) {
	.gl-header .gl-button-call .wp-block-button__link {
		font-size: 0;
		justify-content: center;
		padding: 0;
		width: 2.6rem;
	}

	.gl-header .gl-button-call .wp-block-button__link::before {
		height: 18px;
		width: 18px;
	}
}

/* Smallest phones: a little slack so the header fits even before the web font loads. */
@media (max-width: 380px) {
	.gl-header .wp-block-buttons {
		gap: 0.35rem;
	}

	.gl-header .gl-button-call .wp-block-button__link {
		width: 2.35rem !important;
	}
}

/* Between the smallest phones and 440px, tighten the header so both buttons fit. */
@media (min-width: 381px) and (max-width: 440px) {
	.gl-header__actions {
		gap: 0.75rem !important;
	}

	.gl-header .wp-block-button__link {
		font-size: 0.84rem;
		padding: 0.55rem 0.75rem;
	}
}

@media (max-width: 400px) {
	.gl-hero .wp-block-buttons,
	.gl-cta .wp-block-buttons {
		gap: 0.6rem;
	}

	.gl-hero .wp-block-button__link,
	.gl-cta .wp-block-button__link {
		padding-left: 1.1rem;
		padding-right: 1.1rem;
	}
}
