/*
Theme Name: Taylor & Stapleton (Block)
Theme URI: https://www.taylor-stapleton.co.uk/
Author: Bedford+Co
Author URI: https://bedfordandco.net
Description: Block theme for Taylor & Stapleton Ltd, converted from the classic Taylor & Stapleton theme (1.18.0) with the same design. Core blocks only; design tokens in theme.json; design CSS in assets/css/site.css.
Version: 2.0.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: taylor-and-stapleton-block
*/

/* ==========================================================================
   Block adjustments
   Map core block markup onto the classic design in assets/css/site.css.
   Loads after site.css, so equal-specificity rules here win.
   ========================================================================== */

/* Paragraphs converted from classic labels, spans, links and addresses:
   no paragraph spacing or measure. p:where() keeps this at element
   specificity, so each component's own class still sets its margins. */
p:where(.ts-flat) {
	margin: 0;
	max-width: none;
}

/* Paragraphs that hold a single classic link: the paragraph carries the
   link's class, so the link itself just inherits. */
.link-block > a,
.link-block > a:hover,
.link-block > a:focus {
	color: inherit;
	text-decoration: inherit;
}

/* Whole-card links (service panels, sector tiles): the heading link is
   stretched over the card. The card clips it with overflow: hidden. */
.has-stretched-link :is(h2, h3) {
	position: relative;
	z-index: 2;
}

.has-stretched-link :is(h2, h3) a {
	color: inherit;
	text-decoration: none;
}

.has-stretched-link :is(h2, h3) a::after {
	content: "";
	position: absolute;
	inset: -100vmax;
}

.has-stretched-link :is(h2, h3) a:focus-visible {
	outline: 0;
}

.has-stretched-link:focus-within {
	outline: 3px solid var(--color-accent);
	outline-offset: 3px;
}

/* Images: the Image block wraps each img in a figure. */
.wp-block-image,
.wp-block-image figure {
	margin: 0;
}

[class*="__media"] > .wp-block-image,
.photo-grid__item > .wp-block-image {
	height: 100%;
}

/* Linked images: the link would otherwise sit inline and add a line gap. */
.wp-block-image > a {
	display: block;
}

.site-brand__full img,
.site-brand__mark img,
.site-footer__mark img {
	width: 100%;
	height: auto;
}

