/*
Theme Name: Meridian
Theme URI: https://example.com/meridian
Author: Edgewater Medical Centre
Author URI: https://example.com
Description: A reusable, accessible block theme for service businesses, clinics and practices. Everything visual is configured in theme.json and the Site Editor — no page builder, no jQuery, no CSS framework. Ships with service, team and testimonial content types, block patterns for the common marketing sections, and a Site Details panel whose values can be bound into any block.
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: meridian
Tags: block-patterns, full-site-editing, block-styles, custom-colors, custom-logo, custom-menu, editor-style, featured-images, template-editing, threaded-comments, translation-ready, wide-blocks, accessibility-ready, one-column, two-columns, right-sidebar

Meridian is distributed under the terms of the GNU GPL v2 or later.
*/

/*
 * This file deliberately holds almost nothing.
 *
 * Colours, typography, spacing, layout and per-block styling all live in
 * theme.json so that they are editable in the Site Editor and exported as
 * CSS custom properties. Only rules that theme.json cannot express belong
 * here: focus handling, motion preferences, the screen-reader utility class,
 * and the handful of responsive behaviours our patterns rely on.
 */

/* -------------------------------------------------------------------------
 * Accessibility
 * ---------------------------------------------------------------------- */

/*
 * A visible focus ring on keyboard navigation only. The old theme had no
 * focus styling at all, which made the menu and modals unusable by keyboard.
 */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--custom--focus-ring, #1d4ed8);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Never remove the ring without replacing it. */
:where(a, button, input, select, textarea, summary):focus:not(:focus-visible) {
	outline: none;
}

/* Hide visually, keep for assistive technology. */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--base);
	clip-path: none;
	color: var(--wp--preset--color--primary);
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	height: auto;
	left: 6px;
	line-height: normal;
	padding: 1em 1.5em;
	text-decoration: none;
	top: 6px;
	width: auto;
	z-index: 100000;
}

/* Respect a reduced-motion preference across the whole theme. */
@media (prefers-reduced-motion: reduce) {
	html:focus-within {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* Smooth in-page anchors, but only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* Keep sticky headers from covering the element an anchor jumps to. */
:target {
	scroll-margin-top: 6rem;
}

/* -------------------------------------------------------------------------
 * Block refinements theme.json cannot express
 * ---------------------------------------------------------------------- */

/* Hover transitions for interactive blocks. */
.wp-element-button,
.wp-block-button__link,
.wp-block-navigation a,
.wp-block-social-link {
	transition: background-color var(--wp--custom--transition, 180ms ease),
		color var(--wp--custom--transition, 180ms ease),
		border-color var(--wp--custom--transition, 180ms ease),
		opacity var(--wp--custom--transition, 180ms ease);
}

/*
 * Outline button variation. theme.json sets the spacing and weight; the
 * border and colour have to be inherited from currentColor here so the
 * variation works on any background.
 */
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	background-color: transparent;
	border-color: currentColor;
	color: currentColor;
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):hover,
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):focus-visible {
	background-color: currentColor;
	border-color: currentColor;
	color: var(--wp--preset--color--base);
}

/* Balance short headings rather than leaving one orphaned word. */
h1,
h2,
h3,
.wp-block-post-title,
.wp-block-query-title {
	text-wrap: balance;
}

p,
li {
	text-wrap: pretty;
}

/* Long words and URLs should never force a horizontal scrollbar. */
.wp-block-post-content,
.entry-content {
	overflow-wrap: break-word;
}

/*
 * The mobile navigation overlay inherits the body font size, which makes it
 * cramped on small screens. Core does not expose this through theme.json.
 */
.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--40);
}

.wp-block-navigation__responsive-container.is-menu-open
	.wp-block-navigation__responsive-container-content
	.wp-block-navigation__container {
	gap: var(--wp--preset--spacing--20);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--large);
}

/* Submenus read better with a card treatment than the core default. */
.wp-block-navigation .wp-block-navigation__submenu-container {
	border: 1px solid var(--wp--custom--border-color, #e7e9ee);
	border-radius: var(--wp--custom--border-radius, 10px);
	box-shadow: var(--wp--preset--shadow--md);
	padding: var(--wp--preset--spacing--10);
}

.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	border-radius: 6px;
	padding: 0.5em 0.75em;
}

/* -------------------------------------------------------------------------
 * Pattern helpers
 * ---------------------------------------------------------------------- */

/*
 * Cards used by the services, team and testimonial patterns. Registered as
 * a block style in inc/block-styles.php; the layout rules live here because
 * they involve child selectors.
 */
.is-style-meridian-card {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.is-style-meridian-card > :last-child:not(.wp-block-buttons) {
	margin-block-end: 0;
}

.is-style-meridian-card > .wp-block-buttons {
	margin-block-start: auto;
	padding-block-start: var(--wp--preset--spacing--20);
}

/* Equal-height columns so a row of cards lines up. */
.is-style-meridian-card-grid .wp-block-column {
	display: flex;
}

.is-style-meridian-card-grid .wp-block-column > * {
	width: 100%;
}

/* A compact icon frame for feature lists. Sized in em so it tracks font size. */
.is-style-meridian-icon {
	align-items: center;
	aspect-ratio: 1;
	border-radius: 50%;
	display: inline-flex;
	flex: 0 0 auto;
	justify-content: center;
	width: 2.75em;
}

.is-style-meridian-icon img,
.is-style-meridian-icon svg {
	height: 1.25em;
	width: 1.25em;
}

/* Utility bar: collapses to a centred stack on narrow screens. */
.meridian-utility-bar {
	font-size: var(--wp--preset--font-size--x-small);
}

@media (max-width: 781px) {
	.meridian-utility-bar .wp-block-group {
		justify-content: center;
	}
}

/* -------------------------------------------------------------------------
 * Print
 * ---------------------------------------------------------------------- */

@media print {
	.wp-block-template-part:has(.wp-block-navigation),
	.wp-block-navigation,
	.meridian-utility-bar,
	.wp-block-post-comments-form,
	.wp-block-search {
		display: none !important;
	}

	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 0.8em;
		word-break: break-all;
	}
}