.service-card__logo > .wp-block-image {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.service-card__logo > .wp-block-image img {
	max-height: 100%;
}

/* Separators used as short accent rules. */
.wp-block-separator.stats__rule,
.wp-block-separator.sector-tile__rule {
	border: 0;
	opacity: 1;
}

/* Buttons: the Buttons block is the row. */
.wp-block-buttons.btn-row {
	gap: var(--space-2);
}

/* ==========================================================================
   Header and Navigation block
   The classic header rules target a plain nav > ul. The Navigation block
   nests its list in a responsive container and copies the site-nav class
   onto the inner list, so the menu is restyled here to match.
   ========================================================================== */

.site-brand__name {
	margin: 0;
}

.site-brand__name a {
	color: inherit;
	text-decoration: none;
}

/* Mobile and tablet (below 1000px): the "Menu" toggle, as in the classic
   header, with the list in a panel that drops below the header bar. */
.site-header nav.site-nav {
	display: flex;
	position: static;
}

.site-header .site-nav .wp-block-navigation__responsive-container-open {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background-color: transparent;
	border: 1px solid var(--color-line-dark);
	border-radius: var(--radius);
	color: var(--color-white);
	font-family: var(--font-body);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	cursor: pointer;
}

/* Three-bar icon drawn with one bar and two shadows. */
.site-header .site-nav .wp-block-navigation__responsive-container-open::before {
	content: "";
	width: 18px;
	height: 2px;
	background-color: currentColor;
	box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

@media (max-width: 999px) {
	.site-header .site-nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none;
	}

	/* :not(.disable-default-overlay) matches the specificity of core's white
	   overlay rule, which this loads after. */
	.site-header .site-nav .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
		position: absolute;
		inset: 100% 0 auto;
		max-height: calc(100vh - 80px);
		overflow-y: auto;
		padding: var(--space-2) 24px var(--space-4);
		background-color: var(--color-bg-dark);
		border-bottom: 3px solid var(--color-accent);
		color: var(--color-white);
		animation: none;
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation__responsive-close,
	.site-header .site-nav .is-menu-open .wp-block-navigation__responsive-dialog,
	.site-header .site-nav .is-menu-open .wp-block-navigation__responsive-container-content {
		display: block;
		max-width: none;
		margin: 0;
		padding: 0;
	}

	.site-header .site-nav .wp-block-navigation__responsive-container-close {
		position: static;
		display: block;
		margin: 0 0 var(--space-1) auto;
		padding: 6px 0;
		background: none;
		border: 0;
		color: rgba(255, 255, 255, 0.76);
		font-family: var(--font-body);
		font-size: 12px;
		font-weight: 700;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		cursor: pointer;
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation__container {
		display: block;
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation-item {
		display: block;
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation-item__content {
		display: block;
		padding: 12px 0;
		color: var(--color-white);
		font-size: 15px;
		font-weight: 600;
		letter-spacing: 0.02em;
		text-decoration: none;
		border-bottom: 1px solid var(--color-line-dark);
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation__submenu-container {
		position: static;
		padding: 0 0 0 var(--space-2);
		background: none;
		border: 0;
	}

	.site-header .site-nav .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		font-size: 14px;
		font-weight: 500;
		color: rgba(255, 255, 255, 0.76);
	}
}

/* Desktop (1000px and up): inline menu, as in the classic header. */
@media (min-width: 1000px) {
	.site-header nav.site-nav {
		position: relative;
	}

	.site-header .site-nav .wp-block-navigation__responsive-container-open {
		display: none;
	}

	.site-header .site-nav .wp-block-navigation__responsive-container {
		display: block;
		position: static;
		background: none;
	}

	.site-header .site-nav .wp-block-navigation__container.site-nav {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: flex-end;
		gap: clamp(20px, 2.4vw, 44px);
		margin: 0;
		padding: 0;
	}

	.site-header .site-nav .wp-block-navigation__container > .wp-block-navigation-item {
		position: relative;
	}

	.site-header .site-nav .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
		display: block;
		padding: 10px 0;
		white-space: nowrap;
		border-bottom: 2px solid transparent;
		color: var(--color-white);
		font-size: 14px;
		font-weight: 700;
		letter-spacing: 2px;
		text-transform: uppercase;
		text-decoration: none;
	}

	.site-header .site-nav .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:hover,
	.site-header .site-nav .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:focus,
	.site-header .site-nav .wp-block-navigation__container > .current-menu-item > .wp-block-navigation-item__content,
	.site-header .site-nav .wp-block-navigation__container > .current-menu-ancestor > .wp-block-navigation-item__content {
		color: var(--color-accent);
		border-bottom-color: var(--color-accent);
	}

	/* Dropdowns */
	.site-header .site-nav .wp-block-navigation__submenu-container.wp-block-navigation-submenu {
		position: absolute;
		top: 100%;
		left: -20px;
		z-index: 20;
		width: auto;
		height: auto;
		min-width: 268px;
		padding: var(--space-1) 0;
		background-color: var(--color-bg-darker);
		border: 0;
		border-top: 3px solid var(--color-accent);
		color: var(--color-white);
		opacity: 0;
		visibility: hidden;
		overflow: visible;
		transform: translateY(6px);
		transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
	}

	.site-header .site-nav .has-child:hover > .wp-block-navigation__submenu-container,
	.site-header .site-nav .has-child:focus-within > .wp-block-navigation__submenu-container {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.site-header .site-nav .wp-block-navigation__submenu-container .wp-block-navigation-item {
		display: block;
	}

	.site-header .site-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		display: block;
		padding: 11px 20px;
		border: 0;
		color: rgba(255, 255, 255, 0.76);
		font-size: 14px;
		font-weight: 500;
		letter-spacing: 0.02em;
		text-transform: none;
		text-decoration: none;
		white-space: nowrap;
	}

	.site-header .site-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
	.site-header .site-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus {
		background-color: rgba(255, 255, 255, 0.06);
		color: var(--color-accent);
	}
}

/* Header button: the Buttons block carries site-header__cta, the link
   inside carries the button padding. Hidden below 1180px, as before (the
   Buttons block's own display: flex would otherwise win). */
.site-header .site-header__cta {
	display: none;
}

@media (min-width: 1180px) {
	.site-header .site-header__cta {
		display: flex;
		padding: 0;
	}

	.site-header .site-header__cta .wp-block-button__link {
		padding: 16px 24px;
		font-size: 13px;
		line-height: 1;
		white-space: nowrap;
	}
}

/* Testimonials were <figure> elements in the classic markup and picked up
   the default figure margin (0 0 1em); the Group block replacing them
   keeps the same spacing. */
.testimonial {
	margin: 0 0 1em;
}

/* The thin line that ends the footer copyright row. The classic markup used
   an empty span, which the block editor strips; the rules for it
   (.site-footer__rule in site.css) also draw this pseudo-element. */
.site-footer__meta::after {
	content: "";
}

/* Block editor: the scroll fade-in script does not run in the editor, so
   section content is shown straight away there. Front end unaffected. */
.editor-styles-wrapper .reveal > * {
	opacity: 1;
	transform: none;
	transition: none;
}

/* Block editor: the editor makes every block position: relative with a
   stronger selector, which would drop these background media layers into
   the flow. Same specificity, loaded later, so they sit behind as designed. */
.editor-styles-wrapper :is(.hero__media, .page-hero__media, .service-panel__media, .sector-tile__media) {
	position: absolute;
}

/* Block editor: sections run edge to edge, as on the site. The editor would
   otherwise box every top-level block at the content width; each section
   sets its own inner width with .container. */
.editor-styles-wrapper .block-editor-block-list__layout.is-root-container > * {
	max-width: none;
}

/* List items hold inline text only, so classic paragraphs inside them
   (process steps) became spans; they keep the paragraph measure. */
span.ts-p {
	max-width: 68ch;
}
